1 \section{\class{wxMenu
}}\label{wxmenu
}
3 A menu is a popup (or pull down) list of items, one of which may be
4 selected before the menu goes away (clicking elsewhere dismisses the
5 menu). Menus may be used to construct either menu bars or popup menus.
7 A menu item has an integer ID associated with it which can be used to
8 identify the selection, or to change the menu item in some way.
10 \wxheading{Derived from
}
12 \helpref{wxEvtHandler
}{wxevthandler
}\\
13 \helpref{wxObject
}{wxobject
}
15 \wxheading{Include files
}
19 \wxheading{Event handling
}
21 If the menu is part of a menubar, then
\helpref{wxMenuBar
}{wxmenubar
} event processing is used.
23 With a popup menu, there is a variety of ways to handle a menu selection event
24 (wxEVT
\_COMMAND\_MENU\_SELECTED).
26 \begin{enumerate
}\itemsep=
0pt
27 \item Derive a new class from wxMenu and define event table entries using the EVT
\_MENU macro.
28 \item Set a new event handler for wxMenu, using an object whose class has EVT
\_MENU entries.
29 \item Provide EVT
\_MENU handlers in the window which pops up the menu, or in an ancestor of
31 \item Define a callback of type wxFunction, which you pass to the wxMenu constructor.
32 The callback takes a reference to the menu, and a reference to a
33 \helpref{wxCommandEvent
}{wxcommandevent
}. This method is deprecated and should
34 not be used in the new code, it is provided for backwards compatibility only.
39 \helpref{wxMenuBar
}{wxmenubar
},
\helpref{wxWindow::PopupMenu
}{wxwindowpopupmenu
},
\rtfsp
40 \helpref{Event handling overview
}{eventhandlingoverview
}
42 \latexignore{\rtfignore{\wxheading{Members
}}}
44 \membersection{wxMenu::wxMenu
}\label{wxmenuconstr
}
46 \func{}{wxMenu
}{\param{const wxString\&
}{title = ""
},
\param{long
}{ style =
0}}
48 Constructs a wxMenu object.
50 \wxheading{Parameters
}
52 \docparam{title
}{A title for the popup menu: the empty string denotes no title.
}
54 \docparam{style
}{If set to
{\tt wxMENU
\_TEAROFF}, the menu will be detachable (wxGTK only).
}
56 \func{}{wxMenu
}{\param{long
}{ style
}}
58 Constructs a wxMenu object.
60 \wxheading{Parameters
}
62 \docparam{style
}{If set to
{\tt wxMENU
\_TEAROFF}, the menu will be detachable (wxGTK only).
}
64 \membersection{wxMenu::
\destruct{wxMenu
}}
66 \func{}{\destruct{wxMenu
}}{\void}
68 Destructor, destroying the menu.
70 Note: under Motif, a popup menu must have a valid parent (the window
71 it was last popped up on) when being destroyed. Therefore, make sure
72 you delete or re-use the popup menu
{\it before
} destroying the
73 parent window. Re-use in this context means popping up the menu on
74 a different window from last time, which causes an implicit destruction
75 and recreation of internal data structures.
77 \membersection{wxMenu::Append
}\label{wxmenuappend
}
79 \func{void
}{Append
}{\param{int
}{ id
},
\param{const wxString\&
}{ item
},
\param{const wxString\&
}{helpString = ""
},
\rtfsp
80 \param{const bool
}{ checkable = FALSE
}}
82 Adds a string item to the end of the menu.
84 \func{void
}{Append
}{\param{int
}{ id
},
\param{const wxString\&
}{ item
},
\param{wxMenu *
}{subMenu
},
\rtfsp
85 \param{const wxString\&
}{helpString = ""
}}
87 Adds a pull-right submenu to the end of the menu.
89 \func{void
}{Append
}{\param{wxMenuItem*
}{ menuItem
}}
91 Adds a menu item object. This is the most generic variant of Append() method
92 because it may be used for both items (including separators) and submenus and
93 because you can also specify various extra properties of a menu item this way,
94 such as bitmaps and fonts.
96 \wxheading{Parameters
}
98 \docparam{id
}{The menu command identifier.
}
100 \docparam{item
}{The string to appear on the menu item.
}
102 \docparam{menu
}{Pull-right submenu.
}
104 \docparam{checkable
}{If TRUE, this item is checkable.
}
106 \docparam{helpString
}{An optional help string associated with the item.
107 By default,
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays
108 this string in the status line.
}
110 \docparam{menuItem
}{A menuitem object. It will be owned by the wxMenu object after this function
111 is called, so do not delete it yourself.
}
115 This command can be used after the menu has been shown, as well as on initial
116 creation of a menu or menubar.
120 \helpref{wxMenu::AppendSeparator
}{wxmenuappendseparator
},
\rtfsp
121 \helpref{wxMenu::Insert
}{wxmenuinsert
},
\rtfsp
122 \helpref{wxMenu::SetLabel
}{wxmenusetlabel
},
\helpref{wxMenu::GetHelpString
}{wxmenugethelpstring
},
\rtfsp
123 \helpref{wxMenu::SetHelpString
}{wxmenusethelpstring
},
\helpref{wxMenuItem
}{wxmenuitem
}
125 \pythonnote{In place of a single overloaded method name, wxPython
126 implements the following methods:
\par
127 \indented{2cm
}{\begin{twocollist
}
128 \twocolitem{{\bf Append(id, string, helpStr="", checkable=FALSE)
}}{}
129 \twocolitem{{\bf AppendMenu(id, string, aMenu, helpStr="")
}}{}
130 \twocolitem{{\bf AppendItem(aMenuItem)
}}{}
134 \membersection{wxMenu::AppendSeparator
}\label{wxmenuappendseparator
}
136 \func{void
}{AppendSeparator
}{\void}
138 Adds a separator to the end of the menu.
142 \helpref{wxMenu::Append
}{wxmenuappend
}
144 \membersection{wxMenu::Break
}\label{wxmenubreak
}
146 \func{void
}{Break
}{\void}
148 Inserts a break in a menu, causing the next appended item to appear in a new column.
150 \membersection{wxMenu::Check
}\label{wxmenucheck
}
152 \func{void
}{Check
}{\param{int
}{ id
},
\param{const bool
}{ check
}}
154 Checks or unchecks the menu item.
156 \wxheading{Parameters
}
158 \docparam{id
}{The menu item identifier.
}
160 \docparam{check
}{If TRUE, the item will be checked, otherwise it will be unchecked.
}
164 \helpref{wxMenu::IsChecked
}{wxmenuischecked
}
166 \membersection{wxMenu::Delete
}\label{wxmenudelete
}
168 \func{void
}{Delete
}{\param{int
}{id
}}
170 \func{void
}{Delete
}{\param{wxMenuItem *
}{item
}}
172 Deletes the menu item from the menu. If the item is a submenu, it will
173 {\bf not
} be deleted. Use
\helpref{Destroy
}{wxmenudestroy
} if you want to
176 \wxheading{Parameters
}
178 \docparam{id
}{Id of the menu item to be deleted.
}
180 \docparam{item
}{Menu item to be deleted.
}
184 \helpref{wxMenu::FindItem
}{wxmenufinditem
},
\rtfsp
185 \helpref{wxMenu::Destroy
}{wxmenudestroy
},
\rtfsp
186 \helpref{wxMenu::Remove
}{wxmenuremove
}
188 \membersection{wxMenu::Destroy
}\label{wxmenudestroy
}
190 \func{void
}{Destroy
}{\param{int
}{id
}}
192 \func{void
}{Destroy
}{\param{wxMenuItem *
}{item
}}
194 Deletes the menu item from the menu. If the item is a submenu, it will
195 be deleted. Use
\helpref{Remove
}{wxmenuremove
} if you want to keep the submenu
196 (for example, to reuse it later).
198 \wxheading{Parameters
}
200 \docparam{id
}{Id of the menu item to be deleted.
}
202 \docparam{item
}{Menu item to be deleted.
}
206 \helpref{wxMenu::FindItem
}{wxmenufinditem
},
\rtfsp
207 \helpref{wxMenu::Deletes
}{wxmenudelete
},
\rtfsp
208 \helpref{wxMenu::Remove
}{wxmenuremove
}
210 \membersection{wxMenu::Enable
}\label{wxmenuenable
}
212 \func{void
}{Enable
}{\param{int
}{ id
},
\param{const bool
}{ enable
}}
214 Enables or disables (greys out) a menu item.
216 \wxheading{Parameters
}
218 \docparam{id
}{The menu item identifier.
}
220 \docparam{enable
}{TRUE to enable the menu item, FALSE to disable it.
}
224 \helpref{wxMenu::IsEnabled
}{wxmenuisenabled
}
226 \membersection{wxMenu::FindItem
}\label{wxmenufinditem
}
228 \constfunc{int
}{FindItem
}{\param{const wxString\&
}{itemString
}}
230 Finds the menu item id for a menu item string.
232 \constfunc{wxMenuItem *
}{FindItem
}{\param{int
}{ id
},
\param{wxMenu **
}{menu = NULL
}}
234 Finds the menu item object associated with the given menu item identifier and,
235 optionally, the (sub)menu it belongs to.
237 \perlnote{In wxPerl this method takes just the
{\tt id
} parameter;
238 in scalar context it returns the associated
{\tt Wx::MenuItem
}, in list
239 context it returns a
2-element list
{\tt ( item, submenu )
}}
241 \wxheading{Parameters
}
243 \docparam{itemString
}{Menu item string to find.
}
245 \docparam{id
}{Menu item identifier.
}
247 \docparam{menu
}{If the pointer is not NULL, it will be filled with the items
248 parent menu (if the item was found)
}
250 \wxheading{Return value
}
252 First form: menu item identifier, or wxNOT
\_FOUND if none is found.
254 Second form: returns the menu item object, or NULL if it is not found.
258 Any special menu codes are stripped out of source and target strings
261 \pythonnote{The name of this method in wxPython is
{\tt FindItemById
}
262 and it does not support the second parameter.
}
264 \membersection{wxMenu::GetHelpString
}\label{wxmenugethelpstring
}
266 \constfunc{wxString
}{GetHelpString
}{\param{int
}{ id
}}
268 Returns the help string associated with a menu item.
270 \wxheading{Parameters
}
272 \docparam{id
}{The menu item identifier.
}
274 \wxheading{Return value
}
276 The help string, or the empty string if there is no help string or the
281 \helpref{wxMenu::SetHelpString
}{wxmenusethelpstring
},
\helpref{wxMenu::Append
}{wxmenuappend
}
283 \membersection{wxMenu::GetLabel
}\label{wxmenugetlabel
}
285 \constfunc{wxString
}{GetLabel
}{\param{int
}{ id
}}
287 Returns a menu item label.
289 \wxheading{Parameters
}
291 \docparam{id
}{The menu item identifier.
}
293 \wxheading{Return value
}
295 The item label, or the empty string if the item was not found.
299 \helpref{wxMenu::SetLabel
}{wxmenusetlabel
}
301 \membersection{wxMenu::GetMenuItemCount
}\label{wxmenugetmenuitemcount
}
303 \constfunc{size
\_t}{GetMenuItemCount
}{\void}
305 Returns the number of items in the menu.
307 \membersection{wxMenu::GetMenuItems
}\label{wxmenugetmenuitems
}
309 \constfunc{wxMenuItemList\&
}{GetMenuItems
}{\void}
311 Returns the list of items in the menu. wxMenuItemList is a pseudo-template
312 list class containing wxMenuItem pointers.
314 \membersection{wxMenu::GetTitle
}\label{wxmenugettitle
}
316 \constfunc{wxString
}{GetTitle
}{\void}
318 Returns the title of the menu.
322 This is relevant only to popup menus.
326 \helpref{wxMenu::SetTitle
}{wxmenusettitle
}
328 \membersection{wxMenu::Insert
}\label{wxmenuinsert
}
330 \func{bool
}{Insert
}{\param{size
\_t }{pos
},
\param{wxMenuItem *
}{item
}}
332 Inserts the given
{\it item
} before the position
{\it pos
}. Inserting the item
333 at the position
\helpref{GetMenuItemCount
}{wxmenugetmenuitemcount
} is the same
338 \helpref{wxMenu::Append
}{wxmenuappend
}
340 \membersection{wxMenu::IsChecked
}\label{wxmenuischecked
}
342 \constfunc{bool
}{IsChecked
}{\param{int
}{ id
}}
344 Determines whether a menu item is checked.
346 \wxheading{Parameters
}
348 \docparam{id
}{The menu item identifier.
}
350 \wxheading{Return value
}
352 TRUE if the menu item is checked, FALSE otherwise.
356 \helpref{wxMenu::Check
}{wxmenucheck
}
358 \membersection{wxMenu::IsEnabled
}\label{wxmenuisenabled
}
360 \constfunc{bool
}{IsEnabled
}{\param{int
}{ id
}}
362 Determines whether a menu item is enabled.
364 \wxheading{Parameters
}
366 \docparam{id
}{The menu item identifier.
}
368 \wxheading{Return value
}
370 TRUE if the menu item is enabled, FALSE otherwise.
374 \helpref{wxMenu::Enable
}{wxmenuenable
}
376 \membersection{wxMenu::Remove
}\label{wxmenuremove
}
378 \func{wxMenuItem *
}{Remove
}{\param{int
}{id
}}
380 \func{wxMenuItem *
}{Remove
}{\param{wxMenuItem *
}{item
}}
382 Removes the menu item from the menu but doesn't delete the associated C++
383 object. This allows to reuse the same item later by adding it back to the menu
384 (especially useful with submenus).
386 \wxheading{Parameters
}
388 \docparam{id
}{The identifier of the menu item to remove.
}
390 \docparam{item
}{The menu item to remove.
}
392 \wxheading{Return value
}
394 The item which was detached from the menu.
396 \membersection{wxMenu::SetHelpString
}\label{wxmenusethelpstring
}
398 \func{void
}{SetHelpString
}{\param{int
}{ id
},
\param{const wxString\&
}{helpString
}}
400 Sets an item's help string.
402 \wxheading{Parameters
}
404 \docparam{id
}{The menu item identifier.
}
406 \docparam{helpString
}{The help string to set.
}
410 \helpref{wxMenu::GetHelpString
}{wxmenugethelpstring
}
412 \membersection{wxMenu::SetLabel
}\label{wxmenusetlabel
}
414 \func{void
}{SetLabel
}{\param{int
}{ id
},
\param{const wxString\&
}{label
}}
416 Sets the label of a menu item.
418 \wxheading{Parameters
}
420 \docparam{id
}{The menu item identifier.
}
422 \docparam{label
}{The menu item label to set.
}
426 \helpref{wxMenu::Append
}{wxmenuappend
},
\helpref{wxMenu::GetLabel
}{wxmenugetlabel
}
428 \membersection{wxMenu::SetTitle
}\label{wxmenusettitle
}
430 \func{void
}{SetTitle
}{\param{const wxString\&
}{title
}}
432 Sets the title of the menu.
434 \wxheading{Parameters
}
436 \docparam{title
}{The title to set.
}
440 This is relevant only to popup menus.
444 \helpref{wxMenu::SetTitle
}{wxmenusettitle
}
446 \membersection{wxMenu::UpdateUI
}\label{wxmenuupdateui
}
448 \constfunc{void
}{UpdateUI
}{\param{wxEvtHandler*
}{ source = NULL
}}
450 Sends events to
{\it source
} (or owning window if NULL) to update the
451 menu UI. This is called just before the menu is popped up with
\helpref{wxWindow::PopupMenu
}{wxwindowpopupmenu
}, but
452 the application may call it at other times if required.
456 \helpref{wxUpdateUIEvent
}{wxupdateuievent
}
458 \section{\class{wxMenuBar
}}\label{wxmenubar
}
460 A menu bar is a series of menus accessible from the top of a frame.
462 \wxheading{Derived from
}
464 \helpref{wxEvtHandler
}{wxevthandler
}\\
465 \helpref{wxObject
}{wxobject
}
467 \wxheading{Include files
}
471 \wxheading{Event handling
}
473 To respond to a menu selection, provide a handler for EVT
\_MENU, in the frame
474 that contains the menu bar. If you have a toolbar which uses the same identifiers
475 as your EVT
\_MENU entries, events from the toolbar will also be processed by your
476 EVT
\_MENU event handlers.
478 Note that menu commands (and UI update events for menus) are first sent to
479 the focus window within the frame. If no window within the frame has the focus,
480 then the events are sent directly to the frame. This allows command and UI update
481 handling to be processed by specific windows and controls, and not necessarily
482 by the application frame.
484 {\bf Tip:
} under Windows, if you discover that menu shortcuts (for example, Alt-F to show the file menu)
485 are not working, check any EVT
\_CHAR events you are handling in child windows.
486 If you are not calling
{\tt event.Skip()
} for events that you don't process in these event handlers,
487 menu shortcuts may cease to work.
491 \helpref{wxMenu
}{wxmenu
},
\helpref{Event handling overview
}{eventhandlingoverview
}
493 \latexignore{\rtfignore{\wxheading{Members
}}}
495 \membersection{wxMenuBar::wxMenuBar
}\label{wxmenubarconstr
}
497 \func{void
}{wxMenuBar
}{\param{long
}{style =
0}}
501 \func{void
}{wxMenuBar
}{\param{int
}{ n
},
\param{wxMenu*
}{ menus
[]},
\param{const wxString
}{titles
[]}}
503 Construct a menu bar from arrays of menus and titles.
505 \wxheading{Parameters
}
507 \docparam{n
}{The number of menus.
}
509 \docparam{menus
}{An array of menus. Do not use this array again - it now belongs to the
512 \docparam{titles
}{An array of title strings. Deallocate this array after creating the menu bar.
}
514 \docparam{style
}{If
{\tt wxMB
\_DOCKABLE} the menu bar can be detached (wxGTK only).
}
516 \pythonnote{Only the default constructor is supported in wxPython.
517 Use wxMenuBar.Append instead.
}
519 \perlnote{wxPerl only supports the first contructor:
520 use
{\tt Append
} instead.
}
522 \membersection{wxMenuBar::
\destruct{wxMenuBar
}}
524 \func{void
}{\destruct{wxMenuBar
}}{\void}
526 Destructor, destroying the menu bar and removing it from the parent frame (if any).
528 \membersection{wxMenuBar::Append
}\label{wxmenubarappend
}
530 \func{bool
}{Append
}{\param{wxMenu *
}{menu
},
\param{const wxString\&
}{title
}}
532 Adds the item to the end of the menu bar.
534 \wxheading{Parameters
}
536 \docparam{menu
}{The menu to add. Do not deallocate this menu after calling
{\bf Append
}.
}
538 \docparam{title
}{The title of the menu.
}
540 \wxheading{Return value
}
542 TRUE on success, FALSE if an error occurred.
546 \helpref{wxMenuBar::Insert
}{wxmenubarinsert
}
548 \membersection{wxMenuBar::Check
}\label{wxmenubarcheck
}
550 \func{void
}{Check
}{\param{int
}{ id
},
\param{const bool
}{ check
}}
552 Checks or unchecks a menu item.
554 \wxheading{Parameters
}
556 \docparam{id
}{The menu item identifier.
}
558 \docparam{check
}{If TRUE, checks the menu item, otherwise the item is unchecked.
}
562 Only use this when the menu bar has been associated
563 with a frame; otherwise, use the wxMenu equivalent call.
565 \membersection{wxMenuBar::Enable
}\label{wxmenubarenable
}
567 \func{void
}{Enable
}{\param{int
}{ id
},
\param{const bool
}{ enable
}}
569 Enables or disables (greys out) a menu item.
571 \wxheading{Parameters
}
573 \docparam{id
}{The menu item identifier.
}
575 \docparam{enable
}{TRUE to enable the item, FALSE to disable it.
}
579 Only use this when the menu bar has been
580 associated with a frame; otherwise, use the wxMenu equivalent call.
582 \membersection{wxMenuBar::EnableTop
}\label{wxmenubarenabletop
}
584 \func{void
}{EnableTop
}{\param{int
}{ pos
},
\param{const bool
}{ enable
}}
586 Enables or disables a whole menu.
588 \wxheading{Parameters
}
590 \docparam{pos
}{The position of the menu, starting from zero.
}
592 \docparam{enable
}{TRUE to enable the menu, FALSE to disable it.
}
596 Only use this when the menu bar has been
597 associated with a frame.
599 \membersection{wxMenuBar::FindMenu
}\label{wxmenubarfindmenu
}
601 \constfunc{int
}{FindMenu
}{\param{const wxString\&
}{title
}}
603 Returns the index of the menu with the given
{\it title
} or wxNOT
\_FOUND if no
604 such menu exists in this menubar. The
{\it title
} parameter may specify either
605 the menu title (with accelerator characters, i.e.
{\tt "\&File"
}) or just the
606 menu label (
{\tt "File"
}) indifferently.
608 \membersection{wxMenuBar::FindMenuItem
}\label{wxmenubarfindmenuitem
}
610 \constfunc{int
}{FindMenuItem
}{\param{const wxString\&
}{menuString
},
\param{const wxString\&
}{itemString
}}
612 Finds the menu item id for a menu name/menu item string pair.
614 \wxheading{Parameters
}
616 \docparam{menuString
}{Menu title to find.
}
618 \docparam{itemString
}{Item to find.
}
620 \wxheading{Return value
}
622 The menu item identifier, or wxNOT
\_FOUND if none was found.
626 Any special menu codes are stripped out of source and target strings
629 \membersection{wxMenuBar::FindItem
}\label{wxmenubarfinditem
}
631 \constfunc{wxMenuItem *
}{FindItem
}{\param{int
}{ id
},
\param{wxMenu
}{ **menu = NULL
}}
633 Finds the menu item object associated with the given menu item identifier.
635 \wxheading{Parameters
}
637 \docparam{id
}{Menu item identifier.
}
639 \docparam{menu
}{If not NULL, menu will get set to the associated menu.
}
641 \wxheading{Return value
}
643 The found menu item object, or NULL if one was not found.
645 \membersection{wxMenuBar::GetHelpString
}\label{wxmenubargethelpstring
}
647 \constfunc{wxString
}{GetHelpString
}{\param{int
}{ id
}}
649 Gets the help string associated with the menu item identifer.
651 \wxheading{Parameters
}
653 \docparam{id
}{The menu item identifier.
}
655 \wxheading{Return value
}
657 The help string, or the empty string if there was no help string or the menu item
662 \helpref{wxMenuBar::SetHelpString
}{wxmenubarsethelpstring
}
664 \membersection{wxMenuBar::GetLabel
}\label{wxmenubargetlabel
}
666 \constfunc{wxString
}{GetLabel
}{\param{int
}{ id
}}
668 Gets the label associated with a menu item.
670 \wxheading{Parameters
}
672 \docparam{id
}{The menu item identifier.
}
674 \wxheading{Return value
}
676 The menu item label, or the empty string if the item was not found.
680 Use only after the menubar has been associated with a frame.
682 \membersection{wxMenuBar::GetLabelTop
}\label{wxmenubargetlabeltop
}
684 \constfunc{wxString
}{GetLabelTop
}{\param{int
}{ pos
}}
686 Returns the label of a top-level menu.
688 \wxheading{Parameters
}
690 \docparam{pos
}{Position of the menu on the menu bar, starting from zero.
}
692 \wxheading{Return value
}
694 The menu label, or the empty string if the menu was not found.
698 Use only after the menubar has been associated with a frame.
702 \helpref{wxMenuBar::SetLabelTop
}{wxmenubarsetlabeltop
}
704 \membersection{wxMenuBar::GetMenu
}\label{wxmenubargetmenu
}
706 \constfunc{wxMenu*
}{GetMenu
}{\param{int
}{ menuIndex
}}
708 Returns the menu at
{\it menuIndex
} (zero-based).
710 \membersection{wxMenuBar::GetMenuCount
}\label{wxmenubargetmenucount
}
712 \constfunc{int
}{GetMenuCount
}{\void}
714 Returns the number of menus in this menubar.
716 \membersection{wxMenuBar::Insert
}\label{wxmenubarinsert
}
718 \func{bool
}{Insert
}{\param{size
\_t }{pos
},
\param{wxMenu *
}{menu
},
\param{const wxString\&
}{title
}}
720 Inserts the menu at the given position into the menu bar. Inserting menu at
721 position $
0$ will insert it in the very beginning of it, inserting at position
722 \helpref{GetMenuCount()
}{wxmenubargetmenucount
} is the same as calling
723 \helpref{Append()
}{wxmenubarappend
}.
725 \wxheading{Parameters
}
727 \docparam{pos
}{The position of the new menu in the menu bar
}
729 \docparam{menu
}{The menu to add. wxMenuBar owns the menu and will free it.
}
731 \docparam{title
}{The title of the menu.
}
733 \wxheading{Return value
}
735 TRUE on success, FALSE if an error occurred.
739 \helpref{wxMenuBar::Append
}{wxmenubarappend
}
741 \membersection{wxMenuBar::IsChecked
}\label{wxmenubarischecked
}
743 \constfunc{bool
}{IsChecked
}{\param{int
}{ id
}}
745 Determines whether an item is checked.
747 \wxheading{Parameters
}
749 \docparam{id
}{The menu item identifier.
}
751 \wxheading{Return value
}
753 TRUE if the item was found and is checked, FALSE otherwise.
755 \membersection{wxMenuBar::IsEnabled
}\label{wxmenubarisenabled
}
757 \constfunc{bool
}{IsEnabled
}{\param{int
}{ id
}}
759 Determines whether an item is enabled.
761 \wxheading{Parameters
}
763 \docparam{id
}{The menu item identifier.
}
765 \wxheading{Return value
}
767 TRUE if the item was found and is enabled, FALSE otherwise.
769 \membersection{wxMenuBar::Refresh
}\label{wxmenubarrefresh
}
771 \func{void
}{Refresh
}{\void}
775 \membersection{wxMenuBar::Remove
}\label{wxmenubarremove
}
777 \func{wxMenu *
}{Remove
}{\param{size
\_t }{pos
}}
779 Removes the menu from the menu bar and returns the menu object - the caller is
780 responsible for deleting it. This function may be used together with
781 \helpref{wxMenuBar::Insert
}{wxmenubarinsert
} to change the menubar
786 \helpref{wxMenuBar::Replace
}{wxmenubarreplace
}
788 \membersection{wxMenuBar::Replace
}\label{wxmenubarreplace
}
790 \func{wxMenu *
}{Replace
}{\param{size
\_t }{pos
},
\param{wxMenu *
}{menu
},
\param{const wxString\&
}{title
}}
792 Replaces the menu at the given position with another one.
794 \wxheading{Parameters
}
796 \docparam{pos
}{The position of the new menu in the menu bar
}
798 \docparam{menu
}{The menu to add.
}
800 \docparam{title
}{The title of the menu.
}
802 \wxheading{Return value
}
804 The menu which was previously at the position
{\it pos
}. The caller is
805 responsible for deleting it.
809 \helpref{wxMenuBar::Insert
}{wxmenubarinsert
},
\rtfsp
810 \helpref{wxMenuBar::Remove
}{wxmenubarremove
}
812 \membersection{wxMenuBar::SetHelpString
}\label{wxmenubarsethelpstring
}
814 \func{void
}{SetHelpString
}{\param{int
}{ id
},
\param{const wxString\&
}{helpString
}}
816 Sets the help string associated with a menu item.
818 \wxheading{Parameters
}
820 \docparam{id
}{Menu item identifier.
}
822 \docparam{helpString
}{Help string to associate with the menu item.
}
826 \helpref{wxMenuBar::GetHelpString
}{wxmenubargethelpstring
}
828 \membersection{wxMenuBar::SetLabel
}\label{wxmenubarsetlabel
}
830 \func{void
}{SetLabel
}{\param{int
}{ id
},
\param{const wxString\&
}{label
}}
832 Sets the label of a menu item.
834 \wxheading{Parameters
}
836 \docparam{id
}{Menu item identifier.
}
838 \docparam{label
}{Menu item label.
}
842 Use only after the menubar has been associated with a frame.
846 \helpref{wxMenuBar::GetLabel
}{wxmenubargetlabel
}
848 \membersection{wxMenuBar::SetLabelTop
}\label{wxmenubarsetlabeltop
}
850 \func{void
}{SetLabelTop
}{\param{int
}{ pos
},
\param{const wxString\&
}{label
}}
852 Sets the label of a top-level menu.
854 \wxheading{Parameters
}
856 \docparam{pos
}{The position of a menu on the menu bar, starting from zero.
}
858 \docparam{label
}{The menu label.
}
862 Use only after the menubar has been associated with a frame.
866 \helpref{wxMenuBar::GetLabelTop
}{wxmenubargetlabeltop
}