Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_CanvasNode.h
1 //  SUPERV SUPERVGUI : GUI for Supervisor component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE
4 //
5 //  File   : SUPERVGUI_CanvasNode.h
6 //  Author : Natalia KOPNOVA
7 //  Module : SUPERV
8
9 #ifndef SUPERVGUI_CanvasNode_H
10 #define SUPERVGUI_CanvasNode_H
11
12 using namespace std;
13 #include "SUPERVGUI_Def.h"
14 #include "SUPERVGUI_BrowseNodeDlg.h"
15 #include <qstringlist.h>
16
17 class SUPERVGUI_Main;
18 class SUPERVGUI_CanvasNodePrs;
19
20 class SUPERVGUI_CanvasNode : public QObject {
21   Q_OBJECT
22
23   public:
24     SUPERVGUI_CanvasNode(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
25     virtual ~SUPERVGUI_CanvasNode();
26
27     // done to ignore port update when node is removed
28     bool isDestroyed() const { return myDestroyed; }
29     void setDestroyed();
30
31     virtual void merge();
32     virtual void sync();
33     virtual void syncOnEvent(SUPERV::GraphState theStateFromEvent);
34
35     virtual void show();
36     virtual void move(int x, int y);
37
38     virtual void hideAll();
39     virtual void showAll();
40     virtual bool setNodeName(QString aName);
41
42     SUPERV_CNode getEngine() const { return myNode; }
43     SUPERVGUI_Main* getMain() const { return myMain; }
44     SUPERVGUI_CanvasNodePrs* getPrs() const;
45
46     bool isWarning();
47     bool isStep();
48     bool isTrace();
49     bool isVerbose();
50
51     SUPERV::KindOfNode getNodeType() const { return myNode->Kind(); }
52
53     SUPERV_CNode  getComputingNode() const { return myNode; }
54     SUPERV_FNode  getFactoryNode()   const { return SUPERV::FNode::_narrow(myNode); }
55     SUPERV_INode  getInlineNode()    const { return SUPERV::INode::_narrow(myNode); }
56     SUPERV_GNode  getGotoNode()      const { return SUPERV::GNode::_narrow(myNode); }
57     SUPERV_LNode  getLoopNode()      const { return SUPERV::LNode::_narrow(myNode); }
58     SUPERV_ELNode getEndLoopNode()   const { return SUPERV::ELNode::_narrow(myNode); }
59     SUPERV_SNode  getSwitchNode()    const { return SUPERV::SNode::_narrow(myNode); }
60     SUPERV_ESNode getEndSwitchNode() const { return SUPERV::ESNode::_narrow(myNode); }
61     SUPERV_Graph  getMacroNode() const { return SUPERV::Graph::_narrow(myNode); }
62
63     SUPERV_Port createInPort();
64     SUPERV_Port createOutPort();
65     QStringList getPortsNamesIN(SUPERV_INode theNode, bool theInputPorts);
66
67     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
68
69     QString getLabelText() const { return myLabelText; }
70
71   public slots:
72     void suspendResume();
73     void kill();
74     void stopRestart();
75     void configure();
76     void showPython();
77
78     virtual void rename();
79     virtual void remove();
80     void changeInformation();
81     void browse();
82
83     void switchLabel();
84     void switchPorts();
85
86     void setWarning(bool b);
87     void setStep(bool b);
88     void setTrace(bool b);
89     void setVerbose(bool b);
90
91     virtual void addInputPort();
92     virtual void addOutputPort();
93     virtual void editFunction();
94
95   protected:
96     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
97     virtual void createPort(SUPERV::Port_ptr thePort) const;
98     virtual void createStreamPort(SUPERV::StreamPort_ptr thePort) const;
99     
100     virtual bool eventFilter(QObject* o, QEvent* e);
101     SUPERVGUI_BrowseNodeDlg* myBrowseDlg;
102
103     bool isIgnore;
104
105   protected slots:
106     virtual void onDestroyed(QObject*);
107
108   private:
109     SUPERV_CNode     myNode;
110     SUPERVGUI_Main*  myMain;
111
112     QString          myLabelText;
113     SUPERVGUI_CanvasNodePrs* myPrs;
114
115     bool myDestroyed;
116
117     bool        warning;
118     bool        step;
119     bool        trace;
120     bool        verbose;
121 };
122
123 #endif