Panda3D
|
00001 // Filename: buttonRegistry.I 00002 // Created by: drose (01Mar00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "pnotify.h" 00016 00017 //////////////////////////////////////////////////////////////////// 00018 // Function: ButtonRegistry::RegistryNode::Constructor 00019 // Access: Public 00020 // Description: 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE ButtonRegistry::RegistryNode:: 00023 RegistryNode(ButtonHandle handle, ButtonHandle alias, const string &name) : 00024 _handle(handle), _alias(alias), _name(name) 00025 { 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: ButtonRegistry::ptr 00030 // Access: Published, Static 00031 // Description: Returns the pointer to the global ButtonRegistry 00032 // object. 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE ButtonRegistry *ButtonRegistry:: 00035 ptr() { 00036 if (_global_pointer == (ButtonRegistry *)NULL) { 00037 init_global_pointer(); 00038 } 00039 return _global_pointer; 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: ButtonRegistry::get_name 00044 // Access: Public 00045 // Description: Returns the name of the indicated button. 00046 //////////////////////////////////////////////////////////////////// 00047 INLINE string ButtonRegistry:: 00048 get_name(ButtonHandle button) const { 00049 RegistryNode *rnode = look_up(button); 00050 nassertr(rnode != (RegistryNode *)NULL, ""); 00051 return rnode->_name; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: ButtonRegistry::get_alias 00056 // Access: Public 00057 // Description: Returns the alias for the indicated button, or 00058 // ButtonHandle::none() if the button has no specified 00059 // alias. 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE ButtonHandle ButtonRegistry:: 00062 get_alias(ButtonHandle button) const { 00063 RegistryNode *rnode = look_up(button); 00064 nassertr(rnode != (RegistryNode *)NULL, ButtonHandle::none()); 00065 return rnode->_alias; 00066 }