NCBI C++ ToolKit
|
Search Toolkit Book for CUICommandRegistry
CUICommandRegistry is a centralized registry where all application commands should be registered. More...
#include <gui/widgets/wx/ui_command.hpp>
Public Member Functions | |
CUICommandRegistry (TCmdID start_id) | |
virtual | ~CUICommandRegistry () |
int | RegisterCommand (CUICommand *cmd) |
assumes ownership of the given object returns a command id (useful when registry is used for auto id assignment) More... | |
int | RegisterCommand (TCmdID cmd_id, string menu_label, string label, string icon_alias, string hint=kEmptyStr, string description=kEmptyStr, string help_id=kEmptyStr, wxItemKind kind=wxITEM_NORMAL) |
create a CUICommand and registers it More... | |
const CUICommand * | FindCommandByID (TCmdID cmd_id) const |
returns CUICommand object or NULL More... | |
const CUICommand * | FindCommandByName (string name) const |
It is expensive function so use it wisely. More... | |
Accelerators support | |
add a new accelerators to the local table | |
void | AddAccelerator (const wxAcceleratorEntry &entry) |
void | ApplyAccelerators (wxWindow *frame) |
apply accumulated accelerators to the specifed frame More... | |
Menu and ToolBar support | |
wxMenuItem * | AppendMenuItem (wxMenu &menu, TCmdID cmd_id) const |
wxMenuItem * | AppendMenuItem (wxMenu &menu, TCmdID cmd_id, wxItemKind kind) const |
void | AppendMenuItems (wxMenu &menu, const TCmdID *cmd_ids, int count) const |
void | AppendMenuItems (wxMenu &menu, const vector< TCmdID > cmd_ids) const |
wxMenu * | CreateMenu (const SwxMenuItemRec *items) |
create a menu from a static definition (see WX_*_MENU macros) More... | |
void | AppendTool (wxToolBar &tool_bar, TCmdID cmd_id) |
void | AppendTool (wxAuiToolBar &tool_bar, TCmdID cmd_id) |
Static Public Member Functions | |
static CUICommandRegistry & | GetInstance () |
the main instance associated with the application More... | |
Protected Types | |
typedef std::unordered_map< int, CUICommand * > | TIDToCommand |
Protected Attributes | |
TCmdID | m_NextID |
TIDToCommand | m_IDToCommand |
vector< wxAcceleratorEntry > | m_AccelEntries |
Static Protected Attributes | |
static CUICommandRegistry | sm_TheRegistry |
CUICommandRegistry. More... | |
Private Member Functions | |
CUICommandRegistry (const CUICommandRegistry &) | |
CUICommandRegistry & | operator= (const CUICommandRegistry &) |
CUICommandRegistry is a centralized registry where all application commands should be registered.
The purpose of the registry is to provide completed, consistent and non-redundant information on application commands, their labels, tooltips, icons and other attributes. Application components shall use CUICommandRegistry for constructing menus, toolbars and other command-based UI components. Components adding new commands to the application shall register them in CUICommandRegistry.
Definition at line 145 of file ui_command.hpp.
|
protected |
Definition at line 200 of file ui_command.hpp.
CUICommandRegistry::CUICommandRegistry | ( | TCmdID | start_id | ) |
Definition at line 182 of file ui_command.cpp.
|
virtual |
Definition at line 189 of file ui_command.cpp.
References m_IDToCommand, and NON_CONST_ITERATE.
|
private |
void CUICommandRegistry::AddAccelerator | ( | const wxAcceleratorEntry & | entry | ) |
Definition at line 274 of file ui_command.cpp.
References m_AccelEntries.
Referenced by RegisterCommand(), CBioseqEditorFactory::RegisterCommands(), and CTextPanel::RegisterCommands().
wxMenuItem * CUICommandRegistry::AppendMenuItem | ( | wxMenu & | menu, |
TCmdID | cmd_id | ||
) | const |
Definition at line 300 of file ui_command.cpp.
Referenced by CDiagConsoleList::AppendMenuItems(), CwxTableListCtrl::AppendMenuItems(), AppendMenuItems(), CreateMenu(), CDockManager::GetDockPanelMenu(), CNetBLASTUIDataSource::GetMenu(), CLBLASTUIDataSource::GetMenu(), CBamUIDataSource::GetMenu(), CGenBankUIDataSource::GetMenu(), CMinPanelContainer::OnContextMenu(), CGraphicPanel::OnHelpClick(), CCrossAlignView::x_CreateMenuBarMenu(), CDotMatrixView::x_CreateMenuBarMenu(), CAlnMultiWidget::x_CreatePopupMenu(), CSeqGraphicWidget::x_CreatePopupMenu(), and CProjectTreePanel::x_GetContextMenu().
wxMenuItem * CUICommandRegistry::AppendMenuItem | ( | wxMenu & | menu, |
TCmdID | cmd_id, | ||
wxItemKind | kind | ||
) | const |
Definition at line 308 of file ui_command.cpp.
References _ASSERT, cmd, ERR_POST, FindCommandByID(), and NULL.
Definition at line 330 of file ui_command.cpp.
References AppendMenuItem(), count, and i.
Referenced by CProjectTreePanel::x_GetContextMenu().
Definition at line 339 of file ui_command.cpp.
References AppendMenuItem(), and i.
void CUICommandRegistry::AppendTool | ( | wxAuiToolBar & | tool_bar, |
TCmdID | cmd_id | ||
) |
Definition at line 475 of file ui_command.cpp.
References _ASSERT, cmd, ERR_POST, m_IDToCommand, ToWxString(), and wxT.
void CUICommandRegistry::AppendTool | ( | wxToolBar & | tool_bar, |
TCmdID | cmd_id | ||
) |
Definition at line 448 of file ui_command.cpp.
References _ASSERT, cmd, ERR_POST, m_IDToCommand, ToWxString(), and wxT.
Referenced by CUpdateSeqPanel::CreateControls(), CProjectViewToolBatFactory::x_CreateNavigationToolbar(), CProjectViewToolBatFactory::x_CreateSelectionToolbar(), and CGraphicPanel::x_CreateToolbar().
void CUICommandRegistry::ApplyAccelerators | ( | wxWindow * | frame | ) |
apply accumulated accelerators to the specifed frame
Definition at line 281 of file ui_command.cpp.
References _ASSERT, entries, ERR_POST, int, m_AccelEntries, and n.
Referenced by CFloatingFrame::CFloatingFrame(), and CViewManagerService::x_RegisterExtensionFactories().
wxMenu * CUICommandRegistry::CreateMenu | ( | const SwxMenuItemRec * | items | ) |
create a menu from a static definition (see WX_*_MENU macros)
creates hierarchy of wxMenuItem objects from the array of SwxMenuItemRec descriptors
Definition at line 349 of file ui_command.cpp.
References _ASSERT, AppendMenuItem(), SwxMenuItemRec::eCheckItem, SwxMenuItemRec::eDefaultItem, SwxMenuItemRec::eNormalItem, SwxMenuItemRec::eRadioItem, SwxMenuItemRec::eSeparator, SStaticPair< FirstType, SecondType >::first, SwxMenuItemRec::IsMenuEnd(), SwxMenuItemRec::IsSubMenu(), SwxMenuItemRec::IsSubMenuEnd(), SwxMenuItemRec::m_CommandID, SwxMenuItemRec::m_Label, SwxMenuItemRec::m_Type, NULL, RunningInsideNCBI(), SStaticPair< FirstType, SecondType >::second, ToWxString(), and wxID_ANY.
Referenced by CBioseqEditor::CreateBioseqMenu(), CBioseqEditor::CreateContextMenu(), CreateContextMenuBackbone(), CAlignmentAssistant::CreateControls(), CEditSequence::CreateControls(), CwxGridTableAdapter::CreateMenu(), CFlatFileViewContext::CreateMenu(), CDesktopViewContext::CreateMenu(), CFastaViewContext::CreateMenu(), CFrameworkDemoGUI::GetMenu(), IMenuContributor::GetMenu(), CWindowManager::GetMenu(), CPhyloTreeWidget::OnContextMenu(), CDataMiningPanel::OnContextMenu(), CProjectTreePanel::OnContextMenu(), CCrossAlnWidget::OnContextMenu(), CHitMatrixWidget::OnContextMenu(), CTextItemPanel::OnContextMenu(), CTooltipFrame::OnContextMenu(), CFlatFileViewContext::OnEditBioseq(), CSeqTextWidget::OnShowPopup(), CProjectView::x_CreateContextMenuBackbone(), CSeqTableGridPanel::x_CreateMenu(), CMultiAlignView::x_CreateMenuBarMenu(), CAlnMultiWidget::x_CreatePopupMenu(), and CSeqGraphicWidget::x_CreatePopupMenu().
const CUICommand * CUICommandRegistry::FindCommandByID | ( | TCmdID | cmd_id | ) | const |
returns CUICommand object or NULL
Definition at line 257 of file ui_command.cpp.
References m_IDToCommand, and NULL.
Referenced by AppendMenuItem().
const CUICommand * CUICommandRegistry::FindCommandByName | ( | string | name | ) | const |
It is expensive function so use it wisely.
Definition at line 263 of file ui_command.cpp.
References ITERATE, m_IDToCommand, and NULL.
|
static |
the main instance associated with the application
Definition at line 176 of file ui_command.cpp.
References sm_TheRegistry.
Referenced by AddCommandsForScopedObjects(), CDiagConsoleList::AppendMenuItems(), CwxTableListCtrl::AppendMenuItems(), CFloatingFrame::CFloatingFrame(), CBioseqEditor::CreateBioseqMenu(), CBioseqEditor::CreateContextMenu(), CreateContextMenuBackbone(), CAlignmentAssistant::CreateControls(), CEditSequence::CreateControls(), CUpdateSeqPanel::CreateControls(), CAlignMultipleDemoDlg::CreateControls(), CwxGridTableAdapter::CreateMenu(), CFlatFileViewContext::CreateMenu(), CDesktopViewContext::CreateMenu(), CFastaViewContext::CreateMenu(), CwxGridTableAdapter::CwxGridTableAdapter(), CDockManager::GetDockPanelMenu(), CFrameworkDemoGUI::GetMenu(), IMenuContributor::GetMenu(), CWindowManager::GetMenu(), CNetBLASTUIDataSource::GetMenu(), CLBLASTUIDataSource::GetMenu(), CBamUIDataSource::GetMenu(), CGenBankUIDataSource::GetMenu(), CWorkbench::GetUICommandRegistry(), CWorkbench::Init(), CCrossAlnDemoDlg::Init(), CPhyloTreeDemoDlg::Init(), CSeqGraphicDemoDlg::Init(), CSeqTextDemoDlg::Init(), CGraphOverlay::LH_OnItemRightClick(), CPhyloTreeWidget::OnContextMenu(), CCrossAlnWidget::OnContextMenu(), CHitMatrixWidget::OnContextMenu(), CTextItemPanel::OnContextMenu(), CMinPanelContainer::OnContextMenu(), CTooltipFrame::OnContextMenu(), CFlatFileViewContext::OnEditBioseq(), CGraphicPanel::OnHelpClick(), CSeqTextWidget::OnShowPopup(), CStickyTooltipHandler::RegisterCommands(), CSeqTableGridPanel::x_CreateMenu(), CProjectViewToolBatFactory::x_CreateNavigationToolbar(), CAlnMultiWidget::x_CreatePopupMenu(), CSeqGraphicWidget::x_CreatePopupMenu(), CProjectViewToolBatFactory::x_CreateSelectionToolbar(), CGraphicPanel::x_CreateToolbar(), CProjectTreePanel::x_GetContextMenu(), CAlignPackage::x_RegisterCommands(), CSeqPackage::x_RegisterCommands(), and CSeqTableGridPanel::x_SetUpMenu().
|
private |
int CUICommandRegistry::RegisterCommand | ( | CUICommand * | cmd | ) |
assumes ownership of the given object returns a command id (useful when registry is used for auto id assignment)
Definition at line 198 of file ui_command.cpp.
References _ASSERT, AddAccelerator(), cmd, eCmdInvalid, ERR_POST, ITERATE, m_IDToCommand, and m_NextID.
Referenced by Core_RegisterCommands(), CwxGridTableAdapter::CwxGridTableAdapter(), RegisterCommand(), CStickyTooltipHandler::RegisterCommands(), CBioseqEditorFactory::RegisterCommands(), CCrossAlnWidget::RegisterCommands(), CAlnMultiWidget::RegisterCommands(), CHitMatrixWidget::RegisterCommands(), CPhyloTreeWidget::RegisterCommands(), CFlatFileViewContext::RegisterCommands(), CTextPanel::RegisterCommands(), CSeqGraphicWidget::RegisterCommands(), CViewManagerService::RegisterFactory(), WidgetsData_RegisterCommands(), WidgetsWx_RegisterCommands(), CFrameworkDemoGUI::x_RegisterCommands(), CAlignPackage::x_RegisterCommands(), CSeqPackage::x_RegisterCommands(), and CSeqTableGridPanel::x_SetUpMenu().
int CUICommandRegistry::RegisterCommand | ( | TCmdID | cmd_id, |
string | menu_label, | ||
string | label, | ||
string | icon_alias, | ||
string | hint = kEmptyStr , |
||
string | description = kEmptyStr , |
||
string | help_id = kEmptyStr , |
||
wxItemKind | kind = wxITEM_NORMAL |
||
) |
create a CUICommand and registers it
Definition at line 238 of file ui_command.cpp.
References cmd, eCmdInvalid, label, and RegisterCommand().
|
protected |
Definition at line 208 of file ui_command.hpp.
Referenced by AddAccelerator(), and ApplyAccelerators().
|
protected |
Definition at line 205 of file ui_command.hpp.
Referenced by AppendTool(), FindCommandByID(), FindCommandByName(), RegisterCommand(), and ~CUICommandRegistry().
|
protected |
Definition at line 204 of file ui_command.hpp.
Referenced by RegisterCommand().
|
staticprotected |