📄 menu.tex
字号:
First form: menu item identifier, or {\tt wxNOT\_FOUND} if none is found.Second form: returns the menu item object, or NULL if it is not found.\wxheading{Remarks}Any special menu codes are stripped out of source and target stringsbefore matching.\pythonnote{The name of this method in wxPython is {\tt FindItemById} and it does not support the second parameter.}\membersection{wxMenu::FindItemByPosition}\label{wxmenufinditembyposition}\constfunc{wxMenuItem*}{FindItemByPosition}{\param{size\_t }{position}}Returns the wxMenuItem given a position in the menu.\membersection{wxMenu::GetHelpString}\label{wxmenugethelpstring}\constfunc{wxString}{GetHelpString}{\param{int}{ id}}Returns the help string associated with a menu item.\wxheading{Parameters}\docparam{id}{The menu item identifier.}\wxheading{Return value}The help string, or the empty string if there is no help string or theitem was not found.\wxheading{See also}\helpref{wxMenu::SetHelpString}{wxmenusethelpstring}, \helpref{wxMenu::Append}{wxmenuappend}\membersection{wxMenu::GetLabel}\label{wxmenugetlabel}\constfunc{wxString}{GetLabel}{\param{int}{ id}}Returns a menu item label.\wxheading{Parameters}\docparam{id}{The menu item identifier.}\wxheading{Return value}The item label, or the empty string if the item was not found.\wxheading{See also}\helpref{wxMenu::SetLabel}{wxmenusetlabel}\membersection{wxMenu::GetMenuItemCount}\label{wxmenugetmenuitemcount}\constfunc{size\_t}{GetMenuItemCount}{\void}Returns the number of items in the menu.\membersection{wxMenu::GetMenuItems}\label{wxmenugetmenuitems}\constfunc{wxMenuItemList\&}{GetMenuItems}{\void}Returns the list of items in the menu. wxMenuItemList is a pseudo-templatelist class containing wxMenuItem pointers, see \helpref{wxList}{wxlist}.\membersection{wxMenu::GetTitle}\label{wxmenugettitle}\constfunc{wxString}{GetTitle}{\void}Returns the title of the menu.\wxheading{Remarks}This is relevant only to popup menus, use \helpref{wxMenuBar::GetLabelTop}{wxmenubargetlabeltop} for the menus in themenubar.\wxheading{See also}\helpref{wxMenu::SetTitle}{wxmenusettitle}\membersection{wxMenu::Insert}\label{wxmenuinsert}\func{wxMenuItem*}{Insert}{\param{size\_t }{pos}, \param{wxMenuItem *}{item}}\func{wxMenuItem*}{Insert}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp\param{const wxString\& }{ item = ""}, \param{const wxString\& }{helpString = ""},\rtfsp\param{wxItemKind}{ kind = wxITEM\_NORMAL}}Inserts the given {\it item} before the position {\it pos}. Inserting the itemat position \helpref{GetMenuItemCount}{wxmenugetmenuitemcount} is the sameas appending it.\wxheading{See also}\helpref{wxMenu::Append}{wxmenuappend},\rtfsp\helpref{wxMenu::Prepend}{wxmenuprepend}\membersection{wxMenu::InsertCheckItem}\label{wxmenuinsertcheckitem}\func{wxMenuItem*}{InsertCheckItem}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}Inserts a checkable item at the given position.\wxheading{See also}\helpref{wxMenu::Insert}{wxmenuinsert},\rtfsp\helpref{wxMenu::AppendCheckItem}{wxmenuappendcheckitem}\membersection{wxMenu::InsertRadioItem}\label{wxmenuinsertradioitem}\func{wxMenuItem*}{InsertRadioItem}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}Inserts a radio item at the given position.\wxheading{See also}\helpref{wxMenu::Insert}{wxmenuinsert},\rtfsp\helpref{wxMenu::AppendRadioItem}{wxmenuappendradioitem}\membersection{wxMenu::InsertSeparator}\label{wxmenuinsertseparator}\func{wxMenuItem*}{InsertSeparator}{\param{size\_t }{pos}}Inserts a separator at the given position.\wxheading{See also}\helpref{wxMenu::Insert}{wxmenuinsert},\rtfsp\helpref{wxMenu::AppendSeparator}{wxmenuappendseparator}\membersection{wxMenu::IsChecked}\label{wxmenuischecked}\constfunc{bool}{IsChecked}{\param{int}{ id}}Determines whether a menu item is checked.\wxheading{Parameters}\docparam{id}{The menu item identifier.}\wxheading{Return value}true if the menu item is checked, false otherwise.\wxheading{See also}\helpref{wxMenu::Check}{wxmenucheck}\membersection{wxMenu::IsEnabled}\label{wxmenuisenabled}\constfunc{bool}{IsEnabled}{\param{int}{ id}}Determines whether a menu item is enabled.\wxheading{Parameters}\docparam{id}{The menu item identifier.}\wxheading{Return value}true if the menu item is enabled, false otherwise.\wxheading{See also}\helpref{wxMenu::Enable}{wxmenuenable}\membersection{wxMenu::Prepend}\label{wxmenuprepend}\func{wxMenuItem*}{Prepend}{\param{wxMenuItem *}{item}}\func{wxMenuItem*}{Prepend}{\param{int}{ id},\rtfsp\param{const wxString\& }{ item = ""}, \param{const wxString\& }{helpString = ""},\rtfsp\param{wxItemKind}{ kind = wxITEM\_NORMAL}}Inserts the given {\it item} at position $0$, i.e. before all the otherexisting items.\wxheading{See also}\helpref{wxMenu::Append}{wxmenuappend},\rtfsp\helpref{wxMenu::Insert}{wxmenuinsert}\membersection{wxMenu::PrependCheckItem}\label{wxmenuprependcheckitem}\func{wxMenuItem*}{PrependCheckItem}{\param{int}{ id},\rtfsp\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}Inserts a checkable item at position $0$.\wxheading{See also}\helpref{wxMenu::Prepend}{wxmenuprepend},\rtfsp\helpref{wxMenu::AppendCheckItem}{wxmenuappendcheckitem}\membersection{wxMenu::PrependRadioItem}\label{wxmenuprependradioitem}\func{wxMenuItem*}{PrependRadioItem}{\param{int}{ id},\rtfsp\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}Inserts a radio item at position $0$.\wxheading{See also}\helpref{wxMenu::Prepend}{wxmenuprepend},\rtfsp\helpref{wxMenu::AppendRadioItem}{wxmenuappendradioitem}\membersection{wxMenu::PrependSeparator}\label{wxmenuprependseparator}\func{wxMenuItem*}{PrependSeparator}{\void}Inserts a separator at position $0$.\wxheading{See also}\helpref{wxMenu::Prepend}{wxmenuprepend},\rtfsp\helpref{wxMenu::AppendSeparator}{wxmenuappendseparator}\membersection{wxMenu::Remove}\label{wxmenuremove}\func{wxMenuItem *}{Remove}{\param{int }{id}}\func{wxMenuItem *}{Remove}{\param{wxMenuItem *}{item}}Removes the menu item from the menu but doesn't delete the associated C++object. This allows to reuse the same item later by adding it back to the menu(especially useful with submenus).\wxheading{Parameters}\docparam{id}{The identifier of the menu item to remove.}\docparam{item}{The menu item to remove.}\wxheading{Return value}The item which was detached from the menu.\membersection{wxMenu::SetHelpString}\label{wxmenusethelpstring}\func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}}Sets an item's help string.\wxheading{Parameters}\docparam{id}{The menu item identifier.}\docparam{helpString}{The help string to set.}\wxheading{See also}\helpref{wxMenu::GetHelpString}{wxmenugethelpstring}\membersection{wxMenu::SetLabel}\label{wxmenusetlabel}\func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}}Sets the label of a menu item.\wxheading{Parameters}\docparam{id}{The menu item identifier.}\docparam{label}{The menu item label to set.}\wxheading{See also}\helpref{wxMenu::Append}{wxmenuappend}, \helpref{wxMenu::GetLabel}{wxmenugetlabel}\membersection{wxMenu::SetTitle}\label{wxmenusettitle}\func{void}{SetTitle}{\param{const wxString\& }{title}}Sets the title of the menu.\wxheading{Parameters}\docparam{title}{The title to set.}\wxheading{Remarks}This is relevant only to popup menus, use \helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop} for the menus in themenubar.\wxheading{See also}\helpref{wxMenu::GetTitle}{wxmenugettitle}\membersection{wxMenu::UpdateUI}\label{wxmenuupdateui}\constfunc{void}{UpdateUI}{\param{wxEvtHandler*}{ source = NULL}}Sends events to {\it source} (or owning window if NULL) to update themenu UI. This is called just before the menu is popped up with \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu}, butthe application may call it at other times if required.\wxheading{See also}\helpref{wxUpdateUIEvent}{wxupdateuievent}\section{\class{wxMenuBar}}\label{wxmenubar}A menu bar is a series of menus accessible from the top of a frame.\wxheading{Derived from}\helpref{wxWindow}{wxwindow}\\\helpref{wxEvtHandler}{wxevthandler}\\\helpref{wxObject}{wxobject}\wxheading{Include files}<wx/menu.h>\wxheading{Event handling}To respond to a menu selection, provide a handler for EVT\_MENU, in the framethat contains the menu bar. If you have a toolbar which uses the same identifiersas your EVT\_MENU entries, events from the toolbar will also be processed by yourEVT\_MENU event handlers.{\bf Tip:} under Windows, if you discover that menu shortcuts (for example, Alt-F to show the file menu)are not working, check any EVT\_CHAR events you are handling in child windows.If you are not calling {\tt event.Skip()} for events that you don't process in these event handlers,menu shortcuts may cease to work.\wxheading{See also}\helpref{wxMenu}{wxmenu}, \helpref{Event handling overview}{eventhandlingoverview}\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxMenuBar::wxMenuBar}\label{wxmenubarctor}\func{}{wxMenuBar}{\param{long }{style = 0}}Default constructor.\func{}{wxMenuBar}{\param{size\_t}{ n}, \param{wxMenu*}{ menus[]}, \param{const wxString }{titles[]}, \param{long }{style = 0}}Construct a menu bar from arrays of menus and titles.\wxheading{Parameters}\docparam{n}{The number of menus.}\docparam{menus}{An array of menus. Do not use this array again - it now belongs to themenu bar.}\docparam{titles}{An array of title strings. Deallocate this array after creating the menu bar.}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -