]> SALOME platform Git repositories - modules/superv.git/blob - src/SUPERVGUI/SUPERVGUI_Node.h
Salome HOME
sources v1.2
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Node.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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SUPERVGUI_Node.h
25 //  Author : Francis KLOSS
26 //  Module : SUPERV
27
28 #ifndef SUPERVGUI_Node_H
29 #define SUPERVGUI_Node_H
30
31 using namespace std;
32 #include "SUPERVGUI_Def.h"
33 #include "SUPERVGUI_Label.h"
34 #include <qvbox.h>
35 #include "SUPERVGUI_BrowseNodeDlg.h"
36
37 class SUPERVGUI_Main;
38
39 class SUPERVGUI_Node: public QFrame {
40   Q_OBJECT
41
42   public:
43     SUPERVGUI_Node(QWidget* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
44     virtual ~SUPERVGUI_Node();
45
46     bool eventFilter( QObject* o, QEvent* e );
47     virtual void sync();
48
49     virtual void hideAll()=0;
50     virtual void showAll()=0;
51     virtual void deleteLinks() {};
52     virtual void setNodeName(QString aName);
53
54     SUPERV_CNode getEngine() 
55       { return myNode; };
56
57     SUPERVGUI_Main* getMain()
58       { return myMain; };
59
60     bool isWarning();
61     bool isStep();
62     bool isTrace();
63     bool isVerbose();
64
65     SUPERV::KindOfNode getNodeType()
66       { return myNode->Kind(); }
67
68     SUPERV_CNode getComputingNode()
69       { return myNode; }
70
71     SUPERV_FNode getFactoryNode()
72       { return SUPERV::FNode::_narrow(myNode); }
73
74     SUPERV_INode getInlineNode()
75       { return SUPERV::INode::_narrow(myNode); }
76
77     SUPERV_GNode getGotoNode()
78       { return SUPERV::GNode::_narrow(myNode); }
79
80     SUPERV_LNode getLoopNode()
81       { return SUPERV::LNode::_narrow(myNode); }
82
83     SUPERV_ELNode getEndLoopNode()
84       { return SUPERV::ELNode::_narrow(myNode); }
85
86     SUPERV_SNode getSwitchNode()
87       { return SUPERV::SNode::_narrow(myNode); }
88
89     SUPERV_ESNode getEndSwitchNode()
90       { return SUPERV::ESNode::_narrow(myNode); }
91
92
93     SUPERV_Port createInPort();
94     SUPERV_Port createOutPort();
95
96  protected:
97     void mousePressEvent(QMouseEvent* e);
98
99   public slots:
100     void suspendResume();
101     void kill();
102     void stopRestart();
103     void configure();
104     void showPython();
105
106     virtual void rename();
107     virtual void remove();
108     void changeInformation();
109     void browse();
110
111     void setWarning(bool b);
112     void setStep(bool b);
113     void setTrace(bool b);
114     void setVerbose(bool b);
115     void showPopup(QMouseEvent* e);
116
117     virtual void addInputPort();
118     virtual void addOutputPort();
119     virtual void editFunction();
120
121  protected:
122     virtual void setState(SUPERV::GraphState theState);
123
124     SUPERV_CNode     myNode;
125     SUPERVGUI_Main*  myMain;
126     
127     //SUPERVGUI_Label* myTitle;
128     SUPERVGUI_Label* myTime;
129     SUPERVGUI_Label* myStatus;
130
131     QPopupMenu* myPopup;
132     QPopupMenu* myRunPopup;
133     int         myKillItem;
134     int         mySuspendItem;
135     int         myStopItem;
136     int         myRenameItem;
137     int         myDeleteItem;
138     int         mySeparatorId;
139     
140     SUPERVGUI_BrowseNodeDlg* aBrowseDlg;
141
142   private:
143
144     bool        warning;
145     bool        step;
146     bool        trace;
147     bool        verbose;
148 };
149
150
151
152 /*!
153  * Port parameters dialog definition
154  */
155 class SUPERVGUI_PortParamsDlg: public QDialog {
156   Q_OBJECT
157     
158  public:
159   SUPERVGUI_PortParamsDlg();
160   ~SUPERVGUI_PortParamsDlg() {};
161
162   QString getName() { return myNameTxt->text(); }
163   QString getType() { return myTypeTxt->text(); }
164
165  private:
166   QLineEdit* myNameTxt;
167   QLineEdit* myTypeTxt;
168 };
169
170
171
172 #endif