|
cgv
|
class to represent all possible mouse events with the EID_MOUSE More...
#include <mouse_event.h>
Public Member Functions | |
| 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 | |
| void | stream_out (std::ostream &os) const |
| write to stream | |
| void | stream_in (std::istream &is) |
| read from stream | |
| short | get_x () const |
| current mouse x position (origin is top-left of window) | |
| short | get_y () const |
| current mouse y position (origin is top-left of window) | |
| short | get_dx () const |
| for move and drag events the difference in x to the previous position | |
| short | get_dy () const |
| for move and drag events the difference in y to the previous position, for wheel events the amount the wheel has changed | |
| MouseAction | get_action () const |
| return the mouse action | |
| unsigned char | get_button_state () const |
| return the button state as values from MouseButton combined with a logical or-operation | |
| unsigned char | get_button () const |
| return the pressed or released button for a button press or release action | |
| 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&drop action | |
| void | set_x (short _x) |
| set current mouse x position | |
| void | set_y (short _y) |
| set current mouse y position | |
| void | set_dx (short _dx) |
| set for move and drag events the difference in x to the previous position | |
| void | set_dy (short _dy) |
| set for move and drag events the difference in y to the previous position, for wheel events the amount the wheel has changed | |
| void | set_action (MouseAction _action) |
| return the mouse action | |
| void | set_button_state (unsigned char _button_state) |
| set the button state as values from MouseButton combined with a logical or-operation | |
| void | set_button (unsigned char _button) |
| set the pressed or released button for a button press or release action | |
| void | set_dnd_text (const std::string &text) |
| set the drag&drop text | |
Public Member Functions inherited from cgv::gui::event | |
| event (unsigned int _kind=EID_NONE, unsigned char _modifiers=0, unsigned char _toggle_keys=0, double _time=0) | |
| construct event from its kind | |
| virtual | ~event () |
| virtual destructor for events | |
| virtual void * | get_device_id () const |
| return the device id, by default returns 0 | |
| void | set_kind (unsigned char _kind) |
| set the kind of the event | |
| unsigned | get_kind () const |
| return, what kind of event this is, typically a value from the EventId enum | |
| void | set_flags (unsigned char _flags) |
| return the set the event flags | |
| unsigned | get_flags () const |
| return the event flags | |
| void | set_modifiers (unsigned char _modifiers) |
| set the modifiers | |
| unsigned char | get_modifiers () const |
| return the active modifiers as values from EventModifier combined with a logical or-operation | |
| void | set_toggle_keys (unsigned char _toggle_keys) |
| set the state of the toggle keys | |
| unsigned char | get_toggle_keys () const |
| return the state of the toggle keys as values from EventToggleKeys combined with a logical or-operation | |
| void | set_time (const double &_time) |
| set the time of the event | |
| double | get_time () const |
| return the time of the event in seconds | |
Protected Attributes | |
| short | x |
| x position of mouse pointer | |
| short | y |
| y position of mouse pointer | |
| short | dx |
| change in x position | |
| short | dy |
| change in y position | |
| unsigned char | action |
| store MouseAction | |
| unsigned char | button_state |
| store the button state | |
| unsigned char | button |
| store the pressed button | |
| unsigned char | flags |
| store mouse event flags | |
| std::string | dnd_text |
| the texted resulting from a drag and drop event | |
Protected Attributes inherited from cgv::gui::event | |
| unsigned char | kind |
| store which kind of event we have | |
| unsigned char | flags |
| store event flags | |
| unsigned char | modifiers |
| store the active modifiers | |
| unsigned char | toggle_keys |
| store the active toggle keys | |
| double | time |
| store the time of the event in seconds | |
class to represent all possible mouse events with the EID_MOUSE
Definition at line 32 of file mouse_event.h.
| cgv::gui::mouse_event::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
Definition at line 8 of file mouse_event.cxx.
| MouseAction cgv::gui::mouse_event::get_action | ( | ) | const |
return the mouse action
Definition at line 65 of file mouse_event.cxx.
References action.
Referenced by cgv::app::overlay::handle(), cgv::app::gizmo::handle(), cgv::app::navigator::handle_mouse_event(), cgv::app::color_map_editor::handle_mouse_event(), cgv::app::color_selector::handle_mouse_event(), and stream_out().
| unsigned char cgv::gui::mouse_event::get_button | ( | ) | const |
return the pressed or released button for a button press or release action
Definition at line 75 of file mouse_event.cxx.
References button.
Referenced by cgv::app::navigator::handle_mouse_event(), and stream_out().
| unsigned char cgv::gui::mouse_event::get_button_state | ( | ) | const |
return the button state as values from MouseButton combined with a logical or-operation
Definition at line 70 of file mouse_event.cxx.
References button_state.
Referenced by cgv::app::color_map_editor::handle_mouse_event(), cgv::app::color_selector::handle_mouse_event(), and stream_out().
| const std::string & cgv::gui::mouse_event::get_dnd_text | ( | ) | const |
only valid in a MA_RELEASE event with the flag MF_DND set, return the text resulting from the drag&drop action
Definition at line 81 of file mouse_event.cxx.
References dnd_text.
Referenced by stream_out().
| short cgv::gui::mouse_event::get_dx | ( | ) | const |
for move and drag events the difference in x to the previous position
Definition at line 55 of file mouse_event.cxx.
References dx.
Referenced by stream_out().
| short cgv::gui::mouse_event::get_dy | ( | ) | const |
for move and drag events the difference in y to the previous position, for wheel events the amount the wheel has changed
Definition at line 60 of file mouse_event.cxx.
References dy.
Referenced by stream_out().
| short cgv::gui::mouse_event::get_x | ( | ) | const |
current mouse x position (origin is top-left of window)
Definition at line 45 of file mouse_event.cxx.
References x.
Referenced by cgv::app::overlay::handle(), cgv::app::gizmo::handle(), and stream_out().
| short cgv::gui::mouse_event::get_y | ( | ) | const |
current mouse y position (origin is top-left of window)
Definition at line 50 of file mouse_event.cxx.
References y.
Referenced by cgv::app::overlay::handle(), cgv::app::gizmo::handle(), and stream_out().
| void cgv::gui::mouse_event::set_action | ( | MouseAction | _action | ) |
return the mouse action
Definition at line 111 of file mouse_event.cxx.
References action.
Referenced by cgv::app::overlay::handle().
| void cgv::gui::mouse_event::set_button | ( | unsigned char | _button | ) |
set the pressed or released button for a button press or release action
Definition at line 123 of file mouse_event.cxx.
| void cgv::gui::mouse_event::set_button_state | ( | unsigned char | _button_state | ) |
set the button state as values from MouseButton combined with a logical or-operation
Definition at line 117 of file mouse_event.cxx.
References button_state.
| void cgv::gui::mouse_event::set_dnd_text | ( | const std::string & | text | ) |
| void cgv::gui::mouse_event::set_dx | ( | short | _dx | ) |
set for move and drag events the difference in x to the previous position
Definition at line 99 of file mouse_event.cxx.
References dx.
| void cgv::gui::mouse_event::set_dy | ( | short | _dy | ) |
set for move and drag events the difference in y to the previous position, for wheel events the amount the wheel has changed
Definition at line 105 of file mouse_event.cxx.
References dy.
| void cgv::gui::mouse_event::set_x | ( | short | _x | ) |
| void cgv::gui::mouse_event::set_y | ( | short | _y | ) |
|
virtual |
|
virtual |
write to stream
Reimplemented from cgv::gui::event.
Definition at line 14 of file mouse_event.cxx.
References cgv::gui::EF_DND, get_action(), get_button(), get_button_state(), get_dnd_text(), get_dx(), get_dy(), cgv::gui::event::get_flags(), get_x(), get_y(), cgv::gui::MA_DRAG, cgv::gui::MA_MOVE, cgv::gui::MA_PRESS, cgv::gui::MA_RELEASE, cgv::gui::MA_WHEEL, cgv::gui::MB_LEFT_BUTTON, cgv::gui::MB_MIDDLE_BUTTON, cgv::gui::MB_RIGHT_BUTTON, and cgv::gui::event::stream_out().
|
protected |
store MouseAction
Definition at line 44 of file mouse_event.h.
Referenced by get_action(), and set_action().
|
protected |
|
protected |
store the button state
Definition at line 46 of file mouse_event.h.
Referenced by get_button_state(), and set_button_state().
|
protected |
the texted resulting from a drag and drop event
Definition at line 52 of file mouse_event.h.
Referenced by get_dnd_text(), and set_dnd_text().
|
protected |
change in x position
Definition at line 40 of file mouse_event.h.
|
protected |
change in y position
Definition at line 42 of file mouse_event.h.
|
protected |
store mouse event flags
Definition at line 50 of file mouse_event.h.
|
protected |
x position of mouse pointer
Definition at line 36 of file mouse_event.h.
|
protected |
y position of mouse pointer
Definition at line 38 of file mouse_event.h.