Panda3D
buttonRegistry.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file buttonRegistry.I
10  * @author drose
11  * @date 2000-03-01
12  */
13 
14 #include "pnotify.h"
15 
16 /**
17  *
18  */
19 INLINE ButtonRegistry::RegistryNode::
20 RegistryNode(ButtonHandle handle, ButtonHandle alias, const std::string &name) :
21  _handle(handle), _alias(alias), _name(name)
22 {
23 }
24 
25 /**
26  * Returns the pointer to the global ButtonRegistry object.
27  */
29 ptr() {
30  if (_global_pointer == nullptr) {
31  init_global_pointer();
32  }
33  return _global_pointer;
34 }
35 
36 /**
37  * Returns the name of the indicated button.
38  */
39 INLINE std::string ButtonRegistry::
40 get_name(ButtonHandle button) const {
41  RegistryNode *rnode = look_up(button);
42  nassertr(rnode != nullptr, "");
43  return rnode->_name;
44 }
45 
46 /**
47  * Returns the alias for the indicated button, or ButtonHandle::none() if the
48  * button has no specified alias.
49  */
51 get_alias(ButtonHandle button) const {
52  RegistryNode *rnode = look_up(button);
53  nassertr(rnode != nullptr, ButtonHandle::none());
54  return rnode->_alias;
55 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The ButtonRegistry class maintains all the assigned ButtonHandles in a given system.
std::string get_name(ButtonHandle button) const
Returns the name of the indicated button.
A ButtonHandle represents a single button from any device, including keyboard buttons and mouse butto...
Definition: buttonHandle.h:26
static ButtonRegistry * ptr()
Returns the pointer to the global ButtonRegistry object.
ButtonHandle get_alias(ButtonHandle button) const
Returns the alias for the indicated button, or ButtonHandle::none() if the button has no specified al...