cgv
mouse_event.h
1 #pragma once
2 
3 #include "event.h"
4 
5 #include "lib_begin.h"
6 
7 namespace cgv {
8  namespace gui {
9 
10 
12 enum MouseAction {
19  MA_LEAVE
20 };
21 
24 {
28  MB_RIGHT_BUTTON = 4
29 };
30 
32 class CGV_API mouse_event : public event
33 {
34 protected:
36  short x;
38  short y;
40  short dx;
42  short dy;
44  unsigned char action;
46  unsigned char button_state;
48  unsigned char button;
50  unsigned char flags;
52  std::string dnd_text;
53 public:
55  mouse_event(int x, int y, MouseAction _action, unsigned char _button_state = 0, unsigned char _button = 0, short _dx = 0, short _dy = 0, unsigned char _modifiers = 0, unsigned char _toggle_keys = 0, double _time = 0);
57  void stream_out(std::ostream& os) const;
59  void stream_in(std::istream& is);
61  short get_x() const;
63  short get_y() const;
65  short get_dx() const;
67  short get_dy() const;
69  MouseAction get_action() const;
71  unsigned char get_button_state() const;
73  unsigned char get_button() const;
75  const std::string& get_dnd_text() const;
76 
78  void set_x(short _x);
80  void set_y(short _y);
82  void set_dx(short _dx);
84  void set_dy(short _dy);
86  void set_action(MouseAction _action);
88  void set_button_state(unsigned char _button_state);
90  void set_button(unsigned char _button);
92  void set_dnd_text(const std::string& text);
93 };
94 
95  }
96 }
97 
98 #include <cgv/config/lib_end.h>
cgv::gui::mouse_event
class to represent all possible mouse events with the EID_MOUSE
Definition: mouse_event.h:33
cgv::gui::MB_MIDDLE_BUTTON
@ MB_MIDDLE_BUTTON
middle button
Definition: mouse_event.h:27
cgv::gui::MB_NO_BUTTON
@ MB_NO_BUTTON
no button
Definition: mouse_event.h:25
cgv::gui::mouse_event::dx
short dx
change in x position
Definition: mouse_event.h:40
cgv::gui::mouse_event::button_state
unsigned char button_state
store the button state
Definition: mouse_event.h:46
cgv::gui::mouse_event::action
unsigned char action
store MouseAction
Definition: mouse_event.h:44
cgv::gui::MA_RELEASE
@ MA_RELEASE
mouse button released
Definition: mouse_event.h:14
cgv::gui::mouse_event::x
short x
x position of mouse pointer
Definition: mouse_event.h:36
cgv::gui::MB_RIGHT_BUTTON
@ MB_RIGHT_BUTTON
right button
Definition: mouse_event.h:28
cgv::gui::mouse_event::button
unsigned char button
store the pressed button
Definition: mouse_event.h:48
cgv::gui::mouse_event::dnd_text
std::string dnd_text
the texted resulting from a drag and drop event
Definition: mouse_event.h:52
cgv::gui::mouse_event::dy
short dy
change in y position
Definition: mouse_event.h:42
cgv::gui::MA_ENTER
@ MA_ENTER
mouse enter window action
Definition: mouse_event.h:18
cgv::gui::MB_LEFT_BUTTON
@ MB_LEFT_BUTTON
left button
Definition: mouse_event.h:26
cgv::gui::event
Definition: event.h:59
cgv::gui::MouseAction
MouseAction
different actions that a mouse can perform
Definition: mouse_event.h:12
cgv::gui::MA_LEAVE
@ MA_LEAVE
mouse leave window action
Definition: mouse_event.h:19
cgv::gui::MA_MOVE
@ MA_MOVE
mouse pointer moved
Definition: mouse_event.h:16
cgv::gui::MouseButton
MouseButton
different mouse buttons that can be ored together to specify the button state
Definition: mouse_event.h:24
cgv::gui::MA_WHEEL
@ MA_WHEEL
mouse wheel moved
Definition: mouse_event.h:15
cgv::gui::MA_DRAG
@ MA_DRAG
mouse drag action
Definition: mouse_event.h:17
cgv::gui::mouse_event::y
short y
y position of mouse pointer
Definition: mouse_event.h:38
cgv
the cgv namespace
Definition: vr_calib.cxx:9
cgv::gui::MA_PRESS
@ MA_PRESS
mouse button pressed
Definition: mouse_event.h:13
cgv::gui::mouse_event::flags
unsigned char flags
store mouse event flags
Definition: mouse_event.h:50