SCV  4.2.1
Simple Components for Visual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MouseEvent.h
Go to the documentation of this file.
1 #ifndef __SCV_MOUSE_EVENT_H__
2 #define __SCV_MOUSE_EVENT_H__
3 
4 #include "Point.h"
5 
6 namespace scv {
7 
8 class MouseEvent {
9 public:
10  enum Button {
11  LEFT = GLUT_LEFT_BUTTON,
12  MIDDLE = GLUT_MIDDLE_BUTTON,
13  RIGHT = GLUT_RIGHT_BUTTON,
15  };
16  enum State {
17  CLICK = GLUT_DOWN,
18  UP = GLUT_UP,
21  };
22 
23  MouseEvent(void);
24  MouseEvent(MouseEvent::Button button, MouseEvent::State state, const Point &location, bool doubleClick = false);
25 
26  MouseEvent& operator=(const MouseEvent&rhs);
27 
28  Point getPosition(void) const;
29  Point getInversePosition(void) const;
30  MouseEvent::Button getButton(void) const;
31  MouseEvent::State getState(void) const;
32 
33  inline bool doubleClick(void) const {
34  return _doubleClick;
35  }
36 
37  MouseEvent operator-(const Point &p) const {
38  return MouseEvent(_button, _state, _position - p);
39  }
40 
41 private:
42  MouseEvent::Button _button;
43  MouseEvent::State _state;
44  Point _position;
45  bool _doubleClick;
46 };
47 
48 } // namespace scv
49 
50 #endif // __SCV_MOUSE_EVENT_H__