Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Protected Attributes | List of all members
Mezzanine::UI::ActionHandler Class Reference

This class is the core class responsible for the management of actions. More...

#include <actionhandler.h>

+ Collaboration diagram for Mezzanine::UI::ActionHandler:

Public Types

typedef std::map< String, Action * > ActionContainer
 Container type for Action instances that are stored by this class.
 
typedef ActionContainer::iterator ActionIterator
 Iterator type for Action instances that are stored in this class.
 
typedef std::vector< Action * > ActivatedContainer
 Container type for in-progress Action instances that are stored by this class.
 
typedef ActivatedContainer::iterator ActivatedIterator
 Iterator type for in-progress Action instances that are stored in this class.
 
typedef std::multimap< Input::MetaCodeKey, Action * > BindingContainer
 Container for bindings that connect to input codes to actions.
 
typedef BindingContainer::iterator BindingIterator
 Iterator type for input-action bindings stored in this class.
 
typedef std::pair< Input::MetaCodeKey, Action * > BindingPair
 A convenience type for the actual input-action binding.
 
typedef std::pair< BindingIterator, BindingIteratorBindingRange
 A convenience type for an iterator range of bindings.
 
typedef ActionContainer::const_iterator ConstActionIterator
 Const Iterator type for Action instances that are stored in this class.
 
typedef ActivatedContainer::const_iterator ConstActivatedIterator
 Const Iterator type for in-progress Action instances that are stored in this class.
 
typedef BindingContainer::const_iterator ConstBindingIterator
 Const Iterator type for input-action bindings stored in this class.
 
typedef std::pair< ConstBindingIterator, ConstBindingIteratorConstBindingRange
 A convenience type for a const iterator range of bindings.
 

Public Member Functions

 ActionHandler ()
 Class constructor.
 
 ~ActionHandler ()
 Class destructor.
 
bool _HandleInput (const Input::MetaCode &Code)
 Handles input passed to this handler. More...
 
void _NotifyActionActivated (Action *BeingActivated)
 Used by Actions to notify this handler it was activated. More...
 
void _ProcessAllActions ()
 Processes all active actions, and deactivates them if necessary. More...
 
ActionIterator BeginAction ()
 Gets an iterator to the first Action. More...
 
ConstActionIterator BeginAction () const
 Gets a const iterator to the first Action. More...
 
BindingIterator BeginBinding ()
 Gets an iterator to the first Binding. More...
 
ConstBindingIterator BeginBinding () const
 Gets a const iterator to the first Binding. More...
 
void Bind (const Input::MetaCode &Code, Action *ToBind, bool ForceUnique=true)
 Binds a MetaCode to an action, making the action fire when this handler recieves the code. More...
 
ActionCreateAction (const String &Name)
 Creates a new Action that can be bound to a MetaCode. More...
 
void DestroyAction (Action *ToBeDestroyed)
 Destroy's an action. More...
 
void DestroyAllActions ()
 Destroys all Actions being stored by this Handler.
 
ActionIterator EndAction ()
 Gets an iterator to one-passed-the-last Action. More...
 
ConstActionIterator EndAction () const
 Gets a const iterator to one-passed-the-last Action. More...
 
BindingIterator EndBinding ()
 Gets an iterator to one-passed-the-last Binding. More...
 
ConstBindingIterator EndBinding () const
 Gets a const iterator to one-passed-the-last Binding. More...
 
ActionGetAction (const String &Name)
 Gets an Action by name. More...
 
ConstBindingRange GetActionsBoundToCode (const Input::MetaCode &Code)
 Gets all Actions bound to a MetaCode. More...
 
void RemoveAllBindings ()
 Completely removes all bindings from this Handler.
 
void Unbind (const Input::MetaCode &Code)
 Unbinds Actions via MetaCode. More...
 
void Unbind (Action *ToUnbind)
 Unbinds an Action via Action pointer. More...
 
void UnbindAll ()
 Unbinds all actions in this handler. More...
 

Protected Attributes

ActionContainer Actions
 Container storing all registered actions. More...
 
ActivatedContainer ActivatedActions
 Container storing all the actions that are in-progress. More...
 
BindingContainer Bindings
 Container storing all the bindings that connect inputs to actions. More...
 

Detailed Description

This class is the core class responsible for the management of actions.

Definition at line 54 of file actionhandler.h.

Member Function Documentation

bool Mezzanine::UI::ActionHandler::_HandleInput ( const Input::MetaCode Code)

Handles input passed to this handler.

Parameters
CodeThe MetaCode to be processed.
Returns
Returns true if this input was consumed/handled, false otherwise.

Definition at line 208 of file actionhandler.cpp.

void Mezzanine::UI::ActionHandler::_NotifyActionActivated ( Action BeingActivated)

Used by Actions to notify this handler it was activated.

Parameters
BeingActivatedThe Action calling this method and being activated.

Definition at line 198 of file actionhandler.cpp.

void Mezzanine::UI::ActionHandler::_ProcessAllActions ( )

Processes all active actions, and deactivates them if necessary.

Definition at line 219 of file actionhandler.cpp.

ActionHandler::ActionIterator Mezzanine::UI::ActionHandler::BeginAction ( )

Gets an iterator to the first Action.

