]> SALOME platform Git repositories - modules/superv.git/blob - src/SUPERVGUI/SUPERVGUI_Service.h
Salome HOME
92c195ddc9c31635506f7ac0d6d8f0ad0d995f76
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Service.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_Service.h
25 //  Author : Francis KLOSS
26 //  Module : SUPERV
27
28 #ifndef SUPERVGUI_Service_H
29 #define SUPERVGUI_Service_H
30
31 using namespace std;
32 #include "SUPERVGUI_Def.h"
33 #include <qtabwidget.h>
34 #include <qhgroupbox.h>
35 #include <qwidgetstack.h>
36
37
38 //*****************************************************
39 //  Pane for Python script editing
40 //*****************************************************
41 class SUPERVGUI_PythonEditPane: public QFrame {
42   Q_OBJECT
43
44  public:
45   SUPERVGUI_PythonEditPane(QWidget* theParent);
46   ~SUPERVGUI_PythonEditPane() {};
47   
48   QString getFuncName();
49
50   bool isDefined()
51     { return (myText->paragraphs() > 1); }
52
53   SUPERV_Strings getFunction();
54   void setFunction(SUPERV_Strings theStr);
55     
56  public slots:
57   void loadFile();
58   void readFunction();
59
60  private:
61
62   //QLineEdit* myNameEdt;
63   //QLineEdit* myParamEdt;
64   QTextEdit* myText;
65   //QLineEdit* myOutParamEdt;
66   QPushButton* myNextBtn;
67
68   QTextStream* myIStream;
69   QFile* myFile;
70 };
71
72
73 //*****************************************************
74 //  Dialog box for node creation
75 //*****************************************************
76
77 class SUPERVGUI_Service: public QDialog {
78   Q_OBJECT
79
80   public:
81     SUPERVGUI_Service(SALOME_NamingService* ns);
82     ~SUPERVGUI_Service();
83
84     void choose();
85
86  protected:
87     void showEvent(QShowEvent* theEvent);
88
89   private:
90     void initialise();
91
92   private slots:
93     void tabChanged(QWidget *);
94     void addComputeNode();
95     void addFactoryNode();
96     void addInlineNode();
97     void addMacroNode();
98     void typeNodeSelected(int theRow);
99     void loadGraph();
100
101   private:
102     QListView*            components;
103     SALOME_NamingService* naming;
104     int myX, myY;
105     QWidgetStack* myStackWidget;
106     int myLoopId;
107     int myOtherId;
108
109     SUPERVGUI_PythonEditPane* myScriptPane;
110
111     SUPERVGUI_PythonEditPane* myInitPane;
112     SUPERVGUI_PythonEditPane* myMorePane;
113     SUPERVGUI_PythonEditPane* myNextPane;
114
115     QListView* myMacroPane;
116     QFile*     myMFile;        
117
118     QTabWidget* myTabPane;
119     bool myIsInline;
120
121     QComboBox* myTypeCombo;
122 };
123
124 /*!
125  * Edit Python dialog
126  */
127 class SUPERVGUI_EditPythonDlg: public QDialog {
128   Q_OBJECT
129     
130  public:
131   SUPERVGUI_EditPythonDlg(bool isLoop = false);
132   ~SUPERVGUI_EditPythonDlg() {};
133
134   // Not Loop functions
135   QString getFuncName()
136     { return myEditPane->getFuncName(); }
137
138   bool isDefined()
139     { return myEditPane->isDefined(); }
140
141   SUPERV_Strings getFunction()
142     { return myEditPane->getFunction(); }
143
144   void setFunction(SUPERV_Strings theStr)
145     { myEditPane->setFunction(theStr); }
146
147   // Init functions
148   QString getInitFuncName()
149     { return myInitPane->getFuncName(); }
150
151   SUPERV_Strings getInitFunction()
152     { return myInitPane->getFunction(); }
153
154   void setInitFunction(SUPERV_Strings theStr)
155     { myInitPane->setFunction(theStr); }
156
157   // More functions
158   QString getMoreFuncName()
159     { return myMorePane->getFuncName(); }
160
161   SUPERV_Strings getMoreFunction()
162     { return myMorePane->getFunction(); }
163
164   void setMoreFunction(SUPERV_Strings theStr)
165     { myMorePane->setFunction(theStr); }
166
167   // Next functions
168   QString getNextFuncName()
169     { return myNextPane->getFuncName(); }
170
171   SUPERV_Strings getNextFunction()
172     { return myNextPane->getFunction(); }
173
174   void setNextFunction(SUPERV_Strings theStr)
175     { myNextPane->setFunction(theStr); }
176
177  private:
178   SUPERVGUI_PythonEditPane* myEditPane;
179   SUPERVGUI_PythonEditPane* myInitPane;
180   SUPERVGUI_PythonEditPane* myMorePane;
181   SUPERVGUI_PythonEditPane* myNextPane;
182 };
183
184 #endif