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 SUPERVGUI_CanvasHookPrs : public QCanvasEllipse
23 SUPERVGUI_CanvasHookPrs(QCanvas* theCanvas, SUPERVGUI_CanvasNodePrs* theNode, const bool& theIn);
24 SUPERVGUI_CanvasHookPrs(QCanvas* theCanvas, SUPERVGUI_CanvasPortPrs* thePort, const bool& theIn);
25 ~SUPERVGUI_CanvasHookPrs();
27 QObject* getObject() const;
29 void setCoords(int x, int y);
31 void setVisible(bool b);
32 void moveBy(double dx, double dy);
35 virtual int rtti() const;
38 void init(QCanvas* theCanvas);
40 SUPERVGUI_CanvasNodePrs* myNodePrs;
41 SUPERVGUI_CanvasPortPrs* myPortPrs;
49 class SUPERVGUI_CanvasNode;
50 class SUPERVGUI_CanvasNodePrs: public QCanvasPolygonalItem {
53 SUPERVGUI_CanvasNodePrs(QCanvas* theCanvas, SUPERVGUI_CanvasNode* theNode, bool theCellPrs=false);
54 virtual ~SUPERVGUI_CanvasNodePrs();
56 SUPERVGUI_CanvasNode* getNode() const { return myNode; }
57 QObject* getObject(const QPoint& thePos) const;
59 QString getStatus() const { return myStatus; }
60 QColor getStatusColor() const { return myStatusColor; }
62 void setStatus(QString theStatus) { myStatus = theStatus; }
63 void setStatusColor(QColor theStatusColor) { myStatusColor = theStatusColor; }
65 virtual int width() const;
66 virtual int height() const;
68 virtual int getTitleHeight() const;
69 virtual int getLabelHeight() const;
70 virtual int getStatusHeight() const;
71 virtual int getBodyHeight() const;
72 virtual int getPortHeight() const;
73 virtual int getStreamHeight() const;
74 virtual int getGateHeight() const;
76 QPointArray areaPoints() const;
77 void moveBy(double dx, double dy);
80 void setMoving(bool b) { myMoving = b; }
81 bool isMoving() const { return myMoving; }
83 virtual int rtti() const;
85 virtual void hideAll();
86 virtual void showAll();
87 virtual void setLabelVisible(bool b);
88 virtual void setPortVisible(bool b);
89 bool isLabelVisible() const { return myLabelVisible; }
90 bool isPortVisible() const { return myPortVisible; }
92 virtual void setNodeColor(const QColor& theColor);
93 virtual QColor nodeColor() const { return myColor; }
95 virtual void setState(SUPERV::GraphState theState);
96 virtual void updateInfo();
97 virtual void updatePorts();
98 virtual void updateGates();
99 virtual void updatePoints();
101 virtual QPoint getInConnectionPoint() const;
102 virtual QPoint getOutConnectionPoint() const;
104 virtual QRect getRect() const;
105 virtual QRect getTitleRect() const;
106 virtual QRect getStatusRect() const;
107 virtual QRect getLabelRect() const;
108 virtual QRect getBodyRect() const;
109 virtual QRect getGateRect() const;
112 void draw(QPainter& thePainter);
113 virtual void drawShape(QPainter& thePainter);
115 virtual void drawTitle(QPainter& thePainter);
116 virtual void drawLabel(QPainter& thePainter);
117 virtual void drawPort(QPainter& thePainter);
118 virtual void drawGate(QPainter& thePainter);
119 virtual void drawStatus(QPainter& thePainter);
121 virtual void drawFrame(QPainter& thePainter);
122 virtual void drawTitleShape(QPainter& thePainter);
123 virtual void drawStatusShape(QPainter& thePainter);
128 SUPERVGUI_CanvasNode* myNode;
147 QColor myStatusColor;
149 SUPERVGUI_CanvasHookPrs* myPointIn;
150 SUPERVGUI_CanvasHookPrs* myPointOut;
154 class SUPERVGUI_CanvasPort;
155 class SUPERVGUI_CanvasPortPrs {
158 SUPERVGUI_CanvasPortPrs(QCanvas* theCanvas, SUPERVGUI_CanvasPort* thePort);
159 ~SUPERVGUI_CanvasPortPrs();
161 SUPERVGUI_CanvasPort* getPort() { return myPort; }
162 virtual void update(bool theForce = false);
164 virtual bool isHilight() const;
165 virtual bool isAlert() const;
167 virtual QString getText() const;
168 virtual int getAlignment() const;
170 void setPortRect(const QRect& theRect);
171 QRect getPortRect() const { return myRect; }
173 void setVisible(bool b);
174 bool isVisible() const { return myVisible; }
176 void moveBy(int dx, int dy);
179 QPoint getConnectionPoint() const;
180 void draw(QPainter& thePainter);
183 SUPERVGUI_CanvasPort* myPort;
188 SUPERVGUI_CanvasHookPrs* myPoint;