]> SALOME platform Git repositories - modules/yacs.git/blob - src/genericgui/SceneHeaderNodeItem.hxx
Salome HOME
mergefrom branch BR_V511_PR tag mergeto_trunk_03feb09
[modules/yacs.git] / src / genericgui / SceneHeaderNodeItem.hxx
1 //  Copyright (C) 2006-2008  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.
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 #ifndef _SCENEHEADERNODEITEM_HXX_
20 #define _SCENEHEADERNODEITEM_HXX_
21
22 #include "SceneHeaderItem.hxx"
23 #include "SceneNodeItem.hxx"
24
25 namespace YACS
26 {
27   namespace HMI
28   {
29     class SceneInPortItem;
30     class SceneOutPortItem;
31     class SceneCtrlPortItem;
32
33     class SceneHeaderNodeItem: public SceneHeaderItem
34     {
35     public:
36       SceneHeaderNodeItem(QGraphicsScene *scene, SceneItem *parent,
37                       QString label);
38       virtual ~SceneHeaderNodeItem();
39
40       virtual void paint(QPainter *painter,
41                          const QStyleOptionGraphicsItem *option,
42                          QWidget *widget);
43       virtual void setText(QString label);
44       virtual qreal getHeaderBottom() const;
45       virtual void autoPosControl(AbstractSceneItem *item);
46       virtual void autoPosNewPort(AbstractSceneItem *item);
47       virtual void popupMenu(QWidget *caller, const QPoint &globalPos);
48       virtual void adjustGeometry();
49       virtual void adjustPosPorts();
50       virtual QRectF getMinimalBoundingRect() const;
51       virtual void adaptComposedNode(qreal deltaY);
52       virtual void setEdited(bool isEdited);
53       virtual void setValid(bool isValid);
54       virtual void setExecState(int execState);
55       virtual SceneCtrlPortItem* getCtrlInPortItem();
56       virtual SceneCtrlPortItem* getCtrlOutPortItem();
57
58     protected:
59       virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
60       QColor getValidColor(bool isValid);
61
62       SceneHeaderItem *_header;
63       SceneCtrlPortItem *_controlIn;
64       SceneCtrlPortItem *_controlOut;
65       std::list<SceneInPortItem*> _inPorts;
66       std::list<SceneOutPortItem*> _outPorts;
67
68       QColor _sc;
69       QString _stateDef;
70       int _execState;
71       bool _isProc;
72
73       bool _isValid;
74       bool _isEdited;
75
76       static QColor _editedNodeBrushColor;
77       static QColor _normalNodeBrushColor;
78       static QColor _runNodeBrushColor;
79       static QColor _validNodeColor;
80       static QColor _invalidNodeColor;
81     };
82   }
83 }
84
85 #endif