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


C++ wxMenu类代码示例

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


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

示例1: AddSpellCheckerEntries

void SubsTextEditCtrl::AddSpellCheckerEntries(wxMenu &menu) {
	if (currentWord.empty()) return;

	sugs = spellchecker->GetSuggestions(currentWord);
	if (spellchecker->CheckWord(currentWord)) {
		if (sugs.empty())
			menu.Append(EDIT_MENU_SUGGESTION,_("No spell checker suggestions"))->Enable(false);
		else {
			wxMenu *subMenu = new wxMenu;
			for (size_t i = 0; i < sugs.size(); ++i)
				subMenu->Append(EDIT_MENU_SUGGESTIONS+i, to_wx(sugs[i]));

			menu.Append(-1, wxString::Format(_("Spell checker suggestions for \"%s\""), to_wx(currentWord)), subMenu);
		}
	}
	else {
		if (sugs.empty())
			menu.Append(EDIT_MENU_SUGGESTION,_("No correction suggestions"))->Enable(false);

		for (size_t i = 0; i < sugs.size(); ++i)
			menu.Append(EDIT_MENU_SUGGESTIONS+i, to_wx(sugs[i]));

		// Append "add word"
		menu.Append(EDIT_MENU_ADD_TO_DICT, wxString::Format(_("Add \"%s\" to dictionary"), to_wx(currentWord)))->Enable(spellchecker->CanAddWord(currentWord));
	}
}
开发者ID:sthenc,项目名称:Aegisub,代码行数:26,代码来源:subs_edit_ctrl.cpp

示例2: AppendAdditionalMenuItems

void CompilerMessages::AppendAdditionalMenuItems(wxMenu &menu)
{
    menu.Append(idMenuFit, _("Fit text"), _("Makes the whole text visible"));
    menu.AppendCheckItem(idMenuAutoFit, _("Fit automatically"),
                         _("Automatically makes the whole text visible during compilation"));
    menu.Check(idMenuAutoFit, m_autoFit);
}
开发者ID:simple-codeblocks,项目名称:Codeblocks,代码行数:7,代码来源:compilermessages.cpp

示例3: CreateCommonMenu

void RightPopupMenu::CreateCommonMenu(wxMenu& menu)
{
	if (m_edited_sprs.empty()) {
		return;
	}

	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_UP_LAYER);
	menu.Append(MENU_UP_LAYER, "ÉÏÒÆÒ»²ã");
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_DOWN_LAYER);
	menu.Append(MENU_DOWN_LAYER, "ÏÂÒÆÒ»²ã");	

	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_UP_MOST);
	menu.Append(MENU_UP_MOST, "ÒƵ½¶¥");
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_DOWN_MOST);
	menu.Append(MENU_DOWN_MOST, "ÒƵ½µ×");

	menu.AppendSeparator();

	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_HORI_MIRROR);
	menu.Append(MENU_HORI_MIRROR, "ˮƽ¾µÏñ");
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_VERT_MIRROR);
	menu.Append(MENU_VERT_MIRROR, "ÊúÖ±¾µÏñ");

	menu.AppendSeparator();

	if (m_edited_sprs.size() == 1) 
	{
		m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_SELECT_SAME);
		menu.Append(MENU_SELECT_SAME, "Ñ¡ÔñÏàͬ");

		menu.AppendSeparator();
	}
}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:33,代码来源:RightPopupMenu.cpp

示例4: connectPopUpMenu

