1 // SUPERV SUPERVGUI : GUI for Supervisor component
3 // Copyright (C) 2003 OPEN CASCADE
5 // File : SUPERVGUI_CanvasNodePrs.h
6 // Author : Natalia KOPNOVA
9 #ifndef SUPERVGUI_CanvasNodePrs_H
10 #define SUPERVGUI_CanvasNodePrs_H
13 #include "SUPERVGUI_Def.h"
18 class SUPERVGUI_CanvasNodePrs;
19 class SUPERVGUI_CanvasPortPrs;
20 class SUIT_ResourceMgr;
21 class SUPERVGUI_CanvasHookPrs : public QCanvasEllipse
24 SUPERVGUI_CanvasHookPrs(QCanvas* theCanvas, SUPERVGUI_CanvasNodePrs* theNode, const bool& theIn);
25 SUPERVGUI_CanvasHookPrs(QCanvas* theCanvas, SUPERVGUI_CanvasPortPrs* thePort, const bool& theIn);
26 ~SUPERVGUI_CanvasHookPrs();
28 QObject* getObject() const;
30 void setCoords(int x, int y);
32 void setVisible(bool b);
33 void moveBy(double dx, double dy);
36 virtual int rtti() const;
39 void init(QCanvas* theCanvas);
41 SUPERVGUI_CanvasNodePrs* myNodePrs;
42 SUPERVGUI_CanvasPortPrs* myPortPrs;
50 class SUPERVGUI_CanvasNode;
51 class SUPERVGUI_CanvasNodePrs: public QCanvasPolygonalItem {
54 SUPERVGUI_CanvasNodePrs( SUIT_ResourceMgr*, QCanvas*, SUPERVGUI_CanvasNode*, bool theCellPrs=false);
55 virtual ~SUPERVGUI_CanvasNodePrs();
57 SUPERVGUI_CanvasNode* getNode() const { return myNode; }
58 QObject* getObject(const QPoint& thePos) const;
60 QString getStatus() const { return myStatus; }
61 QColor getStatusColor() const { return myStatusColor; }
63 void setStatus(QString theStatus) { myStatus = theStatus; }
64 void setStatusColor(QColor theStatusColor) { myStatusColor = theStatusColor; }
66 virtual int width() const;
67 virtual int height() const;
69 virtual int getTitleHeight() const;
70 virtual int getLabelHeight() const;
71 virtual int getStatusHeight() const;
72 virtual int getBodyHeight() const;
73 virtual int getPortHeight() const;
74 virtual int getStreamHeight() const;
75 virtual int getGateHeight() const;
77 QPointArray areaPoints() const;
78 void moveBy(double dx, double dy);
81 void setMoving(bool b) { myMoving = b; }
82 bool isMoving() const { return myMoving; }
84 virtual int rtti() const;
86 virtual void hideAll();
87 virtual void showAll();
88 virtual void setLabelVisible(bool b);
89 virtual void setPortVisible(bool b);
90 bool isLabelVisible() const { return myLabelVisible; }
91 bool isPortVisible() const { return myPortVisible; }
93 virtual void setNodeColor(const QColor& theColor);
94 virtual QColor nodeColor() const { return myColor; }
96 virtual void setState(SUPERV::GraphState theState);
97 virtual void updateInfo();
98 virtual void updatePorts();
99 virtual void updateGates();
100 virtual void updatePoints();
102 virtual QPoint getInConnectionPoint() const;
103 virtual QPoint getOutConnectionPoint() const;
105 virtual QRect getRect() const;
106 virtual QRect getTitleRect() const;
107 virtual QRect getStatusRect() const;
108 virtual QRect getLabelRect() const;
109 virtual QRect getBodyRect() const;
110 virtual QRect getGateRect() const;
113 void draw(QPainter& thePainter);
114 virtual void drawShape(QPainter& thePainter);
116 virtual void drawTitle(QPainter& thePainter);
117 virtual void drawLabel(QPainter& thePainter);
118 virtual void drawPort(QPainter& thePainter);
119 virtual void drawGate(QPainter& thePainter);
120 virtual void drawStatus(QPainter& thePainter);
122 virtual void drawFrame(QPainter& thePainter);
123 virtual void drawTitleShape(QPainter& thePainter);
124 virtual void drawStatusShape(QPainter& thePainter);
126 SUIT_ResourceMgr* resMgr() const { return myMgr; }
130 SUPERVGUI_CanvasNode* myNode;
131 SUIT_ResourceMgr* myMgr;
150 QColor myStatusColor;
152 SUPERVGUI_CanvasHookPrs* myPointIn;
153 SUPERVGUI_CanvasHookPrs* myPointOut;
157 class SUPERVGUI_CanvasPort;
158 class SUPERVGUI_CanvasPortPrs {
161 SUPERVGUI_CanvasPortPrs(QCanvas* theCanvas, SUPERVGUI_CanvasPort* thePort);
162 ~SUPERVGUI_CanvasPortPrs();
164 SUPERVGUI_CanvasPort* getPort() { return myPort; }
165 virtual void update(bool theForce = false);
167 virtual bool isHilight() const;
168 virtual bool isAlert() const;
170 virtual QString getText() const;
171 virtual int getAlignment() const;
173 void setPortRect(const QRect& theRect);
174 QRect getPortRect() const { return myRect; }
176 void setVisible(bool b);
177 bool isVisible() const { return myVisible; }
179 void moveBy(int dx, int dy);
182 QPoint getConnectionPoint() const;
183 void draw(QPainter& thePainter);
186 SUPERVGUI_CanvasPort* myPort;
191 SUPERVGUI_CanvasHookPrs* myPoint;