Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
MouseInteractors.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 
22 #ifndef MOUSEOBJECT_H
23 #define MOUSEOBJECT_H
24 
25 #include <tulip/tulipconf.h>
26 
27 #include <QtGui/qcursor.h>
28 
29 #include "tulip/InteractorComposite.h"
30 
31 namespace tlp {
32 
33 /** An interactor class allowing to zoom and pan using the mouse wheel.
34  */
35 class TLP_QT_SCOPE MousePanNZoomNavigator:public InteractorComponent {
36 public:
37  MousePanNZoomNavigator():cameraScaleFactor(1), isGesturing(false) {}
38  ~MousePanNZoomNavigator() {}
39  bool eventFilter(QObject *, QEvent *);
40  InteractorComponent *clone() {
41  return new MousePanNZoomNavigator();
42  }
43 protected:
44  float cameraScaleFactor;
45  bool isGesturing;
46 };
47 
48 /** An interactor class used to delete a graph element on mouse left click
49  */
50 class TLP_QT_SCOPE MouseElementDeleter:public InteractorComponent {
51 public:
52  MouseElementDeleter() {}
53  ~MouseElementDeleter() {}
54  bool eventFilter(QObject *, QEvent *);
55  InteractorComponent *clone() {
56  return new MouseElementDeleter();
57  }
58  void clear();
59 };
60 
61 /** An interactor class to translate/rotate using keys or mouse movements,
62  or to zoom and pan using the mouse wheel or
63  */
64 class TLP_QT_SCOPE MouseNKeysNavigator: public MousePanNZoomNavigator {
65 private:
66  InteractorComponent *currentSpecInteractorComponent;
67 
68  QCursor oldCursor;
69 public:
70  MouseNKeysNavigator() : currentSpecInteractorComponent(NULL) {}
71  ~MouseNKeysNavigator() {}
72  bool eventFilter(QObject *, QEvent *);
73  InteractorComponent *clone() {
74  return new MouseNKeysNavigator();
75  }
76  void clear();
77 };
78 
79 
80 }
81 #endif
82 ///@endcond