Salome HOME
NRI : First integration.
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Service.h
1 //  File      : SUPERVGUI_Service.h
2 //  Created   : 7 / 11 / 2001
3 //  Author    : Francis KLOSS
4 //  Project   : SALOME
5 //  Module    : SUPERVGUI
6 //  Copyright : CEA
7
8 #ifndef SUPERVGUI_Service_H
9 #define SUPERVGUI_Service_H
10
11 using namespace std;
12 #include "SUPERVGUI_Def.h"
13 #include <qtabwidget.h>
14 #include <qhgroupbox.h>
15 #include <qwidgetstack.h>
16
17
18 //*****************************************************
19 //  Pane for Python script editing
20 //*****************************************************
21 class SUPERVGUI_PythonEditPane: public QFrame {
22   Q_OBJECT
23
24  public:
25   SUPERVGUI_PythonEditPane(QWidget* theParent);
26   ~SUPERVGUI_PythonEditPane() {};
27   
28   QString getFuncName();
29
30   bool isDefined()
31     { return (myText->paragraphs() > 1); }
32
33   SUPERV_Strings getFunction();
34   void setFunction(SUPERV_Strings theStr);
35     
36  public slots:
37   void loadFile();
38   void readFunction();
39
40  private:
41
42   //QLineEdit* myNameEdt;
43   //QLineEdit* myParamEdt;
44   QTextEdit* myText;
45   //QLineEdit* myOutParamEdt;
46   QPushButton* myNextBtn;
47
48   QTextStream* myIStream;
49   QFile* myFile;
50 };
51
52
53 //*****************************************************
54 //  Dialog box for node creation
55 //*****************************************************
56
57 class SUPERVGUI_Service: public QDialog {
58   Q_OBJECT
59
60   public:
61     SUPERVGUI_Service(SALOME_NamingService* ns);
62     ~SUPERVGUI_Service();
63
64     void choose();
65
66  protected:
67     void showEvent(QShowEvent* theEvent);
68
69   private:
70     void initialise();
71
72   private slots:
73     void tabChanged(QWidget *);
74     void addComputeNode();
75     void addFactoryNode();
76     void addInlineNode();
77     void typeNodeSelected(int theRow);
78
79   private:
80     QListView*            components;
81     SALOME_NamingService* naming;
82     int myX, myY;
83     QWidgetStack* myStackWidget;
84     int myLoopId;
85     int myOtherId;
86
87     SUPERVGUI_PythonEditPane* myScriptPane;
88
89     SUPERVGUI_PythonEditPane* myInitPane;
90     SUPERVGUI_PythonEditPane* myMorePane;
91     SUPERVGUI_PythonEditPane* myNextPane;
92
93     QTabWidget* myTabPane;
94     bool myIsInline;
95
96     QComboBox* myTypeCombo;
97 };
98
99 /*!
100  * Edit Python dialog
101  */
102 class SUPERVGUI_EditPythonDlg: public QDialog {
103   Q_OBJECT
104     
105  public:
106   SUPERVGUI_EditPythonDlg(bool isLoop = false);
107   ~SUPERVGUI_EditPythonDlg() {};
108
109   // Not Loop functions
110   QString getFuncName()
111     { return myEditPane->getFuncName(); }
112
113   bool isDefined()
114     { return myEditPane->isDefined(); }
115
116   SUPERV_Strings getFunction()
117     { return myEditPane->getFunction(); }
118
119   void setFunction(SUPERV_Strings theStr)
120     { myEditPane->setFunction(theStr); }
121
122   // Init functions
123   QString getInitFuncName()
124     { return myInitPane->getFuncName(); }
125
126   SUPERV_Strings getInitFunction()
127     { return myInitPane->getFunction(); }
128
129   void setInitFunction(SUPERV_Strings theStr)
130     { myInitPane->setFunction(theStr); }
131
132   // More functions
133   QString getMoreFuncName()
134     { return myMorePane->getFuncName(); }
135
136   SUPERV_Strings getMoreFunction()
137     { return myMorePane->getFunction(); }
138
139   void setMoreFunction(SUPERV_Strings theStr)
140     { myMorePane->setFunction(theStr); }
141
142   // Next functions
143   QString getNextFuncName()
144     { return myNextPane->getFuncName(); }
145
146   SUPERV_Strings getNextFunction()
147     { return myNextPane->getFunction(); }
148
149   void setNextFunction(SUPERV_Strings theStr)
150     { myNextPane->setFunction(theStr); }
151
152  private:
153   SUPERVGUI_PythonEditPane* myEditPane;
154   SUPERVGUI_PythonEditPane* myInitPane;
155   SUPERVGUI_PythonEditPane* myMorePane;
156   SUPERVGUI_PythonEditPane* myNextPane;
157 };
158
159 #endif