Salome HOME
NRI : Merge from V1_2.
[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 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     virtual void deletePort();
60
61   protected:
62     SUPERVGUI_Main*  main;
63     SUPERV_Port      port;
64
65     QPopupMenu*      popup;
66     int              mySketchItem;
67     int              myDelItem;
68     int              browser;
69
70     SALOME_Selection* mySelection;
71
72     QString myName;
73
74   private slots:
75     void showPopup(QMouseEvent* e);
76 };
77
78
79
80
81 class SUPERVGUI_GetValueDlg;
82 class SUPERVGUI_PortIn: public SUPERVGUI_Port {
83   Q_OBJECT
84
85   public:
86     SUPERVGUI_PortIn(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p);
87     virtual ~SUPERVGUI_PortIn();
88
89     bool eventFilter( QObject* o, QEvent* e );
90
91     void sync();
92     void setValue(const char* id);
93     virtual QPoint getConnectPnt();
94
95     void setLinkPrs(SUPERVGUI_Link* theLink);
96
97     SUPERVGUI_Link* getLinkPrs()
98       { return myLinkPrs; };
99
100     void deleteLinks();
101
102   private slots:
103     void setInput();
104     void browse();
105     void onDeleteLink(SUPERVGUI_Link*);
106
107
108   private:
109     int   psd;
110     int   psc;
111     SUPERVGUI_Link*        myLinkPrs;
112     SUPERVGUI_GetValueDlg* myDlg;
113 };
114
115
116
117
118
119 class SUPERVGUI_PortOut: public SUPERVGUI_Port {
120   Q_OBJECT
121
122   public:
123     SUPERVGUI_PortOut(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p);
124     virtual ~SUPERVGUI_PortOut();
125
126     void sync();
127     void updateStudy();
128     bool isInStudy() { return study; };
129     void setStudyState(bool theIsInStudy) { study = theIsInStudy; };
130     virtual QPoint getConnectPnt();
131
132     void addLinkPrs(SUPERVGUI_Link* theLink);
133
134     SUPERVGUI_Link* getLinkPrs(int theNum) 
135       { return myLinksList.at(theNum); };
136
137     int getLinkPrsCount()
138       { return myLinksList.count(); };
139
140     void deleteLinks();
141
142   private slots:
143     void toStudy();
144     void browse();
145
146     void sketch(QMouseEvent* e);
147     void onDeleteLink(SUPERVGUI_Link*);
148
149
150   private:
151     int  pls;
152     bool study;
153     QPtrList<SUPERVGUI_Link> myLinksList;
154 };
155
156
157 class SUPERVGUI_PortInESNode: public SUPERVGUI_Port {
158   Q_OBJECT
159
160   public:
161     SUPERVGUI_PortInESNode(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p);
162     virtual ~SUPERVGUI_PortInESNode();
163
164     bool eventFilter( QObject* o, QEvent* e );    
165
166     void sync();
167     void setValue(const char* id);
168     virtual QPoint getConnectPnt();
169
170     void setLinkPrs(SUPERVGUI_Link* theLink);
171     
172     SUPERVGUI_Link* getLinkPrs(int theNum) 
173       { return myLinksList.at(theNum); };
174
175     int getLinkPrsCount()
176       { return myLinksList.count(); };
177
178     void deleteLinks();
179
180
181   private slots:
182     void setInput();
183     void browse();
184     void onDeleteLink(SUPERVGUI_Link*);
185
186
187   private:
188 //    int   psd;
189     int   psc;
190     QPtrList<SUPERVGUI_Link> myLinksList;
191     SUPERVGUI_GetValueDlg* myDlg;
192
193 };
194 #endif