Salome HOME
Update copyrights 2014.
[modules/gui.git] / src / GraphicsView / GraphicsView_ViewFrame.h
1 // Copyright (C) 2013-2014  CEA/DEN, EDF R&D, OPEN CASCADE
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 GRAPHICSVIEW_VIEWFRAME_H
21 #define GRAPHICSVIEW_VIEWFRAME_H
22
23 #include "GraphicsView.h"
24
25 #include <SUIT_ViewWindow.h>
26
27 class QGraphicsSceneContextMenuEvent;
28 class QGraphicsSceneMouseEvent;
29 class QGraphicsSceneWheelEvent;
30
31 class QtxMultiAction;
32
33 class SUIT_Desktop;
34
35 class GraphicsView_Viewer;
36 class GraphicsView_ViewPort;
37
38 /*
39   Class       : GraphicsView_ViewFrame
40   Description : View frame of the graphics view
41 */
42 class GRAPHICSVIEW_API GraphicsView_ViewFrame : public SUIT_ViewWindow
43 {
44   Q_OBJECT
45
46 public:
47   enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId };
48
49 public:
50   GraphicsView_ViewFrame( SUIT_Desktop*, GraphicsView_Viewer* );
51   ~GraphicsView_ViewFrame();
52
53 public:
54   GraphicsView_Viewer*    getViewer() const { return myViewer; }
55   GraphicsView_ViewPort*  getViewPort() const  { return myViewPort; }
56
57   virtual QImage          dumpView();
58
59   virtual QString         getVisualParameters();
60   virtual void            setVisualParameters( const QString& theParameters );
61
62   void                    expandToolBarActions();
63
64 protected slots:
65   void                    onViewPan();
66   void                    onViewZoom();
67   void                    onViewFitAll();
68   void                    onViewFitArea();
69   void                    onViewFitSelect();
70   void                    onViewGlobalPan();
71   void                    onViewReset();
72
73 private slots:
74   void                    keyEvent( QKeyEvent* );
75   void                    mouseEvent( QGraphicsSceneMouseEvent* );
76   void                    wheelEvent( QGraphicsSceneWheelEvent* );
77   void                    contextMenuEvent( QGraphicsSceneContextMenuEvent* );
78
79 signals:
80   void                    keyPressed( QKeyEvent* );
81   void                    keyReleased( QKeyEvent* );
82   void                    mousePressed( QGraphicsSceneMouseEvent* );
83   void                    mouseMoving( QGraphicsSceneMouseEvent* );
84   void                    mouseReleased( QGraphicsSceneMouseEvent* );
85   void                    mouseDoubleClicked( QGraphicsSceneMouseEvent* );
86   void                    wheeling( QGraphicsSceneWheelEvent* );
87
88   void                    sketchingFinished( QPainterPath );
89
90 private:
91   void                    createActions();
92   int                     createToolBar();
93
94 private:
95   GraphicsView_Viewer*    myViewer;
96   GraphicsView_ViewPort*  myViewPort;
97
98   int                     myToolBarId;
99   QtxMultiAction*         myScaleAction;
100   QtxMultiAction*         myPanAction;
101 };
102
103 #endif