Version: 8.3.0
SceneNodeItem.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef _SCENENODEITEM_HXX_
21 #define _SCENENODEITEM_HXX_
22 
23 #include "SceneObserverItem.hxx"
24 
25 #include <QString>
26 
27 namespace YACS
28 {
29  namespace HMI
30  {
31  typedef enum
32  {
36  } shownState;
37 
38  class SceneHeaderItem;
39  class SceneHeaderNodeItem;
40  class SceneComposedNodeItem;
41  class ScenePortItem;
42  class SceneProgressItem;
43 
45  {
46  public:
47  SceneNodeItem(QGraphicsScene *scene, SceneItem *parent,
48  QString label, Subject *subject);
49  virtual ~SceneNodeItem();
50 
51  virtual void setWidth(qreal width);
52  virtual void setHeight(qreal height);
53  virtual void addHeader();
54  virtual SceneHeaderItem* getHeader();
55  virtual void addProgressItem();
57  virtual void paint(QPainter *painter,
58  const QStyleOptionGraphicsItem *option,
59  QWidget *widget);
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);
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();
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(); };
87  void setExpandedWH(qreal w, qreal h) {_expandedWidth = w; _expandedHeight = h; };
88  qreal getExpandedWidth() { return _expandedWidth; };
89  qreal getExpandedHeight() { return _expandedHeight; };
91  bool hasProgressBar() const;
92 
93  protected:
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);
101 
102  QString getHeaderLabel();
103 
104  std::list<AbstractSceneItem*> _inPorts;
105  std::list<AbstractSceneItem*> _outPorts;
109  bool _moving;
110  bool _moved;
111  bool _expanded;
112  QPointF _prevPos;
113  QPointF _expandedPos;
117  };
118  }
119 }
120 
121 #endif