Salome HOME
Merging with JR_ASV_2_1_0_deb_with_KERNEL_Head branch, which contains many bug fixes...
[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     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
132
133     void setPairCell(SUPERVGUI_CanvasCellNode* thePairCell);
134     SUPERVGUI_CanvasCellNode* getPairCell();
135
136      virtual void sync();
137      virtual bool setNodeName(QString aName);
138
139   protected:
140     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
141
142  protected:
143     SUPERVGUI_CanvasCellNode*  myPairCell;  //for ControlNodes
144
145  private:
146     bool        myIsControl;
147     bool        myIsStart;
148
149 };
150
151 class SUPERVGUI_CanvasCellEndNode: public SUPERVGUI_CanvasCellNode {
152  
153   public:
154     SUPERVGUI_CanvasCellEndNode(QObject* theParent, 
155                                 SUPERVGUI_Main* theMain, 
156                                 SUPERV_CNode theNode, 
157                                 SUPERVGUI_CanvasCellNode* theStart);
158     virtual ~SUPERVGUI_CanvasCellEndNode() {}
159
160     virtual bool setNodeName(QString theName);
161 };
162
163 /** 
164  * Taken from SUPERVGUI_ControlNode.h without change
165  */
166 class SUPERVGUI_SelectInlineDlg:  public QDialog {
167   Q_OBJECT
168
169  public:
170   SUPERVGUI_SelectInlineDlg(SUPERVGUI_Main* theMain);
171   virtual ~SUPERVGUI_SelectInlineDlg() {};
172
173   QString getName() { return myCombo->currentText(); }
174
175  private:
176   QComboBox* myCombo;
177 };
178
179
180 #endif