]> Creatis software - cpPlugins.git/blob - appli/cpPipelineEditor/GraphCanvas.h
3a4a9d05e646da33e89eb89c8185617add4ee298
[cpPlugins.git] / appli / cpPipelineEditor / GraphCanvas.h
1 #ifndef __PIPELINEEDITOR__GRAPHCANVAS__H__
2 #define __PIPELINEEDITOR__GRAPHCANVAS__H__
3
4 #include <QtGui/QGraphicsView>
5 #include <cpExtensions/DataStructures/Graph.h>
6
7 // Some forward declarations
8 namespace cpPlugins
9 {
10   namespace Interface
11   {
12     class Workspace;
13   }
14 }
15
16 namespace PipelineEditor
17 {
18   // Some other forward declarations
19   class Node;
20   class Edge;
21
22   /**
23    */
24   class GraphCanvas
25     : public QGraphicsView
26   {
27     Q_OBJECT;
28
29   public:
30     typedef
31     cpExtensions::DataStructures::Graph< Node*, Edge*, std::string > TGraph;
32
33   public:
34     GraphCanvas( QWidget* parent = 0 );
35     virtual ~GraphCanvas( );
36
37     cpPlugins::Interface::Workspace* workspace( );
38     const cpPlugins::Interface::Workspace* workspace( ) const;
39     void setWorkspace( cpPlugins::Interface::Workspace* ws );
40
41     void draw( );
42
43     void itemMoved( );
44
45   public slots:
46     void shuffle( );
47     void zoomIn( );
48     void zoomOut( );
49
50   protected:
51     void keyPressEvent( QKeyEvent* event );
52     void timerEvent( QTimerEvent* event );
53     void wheelEvent( QWheelEvent* event );
54     void drawBackground( QPainter* painter, const QRectF& rect );
55     void scaleView( qreal scaleFactor );
56
57   protected:
58     cpPlugins::Interface::Workspace* m_Workspace;
59     TGraph::Pointer m_Graph;
60   };
61
62 } // ecapseman
63
64 #endif // __PIPELINEEDITOR__GRAPHCANVAS__H__
65
66 // eof - $RCSfile$