#include <vgui_event.h>
For key presses with modifiers the following standards apply:
a modifier = vgui_NULL key = 'a' ascii_char = 'a'
CTRL+a modifier = vgui_CTRL key = 'a' ascii_char = '^A'
SHIFT+a modifier = vgui_SHIFT key = 'a' ascii_char = 'A'
We have decided to make it a standard that key is always lower case for simplicity. In particular people have been defining impossible vgui_event_conditions, eg key='A', modifier=NULL (where NULL is the default modifier) and then wondering why SHIFT+a doesn't work.
A new data type has been added (ascii_char) which holds the actual key stroke pressed by the user.
Definition at line 80 of file vgui_event.h.
Public Member Functions | |
| vgui_event () | |
| Constructor - create a default event. | |
| vgui_event (vgui_event_type) | |
| Constructor - create an event of the given type. | |
| void | set_key (vgui_key c) |
| Convert given key to lower case and use that to set key. | |
| bool | modifier_is_down (int) const |
| double | secs_since (vgui_event const &) const |
| long | usecs_since (vgui_event const &) const |
Public Attributes | |
| vgui_event_type | type |
| The type of event (key press, mouse motion, etc). | |
| vgui_button | button |
| Mouse button used (if it is a mouse event). | |
| vgui_key | key |
| The key pressed in lower case (if it is a key event). | |
| vgui_modifier | modifier |
| Which modifiers are pressed during the event (NULL, CTRL, SHIFT). | |
| vgui_key | ascii_char |
| The actual key stroke pressed by the user. | |
| int | wx |
| Position of the mouse pointer in viewport coordinates when event occurred. | |
| int | wy |
| int | timestamp |
| Timestamp in milliseconds since app started. | |
| vgui_adaptor * | origin |
| The adaptor from which the event came. | |
| int | timer_id |
| If the event is a timer event, this holds the ID. | |
| vcl_string | str |
| A vcl_string message, for an event of type vgui_STRING. | |
| void const * | user |
| Type and data for events of type vgui_OTHER. | |
| void const * | data |
Private Member Functions | |
| void | init () |
| Initialise default event. | |
| vgui_event::vgui_event | ( | ) | [inline] |
| vgui_event::vgui_event | ( | vgui_event_type | ) |
| void vgui_event::set_key | ( | vgui_key | c | ) |
Convert given key to lower case and use that to set key.
I added this to avoid the complication of doing this conversion in each GUI impl - kym.
Definition at line 59 of file vgui_event.cxx.
| bool vgui_event::modifier_is_down | ( | int | ) | const |
Definition at line 73 of file vgui_event.cxx.
| double vgui_event::secs_since | ( | vgui_event const & | ) | const |
Definition at line 79 of file vgui_event.cxx.
| long vgui_event::usecs_since | ( | vgui_event const & | ) | const |
Definition at line 85 of file vgui_event.cxx.
| void vgui_event::init | ( | ) | [private] |
Which modifiers are pressed during the event (NULL, CTRL, SHIFT).
Definition at line 102 of file vgui_event.h.
| int vgui_event::wx |
Position of the mouse pointer in viewport coordinates when event occurred.
Definition at line 108 of file vgui_event.h.
| int vgui_event::wy |
Definition at line 108 of file vgui_event.h.
If the event is a timer event, this holds the ID.
For an event of type vgui_TIMER, this field holds the name that was given when the timer request was posted.
Definition at line 119 of file vgui_event.h.
| vcl_string vgui_event::str |
A vcl_string message, for an event of type vgui_STRING.
An event of type vgui_STRING implies that this field contains some sort of textual message. The exact encoding of these messages is unspecified; the sender and the receiver may use any protocol they like. Caveat : as a corollary there is no guarantee that one protocol will not clash with another.
Definition at line 128 of file vgui_event.h.
| void const* vgui_event::user |
Type and data for events of type vgui_OTHER.
The fields user and data are used only when the event type is vgui_OTHER. The 'user' field must uniquely identify the type of event, in the sense that once the user field is known, the 'data' field can be safely cast to point to the client data (type).
Definition at line 135 of file vgui_event.h.
| void const* vgui_event::data |
Definition at line 136 of file vgui_event.h.
1.5.1