当前位置: 首页>>代码示例>>C++>>正文


C++ wxMenu::Destroy方法代码示例

本文整理汇总了C++中wxMenu::Destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMenu::Destroy方法的具体用法?C++ wxMenu::Destroy怎么用?C++ wxMenu::Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxMenu的用法示例。


在下文中一共展示了wxMenu::Destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ApplyBranding

void RebrandingHelper::ApplyBranding(wxMenu & menu, wxString scope)
{
    size_t separatorIndex = 0;

	wxMenuItemList & itemsList = menu.GetMenuItems();
	for(auto itemIt = itemsList.begin(); itemIt != itemsList.end();++itemIt)
	{
	    wxMenuItem * item = *itemIt;
	    if (!item) continue;

        wxString name = menu.GetLabelText(item->GetId());
        if (item->GetId() == wxID_SEPARATOR)
        {
            name = "Separator_";
            name << separatorIndex;
            separatorIndex++;
        }

	    wxString itemScope = scope + "." + name;

	    if (ShouldDelete(itemScope)) menu.Destroy(item);
	    else if (ShouldRename(itemScope)) item->SetItemLabel(GetNewName(itemScope));
	}
}
开发者ID:HaoDrang,项目名称:GD,代码行数:24,代码来源:RebrandingHelper.cpp

示例2: OnToolsClicked

/**
  * Invoked when user selects the "Menu" item
  */
void WebFrame::OnToolsClicked(wxCommandEvent& WXUNUSED(evt))
{
    if(m_browser->GetCurrentURL() == "")
        return;

    m_tools_tiny->Check(false);
    m_tools_small->Check(false);
    m_tools_medium->Check(false);
    m_tools_large->Check(false);
    m_tools_largest->Check(false);

    wxWebViewZoom zoom = m_browser->GetZoom();
    switch (zoom)
    {
    case wxWEBVIEW_ZOOM_TINY:
        m_tools_tiny->Check();
        break;
    case wxWEBVIEW_ZOOM_SMALL:
        m_tools_small->Check();
        break;
    case wxWEBVIEW_ZOOM_MEDIUM:
        m_tools_medium->Check();
        break;
    case wxWEBVIEW_ZOOM_LARGE:
        m_tools_large->Check();
        break;
    case wxWEBVIEW_ZOOM_LARGEST:
        m_tools_largest->Check();
        break;
    }

    m_edit_cut->Enable(m_browser->CanCut());
    m_edit_copy->Enable(m_browser->CanCopy());
    m_edit_paste->Enable(m_browser->CanPaste());

    m_edit_undo->Enable(m_browser->CanUndo());
    m_edit_redo->Enable(m_browser->CanRedo());

    m_selection_clear->Enable(m_browser->HasSelection());
    m_selection_delete->Enable(m_browser->HasSelection());

    m_context_menu->Check(m_browser->IsContextMenuEnabled());

    //Firstly we clear the existing menu items, then we add the current ones
    wxMenuHistoryMap::const_iterator it;
    for( it = m_histMenuItems.begin(); it != m_histMenuItems.end(); ++it )
    {
        m_tools_history_menu->Destroy(it->first);
    }
    m_histMenuItems.clear();

    wxVector<wxSharedPtr<wxWebViewHistoryItem> > back = m_browser->GetBackwardHistory();
    wxVector<wxSharedPtr<wxWebViewHistoryItem> > forward = m_browser->GetForwardHistory();

    wxMenuItem* item;

    unsigned int i;
    for(i = 0; i < back.size(); i++)
    {
        item = m_tools_history_menu->AppendRadioItem(wxID_ANY, back[i]->GetTitle());
        m_histMenuItems[item->GetId()] = back[i];
        Connect(item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
                wxCommandEventHandler(WebFrame::OnHistory), NULL, this );
    }

    wxString title = m_browser->GetCurrentTitle();
    if ( title.empty() )
        title = "(untitled)";
    item = m_tools_history_menu->AppendRadioItem(wxID_ANY, title);
    item->Check();

    //No need to connect the current item
    m_histMenuItems[item->GetId()] = wxSharedPtr<wxWebViewHistoryItem>(new wxWebViewHistoryItem(m_browser->GetCurrentURL(), m_browser->GetCurrentTitle()));

    for(i = 0; i < forward.size(); i++)
    {
        item = m_tools_history_menu->AppendRadioItem(wxID_ANY, forward[i]->GetTitle());
        m_histMenuItems[item->GetId()] = forward[i];
        Connect(item->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
                wxCommandEventHandler(WebFrame::OnHistory), NULL, this );
    }

    wxPoint position = ScreenToClient( wxGetMousePosition() );
    PopupMenu(m_tools_menu, position.x, position.y);
}
开发者ID:anhlehoang410,项目名称:wxWebViewChromium,代码行数:88,代码来源:webview.cpp


注:本文中的wxMenu::Destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。