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