cgv
|
class to represent all possible keyboard events with the EID_KEY More...
#include <key_event.h>
Public Member Functions | |
key_event (unsigned short _key=0, KeyAction _action=KA_PRESS, unsigned char _char=0, unsigned char _modifiers=0, unsigned char _toggle_keys=0, double _time=0, int _x=0, int _y=0) | |
construct a key event from its textual description | |
void | stream_out (std::ostream &os) const |
write to stream | |
void | stream_in (std::istream &is) |
read from stream | |
unsigned short | get_key () const |
return the key being a capital letter, digit or a value from the Keys enum | |
void | set_key (unsigned short _key) |
set the key | |
KeyAction | get_action () const |
return the key event action | |
void | set_action (KeyAction _action) |
set the key event action | |
unsigned char | get_char () const |
return the key as a character | |
void | set_char (unsigned char _char) |
set the alpha numeric character | |
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) | |
![]() | |
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 | |
unsigned short | key |
store the pressed key | |
unsigned char | action |
store whether | |
unsigned char | character |
store the corresponding ascii character | |
short | x |
x position of mouse pointer | |
short | y |
y position of mouse pointer | |
![]() | |
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 keyboard events with the EID_KEY
Definition at line 22 of file key_event.h.
cgv::gui::key_event::key_event | ( | unsigned short | _key = 0 , |
KeyAction | _action = KA_PRESS , |
||
unsigned char | _char = 0 , |
||
unsigned char | _modifiers = 0 , |
||
unsigned char | _toggle_keys = 0 , |
||
double | _time = 0 , |
||
int | _x = 0 , |
||
int | _y = 0 |
||
) |
construct a key event from its textual description
Definition at line 20 of file key_event.cxx.
KeyAction cgv::gui::key_event::get_action | ( | ) | const |
return the key event action
Definition at line 71 of file key_event.cxx.
References action.
Referenced by vr_view_interactor::handle(), vr_test::handle(), vr_emulator::handle(), cgv::gui::key_control< T >::handle(), cgv::gui::key_control< bool >::handle(), and cgv::app::color_map_editor::handle_key_event().
unsigned char cgv::gui::key_event::get_char | ( | ) | const |
return the key as a character
Definition at line 61 of file key_event.cxx.
References character.
Referenced by stream_out(), cgv::gui::gamepad_key_event::stream_out(), and cgv::gui::vr_key_event::stream_out().
unsigned short cgv::gui::key_event::get_key | ( | ) | const |
return the key being a capital letter, digit or a value from the Keys enum
Definition at line 51 of file key_event.cxx.
References key.
Referenced by vr_view_interactor::handle(), vr_test::handle(), vr_emulator::handle(), cgv::gui::key_control< T >::handle(), cgv::gui::key_control< bool >::handle(), and cgv::app::color_map_editor::handle_key_event().
short cgv::gui::key_event::get_x | ( | ) | const |
current mouse x position (origin is top-left of window)
Definition at line 81 of file key_event.cxx.
References x.
short cgv::gui::key_event::get_y | ( | ) | const |
current mouse y position (origin is top-left of window)
Definition at line 86 of file key_event.cxx.
References y.
void cgv::gui::key_event::set_action | ( | KeyAction | _action | ) |
void cgv::gui::key_event::set_char | ( | unsigned char | _char | ) |
void cgv::gui::key_event::set_key | ( | unsigned short | _key | ) |
|
virtual |
read from stream
Reimplemented from cgv::gui::event.
Reimplemented in cgv::gui::vr_key_event.
Definition at line 45 of file key_event.cxx.
Referenced by cgv::gui::vr_key_event::stream_in().
|
virtual |
write to stream
Reimplemented from cgv::gui::event.
Reimplemented in cgv::gui::vr_key_event.
Definition at line 26 of file key_event.cxx.
References action, get_char(), cgv::gui::get_key_string(), cgv::gui::KA_PRESS, cgv::gui::KA_RELEASE, cgv::gui::KA_REPEAT, key, and cgv::gui::event::stream_out().
|
protected |
store whether
Definition at line 28 of file key_event.h.
Referenced by get_action(), set_action(), stream_out(), cgv::gui::gamepad_key_event::stream_out(), and cgv::gui::vr_key_event::stream_out().
|
protected |
store the corresponding ascii character
Definition at line 30 of file key_event.h.
Referenced by get_char(), and set_char().
|
protected |
store the pressed key
Definition at line 26 of file key_event.h.
Referenced by get_key(), set_key(), stream_out(), cgv::gui::gamepad_key_event::stream_out(), and cgv::gui::vr_key_event::stream_out().
|
protected |
|
protected |