示例#1
0
/**
 *\fn           HRESULT GetAllCommandBar(LIST_STR &lstCommandBar)
 *\brief        得到所有命令栏
 *\param[out]   LIST_STR & lstCommandBar 
 *\return       HRESULT 0成功,其它失败
 */
HRESULT CAddinProcess::GetAllCommandBar(LIST_STR &lstCommandBar)
{
    int nCount = 0;

    BSTR bstrName;

    CComPtr<CommandBar> pCommandBar;

    HRESULT hr = m_pCommandBars->get_Count(&nCount);

    for (int i = 1; i <= nCount; i++)
    {
        pCommandBar = NULL;

        hr = GetCommandBar(i, &pCommandBar);

        if (NULL == pCommandBar) continue;

        hr = pCommandBar->get_Name(&bstrName);

        std::string name = BstrToStr(bstrName);

        lstCommandBar.push_back(name);

        AtlTrace("%d %s\n", i, name.c_str());
    }

    return hr;
}
示例#2
0
void wxGISApplication::ShowToolBarMenu(void)
{
	wxGISToolBarMenu* pToolBarMenu = static_cast<wxGISToolBarMenu*>(GetCommandBar(TOOLBARMENUNAME));
	if(pToolBarMenu)
	{
		PopupMenu(pToolBarMenu);
	}
}
void wxGISApplicationEx::Customize(void)
{
	wxGISCustomizeDlg dialog(this);
	if(dialog.ShowModal() == wxID_OK )
	{
		if(m_pGISAcceleratorTable->HasChanges())
			SetAcceleratorTable(m_pGISAcceleratorTable->GetAcceleratorTable());
		wxGISToolBarMenu* pToolBarMenu =  static_cast<wxGISToolBarMenu*>(GetCommandBar(TOOLBARMENUNAME));
		if(pToolBarMenu)
			pToolBarMenu->Update();
	}
}
示例#4
0
void wxGISApplication::OnCommand(wxCommandEvent& event)
{
    event.Skip();
	if(event.GetId() >= ID_PLUGINCMD && event.GetId() <= ID_PLUGINCMDMAX)
		Command(GetCommand(event.GetId()));
	else if(event.GetId() >= ID_TOOLBARCMD && event.GetId() <= ID_TOOLBARCMDMAX)
	{
		wxGISToolBarMenu* pToolBarMenu = static_cast<wxGISToolBarMenu*>(GetCommandBar(TOOLBARMENUNAME));
		if(pToolBarMenu)
			pToolBarMenu->OnCommand(event);
	}
}
示例#5
0
/**
 *\fn           HRESULT GetCommandBarControls(const char *pszName, CommandBarControls **ppCommandBarControls)
 *\brief        得到菜单
 *\param[in]    const char * pszName 命令条名称(菜单名)
 *\param[out]   CommandBarControls * * ppCommandBarControls 菜单
 *\return       HRESULT 0成功,其它失败
 */
HRESULT CAddinProcess::GetCommandBarControls(const char *pszName, CommandBarControls **ppCommandBarControls)
{
    CComPtr<CommandBar> pCommandBar;
    HRESULT hr = GetCommandBar(pszName, &pCommandBar);

    if (SUCCEEDED(hr))
    {
        hr = pCommandBar->get_Controls(ppCommandBarControls);
    }

    return hr;
}
示例#6
0
/**
 *\fn           HRESULT GetCommandBarControls(unsigned int nIndex, CommandBarControls **ppCommandBarControls)
 *\brief        得到菜单
 *\param[in]    unsigned int nIndex 序号
 *\param[out]   CommandBarControls * * ppCommandBarControls 菜单
 *\return       HRESULT 0成功,其它失败
 */
HRESULT CAddinProcess::GetCommandBarControls(unsigned int nIndex, CommandBarControls **ppCommandBarControls)
{
    CComPtr<CommandBar> pCommandBar;
    HRESULT hr = GetCommandBar(nIndex, &pCommandBar);

    if (SUCCEEDED(hr))
    {
        hr = pCommandBar->get_Controls(ppCommandBarControls);
    }

    return hr;
}