//Hack to allow use (events) of wxmenu inside a tool like simpletexttool
void hdDrawingView::connectPopUpMenu(wxMenu &mnu)
{
    // Connect the main menu
    mnu.Connect(wxEVT_COMMAND_MENU_SELECTED,
                (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &hdDrawingView::OnGenericPopupClick,
                NULL,
                this);

    // Connect all submenus
    wxMenuItem *item;
    wxMenuItemList list = mnu.GetMenuItems();
    for (unsigned int index = 0; index < list.GetCount(); index++)
    {
        wxMenuItemList::compatibility_iterator node = list.Item(index);
        item = (wxMenuItem *) node->GetData();
        if (item->IsSubMenu())
        {
            wxMenu *submenu = item->GetSubMenu();
            submenu->Connect(wxEVT_COMMAND_MENU_SELECTED,
                             (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &hdDrawingView::OnGenericPopupClick,
                             NULL,
                             this);
        }
    }
}
开发者ID:dragansah,项目名称:pgadmin3,代码行数:26,代码来源:hdDrawingView.cpp

示例5: showPopupMenu

    void showPopupMenu( wxMenu& menu ) override
    {
        if( m_grid->GetGridCursorCol() == COL_OPTIONS )
        {
            menu.Append( MYID_OPTIONS_EDITOR, _( "Options Editor..." ), _( "Edit options" ) );
            menu.AppendSeparator();
        }

        GRID_TRICKS::showPopupMenu( menu );
    }
开发者ID:johnbeard,项目名称:kicad,代码行数:10,代码来源:panel_fp_lib_table.cpp

示例6: AddColumnsItems

void wxHeaderCtrlBase::AddColumnsItems(wxMenu& menu, int idColumnsBase)
{
    const unsigned count = GetColumnCount();
    for ( unsigned n = 0; n < count; n++ )
    {
        const wxHeaderColumn& col = GetColumn(n);
        menu.AppendCheckItem(idColumnsBase + n, col.GetTitle());
        if ( col.IsShown() )
            menu.Check(n, true);
    }
}
开发者ID:yinglang,项目名称:newton-dynamics,代码行数:11,代码来源:headerctrlcmn.cpp

示例7: createMenu

void ddColumnOptionIcon::createMenu(wxMenu &mnu)
{
	wxMenuItem *item;

	item = mnu.AppendCheckItem(MNU_COLNULL, _("NULL"));
	item->Check(colOption == null);
	item->Enable(!getOwnerColumn()->isGeneratedForeignKey());
	item = mnu.AppendCheckItem(MNU_COLNOTNULL, _("Not NULL"));
	item->Check(colOption == notnull);
	item->Enable(!getOwnerColumn()->isGeneratedForeignKey());
}
开发者ID:GHnubsST,项目名称:pgadmin3,代码行数:11,代码来源:ddColumnOptionIcon.cpp

示例8: MouseRightDown

bool LocationView::MouseRightDown(const Point2D& mousePt, wxMenu& popupMenu) 
{ 	
	if(IsClicked(mousePt))
	{
		if(popupMenu.GetMenuItems().size() == 0)
		{
			popupMenu.Append(ID_POPUP_MNU_PROPERTIES, wxT("Properties"));
		}

		return true;
	}

	return false;
}
开发者ID:jjhoyt,项目名称:gengis,代码行数:14,代码来源:LocationView.cpp

示例9: CreateDebugMenu

void RightPopupMenu::CreateDebugMenu(wxMenu& menu)
{
	if (m_edited_sprs.empty()) {
		return;
	}

#ifdef _DEBUG
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_INSERT_TO_DTEX);
	menu.Append(MENU_INSERT_TO_DTEX, "Insert To DTex");
	m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_REMOVE_FROM_DTEX);
	menu.Append(MENU_REMOVE_FROM_DTEX, "Remove From DTex");

	menu.AppendSeparator();
#endif
}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:15,代码来源:RightPopupMenu.cpp

示例10: CreateSelectMenu

void RightPopupMenu::CreateSelectMenu(wxMenu& menu)
{
	if (m_selected_sprs.size() <= 1) {
		return;
	}

	int sz = std::min(MENU_MULTI_SELECTED_END - MENU_MULTI_SELECTED + 1, (int)m_selected_sprs.size());
	for (int i = 0; i < sz; ++i) {
		auto spr = m_selected_sprs[i];
		m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_MULTI_SELECTED + i);
		auto name = FileHelper::GetFilename(std::dynamic_pointer_cast<ee::Symbol>(spr->GetSymbol())->GetFilepath());
		menu.Append(MENU_MULTI_SELECTED + i, name.c_str());
	}

	menu.AppendSeparator();
}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:16,代码来源:RightPopupMenu.cpp

