Salome HOME
b903e9d5141c21b36333b1bf76e88ead43ac8f37
[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     virtual void addInputPort();
64     virtual void addOutputPort();
65     virtual void pastePort();
66
67   protected:
68     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
69
70   protected slots:
71     virtual void onDestroyed(QObject*);
72
73   private:
74     friend class SUPERVGUI_CanvasEndNode;
75     void setCoupled(SUPERVGUI_CanvasEndNode* theEnd) { myCoupled = theEnd; }
76
77     SUPERVGUI_CanvasEndNode* myCoupled;
78
79 };
80
81
82 class SUPERVGUI_CanvasEndNode : public SUPERVGUI_CanvasNode {
83   Q_OBJECT
84
85   public:
86     SUPERVGUI_CanvasEndNode(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
87                             SUPERVGUI_CanvasStartNode* theStart);
88     virtual ~SUPERVGUI_CanvasEndNode() {}
89
90     SUPERVGUI_CanvasStartNode* getCoupled() const { return myCoupled; }
91
92     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
93
94   public slots:
95     virtual void addInputPort();
96
97   protected:
98     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
99
100   private:
101     SUPERVGUI_CanvasStartNode* myCoupled;
102
103 };
104
105
106 class SUPERVGUI_CanvasGotoNode : public SUPERVGUI_CanvasNode {
107   Q_OBJECT
108
109   public:
110     SUPERVGUI_CanvasGotoNode(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
111     virtual ~SUPERVGUI_CanvasGotoNode() {}
112
113     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
114
115   public slots:
116     void linkToNode();
117
118   protected:
119     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
120 };
121
122 class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode {
123   Q_OBJECT
124
125   public:
126     SUPERVGUI_CanvasCellNode(QObject* theParent, 
127                              SUPERVGUI_Main* theMain, 
128                              SUPERV_CNode theNode);
129     virtual ~SUPERVGUI_CanvasCellNode();
130
131     // asv : 26.01.05 : everything moved to CanvasNode::getPopupMenu()
132     //virtual QPopupMenu* getPopupMenu(QWidget* theParent);
133
134     void setPairCell(SUPERVGUI_CanvasCellNode* thePairCell);
135     SUPERVGUI_CanvasCellNode* getPairCell();
136
137      virtual void sync();
138
139      // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
140      //virtual bool setNodeName(QString aName);
141
142   protected:
143     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
144
145  protected:
146     SUPERVGUI_CanvasCellNode*  myPairCell;  //for ControlNodes
147
148  private:
149     bool        myIsControl;
150     bool        myIsStart;
151
152 };
153
154 class SUPERVGUI_CanvasCellEndNode: public SUPERVGUI_CanvasCellNode {
155  
156   public:
157     SUPERVGUI_CanvasCellEndNode(QObject* theParent, 
158                                 SUPERVGUI_Main* theMain, 
159                                 SUPERV_CNode theNode, 
160                                 SUPERVGUI_CanvasCellNode* theStart);
161     virtual ~SUPERVGUI_CanvasCellEndNode() {}
162
163      // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
164      //virtual bool setNodeName(QString theName);
165 };
166
167 /** 
168  * Taken from SUPERVGUI_ControlNode.h without change
169  */
170 class SUPERVGUI_SelectInlineDlg:  public QDialog {
171   Q_OBJECT
172
173  public:
174   SUPERVGUI_SelectInlineDlg(SUPERVGUI_Main* theMain);
175   virtual ~SUPERVGUI_SelectInlineDlg() {};
176
177   QString getName() { return myCombo->currentText(); }
178
179  private:
180   QComboBox* myCombo;
181 };
182
183
184 #endif