OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
coMousePointer.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 /************************************************************************
9  * *
10  * *
11  * (C) 2001 *
12  * Computer Centre University of Stuttgart *
13  * Allmandring 30 *
14  * D-70550 Stuttgart *
15  * Germany *
16  * *
17  * *
18  * File coMousePointer.h (Performer 2.0) *
19  * *
20  * Description Mouse support for COVER
21  * *
22  * Author Uwe Woessner *
23  * *
24  * Date 19.09.2001 *
25  * *
26  * Status none *
27  * *
28  ************************************************************************/
29 
30 #ifndef MOUSE_POINTER_H
31 #define MOUSE_POINTER_H
32 
33 #include <util/common.h>
34 #include <osg/Matrix>
35 
36 namespace opencover
37 {
38 
39 class ButtonDevice;
40 
41 struct MouseEvent
42 {
43  int type, state, code;
44 };
45 
46 class COVEREXPORT coMousePointer
47 {
48  friend class Input;
49 
50 private:
52  ~coMousePointer();
53 
54  osg::Matrix matrix;
55 
56  float width, height;
57  int xres, yres, xori, yori;
58  float screenX, screenY, screenZ;
59  float screenH, screenP, screenR;
60 
61  int wheelCounter[2], newWheelCounter[2]; // vertical and horizontal
62  float mouseX, mouseY;
63  typedef std::deque<MouseEvent> EventQueue;
64  EventQueue eventQueue;
65  double mouseTime, mouseButtonTime;
66  void queueEvent(int type, int state, int code);
67  void processEvents();
68 
69  ButtonDevice *buttons;
70  bool buttonPressed = false;
71 
72 public:
73  // frame time of last mouse event
74  double eventTime() const;
75 
76  // process mouse events
77  void handleEvent(int type, int state, int code, bool queue = true);
78 
79  void update();
80  void setMatrix(const osg::Matrix &mat);
81  const osg::Matrix &getMatrix() const;
82 
84  float x() const;
85 
87  float y() const;
88 
90  float winWidth() const;
91 
93  float winHeight() const;
94 
96  float screenWidth() const;
97 
99  float screenHeight() const;
100 
101  int wheel(size_t num = 0) const;
102 
103  unsigned int buttonState() const;
104 };
105 }
106 #endif
Definition: buttondevice.h:27
int type
Definition: coMousePointer.h:43
int state
Definition: coMousePointer.h:43
Definition: coMousePointer.h:41
The Input class.
Definition: input.h:38
Definition: coMousePointer.h:46
int code
Definition: coMousePointer.h:43