示例11: to_wx

void SubsTextEditCtrl::AddThesaurusEntries(wxMenu &menu) {
	if (currentWord.empty()) return;

	if (!thesaurus)
		thesaurus.reset(new Thesaurus);

	std::vector<Thesaurus::Entry> results;
	thesaurus->Lookup(currentWord, &results);

	thesSugs.clear();

	if (results.size()) {
		wxMenu *thesMenu = new wxMenu;

		int curThesEntry = 0;
		for (auto const& result : results) {
			// Single word, insert directly
			if (result.second.size() == 1) {
				thesMenu->Append(EDIT_MENU_THESAURUS_SUGS+curThesEntry, to_wx(result.first));
				thesSugs.push_back(result.first);
				++curThesEntry;
			}
			// Multiple, create submenu
			else {
				wxMenu *subMenu = new wxMenu;
				for (auto const& sug : result.second) {
					subMenu->Append(EDIT_MENU_THESAURUS_SUGS+curThesEntry, to_wx(sug));
					thesSugs.push_back(sug);
					++curThesEntry;
				}

				thesMenu->Append(-1, to_wx(result.first), subMenu);
			}
		}

		menu.Append(-1, wxString::Format(_("Thesaurus suggestions for \"%s\""), to_wx(currentWord)), thesMenu);
	}
	else
		menu.Append(EDIT_MENU_THESAURUS,_("No thesaurus suggestions"))->Enable(false);

	// Append language list
	menu.Append(-1,_("Thesaurus language"), GetLanguagesMenu(
		EDIT_MENU_THES_LANGS,
		to_wx(OPT_GET("Tool/Thesaurus/Language")->GetString()),
		to_wx(thesaurus->GetLanguageList())));
	menu.AppendSeparator();
}
开发者ID:seawaveT,项目名称:Aegisub,代码行数:47,代码来源:subs_edit_ctrl.cpp

示例12: DoPopulateUnRedoMenu

void CommandProcessorBase::DoPopulateUnRedoMenu(wxMenu& menu, bool undoing)
{
    wxString prefix(undoing ? _("Undo ") : _("Redo "));
    int id = FIRST_MENU_ID;
    int count = 0;

    if (undoing) {
        if (GetCommands().size() > 0) {
            for (CLCommand::Vec_t::const_reverse_iterator iter = GetCommands().rbegin() + GetNextUndoCommand(); iter != GetCommands().rend(); ++iter) {
                CLCommand::Ptr_t command = *iter;
                if (command) {
                    wxString label;
                    if (!command->GetUserLabel().empty()) {
                        if (command->GetName().Contains(":")) {
                            label = command->GetName().BeforeFirst(':') + ": ";
                        }
                        label << command->GetUserLabel();
                    } else {
                        if (command == GetOpenCommand()) {
                            label = GetBestLabel(command); // If the command's still open, there won't otherwise be a name string
                        } else {
                            label = command->GetName();
                        }
                    }
                    menu.Append(id++, wxString::Format("%i ", ++count) + prefix + label);
                }
            }
        }
    } else {
        for (CLCommand::Vec_t::const_iterator iter = GetCommands().begin() + GetCurrentCommand() + 1; iter != GetCommands().end(); ++iter) {
            CLCommand::Ptr_t command = *iter;
            if (command) {
                wxString label;
                if (!command->GetUserLabel().empty()) {
                    if (command->GetName().Contains(":")) {
                        label = command->GetName().BeforeFirst(':') + ": ";
                    }
                    label << command->GetUserLabel();
                } else {
                    label = command->GetName();
                }
                menu.Append(id++, wxString::Format("%i ", ++count) + prefix + label);
            }
        }
    }
}
开发者ID:292388900,项目名称:codelite,代码行数:46,代码来源:unredobase.cpp

示例13: BuildContextMenu