Returns
Returns an iterator to the first Action stored by this handler.

Definition at line 104 of file actionhandler.cpp.

ActionHandler::ConstActionIterator Mezzanine::UI::ActionHandler::BeginAction ( ) const

Gets a const iterator to the first Action.

Returns
Returns a const iterator to the first Action stored by this handler.

Definition at line 114 of file actionhandler.cpp.

ActionHandler::BindingIterator Mezzanine::UI::ActionHandler::BeginBinding ( )

Gets an iterator to the first Binding.

Returns
Returns an iterator to the first Binding stored by this handler.

Definition at line 175 of file actionhandler.cpp.

ActionHandler::ConstBindingIterator Mezzanine::UI::ActionHandler::BeginBinding ( ) const

Gets a const iterator to the first Binding.

Returns
Returns a const iterator to the first Binding stored by this handler.

Definition at line 185 of file actionhandler.cpp.

void Mezzanine::UI::ActionHandler::Bind ( const Input::MetaCode Code,
Action ToBind,
bool  ForceUnique = true 
)

Binds a MetaCode to an action, making the action fire when this handler recieves the code.

Note
Only one Action can be bound to a given code. Binding a second Action to a code will unbind the first.
Parameters
CodeThe code to trigger the Action.
ToBindThe Action to be triggered.
ForceUniqueIf true this will clear any previous entries that are equal to the MetaCode provided in the binding multimap.

Definition at line 132 of file actionhandler.cpp.

Action * Mezzanine::UI::ActionHandler::CreateAction ( const String Name)

Creates a new Action that can be bound to a MetaCode.

Parameters
NameThe name to be given to the created Action.
Returns
Returns a pointer to the created Action.

Definition at line 63 of file actionhandler.cpp.

void Mezzanine::UI::ActionHandler::DestroyAction ( Action ToBeDestroyed)

Destroy's an action.

Parameters
ToBeDestroyedThe action to be destroyed.

Definition at line 83 of file actionhandler.cpp.

ActionHandler::ActionIterator Mezzanine::UI::ActionHandler::EndAction ( )

Gets an iterator to one-passed-the-last Action.

Returns
Returns an iterator to one-passed-the-last Action stored by this handler.

Definition at line 109 of file actionhandler.cpp.

ActionHandler::ConstActionIterator Mezzanine::UI::ActionHandler::EndAction ( ) const

Gets a const iterator to one-passed-the-last Action.

Returns
Returns a const iterator to one-passed-the-last Action stored by this handler.

Definition at line 119 of file actionhandler.cpp.

ActionHandler::BindingIterator Mezzanine::UI::ActionHandler::EndBinding ( )

Gets an iterator to one-passed-the-last Binding.

Returns
Returns an iterator to one-passed-the-last Binding stored by this handler.

Definition at line 180 of file actionhandler.cpp.

ActionHandler::ConstBindingIterator Mezzanine::UI::ActionHandler::EndBinding ( ) const

Gets a const iterator to one-passed-the-last Binding.

Returns
Returns a const iterator to one-passed-the-last Binding stored by this handler.

Definition at line 190 of file actionhandler.cpp.

Action * Mezzanine::UI::ActionHandler::GetAction ( const String Name)

Gets an Action by name.

Parameters
NameThe name of the Action to retrieve.
Returns
Returns a pointer to the named Action.

Definition at line 76 of file actionhandler.cpp.

ActionHandler::ConstBindingRange Mezzanine::UI::ActionHandler::GetActionsBoundToCode ( const Input::MetaCode Code)

Gets all Actions bound to a MetaCode.

Parameters
CodeThe MetaCode to use to search for bound Actions.
Returns
Returns the first and one-passed-the-last iterators representing all of the Actions bound to the provided code.

Definition at line 127 of file actionhandler.cpp.

void Mezzanine::UI::ActionHandler::Unbind ( const Input::MetaCode Code)

Unbinds Actions via MetaCode.

Note
This can unbind multiple Actions.
Parameters
CodeThe MetaCode to find and remove all bindings to actions.

Definition at line 146 of file actionhandler.cpp.

void Mezzanine::UI::ActionHandler::Unbind ( Action ToUnbind)

Unbinds an Action via Action pointer.

Note
This method will iterate over all the elements in the binding multimap in search of all bindings to the provided Action.
Parameters
ToUnbindThe Action to unbind from any and all MetaCodes.

Definition at line 153 of file actionhandler.cpp.

void Mezzanine::UI::ActionHandler::UnbindAll ( )

Unbinds all actions in this handler.

Note
This does not delete entries for MetaCodeKey's, this simply sets the Action value to NULL.

Definition at line 162 of file actionhandler.cpp.

Member Data Documentation

ActionContainer Mezzanine::UI::ActionHandler::Actions
protected

Container storing all registered actions.

Definition at line 84 of file actionhandler.h.

ActivatedContainer Mezzanine::UI::ActionHandler::ActivatedActions
protected

Container storing all the actions that are in-progress.

Definition at line 90 of file actionhandler.h.

BindingContainer Mezzanine::UI::ActionHandler::Bindings
protected

Container storing all the bindings that connect inputs to actions.

Definition at line 87 of file actionhandler.h.


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