X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a660d684eda27638bca0384b2058911a31c8e845..4dba84be231243149a45a286a651d02be8487423:/docs/latex/wx/menu.tex diff --git a/docs/latex/wx/menu.tex b/docs/latex/wx/menu.tex index fa828b464b..29304cf79f 100644 --- a/docs/latex/wx/menu.tex +++ b/docs/latex/wx/menu.tex @@ -21,7 +21,7 @@ With a popup menu, there is a variety of ways to handle a menu selection event \begin{enumerate}\itemsep=0pt \item Define a callback of type wxFunction, which you pass to the wxMenu constructor. -The callback takes a reference to a window, and a reference to a \helpref{wxCommandEvent}{wxcommandevent}. +The callback takes a reference to the menu, and a reference to a \helpref{wxCommandEvent}{wxcommandevent}. \item Derive a new class from wxMenu and define event table entries using the EVT\_MENU macro. \item Set a new event handler for wxMenu, using an object whose class has EVT\_MENU entries. \item Provide EVT\_MENU handlers in the window which pops up the menu, or in an ancestor of @@ -53,14 +53,21 @@ Constructs a wxMenu object. 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{const int}{ id}, \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp +\func{void}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp \param{const bool}{ checkable = FALSE}} Adds a string item to the end of the menu. -\func{void}{Append}{\param{const int}{ id}, \param{const wxString\& }{ item}, \param{wxMenu *}{subMenu},\rtfsp +\func{void}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{wxMenu *}{subMenu},\rtfsp \param{const wxString\& }{helpString = ""}} Adds a pull-right submenu to the end of the menu. @@ -115,7 +122,7 @@ Inserts a break in a menu, causing the next appended item to appear in a new col \membersection{wxMenu::Check}\label{wxmenucheck} -\func{void}{Check}{\param{const int}{ id}, \param{const bool}{ check}} +\func{void}{Check}{\param{int}{ id}, \param{const bool}{ check}} Checks or unchecks the menu item. @@ -131,7 +138,7 @@ Checks or unchecks the menu item. \membersection{wxMenu::Enable}\label{wxmenuenable} -\func{void}{Enable}{\param{const int}{ id}, \param{const bool}{ enable}} +\func{void}{Enable}{\param{int}{ id}, \param{const bool}{ enable}} Enables or disables (greys out) a menu item. @@ -170,7 +177,7 @@ before matching. \membersection{wxMenu::FindItemForId}\label{wxmenufinditemforid} -\constfunc{wxMenuItem*}{FindItemForId}{\param{const int}{ id}} +\constfunc{wxMenuItem*}{FindItemForId}{\param{int}{ id}} Finds the menu item object associated with the given menu item identifier. @@ -188,7 +195,7 @@ Returns the menu item object, or NULL if it is not found. \membersection{wxMenu::GetHelpString}\label{wxmenugethelpstring} -\constfunc{wxString}{GetHelpString}{\param{const int}{ id}} +\constfunc{wxString}{GetHelpString}{\param{int}{ id}} Returns the help string associated with a menu item. @@ -207,7 +214,7 @@ item was not found. \membersection{wxMenu::GetLabel}\label{wxmenugetlabel} -\constfunc{wxString}{GetLabel}{\param{const int}{ id}} +\constfunc{wxString}{GetLabel}{\param{int}{ id}} Returns a menu item label. @@ -239,7 +246,7 @@ This is relevant only to popup menus. \membersection{wxMenu::IsChecked}\label{wxmenuischecked} -\constfunc{bool}{IsChecked}{\param{const int}{ id}} +\constfunc{bool}{IsChecked}{\param{int}{ id}} Determines whether a menu item is checked. @@ -257,7 +264,7 @@ TRUE if the menu item is checked, FALSE otherwise. \membersection{wxMenu::IsEnabled}\label{wxmenuisenabled} -\constfunc{bool}{IsEnabled}{\param{const int}{ id}} +\constfunc{bool}{IsEnabled}{\param{int}{ id}} Determines whether a menu item is enabled. @@ -275,7 +282,7 @@ TRUE if the menu item is enabled, FALSE otherwise. \membersection{wxMenu::SetHelpString}\label{wxmenusethelpstring} -\func{void}{SetHelpString}{\param{const int}{ id}, \param{const wxString\& }{helpString}} +\func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}} Sets an item's help string. @@ -291,7 +298,7 @@ Sets an item's help string. \membersection{wxMenu::SetLabel}\label{wxmenusetlabel} -\func{void}{SetLabel}{\param{const int}{ id}, \param{const wxString\& }{label}} +\func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}} Sets the label of a menu item. @@ -349,7 +356,7 @@ that contains the menu bar. Default constructor. -\func{void}{wxMenuBar}{\param{const int}{ n}, \param{wxMenu*}{ menus[]}, \param{const wxString }{titles[]}} +\func{void}{wxMenuBar}{\param{int}{ n}, \param{wxMenu*}{ menus[]}, \param{const wxString }{titles[]}} Construct a menu bar from arrays of menus and titles. @@ -382,7 +389,7 @@ Adds the item to the end of the menu bar. \membersection{wxMenuBar::Check}\label{wxmenubarcheck} -\func{void}{Check}{\param{const int}{ id}, \param{const bool}{ check}} +\func{void}{Check}{\param{int}{ id}, \param{const bool}{ check}} Checks or unchecks a menu item. @@ -399,7 +406,7 @@ with a frame; otherwise, use the wxMenu equivalent call. \membersection{wxMenuBar::Enable}\label{wxmenubarenable} -\func{void}{Enable}{\param{const int}{ id}, \param{const bool}{ enable}} +\func{void}{Enable}{\param{int}{ id}, \param{const bool}{ enable}} Enables or disables (greys out) a menu item. @@ -416,7 +423,7 @@ associated with a frame; otherwise, use the wxMenu equivalent call. \membersection{wxMenuBar::EnableTop}\label{wxmenubarenabletop} -\func{void}{EnableTop}{\param{const int}{ pos}, \param{const bool}{ enable}} +\func{void}{EnableTop}{\param{int}{ pos}, \param{const bool}{ enable}} Enables or disables a whole menu. @@ -454,7 +461,7 @@ before matching. \membersection{wxMenuBar::FindItemById}\label{wxmenubarfinditembyid} -\constfunc{wxMenuItem *}{FindItemById}{\param{const int}{ id}} +\constfunc{wxMenuItem *}{FindItemById}{\param{int}{ id}} Finds the menu item object associated with the given menu item identifier, @@ -468,7 +475,7 @@ The found menu item object, or NULL if one was not found. \membersection{wxMenuBar::GetHelpString}\label{wxmenubargethelpstring} -\constfunc{wxString}{GetHelpString}{\param{const int}{ id}} +\constfunc{wxString}{GetHelpString}{\param{int}{ id}} Gets the help string associated with the menu item identifer. @@ -487,7 +494,7 @@ was not found. \membersection{wxMenuBar::GetLabel}\label{wxmenubargetlabel} -\constfunc{wxString}{GetLabel}{\param{const int}{ id}} +\constfunc{wxString}{GetLabel}{\param{int}{ id}} Gets the label associated with a menu item. @@ -505,7 +512,7 @@ Use only after the menubar has been associated with a frame. \membersection{wxMenuBar::GetLabelTop}\label{wxmenubargetlabeltop} -\constfunc{wxString}{GetLabelTop}{\param{const int}{ pos}} +\constfunc{wxString}{GetLabelTop}{\param{int}{ pos}} Returns the label of a top-level menu. @@ -525,9 +532,21 @@ Use only after the menubar has been associated with a frame. \helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop} +\membersection{wxMenuBar::GetMenu}\label{wxmenubargetmenu} + +\constfunc{wxMenu*}{GetMenu}{\param{int}{ menuIndex}} + +Returns the menu at {\it menuIndex} (zero-based). + +\membersection{wxMenuBar::GetMenuCount}\label{wxmenubargetmenucount} + +\constfunc{int}{GetMenuCount}{\void} + +Returns the number of menus in this menubar. + \membersection{wxMenuBar::IsChecked}\label{wxmenubarischecked} -\constfunc{bool}{IsChecked}{\param{const int}{ id}} +\constfunc{bool}{IsChecked}{\param{int}{ id}} Determines whether an item is checked. @@ -541,7 +560,7 @@ TRUE if the item was found and is checked, FALSE otherwise. \membersection{wxMenuBar::IsEnabled}\label{wxmenubarisenabled} -\constfunc{bool}{IsEnabled}{\param{const int}{ id}} +\constfunc{bool}{IsEnabled}{\param{int}{ id}} Determines whether an item is enabled. @@ -555,7 +574,7 @@ TRUE if the item was found and is enabled, FALSE otherwise. \membersection{wxMenuBar::SetHelpString}\label{wxmenubarsethelpstring} -\func{void}{SetHelpString}{\param{const int}{ id}, \param{const wxString\& }{helpString}} +\func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}} Sets the help string associated with a menu item. @@ -571,7 +590,7 @@ Sets the help string associated with a menu item. \membersection{wxMenuBar::SetLabel}\label{wxmenubarsetlabel} -\func{void}{SetLabel}{\param{const int}{ id}, \param{const wxString\& }{label}} +\func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}} Sets the label of a menu item. @@ -591,7 +610,7 @@ Use only after the menubar has been associated with a frame. \membersection{wxMenuBar::SetLabelTop}\label{wxmenubarsetlabeltop} -\func{void}{SetLabelTop}{\param{const int}{ pos}, \param{const wxString\& }{label}} +\func{void}{SetLabelTop}{\param{int}{ pos}, \param{const wxString\& }{label}} Sets the label of a top-level menu.