void DebuggerMenuHandler::BuildContextMenu(wxMenu &menu, const wxString& word_at_caret, bool is_running)
{
    cbDebuggerPlugin *plugin = Manager::Get()->GetDebuggerManager()->GetActiveDebugger();
    if (!plugin)
        return;

    int item = 0;
    // Insert Run to Cursor
    if (plugin->SupportsFeature(cbDebuggerFeature::RunToCursor))
        menu.Insert(item++, idMenuRunToCursor, _("Run to cursor"));
    if (is_running)
    {
        if (plugin->SupportsFeature(cbDebuggerFeature::SetNextStatement))
            menu.Insert(item++, idMenuSetNextStatement, _("Set next statement"));
        if (item > 0)
            menu.InsertSeparator(item++);
        if (!word_at_caret.empty())
        {
            if (plugin->SupportsFeature(cbDebuggerFeature::Watches))
                menu.Insert(item++, idMenuDebuggerAddWatch, wxString::Format(_("Watch '%s'"), word_at_caret.c_str()));
            // data breakpoint
            if (plugin->SupportsFeature(cbDebuggerFeature::Breakpoints))
            {
                menu.Insert(item++, idMenuAddDataBreakpoint,
                            wxString::Format(_("Add data breakpoint for '%s'"), word_at_caret.c_str()));
            }
        }
    }
    // Insert toggle breakpoint
    if (plugin->SupportsFeature(cbDebuggerFeature::Breakpoints))
        menu.Insert(item++, idMenuToggleBreakpoint, _("Toggle breakpoint"));
    if (item > 0)
        menu.InsertSeparator(item++);
}
开发者ID:stahta01,项目名称:codeblocks_backup,代码行数:34,代码来源:debuggermenu.cpp

示例14: AppendWindowMenuItems

void DebuggerMenuHandler::AppendWindowMenuItems(wxMenu &menu)
{
    std::map<wxString, long> sortedNames;

    for (WindowMenuItemsMap::iterator it = m_windowMenuItems.begin(); it != m_windowMenuItems.end(); ++it)
        sortedNames[it->second.name] = it->first;

    for (std::map<wxString, long>::iterator it = sortedNames.begin(); it != sortedNames.end(); ++it)
        menu.AppendCheckItem(it->second, it->first, m_windowMenuItems[it->second].help);
}
开发者ID:stahta01,项目名称:codeblocks_backup,代码行数:10,代码来源:debuggermenu.cpp

示例15: SetMenu

    void SetMenu( wxMenu* menu, const OS_string& items, EnabledCallback enabledCallback = NULL )
    {
        // protect the MRU so that it is only tied to one menu
        HELIUM_ASSERT( m_Menu == NULL || m_Menu == menu );

        m_Menu = menu;

        m_MenuItemIDToString.clear();

        // Clear out the old menu items
        while ( m_Menu->GetMenuItemCount() > 0 )
        {
            m_Menu->Delete( *( m_Menu->GetMenuItems().begin() ) );
        }

        // Build a new list of menu items from the MRU
        OS_string::ReverseIterator mruItr = items.ReverseBegin();
        OS_string::ReverseIterator mruEnd = items.ReverseEnd();
        for ( ; mruItr != mruEnd; ++mruItr )
        {
            const tstring& item = *mruItr;

            wxMenuItem* menuItem = menu->Append( wxID_ANY, item.c_str() );

            bool enabled = true;
            if ( enabledCallback )
            {
                enabled = (*enabledCallback)( item );
            }

            if ( enabled )
            {
                Connect( menuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MenuMRUEvtHandler::OnMRUMenuItem ), NULL, this );
            }
            else
            {
                menuItem->SetItemLabel( ( item + TXT( " (missing)" ) ).c_str() );
                menuItem->Enable( false );
            }

            m_MenuItemIDToString.insert( M_MenuItemIDToString::value_type( menuItem->GetId(), item ) );
        }
    }
开发者ID:foolhuang,项目名称:Helium,代码行数:43,代码来源:MenuMRU.cpp


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