Salome HOME
DCQ:prepare 2.0.0
[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
50   protected:
51     virtual SUPERVGUI_CanvasPortPrs* createPrs() const;
52
53   private:
54     SUPERV_Port      myPort;
55     SUPERVGUI_Main*  myMain;
56
57     SUPERVGUI_CanvasPortPrs* myPrs;
58     QValueList<SUPERVGUI_CanvasLink*> myLinks;
59     bool isIgnore;
60 };
61
62 class SUPERVGUI_GetValueDlg;
63 class SUPERVGUI_CanvasPortIn : public SUPERVGUI_CanvasPort {
64   Q_OBJECT
65
66   public:
67     SUPERVGUI_CanvasPortIn(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort);
68     virtual ~SUPERVGUI_CanvasPortIn();
69
70     void setValue(const char* theValue);
71
72     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
73
74   public slots:
75     void setInput();
76
77   protected:
78     bool eventFilter(QObject* o, QEvent* e);
79
80   private:
81     SUPERVGUI_GetValueDlg* myDlg;
82 };
83
84 class SUPERVGUI_CanvasPortOut : public SUPERVGUI_CanvasPort {
85   Q_OBJECT
86
87   public:
88     SUPERVGUI_CanvasPortOut(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort);
89     virtual ~SUPERVGUI_CanvasPortOut();
90
91     void sync();
92     bool isInStudy() const { return myInStudy; }
93     void setStudyState(bool theInStudy) { myInStudy = theInStudy; }
94
95     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
96
97   public slots:
98     void toStudy();
99
100   private:
101     bool myInStudy;
102 };
103
104 class SUPERVGUI_CanvasStreamPortIn : public SUPERVGUI_CanvasPortIn {
105   Q_OBJECT
106
107   public:
108     SUPERVGUI_CanvasStreamPortIn(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::StreamPort_ptr thePort);
109     virtual ~SUPERVGUI_CanvasStreamPortIn() {}
110
111     virtual bool isStream() const { return true; }
112     SUPERV_StreamPort getStreamEngine() const { return myStreamPort; }
113
114     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
115
116   public slots:
117     void setParams();
118
119   private:
120     SUPERV_StreamPort myStreamPort;
121 };
122
123 class SUPERVGUI_CanvasStreamPortOut : public SUPERVGUI_CanvasPortOut {
124   Q_OBJECT
125
126   public:
127     SUPERVGUI_CanvasStreamPortOut(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::StreamPort_ptr thePort);
128     virtual ~SUPERVGUI_CanvasStreamPortOut() {}
129
130     virtual bool isStream() const { return true; }
131     SUPERV_StreamPort getStreamEngine() const { return myStreamPort; }
132
133     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
134
135   public slots:
136     void setParams();
137
138   private:
139     SUPERV_StreamPort myStreamPort;
140 };
141
142 #endif