cgv
Loading...
Searching...
No Matches
mouse_event.h
1#pragma once
2
3#include "event.h"
4
5#include "lib_begin.h"
6
7namespace cgv {
8 namespace gui {
9
10
21
30
32class CGV_API mouse_event : public event
33{
34protected:
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;
53public:
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>
class to represent all possible mouse events with the EID_MOUSE
Definition mouse_event.h:33
short dx
change in x position
Definition mouse_event.h:40
short y
y position of mouse pointer
Definition mouse_event.h:38
unsigned char action
store MouseAction
Definition mouse_event.h:44
short dy
change in y position
Definition mouse_event.h:42
unsigned char flags
store mouse event flags
Definition mouse_event.h:50
unsigned char button
store the pressed button
Definition mouse_event.h:48
std::string dnd_text
the texted resulting from a drag and drop event
Definition mouse_event.h:52
unsigned char button_state
store the button state
Definition mouse_event.h:46
short x
x position of mouse pointer
Definition mouse_event.h:36
MouseButton
different mouse buttons that can be ored together to specify the button state
Definition mouse_event.h:24
@ MB_MIDDLE_BUTTON
middle button
Definition mouse_event.h:27
@ MB_NO_BUTTON
no button
Definition mouse_event.h:25
@ MB_RIGHT_BUTTON
right button
Definition mouse_event.h:28
@ MB_LEFT_BUTTON
left button
Definition mouse_event.h:26
MouseAction
different actions that a mouse can perform
Definition mouse_event.h:12
@ MA_PRESS
mouse button pressed
Definition mouse_event.h:13
@ MA_LEAVE
mouse leave window action
Definition mouse_event.h:19
@ MA_MOVE
mouse pointer moved
Definition mouse_event.h:16
@ MA_ENTER
mouse enter window action
Definition mouse_event.h:18
@ MA_WHEEL
mouse wheel moved
Definition mouse_event.h:15
@ MA_DRAG
mouse drag action
Definition mouse_event.h:17
@ MA_RELEASE
mouse button released
Definition mouse_event.h:14
the cgv namespace
Definition print.h:11