]> Creatis software - cpPlugins.git/blob - appli/cpPipelineEditor/Node.h
More on PipelineEditor
[cpPlugins.git] / appli / cpPipelineEditor / Node.h
1 #ifndef __PIPELINEEDITOR__NODE__H__
2 #define __PIPELINEEDITOR__NODE__H__
3
4 #include <QGraphicsItem>
5 #include <QList>
6
7 // Some forward declarations
8 class QGraphicsSceneMouseEvent;
9 class QGraphicsSceneHoverEvent;
10
11 // Some forward declarations
12 namespace cpPlugins
13 {
14   namespace Interface
15   {
16     class Object;
17   }
18 }
19
20 namespace PipelineEditor
21 {
22   // Some other forward declarations
23   class Edge;
24   class GraphCanvas;
25
26   /**
27    */
28   class Node
29     : public QGraphicsItem
30   {
31   public:
32     Node( GraphCanvas* canvas, cpPlugins::Interface::Object* object );
33     virtual ~Node( );
34
35     void addEdge( Edge* edge );
36     QList< Edge* > edges( ) const;
37
38     QRectF boundingRect( ) const;
39     QPainterPath shape( ) const;
40     void paint(
41       QPainter* painter,
42       const QStyleOptionGraphicsItem* option,
43       QWidget* widget
44       );
45
46   protected:
47     QVariant itemChange( GraphicsItemChange change, const QVariant& value );
48
49     void mousePressEvent( QGraphicsSceneMouseEvent* event );
50     void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
51     void mouseDoubleClickEvent( QGraphicsSceneMouseEvent* event );
52     void hoverMoveEvent( QGraphicsSceneHoverEvent* event );
53
54   private:
55     GraphCanvas*   m_Canvas;
56     QList< Edge* > m_Edges;
57     cpPlugins::Interface::Object* m_Object;
58     mutable QString m_Label;
59     mutable QRectF m_Bounds;
60     mutable bool m_UpdatedBounds;
61   };
62
63 } // ecapseman
64
65 #endif // __PIPELINEEDITOR__NODE__H__
66
67 // eof - $RCSfile$