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);
54 virtual ~SUPERVGUI_CanvasNodePrs();
56 SUPERVGUI_CanvasNode* getNode() const { return myNode; }
57 QObject* getObject(const QPoint& thePos) const;
59 virtual int width() const;
60 virtual int height() const;
62 virtual int getTitleHeight() const;
63 virtual int getLabelHeight() const;
64 virtual int getStatusHeight() const;
65 virtual int getBodyHeight() const;
66 virtual int getPortHeight() const;
67 virtual int getStreamHeight() const;
68 virtual int getGateHeight() const;
70 QPointArray areaPoints() const;
71 void moveBy(double dx, double dy);
74 void setMoving(bool b) { myMoving = b; }
75 bool isMoving() const { return myMoving; }
77 virtual int rtti() const;
79 virtual void hideAll();
80 virtual void showAll();
81 virtual void setLabelVisible(bool b);
82 virtual void setPortVisible(bool b);
83 bool isLabelVisible() const { return myLabelVisible; }
84 bool isPortVisible() const { return myPortVisible; }
86 virtual void setNodeColor(const QColor& theColor);
87 virtual QColor nodeColor() const { return myColor; }
89 virtual void setState(SUPERV::GraphState theState);
90 virtual void updateInfo();
91 virtual void updatePorts();
92 virtual void updateGates();
93 virtual void updatePoints();
95 virtual QPoint getInConnectionPoint() const;
96 virtual QPoint getOutConnectionPoint() const;
98 virtual QRect getRect() const;
99 virtual QRect getTitleRect() const;
100 virtual QRect getStatusRect() const;
101 virtual QRect getLabelRect() const;
102 virtual QRect getBodyRect() const;
103 virtual QRect getGateRect() const;
106 void draw(QPainter& thePainter);
107 void drawShape(QPainter& thePainter);
109 virtual void drawTitle(QPainter& thePainter);
110 virtual void drawLabel(QPainter& thePainter);
111 virtual void drawPort(QPainter& thePainter);
112 virtual void drawGate(QPainter& thePainter);
113 virtual void drawStatus(QPainter& thePainter);
115 virtual void drawFrame(QPainter& thePainter);
116 virtual void drawTitleShape(QPainter& thePainter);
117 virtual void drawStatusShape(QPainter& thePainter);
120 SUPERVGUI_CanvasNode* myNode;
139 QColor myStatusColor;
141 SUPERVGUI_CanvasHookPrs* myPointIn;
142 SUPERVGUI_CanvasHookPrs* myPointOut;
146 class SUPERVGUI_CanvasPort;
147 class SUPERVGUI_CanvasPortPrs {
150 SUPERVGUI_CanvasPortPrs(QCanvas* theCanvas, SUPERVGUI_CanvasPort* thePort);
151 ~SUPERVGUI_CanvasPortPrs();
153 SUPERVGUI_CanvasPort* getPort() { return myPort; }
154 virtual void update(bool theForce = false);
156 virtual bool isHilight() const;
157 virtual bool isAlert() const;
159 virtual QString getText() const;
160 virtual int getAlignment() const;
162 void setPortRect(const QRect& theRect);
163 QRect getPortRect() const { return myRect; }
165 void setVisible(bool b);
166 bool isVisible() const { return myVisible; }
168 void moveBy(int dx, int dy);
171 QPoint getConnectionPoint() const;
172 void draw(QPainter& thePainter);
175 SUPERVGUI_CanvasPort* myPort;
180 SUPERVGUI_CanvasHookPrs* myPoint;