Salome HOME
8f6767f1cb0bff359bcd8393c3ea2cfe4d09fb19
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_CanvasControlNode.h
1 //  SUPERV SUPERVGUI : GUI for Supervisor component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SUPERVGUI_CanvasControlNode.h
23 //  Author : Natalia KOPNOVA
24 //  Module : SUPERV
25
26 #ifndef SUPERVGUI_CanvasControlNode_H
27 #define SUPERVGUI_CanvasControlNode_H
28
29 #include "SUPERVGUI_Def.h"
30 #include "SUPERVGUI_CanvasNode.h"
31 #include <qdialog.h>
32 #include <qcombobox.h>
33
34 class SUPERVGUI_CanvasComputeNode : public SUPERVGUI_CanvasNode {
35   Q_OBJECT
36
37   public:
38     SUPERVGUI_CanvasComputeNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
39     virtual ~SUPERVGUI_CanvasComputeNode() {}
40
41     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
42 };
43
44 class SUPERVGUI_CanvasMacroNode : public SUPERVGUI_CanvasComputeNode {
45   Q_OBJECT
46
47   public:
48     SUPERVGUI_CanvasMacroNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
49     virtual ~SUPERVGUI_CanvasMacroNode() {}
50
51     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
52
53   public slots:
54     virtual void remove(); // mkr : IPAL11549
55     void openSubGraph();
56     void exportDataflow();
57
58   protected:
59     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
60 };
61
62
63 class SUPERVGUI_CanvasEndNode;
64 class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode {
65   Q_OBJECT
66
67   public:
68     SUPERVGUI_CanvasStartNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
69     virtual ~SUPERVGUI_CanvasStartNode() {}
70
71     virtual bool setNodeName(QString aName);
72
73     SUPERVGUI_CanvasEndNode* getCoupled() const { return myCoupled; }
74     
75     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
76
77   public slots:
78     virtual void remove();
79
80     // mkr : IPAL9815 : commented the following code
81     /*virtual void addInputPort();
82       virtual void addOutputPort();*/
83     virtual void pastePort();
84
85   protected:
86     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
87
88   protected slots:
89     virtual void onDestroyed(QObject*);
90
91   private:
92     friend class SUPERVGUI_CanvasEndNode;
93     void setCoupled(SUPERVGUI_CanvasEndNode* theEnd) { myCoupled = theEnd; }
94
95     SUPERVGUI_CanvasEndNode* myCoupled;
96
97 };
98
99
100 class SUPERVGUI_CanvasEndNode : public SUPERVGUI_CanvasNode {
101   Q_OBJECT
102
103   public:
104     SUPERVGUI_CanvasEndNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
105                              SUPERVGUI_CanvasStartNode* theStart);
106     virtual ~SUPERVGUI_CanvasEndNode() {}
107
108     SUPERVGUI_CanvasStartNode* getCoupled() const { return myCoupled; }
109
110     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
111
112   // mkr : IPAL9815 : commented the following code
113   /*public slots:
114     virtual void addInputPort();*/
115
116   protected:
117     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
118
119   private:
120     SUPERVGUI_CanvasStartNode* myCoupled;
121
122 };
123
124
125 class SUPERVGUI_CanvasGotoNode : public SUPERVGUI_CanvasNode {
126   Q_OBJECT
127
128   public:
129     SUPERVGUI_CanvasGotoNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
130     virtual ~SUPERVGUI_CanvasGotoNode() {}
131
132     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
133
134   public slots:
135     void linkToNode();
136
137   protected:
138     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
139 };
140
141 class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode {
142   Q_OBJECT
143
144   public:
145     SUPERVGUI_CanvasCellNode( SUIT_ResourceMgr*, QObject* theParent, 
146                               SUPERVGUI_Main* theMain, 
147                               SUPERV_CNode theNode);
148     virtual ~SUPERVGUI_CanvasCellNode();
149
150     // asv : 26.01.05 : everything moved to CanvasNode::getPopupMenu()
151     //virtual QPopupMenu* getPopupMenu(QWidget* theParent);
152
153     void setPairCell(SUPERVGUI_CanvasCellNode* thePairCell);
154     SUPERVGUI_CanvasCellNode* getPairCell();
155
156      virtual void sync();
157
158      // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
159      //virtual bool setNodeName(QString aName);
160
161   protected:
162     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
163
164  protected:
165     SUPERVGUI_CanvasCellNode*  myPairCell;  //for ControlNodes
166
167  private:
168     bool        myIsControl;
169     bool        myIsStart;
170
171 };
172
173 class SUPERVGUI_CanvasCellEndNode: public SUPERVGUI_CanvasCellNode {
174  
175   public:
176     SUPERVGUI_CanvasCellEndNode( SUIT_ResourceMgr*, QObject* theParent, 
177                                  SUPERVGUI_Main* theMain, 
178                                  SUPERV_CNode theNode, 
179                                  SUPERVGUI_CanvasCellNode* theStart);
180     virtual ~SUPERVGUI_CanvasCellEndNode() {}
181
182      // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
183      //virtual bool setNodeName(QString theName);
184 };
185
186 /** 
187  * Taken from SUPERVGUI_ControlNode.h without change
188  */
189 class SUPERVGUI_SelectInlineDlg:  public QDialog {
190   Q_OBJECT
191
192  public:
193   SUPERVGUI_SelectInlineDlg(SUPERVGUI_Main* theMain);
194   virtual ~SUPERVGUI_SelectInlineDlg() {};
195
196   QString getName() { return myCombo->currentText(); }
197
198  private:
199   QComboBox* myCombo;
200 };
201
202
203 #endif