]> SALOME platform Git repositories - modules/superv.git/blob - src/SUPERVGUI/SUPERVGUI_Port.h
Salome HOME
Modify the version number of SALOME: 2.2.0.
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Port.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_Port.h
25 //  Author : Francis KLOSS
26 //  Module : SUPERV
27
28 #ifndef SUPERVGUI_Port_H
29 #define SUPERVGUI_Port_H
30
31 //#include "SUPERVGUI_Point.h"
32 #include "SUPERVGUI_Label.h"
33 #include "SUPERVGUI_Def.h"
34 #include "SALOME_Selection.h"
35
36 class SUPERVGUI_Main;
37 class SUPERVGUI_Link;
38
39 class SUPERVGUI_Port: public SUPERVGUI_Label {
40   Q_OBJECT
41
42   public:
43     SUPERVGUI_Port(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p);
44     virtual ~SUPERVGUI_Port();
45
46     SUPERV_Port getPort();
47
48     virtual QPoint getConnectPnt();
49     virtual void deleteLinks() = 0;
50     virtual void sync();
51
52     SUPERVGUI_Main* getMain() { return main;}
53
54   private slots:
55     void sketchLink();
56     void endSketch();
57
58   protected slots:
59     void browse();
60     virtual void deletePort();
61
62   protected:
63     SUPERVGUI_Main*  main;
64     SUPERV_Port  port;
65
66     QPopupMenu*      popup;
67     int              mySketchItem;
68     int              myDelItem;
69     int              browser;
70
71     SALOME_Selection* mySelection;
72
73     QString myName;
74
75   private slots:
76     virtual void showPopup(QMouseEvent* e);
77 };
78
79
80
81
82 class SUPERVGUI_GetValueDlg;
83 class SUPERVGUI_PortIn: public SUPERVGUI_Port {
84   Q_OBJECT
85
86   public:
87     SUPERVGUI_PortIn(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p);
88     virtual ~SUPERVGUI_PortIn();
89
90     bool eventFilter( QObject* o, QEvent* e );
91
92     void sync();
93     void setValue(const char* id);
94     virtual QPoint getConnectPnt();
95
96     void setLinkPrs(SUPERVGUI_Link* theLink);
97
98     SUPERVGUI_Link* getLinkPrs()
99       { return myLinkPrs; };
100
101     void deleteLinks();
102
103   private slots:
104     void setInput();
105   //    void browse();
106     void onDeleteLink(SUPERVGUI_Link*);
107     virtual void showPopup(QMouseEvent* e);
108
109
110   private:
111     int   psd;
112     int   psc;
113     SUPERVGUI_Link*        myLinkPrs;
114     SUPERVGUI_GetValueDlg* myDlg;
115 };
116
117
118
119
120
121 class SUPERVGUI_PortOut: public SUPERVGUI_Port {
122   Q_OBJECT
123
124   public:
125     SUPERVGUI_PortOut(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p);
126     virtual ~SUPERVGUI_PortOut();
127
128     void sync();
129     void updateStudy();
130     bool isInStudy() { return study; };
131     void setStudyState(bool theIsInStudy) { study = theIsInStudy; };
132     virtual QPoint getConnectPnt();
133
134     void addLinkPrs(SUPERVGUI_Link* theLink);
135
136     SUPERVGUI_Link* getLinkPrs(int theNum) 
137       { return myLinksList.at(theNum); };
138
139     int getLinkPrsCount()
140       { return myLinksList.count(); };
141
142     void deleteLinks();
143
144   private slots:
145     void toStudy();
146   //    void browse();
147
148     void sketch(QMouseEvent* e);
149     void onDeleteLink(SUPERVGUI_Link*);
150
151
152   private:
153     int  pls;
154     bool study;
155     QPtrList<SUPERVGUI_Link> myLinksList;
156 };
157
158
159 class SUPERVGUI_PortInESNode: public SUPERVGUI_Port {
160   Q_OBJECT
161
162   public:
163     SUPERVGUI_PortInESNode(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p);
164     virtual ~SUPERVGUI_PortInESNode();
165
166     bool eventFilter( QObject* o, QEvent* e );    
167
168     void sync();
169     void setValue(const char* id);
170     virtual QPoint getConnectPnt();
171
172     void setLinkPrs(SUPERVGUI_Link* theLink);
173     
174     SUPERVGUI_Link* getLinkPrs(int theNum) 
175       { return myLinksList.at(theNum); };
176
177     int getLinkPrsCount()
178       { return myLinksList.count(); };
179
180     void deleteLinks();
181
182
183   private slots:
184     void setInput();
185   //    void browse();
186     void onDeleteLink(SUPERVGUI_Link*);
187
188
189   private:
190 //    int   psd;
191     int   psc;
192     QPtrList<SUPERVGUI_Link> myLinksList;
193     SUPERVGUI_GetValueDlg* myDlg;
194
195 };
196
197
198
199
200 class SUPERVGUI_StreamPortIn: public SUPERVGUI_PortIn 
201 {
202   Q_OBJECT
203 public:
204   SUPERVGUI_StreamPortIn(QWidget* parent, SUPERVGUI_Main* m, SUPERV::StreamPort_ptr p);
205   virtual ~SUPERVGUI_StreamPortIn();
206
207   void sync();
208   SUPERV_StreamPort getStreamPort() { return myPort;}
209
210 private slots:
211   void setParams();
212
213 private:
214   SUPERV_StreamPort myPort;
215
216   int myParamItem;
217 };
218
219
220 class SUPERVGUI_StreamPortOut: public SUPERVGUI_PortOut
221 {
222   Q_OBJECT
223 public:
224   SUPERVGUI_StreamPortOut(QWidget* parent, SUPERVGUI_Main* m, SUPERV::StreamPort_ptr p);
225   virtual ~SUPERVGUI_StreamPortOut();
226
227   void sync();
228   SUPERV_StreamPort getStreamPort() { return myPort;}
229
230 private slots:
231   void setParams();
232
233 private:
234   SUPERV_StreamPort myPort;
235   int myParamItem;
236 };
237
238
239 #endif