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