|
KiCad PCB EDA Suite
|
Registry for toolbar context menu factories. More...
#include <toolbar_context_menu_registry.h>
Public Types | |
| using | MENU_FACTORY = std::function<std::unique_ptr<ACTION_MENU>( TOOL_MANAGER* )> |
| Factory function type: takes TOOL_MANAGER, returns owned ACTION_MENU. | |
Static Public Member Functions | |
| static void | RegisterMenuFactory (const std::string &aActionName, MENU_FACTORY aFactory) |
| Register a context menu factory for an action. | |
| static void | RegisterGroupMenuFactory (const std::string &aGroupName, MENU_FACTORY aFactory) |
| Register a context menu factory for a toolbar group. | |
| static MENU_FACTORY | GetMenuFactory (const std::string &aActionName) |
| Get the menu factory for an action, if one is registered. | |
| static MENU_FACTORY | GetGroupMenuFactory (const std::string &aGroupName) |
| Get the menu factory for a group, if one is registered. | |
Static Private Member Functions | |
| static std::map< std::string, MENU_FACTORY > & | getActionMenus () |
| static std::map< std::string, MENU_FACTORY > & | getGroupMenus () |
Registry for toolbar context menu factories.
This allows context menus to be associated with actions and groups by name, so that JSON-loaded toolbar configurations can get the same menus as code-defined default configurations.
Definition at line 44 of file toolbar_context_menu_registry.h.
| using TOOLBAR_CONTEXT_MENU_REGISTRY::MENU_FACTORY = std::function<std::unique_ptr<ACTION_MENU>( TOOL_MANAGER* )> |
Factory function type: takes TOOL_MANAGER, returns owned ACTION_MENU.
Definition at line 48 of file toolbar_context_menu_registry.h.
|
staticprivate |
Definition at line 28 of file toolbar_context_menu_registry.cpp.
Referenced by GetMenuFactory(), and RegisterMenuFactory().
|
static |
Get the menu factory for a group, if one is registered.
| aGroupName | The group name to look up |
Definition at line 71 of file toolbar_context_menu_registry.cpp.
References getGroupMenus().
Referenced by ACTION_TOOLBAR::ApplyConfiguration().
|
staticprivate |
Definition at line 36 of file toolbar_context_menu_registry.cpp.
Referenced by GetGroupMenuFactory(), and RegisterGroupMenuFactory().
|
static |
Get the menu factory for an action, if one is registered.
| aActionName | The action name to look up |
Definition at line 58 of file toolbar_context_menu_registry.cpp.
References getActionMenus().
Referenced by ACTION_TOOLBAR::ApplyConfiguration().
|
static |
Register a context menu factory for a toolbar group.
| aGroupName | The group name (from TOOLBAR_GROUP_CONFIG) |
| aFactory | Factory function that creates the menu |
Definition at line 50 of file toolbar_context_menu_registry.cpp.
References getGroupMenus(), and KICOMMON_API.
Referenced by TOOLBAR_GROUP_CONFIG::AddContextMenu().
|
static |
Register a context menu factory for an action.
| aActionName | The action name (from TOOL_ACTION::GetName()) |
| aFactory | Factory function that creates the menu |
Definition at line 43 of file toolbar_context_menu_registry.cpp.
References getActionMenus(), and KICOMMON_API.
Referenced by TOOLBAR_ITEM_REF::WithContextMenu().