Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ButtonRegistry Class Reference

The ButtonRegistry class maintains all the assigned ButtonHandles in a given system. More...

#include <buttonRegistry.h>

List of all members.

Public Member Functions

bool register_button (ButtonHandle &button_handle, const string &name, char ascii_equivalent= '\0')
 Registers a new ButtonHandle with the indicated name, and if specified, the indicated ASCII equivalent.

ButtonHandle get_button (const string &name)
 Finds a ButtonHandle in the registry matching the indicated name.

ButtonHandle find_ascii_button (char ascii_equivalent) const
 Finds a ButtonHandle in the registry matching the indicated ASCII equivalent character.

string get_name (ButtonHandle button) const
 Returns the name of the indicated button.

void write (ostream &out) const

Static Public Member Functions

ButtonRegistry * ptr ()
 Returns the pointer to the global ButtonRegistry object.


Private Types

typedef pvector< RegistryNode * > HandleRegistry
typedef pmap< string, RegistryNode * > NameRegistry

Private Member Functions

 ButtonRegistry ()
RegistryNodelook_up (ButtonHandle button) const

Static Private Member Functions

void init_global_pointer ()
 Constructs the ButtonRegistry object for the first time.


Private Attributes

HandleRegistry _handle_registry
NameRegistry _name_registry

Static Private Attributes

ButtonRegistry * _global_pointer = NULL


Detailed Description

The ButtonRegistry class maintains all the assigned ButtonHandles in a given system.

There should be only one ButtonRegistry class during the lifetime of the application.

Definition at line 46 of file buttonRegistry.h.


Member Typedef Documentation

typedef pvector<RegistryNode *> ButtonRegistry::HandleRegistry [private]
 

Definition at line 81 of file buttonRegistry.h.

typedef pmap<string, RegistryNode *> ButtonRegistry::NameRegistry [private]
 

Definition at line 84 of file buttonRegistry.h.


Constructor & Destructor Documentation

ButtonRegistry::ButtonRegistry  )  [private]
 

Definition at line 207 of file buttonRegistry.cxx.

References _handle_registry, ButtonHandle::_index, nassertr, and NULL.


Member Function Documentation

ButtonHandle ButtonRegistry::find_ascii_button char  ascii_equivalent  )  const
 

Finds a ButtonHandle in the registry matching the indicated ASCII equivalent character.

If there is no such ButtonHandle, returns ButtonHandle::none().

Definition at line 162 of file buttonRegistry.cxx.

Referenced by KeyboardButton::ascii_key().

ButtonHandle ButtonRegistry::get_button const string &  name  ) 
 

Finds a ButtonHandle in the registry matching the indicated name.

If there is no such ButtonHandle, registers a new one and returns it.

Definition at line 136 of file buttonRegistry.cxx.

References _handle_registry, ButtonHandle::none(), and NULL.

string ButtonRegistry::get_name ButtonHandle  button  )  const [inline]
 

Returns the name of the indicated button.

Definition at line 63 of file buttonRegistry.I.

void ButtonRegistry::init_global_pointer  )  [static, private]
 

Constructs the ButtonRegistry object for the first time.

Definition at line 230 of file buttonRegistry.cxx.

Referenced by ButtonRegistry::RegistryNode::RegistryNode().

ButtonRegistry::RegistryNode * ButtonRegistry::look_up ButtonHandle  button  )  const [private]
 

Definition at line 243 of file buttonRegistry.cxx.

Referenced by ptr().

ButtonRegistry * ButtonRegistry::ptr  )  [inline, static]
 

Returns the pointer to the global ButtonRegistry object.

Definition at line 47 of file buttonRegistry.I.

References ButtonRegistry::RegistryNode::_name, INLINE, look_up(), nassertr, and NULL.

Referenced by KeyboardButton::ascii_key(), and MouseButton::three().

bool ButtonRegistry::register_button ButtonHandle button_handle,
const string &  name,
char  ascii_equivalent = '\0'
 

Registers a new ButtonHandle with the indicated name, and if specified, the indicated ASCII equivalent.

Returns true if the button was registered, or false it was already registered; in either case, the new ButtonHandle is loaded into the first parameter.

This defines a new kind of button matching the indicated name. The ButtonHandle can then be passed around to devices as a button in its own right.

Definition at line 60 of file buttonRegistry.cxx.

Referenced by MouseButton::three().

void ButtonRegistry::write ostream &  out  )  const
 

Definition at line 178 of file buttonRegistry.cxx.

References _handle_registry, and NULL.


Member Data Documentation

ButtonRegistry * ButtonRegistry::_global_pointer = NULL [static, private]
 

Definition at line 32 of file buttonRegistry.cxx.

HandleRegistry ButtonRegistry::_handle_registry [private]
 

Definition at line 82 of file buttonRegistry.h.

Referenced by ButtonRegistry(), get_button(), and write().

NameRegistry ButtonRegistry::_name_registry [private]
 

Definition at line 85 of file buttonRegistry.h.


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:48:03 2003 for Panda by doxygen1.3