Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_CanvasPort.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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SUPERVGUI_CanvasPort.h
23 //  Author : Natalia KOPNOVA
24 //  Module : SUPERV
25
26 #ifndef SUPERVGUI_CanvasPort_H
27 #define SUPERVGUI_CanvasPort_H
28
29 #include "SUPERVGUI_Def.h"
30
31
32 class SUPERVGUI_Main;
33 class SUPERVGUI_CanvasLink;
34 class SUPERVGUI_CanvasPortPrs;
35
36 class SUPERVGUI_CanvasPort : public QObject {
37   Q_OBJECT
38
39   public:
40     SUPERVGUI_CanvasPort(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort);
41     virtual ~SUPERVGUI_CanvasPort();
42
43     virtual void update();
44     virtual void sync();
45
46     virtual bool isStream() const { return false; }
47
48     SUPERV_Port getEngine() const { return myPort; }
49     SUPERVGUI_Main* getMain() const { return myMain; }
50     SUPERVGUI_CanvasPortPrs* getPrs() const;
51
52     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
53
54     virtual QPoint getConnectionPoint() const;
55
56     void moveBy(int dx, int dy);
57     void addLink(SUPERVGUI_CanvasLink* theLink);
58     void removeLink(SUPERVGUI_CanvasLink* theLink);
59     void updateLinks();
60
61   signals:
62     void objectDeleted(); // mkr : PAL8237
63
64   public slots:
65     void sketchLink();
66     virtual void remove();
67     void browse();
68     void copy();
69
70   protected:
71     virtual SUPERVGUI_CanvasPortPrs* createPrs() const;
72
73   private:
74     SUPERV_Port      myPort;
75     SUPERVGUI_Main*  myMain;
76
77     SUPERVGUI_CanvasPortPrs* myPrs;
78     QValueList<SUPERVGUI_CanvasLink*> myLinks;
79     bool isIgnore;
80 };
81
82 class SUPERVGUI_GetValueDlg;
83 class SUPERVGUI_CanvasPortIn : public SUPERVGUI_CanvasPort {
84   Q_OBJECT
85
86   public:
87     SUPERVGUI_CanvasPortIn(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort);
88     virtual ~SUPERVGUI_CanvasPortIn();
89
90     void setValue(const char* theValue);
91
92     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
93
94   public slots:
95     void setInput();
96
97   protected:
98     bool eventFilter(QObject* o, QEvent* e);
99
100   private:
101     SUPERVGUI_GetValueDlg* myDlg;
102 };
103
104 class SUPERVGUI_CanvasPortOut : public SUPERVGUI_CanvasPort {
105   Q_OBJECT
106
107   public:
108     SUPERVGUI_CanvasPortOut(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort);
109     virtual ~SUPERVGUI_CanvasPortOut();
110
111     void sync();
112     bool isInStudy() const { return myInStudy; }
113     void setStudyState(bool theInStudy) { myInStudy = theInStudy; }
114
115     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
116
117   signals:
118     void putInStudy( QString* ); // mkr : PAL8150
119
120   public slots:
121     void toStudy();
122
123   private:
124     bool myInStudy;
125 };
126
127 class SUPERVGUI_CanvasStreamPortIn : public SUPERVGUI_CanvasPortIn {
128   Q_OBJECT
129
130   public:
131     SUPERVGUI_CanvasStreamPortIn(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::StreamPort_ptr thePort);
132     virtual ~SUPERVGUI_CanvasStreamPortIn() {}
133
134     virtual bool isStream() const { return true; }
135     SUPERV_StreamPort getStreamEngine() const { return myStreamPort; }
136
137     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
138
139   public slots:
140     void setParams();
141
142   private:
143     SUPERV_StreamPort myStreamPort;
144 };
145
146 class SUPERVGUI_CanvasStreamPortOut : public SUPERVGUI_CanvasPortOut {
147   Q_OBJECT
148
149   public:
150     SUPERVGUI_CanvasStreamPortOut(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::StreamPort_ptr thePort);
151     virtual ~SUPERVGUI_CanvasStreamPortOut() {}
152
153     virtual bool isStream() const { return true; }
154     SUPERV_StreamPort getStreamEngine() const { return myStreamPort; }
155
156     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
157
158   public slots:
159     void setParams();
160
161   private:
162     SUPERV_StreamPort myStreamPort;
163 };
164
165 #endif