Panda3D
|
Records a button event of some kind. More...
#include "buttonEvent.h"
Public Types | |
enum | Type { T_down , T_resume_down , T_up , T_repeat , T_keystroke , T_candidate , T_move , T_raw_down , T_raw_up } |
Public Member Functions | |
ButtonEvent (ButtonHandle button, Type type, double time=ClockObject::get_global_clock() ->get_frame_time()) | |
ButtonEvent (const ButtonEvent ©) | |
ButtonEvent (const std::wstring &candidate_string, size_t highlight_start, size_t highlight_end, size_t cursor_pos) | |
ButtonEvent (int keycode, double time=ClockObject::get_global_clock() ->get_frame_time()) | |
ButtonHandle | get_button () const |
int | get_keycode () const |
double | get_time () const |
Type | get_type () const |
bool | operator!= (const ButtonEvent &other) const |
bool | operator< (const ButtonEvent &other) const |
void | operator= (const ButtonEvent ©) |
bool | operator== (const ButtonEvent &other) const |
The equality operator does not consider time significant. | |
void | output (std::ostream &out) const |
void | read_datagram (DatagramIterator &scan) |
Restores the event from the datagram. | |
bool | update_mods (ModifierButtons &mods) const |
Calls button_down() or button_up(), as appropriate, according to the ButtonEvent. | |
void | write_datagram (Datagram &dg) const |
Writes the event into a datagram. | |
Public Attributes | |
ButtonHandle | _button |
std::wstring | _candidate_string |
size_t | _cursor_pos |
size_t | _highlight_end |
size_t | _highlight_start |
int | _keycode |
double | _time |
Type | _type |
get_button | |
get_keycode | |
get_time | |
get_type | |
Records a button event of some kind.
This is either a keyboard or mouse button (or some other kind of button) changing state from up to down, or vice-versa, or it is a single "keystroke".
A keystroke is different than a button event in that (a) it does not necessarily correspond to a physical button on a keyboard, but might be the result of a combination of buttons (e.g. "A" is the result of shift + "a"); and (b) it does not manage separate "up" and "down" events, but is itself an instantaneous event.
Normal up/down button events can be used to track the state of a particular button on the keyboard, while keystroke events are best used to monitor what a user is attempting to type.
Button up/down events are defined across all the physical keys on the keyboard (and other buttons for which there is a corresponding ButtonHandle object), while keystroke events are defined across the entire Unicode character set.
This API should not be considered stable and may change in a future version of Panda3D.
Definition at line 49 of file buttonEvent.h.
enum ButtonEvent::Type |
Definition at line 51 of file buttonEvent.h.
|
inline |
Definition at line 17 of file buttonEvent.I.
|
inline |
Definition at line 29 of file buttonEvent.I.
|
inline |
Definition at line 43 of file buttonEvent.I.
|
inline |
Definition at line 57 of file buttonEvent.I.
|
inline |
Definition at line 74 of file buttonEvent.I.
|
inline |
Definition at line 115 of file buttonEvent.I.
|
inline |
Definition at line 123 of file buttonEvent.I.
|
inline |
Definition at line 90 of file buttonEvent.I.
|
inline |
The equality operator does not consider time significant.
Definition at line 105 of file buttonEvent.I.
void ButtonEvent::output | ( | std::ostream & | out | ) | const |
Definition at line 23 of file buttonEvent.cxx.
void ButtonEvent::read_datagram | ( | DatagramIterator & | scan | ) |
Restores the event from the datagram.
Definition at line 108 of file buttonEvent.cxx.
References TextEncoder::decode_text(), ButtonRegistry::get_button(), TextEncoder::get_default_encoding, DatagramIterator::get_string(), DatagramIterator::get_uint16(), DatagramIterator::get_uint8(), and ButtonRegistry::ptr().
Referenced by ButtonEventList::fillin().
|
inline |
Calls button_down() or button_up(), as appropriate, according to the ButtonEvent.
Definition at line 139 of file buttonEvent.I.
References ModifierButtons::button_down(), and ModifierButtons::button_up().
void ButtonEvent::write_datagram | ( | Datagram & | dg | ) | const |
Writes the event into a datagram.
Definition at line 69 of file buttonEvent.cxx.
References Datagram::add_string(), Datagram::add_uint16(), Datagram::add_uint8(), TextEncoder::encode_wtext(), TextEncoder::get_default_encoding, and ButtonHandle::get_name.
ButtonHandle ButtonEvent::_button |
Definition at line 126 of file buttonEvent.h.
std::wstring ButtonEvent::_candidate_string |
Definition at line 133 of file buttonEvent.h.
size_t ButtonEvent::_cursor_pos |
Definition at line 136 of file buttonEvent.h.
size_t ButtonEvent::_highlight_end |
Definition at line 135 of file buttonEvent.h.
size_t ButtonEvent::_highlight_start |
Definition at line 134 of file buttonEvent.h.
int ButtonEvent::_keycode |
Definition at line 130 of file buttonEvent.h.
double ButtonEvent::_time |
Definition at line 145 of file buttonEvent.h.
Type ButtonEvent::_type |
Definition at line 139 of file buttonEvent.h.
|
inline |
Definition at line 119 of file buttonEvent.h.
|
inline |
Definition at line 120 of file buttonEvent.h.
|
inline |
Definition at line 122 of file buttonEvent.h.
|
inline |
Definition at line 121 of file buttonEvent.h.