Panda3D
Public Types | Public Member Functions | Public Attributes

ButtonEvent Class Reference

Records a button event of some kind. More...

#include "buttonEvent.h"

List of all members.

Public Types

enum  Type {
  T_down, T_resume_down, T_up, T_repeat,
  T_keystroke, T_candidate, T_move
}

Public Member Functions

 ButtonEvent (ButtonHandle button, Type type, double time=ClockObject::get_global_clock()->get_frame_time())
 ButtonEvent (const wstring &candidate_string, size_t highlight_start, size_t highlight_end, size_t cursor_pos)
 ButtonEvent (const ButtonEvent &copy)
 ButtonEvent (short keycode, double time=ClockObject::get_global_clock()->get_frame_time())
bool operator!= (const ButtonEvent &other) const
bool operator< (const ButtonEvent &other) const
void operator= (const ButtonEvent &copy)
bool operator== (const ButtonEvent &other) const
 The equality operator does not consider time significant.
void output (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
wstring _candidate_string
size_t _cursor_pos
size_t _highlight_end
size_t _highlight_start
short _keycode
double _time
Type _type

Detailed Description

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.

Definition at line 53 of file buttonEvent.h.


Member Function Documentation

bool ButtonEvent::operator== ( const ButtonEvent other) const [inline]

The equality operator does not consider time significant.

Definition at line 123 of file buttonEvent.I.

void ButtonEvent::read_datagram ( DatagramIterator scan)
bool ButtonEvent::update_mods ( ModifierButtons mods) const [inline]

Calls button_down() or button_up(), as appropriate, according to the ButtonEvent.

Definition at line 163 of file buttonEvent.I.

References ModifierButtons::button_down(), and ModifierButtons::button_up().

Referenced by MouseWatcher::do_transmit_data().

void ButtonEvent::write_datagram ( Datagram dg) const

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations