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;
153 static std::list<TOOL_ACTION*> actionList;
179 std::map<std::string, int> aHotKeyMap );
SELECTION_CONDITION showCondition
Returns true if the UI control should be shown.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
std::map< int, int > m_hotkeys
const std::map< std::string, TOOL_ACTION * > & GetActions() const
Get a list of currently-registered actions mapped by their name.
static int MakeActionId(const std::string &aActionName)
Generate an unique ID from for an action with given name.
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 & Show(const SELECTION_CONDITION &aCondition)
void UpdateHotKeys(bool aFullUpdate)
Optionally read the hotkey config files and then rebuilds the internal hotkey maps.
std::map< int, std::list< TOOL_ACTION * > > HOTKEY_LIST
~ACTION_MANAGER()
Unregister every registered action.
Manage TOOL_ACTION objects.
static std::list< TOOL_ACTION * > & GetActionList()
Return list of TOOL_ACTIONs.
TOOL_ACTION * FindAction(const std::string &aActionName) const
Find an action with a given name (if there is one available).
ACTION_CONDITIONS & Enable(const SELECTION_CONDITION &aCondition)
bool RunHotKey(int aHotKey) const
Run an action associated with a hotkey (if there is one available).
int GetHotKey(const TOOL_ACTION &aAction) const
Return the hot key associated with a given action or 0 if there is none.
ACTION_MANAGER(TOOL_MANAGER *aToolManager)
std::function< bool(const SELECTION &)> SELECTION_CONDITION
< Functor type that checks a specific condition for selected items.
std::map< std::string, TOOL_ACTION * > m_actionNameIndex
Map for indexing actions by their hotkeys.
HOTKEY_LIST m_actionHotKeys
Quick action<->hot key lookup.
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...
TOOL_MANAGER * m_toolMgr
Map for indexing actions by their names.
void RegisterAction(TOOL_ACTION *aAction)
Add a tool action to the manager and sets it up.
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.
int processHotKey(TOOL_ACTION *aAction, std::map< std::string, int > aLegacyMap, std::map< std::string, int > aHotKeyMap)
Tool manager needed to run actions.
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
static bool ShowNever(const SELECTION &aSelection)
Always returns false.
const ACTION_CONDITIONS * GetCondition(const TOOL_ACTION &aAction) const
Get the conditions to use for a specific tool action.
ACTION_CONDITIONS & Check(const SELECTION_CONDITION &aCondition)