1 // SUPERV SUPERVGUI : GUI for Supervisor component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SUPERVGUI_CanvasNodePrs.h
23 // Author : Natalia KOPNOVA
26 #ifndef SUPERVGUI_CanvasNodePrs_H
27 #define SUPERVGUI_CanvasNodePrs_H
29 #include "SUPERVGUI_Def.h"
34 class SUPERVGUI_CanvasNodePrs;
35 class SUPERVGUI_CanvasPortPrs;
36 class SUIT_ResourceMgr;
37 class SUPERVGUI_CanvasHookPrs : public QCanvasEllipse
40 SUPERVGUI_CanvasHookPrs(QCanvas* theCanvas, SUPERVGUI_CanvasNodePrs* theNode, const bool& theIn);
41 SUPERVGUI_CanvasHookPrs(QCanvas* theCanvas, SUPERVGUI_CanvasPortPrs* thePort, const bool& theIn);
42 ~SUPERVGUI_CanvasHookPrs();
44 QObject* getObject() const;
46 void setCoords(int x, int y);
48 void setVisible(bool b);
49 void moveBy(double dx, double dy);
52 virtual int rtti() const;
55 void init(QCanvas* theCanvas);
57 SUPERVGUI_CanvasNodePrs* myNodePrs;
58 SUPERVGUI_CanvasPortPrs* myPortPrs;
66 class SUPERVGUI_CanvasNode;
67 class SUPERVGUI_CanvasNodePrs: public QCanvasPolygonalItem {
70 SUPERVGUI_CanvasNodePrs( SUIT_ResourceMgr*, QCanvas*, SUPERVGUI_CanvasNode*, bool theCellPrs=false);
71 virtual ~SUPERVGUI_CanvasNodePrs();
73 SUPERVGUI_CanvasNode* getNode() const { return myNode; }
74 QObject* getObject(const QPoint& thePos) const;
76 QString getStatus() const { return myStatus; }
77 QColor getStatusColor() const { return myStatusColor; }
79 void setStatus(QString theStatus) { myStatus = theStatus; }
80 void setStatusColor(QColor theStatusColor) { myStatusColor = theStatusColor; }
82 virtual int width() const;
83 virtual int height() const;
85 virtual int getTitleHeight() const;
86 virtual int getLabelHeight() const;
87 virtual int getStatusHeight() const;
88 virtual int getBodyHeight() const;
89 virtual int getPortHeight() const;
90 virtual int getStreamHeight() const;
91 virtual int getGateHeight() const;
93 QPointArray areaPoints() const;
94 void moveBy(double dx, double dy);
97 void setMoving(bool b) { myMoving = b; }
98 bool isMoving() const { return myMoving; }
100 virtual int rtti() const;
102 virtual void hideAll();
103 virtual void showAll();
104 virtual void setLabelVisible(bool b);
105 virtual void setPortVisible(bool b);
106 bool isLabelVisible() const { return myLabelVisible; }
107 bool isPortVisible() const { return myPortVisible; }
109 virtual void setNodeColor(const QColor& theColor);
110 virtual QColor nodeColor() const { return myColor; }
112 virtual void setState(SUPERV::GraphState theState);
113 virtual void updateInfo();
114 virtual void updatePorts();
115 virtual void updateGates();
116 virtual void updatePoints();
118 virtual QPoint getInConnectionPoint() const;
119 virtual QPoint getOutConnectionPoint() const;
121 virtual QRect getRect() const;
122 virtual QRect getTitleRect() const;
123 virtual QRect getStatusRect() const;
124 virtual QRect getLabelRect() const;
125 virtual QRect getBodyRect() const;
126 virtual QRect getGateRect() const;
129 void draw(QPainter& thePainter);
130 virtual void drawShape(QPainter& thePainter);
132 virtual void drawTitle(QPainter& thePainter);
133 virtual void drawLabel(QPainter& thePainter);
134 virtual void drawPort(QPainter& thePainter);
135 virtual void drawGate(QPainter& thePainter);
136 virtual void drawStatus(QPainter& thePainter);
138 virtual void drawFrame(QPainter& thePainter);
139 virtual void drawTitleShape(QPainter& thePainter);
140 virtual void drawStatusShape(QPainter& thePainter);
142 SUIT_ResourceMgr* resMgr() const { return myMgr; }
146 SUPERVGUI_CanvasNode* myNode;
147 SUIT_ResourceMgr* myMgr;
166 QColor myStatusColor;
168 SUPERVGUI_CanvasHookPrs* myPointIn;
169 SUPERVGUI_CanvasHookPrs* myPointOut;
173 class SUPERVGUI_CanvasPort;
174 class SUPERVGUI_CanvasPortPrs {
177 SUPERVGUI_CanvasPortPrs(QCanvas* theCanvas, SUPERVGUI_CanvasPort* thePort);
178 ~SUPERVGUI_CanvasPortPrs();
180 SUPERVGUI_CanvasPort* getPort() { return myPort; }
181 virtual void update(bool theForce = false);
183 virtual bool isHilight() const;
184 virtual bool isAlert() const;
186 virtual QString getText() const;
187 virtual int getAlignment() const;
189 void setPortRect(const QRect& theRect);
190 QRect getPortRect() const { return myRect; }
192 void setVisible(bool b);
193 bool isVisible() const { return myVisible; }
195 void moveBy(int dx, int dy);
198 QPoint getConnectionPoint() const;
199 void draw(QPainter& thePainter);
202 SUPERVGUI_CanvasPort* myPort;
207 SUPERVGUI_CanvasHookPrs* myPoint;