Panda3D
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
ButtonEvent Class Reference

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 &copy)
 
 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 &copy)
 
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
 

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.

This API should not be considered stable and may change in a future version of Panda3D.

Definition at line 49 of file buttonEvent.h.

Member Enumeration Documentation

◆ Type

enum ButtonEvent::Type

Definition at line 51 of file buttonEvent.h.

Constructor & Destructor Documentation

◆ ButtonEvent() [1/5]

ButtonEvent::ButtonEvent ( )
inline

Definition at line 17 of file buttonEvent.I.

◆ ButtonEvent() [2/5]

ButtonEvent::ButtonEvent ( ButtonHandle button,
ButtonEvent::Type type,
double time = ClockObject::get_global_clock()->get_frame_time() )
inline

Definition at line 29 of file buttonEvent.I.

◆ ButtonEvent() [3/5]

ButtonEvent::ButtonEvent ( int keycode,
double time = ClockObject::get_global_clock()->get_frame_time() )
inline

Definition at line 43 of file buttonEvent.I.

◆ ButtonEvent() [4/5]

ButtonEvent::ButtonEvent ( const std::wstring & candidate_string,
size_t highlight_start,
size_t highlight_end,
size_t cursor_pos )
inline

Definition at line 57 of file buttonEvent.I.

◆ ButtonEvent() [5/5]

ButtonEvent::ButtonEvent ( const ButtonEvent & copy)
inline

Definition at line 74 of file buttonEvent.I.

Member Function Documentation

◆ operator!=()

bool ButtonEvent::operator!= ( const ButtonEvent & other) const
inline

Definition at line 115 of file buttonEvent.I.

◆ operator<()

bool ButtonEvent::operator< ( const ButtonEvent & other) const
inline

Definition at line 123 of file buttonEvent.I.

◆ operator=()

void ButtonEvent::operator= ( const ButtonEvent & copy)
inline

Definition at line 90 of file buttonEvent.I.

◆ operator==()

bool ButtonEvent::operator== ( const ButtonEvent & other) const
inline

The equality operator does not consider time significant.

Definition at line 105 of file buttonEvent.I.

◆ output()

void ButtonEvent::output ( std::ostream & out) const

Definition at line 23 of file buttonEvent.cxx.

◆ read_datagram()

void ButtonEvent::read_datagram ( DatagramIterator & scan)

◆ update_mods()

bool ButtonEvent::update_mods ( ModifierButtons & mods) const
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().

◆ write_datagram()

void ButtonEvent::write_datagram ( Datagram & dg) const

Member Data Documentation

◆ _button

ButtonHandle ButtonEvent::_button

Definition at line 126 of file buttonEvent.h.

◆ _candidate_string

std::wstring ButtonEvent::_candidate_string

Definition at line 133 of file buttonEvent.h.

◆ _cursor_pos

size_t ButtonEvent::_cursor_pos

Definition at line 136 of file buttonEvent.h.

◆ _highlight_end

size_t ButtonEvent::_highlight_end

Definition at line 135 of file buttonEvent.h.

◆ _highlight_start

size_t ButtonEvent::_highlight_start

Definition at line 134 of file buttonEvent.h.

◆ _keycode

int ButtonEvent::_keycode

Definition at line 130 of file buttonEvent.h.

◆ _time

double ButtonEvent::_time

Definition at line 145 of file buttonEvent.h.

◆ _type

Type ButtonEvent::_type

Definition at line 139 of file buttonEvent.h.

◆ get_button

ButtonHandle ButtonEvent::get_button
inline

Definition at line 119 of file buttonEvent.h.

◆ get_keycode

int ButtonEvent::get_keycode
inline

Definition at line 120 of file buttonEvent.h.

◆ get_time

double ButtonEvent::get_time
inline

Definition at line 122 of file buttonEvent.h.

◆ get_type

ButtonEvent::Type ButtonEvent::get_type
inline

Definition at line 121 of file buttonEvent.h.


The documentation for this class was generated from the following files: