]> git.saurik.com Git - wxWidgets.git/blobdiff - docs/latex/wx/menu.tex
1. wxFileDataObject fixes from Ricky Gonzales - seems to work, so demo added
[wxWidgets.git] / docs / latex / wx / menu.tex
index 203e6277c0f5a32b0e48a9a8a97bf225fdaec919..8846d7579bbf01f189c942c3e1f8c0fb390c1e89 100644 (file)
@@ -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}
+
+<wx/menu.h>
+
 \wxheading{Event handling}
 
 If the menu is part of a menubar, then \helpref{wxMenuBar}{wxmenubar} event processing is used.
@@ -37,7 +41,8 @@ this window.
 
 \membersection{wxMenu::wxMenu}\label{wxmenuconstr}
 
-\func{}{wxMenu}{\param{const wxString\& }{title = ""}, \param{const wxFunction}{ func = NULL}}
+\func{}{wxMenu}{\param{const wxString\& }{title = ""},
+ \param{const wxFunction}{ func = NULL}, \param{long}{ style = 0}}
 
 Constructs a wxMenu object.
 
@@ -47,6 +52,25 @@ Constructs a wxMenu object.
 
 \docparam{func}{A callback function if the menu is used as a popup using \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu}.}
 
+\docparam{style}{If set to \tt{wxMENU_TEAROFF}, the menu will be detachable.}
+
+\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.
+}
+
+\func{}{wxMenu}{\param{long}{ style}}
+
+Constructs a wxMenu object.
+
+\wxheading{Parameters}
+
+\docparam{style}{If set to \tt{wxMENU_TEAROFF}, the menu will be detachable.}
+
 \membersection{wxMenu::\destruct{wxMenu}}
 
 \func{}{\destruct{wxMenu}}{\void}
@@ -104,6 +128,15 @@ 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}
@@ -136,6 +169,24 @@ Checks or unchecks the menu item.
 
 \helpref{wxMenu::IsChecked}{wxmenuischecked}
 
+\membersection{wxMenu::Delete}\label{wxmenudelete}
+
+\func{void}{Delete}{\param{int }{id}}
+
+Deletes the menu item from the menu.
+
+\wxheading{Parameters}
+
+\docparam{id}{Menu item to be deleted.}
+
+\wxheading{Remarks}
+
+Does not delete a sub menu, if any.
+
+\wxheading{See also}
+
+\helpref{wxMenu::FindItemForId}{wxmenufinditemforid}
+
 \membersection{wxMenu::Enable}\label{wxmenuenable}
 
 \func{void}{Enable}{\param{int}{ id}, \param{const bool}{ enable}}
@@ -164,7 +215,7 @@ Finds the menu item id for a menu item string.
 
 \wxheading{Return value}
 
-Menu item identifier, or -1 if none is found.
+Menu item identifier, or wxNOT_FOUND if none is found.
 
 \wxheading{Remarks}
 
@@ -179,6 +230,8 @@ before matching.
 
 \constfunc{wxMenuItem*}{FindItemForId}{\param{int}{ id}}
 
+\constfunc{wxMenuItem*}{FindItem}{\param{int}{ id}}
+
 Finds the menu item object associated with the given menu item identifier.
 
 \wxheading{Parameters}
@@ -351,10 +404,22 @@ A menu bar is a series of menus accessible from the top of a frame.
 \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 frame
-that contains the menu bar.
+that contains the menu bar. If you have a toolbar which uses the same identifiers
+as your EVT\_MENU entries, events from the toolbar will also be processed by your
+EVT\_MENU event handlers.
+
+Note that menu commands (and UI update events for menus) are first sent to
+the focus window within the frame. If no window within the frame has the focus,
+then the events are sent directly to the frame. This allows command and UI update
+handling to be processed by specific windows and controls, and not necessarily
+by the application frame.
 
 \wxheading{See also}
 
@@ -381,6 +446,9 @@ 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}
@@ -464,23 +532,25 @@ Finds the menu item id for a menu name/menu item string pair.
 
 \wxheading{Return value}
 
-The menu item identifier, or -1 if none was found.
+The menu item identifier, or wxNOT_FOUND if none was found.
 
 \wxheading{Remarks}
 
 Any special menu codes are stripped out of source and target strings
 before matching.
 
-\membersection{wxMenuBar::FindItemById}\label{wxmenubarfinditembyid}
+\membersection{wxMenuBar::FindItem}\label{wxmenubarfinditem}
 
-\constfunc{wxMenuItem *}{FindItemById}{\param{int}{ id}}
+\constfunc{wxMenuItem *}{FindItem}{\param{int}{ id}, \param{wxMenu}{ **menu = NULL}}
 
-Finds the menu item object associated with the given menu item identifier,
+Finds the menu item object associated with the given menu item identifier.
 
 \wxheading{Parameters}
 
 \docparam{id}{Menu item identifier.}
 
+\docparam{menu}{If not NULL, menu will get set to the associated menu.}
+
 \wxheading{Return value}
 
 The found menu item object, or NULL if one was not found.
@@ -584,6 +654,12 @@ Determines whether an item is enabled.
 
 TRUE if the item was found and is enabled, FALSE otherwise.
 
+\membersection{wxMenuBar::Refresh}\label{wxmenubarrefresh}
+
+\func{void}{Refresh}{\void}
+
+Redraw the menu bar
+
 \membersection{wxMenuBar::SetHelpString}\label{wxmenubarsethelpstring}
 
 \func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}}