This class represents a map containing all of the buttons of a (keyboard) device, though it can also be used as a generic mapping between ButtonHandles. More...
#include "buttonMap.h"
Public Member Functions | |
| virtual TypeHandle | force_init_type () |
| ButtonHandle | get_mapped_button (size_t i) const |
| Returns the nth mapped button, meaning the button that the nth raw button is mapped to. More... | |
| ButtonHandle | get_mapped_button (ButtonHandle raw) const |
| Returns the button that the given button is mapped to, or ButtonHandle::none() if this map does not specify a mapped button for the given raw button. More... | |
| ButtonHandle | get_mapped_button (const std::string &raw_name) const |
| Returns the button that the given button is mapped to, or ButtonHandle::none() if this map does not specify a mapped button for the given raw button. More... | |
| const std::string & | get_mapped_button_label (size_t i) const |
| Returns the label associated with the nth mapped button, meaning the button that the nth raw button is mapped to. More... | |
| const std::string & | get_mapped_button_label (ButtonHandle raw) const |
| If the button map specifies a special name for the button (eg. More... | |
| const std::string & | get_mapped_button_label (const std::string &raw_name) const |
| If the button map specifies a special name for the button (eg. More... | |
| size_t | get_num_buttons () const |
| Returns the number of buttons that this button mapping specifies. More... | |
| ButtonHandle | get_raw_button (size_t i) const |
| Returns the underlying raw button associated with the nth button. More... | |
| virtual TypeHandle | get_type () const |
| void | map_button (ButtonHandle raw_button, ButtonHandle button, const std::string &label="") |
| Registers a new button mapping. More... | |
| void | output (std::ostream &out) const |
| void | write (std::ostream &out, int indent_level=0) const |
Public Member Functions inherited from TypedReferenceCount | |
| TypedReferenceCount (const TypedReferenceCount ©) | |
| void | operator= (const TypedReferenceCount ©) |
Public Member Functions inherited from TypedObject | |
| TypedObject (const TypedObject ©)=default | |
| TypedObject * | as_typed_object () |
| Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
| const TypedObject * | as_typed_object () const |
| Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
| int | get_best_parent_from_Set (const std::set< int > &) const |
| int | get_type_index () const |
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
| bool | is_exact_type (TypeHandle handle) const |
| Returns true if the current object is the indicated type exactly. More... | |
| bool | is_of_type (TypeHandle handle) const |
| Returns true if the current object is or derives from the indicated type. More... | |
| TypedObject & | operator= (const TypedObject ©)=default |
Public Member Functions inherited from ReferenceCount | |
| int | get_ref_count () const |
| WeakReferenceList * | get_weak_list () const |
| Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
| bool | has_weak_list () const |
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
| void | local_object () |
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
| void | ref () const |
| Explicitly increments the reference count. More... | |
| bool | ref_if_nonzero () const |
| Atomically increases the reference count of this object if it is not zero. More... | |
| bool | test_ref_count_integrity () const |
| Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
| bool | test_ref_count_nonzero () const |
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
| virtual bool | unref () const |
| Explicitly decrements the reference count. More... | |
| WeakReferenceList * | weak_ref () |
| Adds the indicated PointerToVoid as a weak reference to this object. More... | |
| void | weak_unref () |
| Removes the indicated PointerToVoid as a weak reference to this object. More... | |
Static Public Member Functions | |
| static TypeHandle | get_class_type () |
| static void | init_type () |
Static Public Member Functions inherited from TypedReferenceCount | |
| static TypeHandle | get_class_type () |
| static void | init_type () |
Static Public Member Functions inherited from TypedObject | |
| static TypeHandle | get_class_type () |
| static void | init_type () |
| This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
Static Public Member Functions inherited from ReferenceCount | |
| static TypeHandle | get_class_type () |
| static void | init_type () |
Additional Inherited Members | |
Public Attributes inherited from TypedObject | |
| get_type | |
Public Attributes inherited from ReferenceCount | |
| get_ref_count | |
| Returns the current reference count. More... | |
This class represents a map containing all of the buttons of a (keyboard) device, though it can also be used as a generic mapping between ButtonHandles.
It maps an underlying 'raw' button to a 'virtual' button, which may optionally be associated with an appropriate platform-specific name for the button.
Definition at line 30 of file buttonMap.h.
|
inline |
Returns the nth mapped button, meaning the button that the nth raw button is mapped to.
Definition at line 35 of file buttonMap.I.
Referenced by get_mapped_button().
|
inline |
Returns the button that the given button is mapped to, or ButtonHandle::none() if this map does not specify a mapped button for the given raw button.
Definition at line 54 of file buttonMap.I.
References ButtonHandle::get_index.
|
inline |
Returns the button that the given button is mapped to, or ButtonHandle::none() if this map does not specify a mapped button for the given raw button.
Definition at line 70 of file buttonMap.I.
References ButtonRegistry::find_button(), get_mapped_button(), and ButtonRegistry::ptr().
|
inline |
Returns the label associated with the nth mapped button, meaning the button that the nth raw button is mapped to.
Definition at line 44 of file buttonMap.I.
Referenced by get_mapped_button_label().
|
inline |
If the button map specifies a special name for the button (eg.
if the operating system or keyboard device has a localized name describing the key), returns it, or the empty string otherwise.
Note that this is not the same as get_mapped_button().get_name(), which returns the name of the Panda event associated with the button.
Definition at line 88 of file buttonMap.I.
References ButtonHandle::get_index.
|
inline |
If the button map specifies a special name for the button (eg.
if the operating system or keyboard device has a localized name describing the key), returns it, or the empty string otherwise.
Note that this is not the same as get_mapped_button().get_name(), which returns the name of the Panda event associated with the button.
Definition at line 108 of file buttonMap.I.
References ButtonRegistry::find_button(), get_mapped_button_label(), and ButtonRegistry::ptr().
|
inline |
Returns the number of buttons that this button mapping specifies.
Definition at line 18 of file buttonMap.I.
|
inline |
Returns the underlying raw button associated with the nth button.
Definition at line 26 of file buttonMap.I.
| void ButtonMap::map_button | ( | ButtonHandle | raw_button, |
| ButtonHandle | button, | ||
| const std::string & | label = "" |
||
| ) |
Registers a new button mapping.
Definition at line 23 of file buttonMap.cxx.
References ButtonHandle::get_index.
1.8.15