1#include <cgv/gui/mouse_event.h>
8mouse_event::mouse_event(
int _x,
int _y,
MouseAction _action,
unsigned char _button_state,
unsigned char _button,
short _dx,
short _dy,
unsigned char _modifiers,
unsigned char _toggle_keys,
double _time)
10 x(_x), y(_y), dx(_dx), dy(_dy), action(_action), button_state(_button_state),
button(_button)
16 const char* action_strs[] = {
17 "press",
"release",
"wheel",
"move",
"drag",
"enter",
"leave"
19 const char* button_strs[] = {
20 "",
"Left_Button",
"Middle_Button",
"",
"Right_Button"
26 os <<
"Middle_Button+";
28 os <<
"Right_Button+";
35 os <<
"(" <<
get_dy() <<
")";
virtual void stream_out(std::ostream &os) const
write to stream
unsigned get_flags() const
return the event flags
void set_dy(short _dy)
set for move and drag events the difference in y to the previous position, for wheel events the amoun...
void set_dx(short _dx)
set for move and drag events the difference in x to the previous position
short get_y() const
current mouse y position (origin is top-left of window)
short dx
change in x position
void set_x(short _x)
set current mouse x position
short y
y position of mouse pointer
void set_button_state(unsigned char _button_state)
set the button state as values from MouseButton combined with a logical or-operation
unsigned char action
store MouseAction
void stream_in(std::istream &is)
read from stream
short dy
change in y position
void set_button(unsigned char _button)
set the pressed or released button for a button press or release action
MouseAction get_action() const
return the mouse action
unsigned char button
store the pressed button
void set_action(MouseAction _action)
return the mouse action
short get_dx() const
for move and drag events the difference in x to the previous position
std::string dnd_text
the texted resulting from a drag and drop event
void stream_out(std::ostream &os) const
write to stream
short get_x() const
current mouse x position (origin is top-left of window)
unsigned char button_state
store the button state
void set_y(short _y)
set current mouse y position
unsigned char get_button_state() const
return the button state as values from MouseButton combined with a logical or-operation
void set_dnd_text(const std::string &text)
set the drag&drop text
short x
x position of mouse pointer
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)
construct a mouse
short get_dy() const
for move and drag events the difference in y to the previous position, for wheel events the amount th...
const std::string & get_dnd_text() const
only valid in a MA_RELEASE event with the flag MF_DND set, return the text resulting from the drag&dr...
unsigned char get_button() const
return the pressed or released button for a button press or release action
@ MB_MIDDLE_BUTTON
middle button
@ MB_RIGHT_BUTTON
right button
@ MB_LEFT_BUTTON
left button
MouseAction
different actions that a mouse can perform
@ MA_PRESS
mouse button pressed
@ MA_MOVE
mouse pointer moved
@ MA_WHEEL
mouse wheel moved
@ MA_DRAG
mouse drag action
@ MA_RELEASE
mouse button released
@ EID_MOUSE
id for mouse event
@ EF_DND
whether mouse has a drag and drop target attached