Salome HOME
ddb250ea79430b09ab59c27854886d34acd6f91b
[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     static SUPERVGUI_CanvasComputeNode* Create (SUIT_ResourceMgr*, QObject* theParent,
39                                                 SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
40     virtual ~SUPERVGUI_CanvasComputeNode() {}
41
42     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
43
44   protected:
45     SUPERVGUI_CanvasComputeNode (SUIT_ResourceMgr*, QObject* theParent,
46                                  SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
47 };
48
49 class SUPERVGUI_CanvasMacroNode : public SUPERVGUI_CanvasComputeNode {
50   Q_OBJECT
51
52   public:
53     static SUPERVGUI_CanvasMacroNode* Create (SUIT_ResourceMgr*, QObject* theParent,
54                                               SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
55     virtual ~SUPERVGUI_CanvasMacroNode() {}
56
57     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
58
59   public slots:
60     virtual void remove(); // mkr : IPAL11549
61     void openSubGraph();
62     void exportDataflow();
63
64   protected:
65     SUPERVGUI_CanvasMacroNode (SUIT_ResourceMgr*, QObject* theParent,
66                                SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
67
68     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
69 };
70
71
72 class SUPERVGUI_CanvasEndNode;
73 class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode
74 {
75   Q_OBJECT
76
77   public:
78     static SUPERVGUI_CanvasStartNode* Create (SUIT_ResourceMgr*, QObject* theParent,
79                                               SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
80     virtual ~SUPERVGUI_CanvasStartNode() {}
81
82     virtual bool setNodeName(QString aName);
83
84     SUPERVGUI_CanvasEndNode* getCoupled() const { return myCoupled; }
85
86     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
87
88   public slots:
89     virtual void remove();
90
91     // mkr : IPAL9815 : commented the following code
92     /*virtual void addInputPort();
93       virtual void addOutputPort();*/
94     virtual void pastePort();
95
96   protected:
97     SUPERVGUI_CanvasStartNode (SUIT_ResourceMgr*, QObject* theParent,
98                                SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
99
100     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
101
102   protected slots:
103     virtual void onDestroyed(QObject*);
104
105   private:
106     friend class SUPERVGUI_CanvasEndNode;
107     void setCoupled(SUPERVGUI_CanvasEndNode* theEnd) { myCoupled = theEnd; }
108
109     SUPERVGUI_CanvasEndNode* myCoupled;
110 };
111
112
113 class SUPERVGUI_CanvasEndNode : public SUPERVGUI_CanvasNode {
114   Q_OBJECT
115
116   public:
117     static SUPERVGUI_CanvasEndNode* Create (SUIT_ResourceMgr*, QObject* theParent,
118                                             SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
119                                             SUPERVGUI_CanvasStartNode* theStart);
120     virtual ~SUPERVGUI_CanvasEndNode() {}
121
122     SUPERVGUI_CanvasStartNode* getCoupled() const { return myCoupled; }
123
124     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
125
126   // mkr : IPAL9815 : commented the following code
127   /*public slots:
128     virtual void addInputPort();*/
129
130   protected:
131     SUPERVGUI_CanvasEndNode (SUIT_ResourceMgr*, QObject* theParent,
132                              SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
133                              SUPERVGUI_CanvasStartNode* theStart);
134
135     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
136
137   private:
138     SUPERVGUI_CanvasStartNode* myCoupled;
139 };
140
141
142 class SUPERVGUI_CanvasGotoNode : public SUPERVGUI_CanvasNode {
143   Q_OBJECT
144
145   public:
146     static SUPERVGUI_CanvasGotoNode* Create (SUIT_ResourceMgr*, QObject* theParent,
147                                              SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
148     virtual ~SUPERVGUI_CanvasGotoNode() {}
149
150     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
151
152   public slots:
153     void linkToNode();
154
155   protected:
156     SUPERVGUI_CanvasGotoNode (SUIT_ResourceMgr*, QObject* theParent,
157                               SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
158
159     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
160 };
161
162 class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode {
163   Q_OBJECT
164
165   public:
166     static SUPERVGUI_CanvasCellNode* Create (SUIT_ResourceMgr*, QObject* theParent, 
167                                              SUPERVGUI_Main* theMain, 
168                                              SUPERV_CNode theNode);
169     virtual ~SUPERVGUI_CanvasCellNode();
170
171     // asv : 26.01.05 : everything moved to CanvasNode::getPopupMenu()
172     //virtual QPopupMenu* getPopupMenu(QWidget* theParent);
173
174     void setPairCell(SUPERVGUI_CanvasCellNode* thePairCell);
175     SUPERVGUI_CanvasCellNode* getPairCell();
176
177     virtual void sync();
178
179     // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
180     //virtual bool setNodeName(QString aName);
181
182   protected:
183     SUPERVGUI_CanvasCellNode (SUIT_ResourceMgr*, QObject* theParent, 
184                               SUPERVGUI_Main* theMain, 
185                               SUPERV_CNode theNode);
186
187     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
188
189  protected:
190     SUPERVGUI_CanvasCellNode*  myPairCell;  //for ControlNodes
191
192  private:
193     bool        myIsControl;
194     bool        myIsStart;
195 };
196
197 class SUPERVGUI_CanvasCellEndNode : public SUPERVGUI_CanvasCellNode {
198  
199   public:
200     static SUPERVGUI_CanvasCellEndNode* Create (SUIT_ResourceMgr*, QObject* theParent, 
201                                                 SUPERVGUI_Main* theMain, 
202                                                 SUPERV_CNode theNode, 
203                                                 SUPERVGUI_CanvasCellNode* theStart);
204     virtual ~SUPERVGUI_CanvasCellEndNode() {}
205
206     // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
207     //virtual bool setNodeName(QString theName);
208
209   protected:
210     SUPERVGUI_CanvasCellEndNode (SUIT_ResourceMgr*, QObject* theParent, 
211                                  SUPERVGUI_Main* theMain, 
212                                  SUPERV_CNode theNode, 
213                                  SUPERVGUI_CanvasCellNode* theStart);
214 };
215
216 /**
217  * Taken from SUPERVGUI_ControlNode.h without change
218  */
219 class SUPERVGUI_SelectInlineDlg : public QDialog {
220   Q_OBJECT
221
222  public:
223   SUPERVGUI_SelectInlineDlg(SUPERVGUI_Main* theMain);
224   virtual ~SUPERVGUI_SelectInlineDlg() {};
225
226   QString getName() { return myCombo->currentText(); }
227
228  private:
229   QComboBox* myCombo;
230 };
231
232
233 #endif