Salome HOME
Memory Leaks
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_CanvasPort.h
1 //  SUPERV SUPERVGUI : GUI for Supervisor component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE
4 //
5 //  File   : SUPERVGUI_CanvasPort.h
6 //  Author : Natalia KOPNOVA
7 //  Module : SUPERV
8
9 #ifndef SUPERVGUI_CanvasPort_H
10 #define SUPERVGUI_CanvasPort_H
11
12 using namespace std;
13 #include "SUPERVGUI_Def.h"
14
15
16 class SUPERVGUI_Main;
17 class SUPERVGUI_CanvasLink;
18 class SUPERVGUI_CanvasPortPrs;
19
20 class SUPERVGUI_CanvasPort : public QObject {
21   Q_OBJECT
22
23   public:
24     SUPERVGUI_CanvasPort(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort);
25     virtual ~SUPERVGUI_CanvasPort();
26
27     virtual void update();
28     virtual void sync();
29
30     virtual bool isStream() const { return false; }
31
32     SUPERV_Port getEngine() const { return myPort; }
33     SUPERVGUI_Main* getMain() const { return myMain; }
34     SUPERVGUI_CanvasPortPrs* getPrs() const;
35
36     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
37
38     virtual QPoint getConnectionPoint() const;
39
40     void moveBy(int dx, int dy);
41     void addLink(SUPERVGUI_CanvasLink* theLink);
42     void removeLink(SUPERVGUI_CanvasLink* theLink);
43     void updateLinks();
44
45   public slots:
46     void sketchLink();
47     virtual void remove();
48     void browse();
49     void copy();
50
51   protected:
52     virtual SUPERVGUI_CanvasPortPrs* createPrs() const;
53
54   private:
55     SUPERV_Port      myPort;
56     SUPERVGUI_Main*  myMain;
57
58     SUPERVGUI_CanvasPortPrs* myPrs;
59     QValueList<SUPERVGUI_CanvasLink*> myLinks;
60     bool isIgnore;
61 };
62
63 class SUPERVGUI_GetValueDlg;
64 class SUPERVGUI_CanvasPortIn : public SUPERVGUI_CanvasPort {
65   Q_OBJECT
66
67   public:
68     SUPERVGUI_CanvasPortIn(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort);
69     virtual ~SUPERVGUI_CanvasPortIn();
70
71     void setValue(const char* theValue);
72
73     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
74
75   public slots:
76     void setInput();
77
78   protected:
79     bool eventFilter(QObject* o, QEvent* e);
80
81   private:
82     SUPERVGUI_GetValueDlg* myDlg;
83 };
84
85 class SUPERVGUI_CanvasPortOut : public SUPERVGUI_CanvasPort {
86   Q_OBJECT
87
88   public:
89     SUPERVGUI_CanvasPortOut(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort);
90     virtual ~SUPERVGUI_CanvasPortOut();
91
92     void sync();
93     bool isInStudy() const { return myInStudy; }
94     void setStudyState(bool theInStudy) { myInStudy = theInStudy; }
95
96     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
97
98   public slots:
99     void toStudy();
100
101   private:
102     bool myInStudy;
103 };
104
105 class SUPERVGUI_CanvasStreamPortIn : public SUPERVGUI_CanvasPortIn {
106   Q_OBJECT
107
108   public:
109     SUPERVGUI_CanvasStreamPortIn(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::StreamPort_ptr thePort);
110     virtual ~SUPERVGUI_CanvasStreamPortIn() {}
111
112     virtual bool isStream() const { return true; }
113     SUPERV_StreamPort getStreamEngine() const { return myStreamPort; }
114
115     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
116
117   public slots:
118     void setParams();
119
120   private:
121     SUPERV_StreamPort myStreamPort;
122 };
123
124 class SUPERVGUI_CanvasStreamPortOut : public SUPERVGUI_CanvasPortOut {
125   Q_OBJECT
126
127   public:
128     SUPERVGUI_CanvasStreamPortOut(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::StreamPort_ptr thePort);
129     virtual ~SUPERVGUI_CanvasStreamPortOut() {}
130
131     virtual bool isStream() const { return true; }
132     SUPERV_StreamPort getStreamEngine() const { return myStreamPort; }
133
134     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
135
136   public slots:
137     void setParams();
138
139   private:
140     SUPERV_StreamPort myStreamPort;
141 };
142
143 #endif