1 // Copyright (C) 2006-2014 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, or (at your option) any later version.
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;
42 class SceneProgressItem;
44 class SceneNodeItem: public SceneObserverItem
47 SceneNodeItem(QGraphicsScene *scene, SceneItem *parent,
48 QString label, Subject *subject);
49 virtual ~SceneNodeItem();
51 virtual void setWidth(qreal width);
52 virtual void setHeight(qreal height);
53 virtual void addHeader();
54 virtual SceneHeaderItem* getHeader();
55 virtual void addProgressItem();
56 virtual SceneProgressItem* getProgressItem() { return _progressItem; };
57 virtual void paint(QPainter *painter,
58 const QStyleOptionGraphicsItem *option,
60 virtual void update(GuiEvent event, int type, Subject* son);
61 virtual qreal getHeaderBottom();
62 virtual void autoPosNewPort(AbstractSceneItem *item, int nbPorts);
63 virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
64 virtual SceneComposedNodeItem* getParent();
65 virtual void removeInPortFromList(AbstractSceneItem* inPort);
66 virtual void removeOutPortFromList(AbstractSceneItem* outPort);
67 virtual void setMoving(bool moving);
68 virtual void setTopLeft(QPointF topLeft);
69 virtual void adjustHeader();
70 virtual ScenePortItem* getCtrlInPortItem();
71 virtual ScenePortItem* getCtrlOutPortItem();
72 virtual void updateName();
73 virtual void arrangeNodes(bool isRecursive);
74 virtual void arrangeChildNodes();
75 virtual void reorganizeShrinkExpand(ShrinkMode theShrinkMode);
76 virtual void updateChildItems();
77 virtual void shrinkExpandLink(bool se);
78 virtual void showOutScopeLinks();
79 virtual void updateLinks();
80 virtual void setShownState(shownState ss);
81 bool isExpanded() { return _expanded; };
82 void setExpanded(bool e){ _expanded = e; };
83 void setExpandedPos(QPointF epos) { _expandedPos = epos; };
84 qreal getExpandedX() { return _expandedPos.x(); };
85 qreal getExpandedY() { return _expandedPos.y(); };
86 void setExpandedWH() {_expandedWidth = _width; _expandedHeight = _height; };
87 void setExpandedWH(qreal w, qreal h) {_expandedWidth = w; _expandedHeight = h; };
88 qreal getExpandedWidth() { return _expandedWidth; };
89 qreal getExpandedHeight() { return _expandedHeight; };
90 shownState getShownState() {return _shownState; };
91 bool hasProgressBar() const;
94 virtual QString getMimeFormat();
95 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
96 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
97 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
98 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
99 virtual void updateState();
100 virtual void setExecState(int execState);
102 QString getHeaderLabel();
104 std::list<AbstractSceneItem*> _inPorts;
105 std::list<AbstractSceneItem*> _outPorts;
106 SceneHeaderNodeItem *_header;
107 SceneProgressItem *_progressItem;
113 QPointF _expandedPos;
114 qreal _expandedWidth;
115 qreal _expandedHeight;
116 shownState _shownState;