40 #ifndef _uiactionhandler_cpp
41 #define _uiactionhandler_cpp
43 #include "UI/actionhandler.h"
44 #include "UI/action.h"
69 Actions.insert( std::pair<String,Action*>(Name,NewAction) );
79 if( ActIt !=
Actions.end() )
return (*ActIt).second;
99 delete (*ActIt).second;
138 if( Range.first != Range.second )
140 Bindings.erase(Range.first,Range.second);
149 for(
BindingIterator BindIt = Range.first ; BindIt != Range.second ; ++BindIt )
150 (*BindIt).second = NULL;
157 if( ToUnbind == (*BindIt).second )
158 (*BindIt).second = NULL;
166 (*BindIt).second = NULL;
202 if( BeingActivated == (*ActIt) )
212 if( CodeRange.first != CodeRange.second )
const String & GetName() const
Gets the name of this Action.
BindingIterator BeginBinding()
Gets an iterator to the first Binding.
Thrown when duplicates of teh same identity string exist.
ActionContainer::const_iterator ConstActionIterator
Const Iterator type for Action instances that are stored in this class.
void DestroyAllActions()
Destroys all Actions being stored by this Handler.
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...
std::pair< ConstBindingIterator, ConstBindingIterator > ConstBindingRange
A convenience type for a const iterator range of bindings.
void _ProcessAllActions()
Processes all active actions, and deactivates them if necessary.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
ActivatedContainer ActivatedActions
Container storing all the actions that are in-progress.
BindingContainer::const_iterator ConstBindingIterator
Const Iterator type for input-action bindings stored in this class.
std::pair< Input::MetaCodeKey, Action * > BindingPair
A convenience type for the actual input-action binding.
ActionContainer Actions
Container storing all registered actions.
~ActionHandler()
Class destructor.
Action * CreateAction(const String &Name)
Creates a new Action that can be bound to a MetaCode.
BindingIterator EndBinding()
Gets an iterator to one-passed-the-last Binding.
This class represents an action to be taken. Can have multiple inputs bound to it.
bool _HandleInput(const Input::MetaCode &Code)
Handles input passed to this handler.
std::pair< BindingIterator, BindingIterator > BindingRange
A convenience type for an iterator range of bindings.
void DestroyAction(Action *ToBeDestroyed)
Destroy's an action.
BindingContainer Bindings
Container storing all the bindings that connect inputs to actions.
void RemoveAllBindings()
Completely removes all bindings from this Handler.
ActionContainer::iterator ActionIterator
Iterator type for Action instances that are stored in this class.
void _NotifyActionActivated(Action *BeingActivated)
Used by Actions to notify this handler it was activated.
ConstBindingRange GetActionsBoundToCode(const Input::MetaCode &Code)
Gets all Actions bound to a MetaCode.
ActionIterator EndAction()
Gets an iterator to one-passed-the-last Action.
Action * GetAction(const String &Name)
Gets an Action by name.
The bulk of the engine components go in this namspace.
ActionHandler()
Class constructor.
ActionIterator BeginAction()
Gets an iterator to the first Action.
void UnbindAll()
Unbinds all actions in this handler.
void Unbind(const Input::MetaCode &Code)
Unbinds Actions via MetaCode.
BindingContainer::iterator BindingIterator
Iterator type for input-action bindings stored in this class.
std::string String
A datatype used to a series of characters.
ActivatedContainer::iterator ActivatedIterator
Iterator type for in-progress Action instances that are stored in this class.