Salome HOME
Merge from V6_main 01/04/2013
[modules/yacs.git] / src / genericgui / GraphicsView.hxx
1 // Copyright (C) 2006-2013  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
20 #ifndef _GRAPHICSVIEW_HXX_
21 #define _GRAPHICSVIEW_HXX_
22
23 #include "WrapGraphicsView.hxx"
24
25 #include <QContextMenuEvent>
26 #include <QAction>
27 #include <QGraphicsRectItem>
28
29 namespace YACS
30 {
31   namespace HMI
32   {
33     class GraphicsView: public WrapGraphicsView
34     {
35       Q_OBJECT
36
37     public:
38       GraphicsView(QWidget *parent = 0);
39       virtual ~GraphicsView();
40
41     public slots:
42       virtual void onViewFitAll();
43       virtual void onViewFitArea();
44       virtual void onViewZoom();
45       virtual void onViewPan(); 
46       virtual void onViewGlobalPan(); 
47       virtual void onViewReset();
48
49       virtual void onZoomToBloc();
50       virtual void onCenterOnNode();
51
52     protected:
53       void contextMenuEvent(QContextMenuEvent *event);
54       void mouseMoveEvent (QMouseEvent *e);
55       void mousePressEvent (QMouseEvent *e);
56       void mouseReleaseEvent (QMouseEvent *e);
57       virtual void wheelEvent (QWheelEvent *e);
58
59       bool _zooming;
60       bool _fittingArea;
61       bool _panning;
62       int _prevX;
63       int _prevY;
64       qreal _scale;
65       QPoint _prevPos;
66       QGraphicsRectItem *_rect;
67     };
68   }
69 }
70 #endif