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