1 // Copyright (C) 2006-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _SCENENODEITEM_HXX_
21 #define _SCENENODEITEM_HXX_
23 #include "SceneObserverItem.hxx"
38 class SceneHeaderItem;
39 class SceneHeaderNodeItem;
40 class SceneComposedNodeItem;
43 class SceneNodeItem: public SceneObserverItem
46 SceneNodeItem(QGraphicsScene *scene, SceneItem *parent,
47 QString label, Subject *subject);
48 virtual ~SceneNodeItem();
50 virtual void setWidth(qreal width);
51 virtual void setHeight(qreal height);
52 virtual void addHeader();
53 virtual SceneHeaderItem* getHeader();
54 virtual void paint(QPainter *painter,
55 const QStyleOptionGraphicsItem *option,
57 virtual void update(GuiEvent event, int type, Subject* son);
58 virtual qreal getHeaderBottom();
59 virtual void autoPosNewPort(AbstractSceneItem *item, int nbPorts);
60 virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
61 virtual SceneComposedNodeItem* getParent();
62 virtual void removeInPortFromList(AbstractSceneItem* inPort);
63 virtual void removeOutPortFromList(AbstractSceneItem* outPort);
64 virtual void setMoving(bool moving);
65 virtual void setTopLeft(QPointF topLeft);
66 virtual void adjustHeader();
67 virtual ScenePortItem* getCtrlInPortItem();
68 virtual ScenePortItem* getCtrlOutPortItem();
69 virtual void updateName();
70 virtual void arrangeNodes(bool isRecursive);
71 virtual void arrangeChildNodes();
72 virtual void reorganizeShrinkExpand();
73 virtual void updateChildItems();
74 virtual void shrinkExpandLink(bool se);
75 virtual void showOutScopeLinks();
76 virtual void updateLinks();
77 virtual void setShownState(shownState ss);
78 bool isExpanded() { return _expanded; };
79 void setExpanded(bool e){ _expanded = e; };
80 void setExpandedPos(QPointF epos) { _expandedPos = epos; };
81 qreal getExpandedX() { return _expandedPos.x(); };
82 qreal getExpandedY() { return _expandedPos.y(); };
83 void setExpandedWH() {_expandedWidth = _width; _expandedHeight = _height; };
84 void setExpandedWH(qreal w, qreal h) {_expandedWidth = w; _expandedHeight = h; };
85 qreal getExpandedWidth() { return _expandedWidth; };
86 qreal getExpandedHeight() { return _expandedHeight; };
87 shownState getShownState() {return _shownState; };
92 virtual QString getMimeFormat();
93 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
94 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
95 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
96 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
97 virtual void updateState();
98 virtual void setExecState(int execState);
100 QString getHeaderLabel();
102 std::list<AbstractSceneItem*> _inPorts;
103 std::list<AbstractSceneItem*> _outPorts;
104 SceneHeaderNodeItem *_header;
110 QPointF _expandedPos;
111 qreal _expandedWidth;
112 qreal _expandedHeight;
113 shownState _shownState;