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