X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7f555861b7e50f335c7b929bb76be38e9ebd69c5..0ed9a934caaaf8bc3a88a239bed84eefa6a06df2:/docs/latex/wx/menu.tex diff --git a/docs/latex/wx/menu.tex b/docs/latex/wx/menu.tex index 8d2b277cf5..9823528169 100644 --- a/docs/latex/wx/menu.tex +++ b/docs/latex/wx/menu.tex @@ -12,6 +12,10 @@ identify the selection, or to change the menu item in some way. \helpref{wxEvtHandler}{wxevthandler}\\ \helpref{wxObject}{wxobject} +\wxheading{Include files} + + + \wxheading{Event handling} If the menu is part of a menubar, then \helpref{wxMenuBar}{wxmenubar} event processing is used. @@ -47,12 +51,28 @@ Constructs a wxMenu object. \docparam{func}{A callback function if the menu is used as a popup using \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu}.} +\pythonnote{The wxPython version of the \tt{wxMenu} constructor +doesn't accept the callback argument because of reference counting +issues. There is a specialized wxMenu constructor called +\tt{wxPyMenu} which does and can be used for PopupMenus when callbacks +are needed. You must retain a reference to the menu while useing it +otherwise your callback function will get dereferenced when the menu +does. +} + \membersection{wxMenu::\destruct{wxMenu}} \func{}{\destruct{wxMenu}}{\void} Destructor, destroying the menu. +Note: under Motif, a popup menu must have a valid parent (the window +it was last popped up on) when being destroyed. Therefore, make sure +you delete or re-use the popup menu {\it before} destroying the +parent window. Re-use in this context means popping up the menu on +a different window from last time, which causes an implicit destruction +and recreation of internal data structures. + \membersection{wxMenu::Append}\label{wxmenuappend} \func{void}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp @@ -97,6 +117,17 @@ creation of a menu or menubar. \helpref{wxMenu::AppendSeparator}{wxmenuappendseparator}, \helpref{wxMenu::SetLabel}{wxmenusetlabel}, \helpref{wxMenu::GetHelpString}{wxmenugethelpstring},\rtfsp \helpref{wxMenu::SetHelpString}{wxmenusethelpstring}, \helpref{wxMenuItem}{wxmenuitem} + +\pythonnote{In place of a single overloaded method name, wxPython +implements the following methods:\par +\indented{2cm}{\begin{twocollist} +\twocolitem{\bf{Append(id, string, helpStr="", checkable=FALSE)}}{} +\twocolitem{\bf{AppendMenu(id, string, aMenu, helpStr="")}}{} +\twocolitem{\bf{AppendItem(aMenuItem)}}{} +\end{twocollist}} +} + + \membersection{wxMenu::AppendSeparator}\label{wxmenuappendseparator} \func{void}{AppendSeparator}{\void} @@ -170,13 +201,14 @@ before matching. \membersection{wxMenu::FindItemForId}\label{wxmenufinditemforid} -\constfunc{wxMenuItem*}{FindItemForId}{\param{int}{ id}} +\constfunc{wxMenuItem*}{FindItemForId}{\param{int}{ id}, \param{wxMenu **}{ menuForItem = NULL}} Finds the menu item object associated with the given menu item identifier. \wxheading{Parameters} \docparam{id}{Menu item identifier.} +\docparam{menuForItem}{will be filled with the menu for this item if not NULL.} \wxheading{Return value} @@ -323,6 +355,18 @@ This is relevant only to popup menus. \helpref{wxMenu::SetTitle}{wxmenusettitle} +\membersection{wxMenu::UpdateUI}\label{wxmenuupdateui} + +\constfunc{void}{UpdateUI}{\param{wxEvtHandler*}{ source = NULL}} + +Sends events to {\it source} (or owning window if NULL) to update the +menu UI. This is called just before the menu is popped up with \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu}, but +the 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. @@ -332,6 +376,10 @@ A menu bar is a series of menus accessible from the top of a frame. \helpref{wxEvtHandler}{wxevthandler}\\ \helpref{wxObject}{wxobject} +\wxheading{Include files} + + + \wxheading{Event handling} To respond to a menu selection, provide a handler for EVT\_MENU, in the frame @@ -362,6 +410,10 @@ menu bar.} \docparam{titles}{An array of title strings. Deallocate this array after creating the menu bar.} +\pythonnote{Only the default constructor is supported in wxPython. +Use wxMenuBar.Append instead.} + + \membersection{wxMenuBar::\destruct{wxMenuBar}} \func{void}{\destruct{wxMenuBar}}{\void}