27#ifndef ACTION_MANAGER_H_
28#define ACTION_MANAGER_H_
109 static int MakeActionId(
const std::string& aActionName );
114 const std::map<std::string, TOOL_ACTION*>&
GetActions()
const;
158 static std::list<TOOL_ACTION*> actionList;
184 const std::map<std::string, std::pair<int, int>>& aHotKeyMap );
Manage TOOL_ACTION objects.
~ACTION_MANAGER()
Unregister every registered action.
HOTKEY_LIST m_actionHotKeys
Quick action<->hot key lookup.
const ACTION_CONDITIONS * GetCondition(const TOOL_ACTION &aAction) const
Get the conditions to use for a specific tool action.
std::map< int, TOOL_ACTION * > m_customUIIdIndex
Map for indexing actions by their hotkeys.
TOOL_MANAGER * m_toolMgr
Map for indexing actions by their names.
void processHotKey(TOOL_ACTION *aAction, const std::map< std::string, int > &aLegacyMap, const std::map< std::string, std::pair< int, int > > &aHotKeyMap)
Tool manager needed to run actions.
const std::map< std::string, TOOL_ACTION * > & GetActions() const
Get a list of currently-registered actions mapped by their name.
std::map< std::string, TOOL_ACTION * > m_actionNameIndex
Map for recording actions that have custom UI IDs.
std::map< int, int > m_hotkeys
bool RunHotKey(int aHotKey) const
Run an action associated with a hotkey (if there is one available).
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
void RegisterAction(TOOL_ACTION *aAction)
Add a tool action to the manager and sets it up.
TOOL_ACTION * FindAction(const std::string &aActionName) const
Find an action with a given name (if there is one available).
static std::list< TOOL_ACTION * > & GetActionList()
Return list of TOOL_ACTIONs.
bool IsActionUIId(int aId) const
Test if a UI ID corresponds to an action ID in our system.
int GetHotKey(const TOOL_ACTION &aAction) const
Return the hot key associated with a given action or 0 if there is none.
static int MakeActionId(const std::string &aActionName)
Generate an unique ID from for an action with given name.
std::map< int, ACTION_CONDITIONS > m_uiConditions
Map the command ID that wx uses for the action to the UI conditions for the menu/toolbar items.
std::map< int, std::list< TOOL_ACTION * > > HOTKEY_LIST
void UpdateHotKeys(bool aFullUpdate)
Optionally read the hotkey config files and then rebuilds the internal hotkey maps.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
static bool ShowNever(const SELECTION &aSelection)
Always returns false.
std::function< bool(const SELECTION &)> SELECTION_CONDITION
Functor type that checks a specific condition for selected items.
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
SELECTION_CONDITION enableCondition
Returns true if the UI control should be enabled.
SELECTION_CONDITION checkCondition
Returns true if the UI control should be checked.
ACTION_CONDITIONS & Enable(const SELECTION_CONDITION &aCondition)
SELECTION_CONDITION showCondition
Returns true if the UI control should be shown.
ACTION_CONDITIONS & Check(const SELECTION_CONDITION &aCondition)
ACTION_CONDITIONS & Show(const SELECTION_CONDITION &aCondition)