]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/menu.tex
New toolbar wrappers
[wxWidgets.git] / docs / latex / wx / menu.tex
CommitLineData
a660d684
KB
1\section{\class{wxMenu}}\label{wxmenu}
2
3A menu is a popup (or pull down) list of items, one of which may be
4selected before the menu goes away (clicking elsewhere dismisses the
5menu). Menus may be used to construct either menu bars or popup menus.
6
7A menu item has an integer ID associated with it which can be used to
8identify the selection, or to change the menu item in some way.
9
10\wxheading{Derived from}
11
12\helpref{wxEvtHandler}{wxevthandler}\\
13\helpref{wxObject}{wxobject}
14
954b8ae6
JS
15\wxheading{Include files}
16
17<wx/menu.h>
18
a660d684
KB
19\wxheading{Event handling}
20
21If the menu is part of a menubar, then \helpref{wxMenuBar}{wxmenubar} event processing is used.
22
23With a popup menu, there is a variety of ways to handle a menu selection event
24(wxEVT\_COMMAND\_MENU\_SELECTED).
25
26\begin{enumerate}\itemsep=0pt
a660d684
KB
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
30this window.
1aaef614
VZ
31\item Define a callback of type wxFunction, which you pass to the wxMenu constructor.
32The callback takes a reference to the menu, and a reference to a
33\helpref{wxCommandEvent}{wxcommandevent}. This method is deprecated and should
34not be used in the new code, it is provided for backwards compatibility only.
a660d684
KB
35\end{enumerate}
36
37\wxheading{See also}
38
39\helpref{wxMenuBar}{wxmenubar}, \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu},\rtfsp
40\helpref{Event handling overview}{eventhandlingoverview}
41
42\latexignore{\rtfignore{\wxheading{Members}}}
43
44\membersection{wxMenu::wxMenu}\label{wxmenuconstr}
45
b1462dfa 46\func{}{wxMenu}{\param{const wxString\& }{title = ""}, \param{long}{ style = 0}}
a660d684
KB
47
48Constructs a wxMenu object.
49
50\wxheading{Parameters}
51
52\docparam{title}{A title for the popup menu: the empty string denotes no title.}
53
2182e26f 54\docparam{style}{If set to {\tt wxMENU\_TEAROFF}, the menu will be detachable.}
06d20283 55
407f3681 56\func{}{wxMenu}{\param{long}{ style}}
4e986502
KB
57
58Constructs a wxMenu object.
59
60\wxheading{Parameters}
407f3681 61
2182e26f 62\docparam{style}{If set to {\tt wxMENU\_TEAROFF}, the menu will be detachable.}
4e986502 63
a660d684
KB
64\membersection{wxMenu::\destruct{wxMenu}}
65
66\func{}{\destruct{wxMenu}}{\void}
67
68Destructor, destroying the menu.
69
b412f9be
JS
70Note: under Motif, a popup menu must have a valid parent (the window
71it was last popped up on) when being destroyed. Therefore, make sure
72you delete or re-use the popup menu {\it before} destroying the
73parent window. Re-use in this context means popping up the menu on
74a different window from last time, which causes an implicit destruction
75and recreation of internal data structures.
76
a660d684
KB
77\membersection{wxMenu::Append}\label{wxmenuappend}
78
eaaa6a06 79\func{void}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp
a660d684
KB
80\param{const bool}{ checkable = FALSE}}
81
82Adds a string item to the end of the menu.
83
eaaa6a06 84\func{void}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{wxMenu *}{subMenu},\rtfsp
a660d684
KB
85\param{const wxString\& }{helpString = ""}}
86
87Adds a pull-right submenu to the end of the menu.
88
89\func{void}{Append}{\param{wxMenuItem*}{ menuItem}}
90
1aaef614
VZ
91Adds a menu item object. This is the most generic variant of Append() method
92because it may be used for both items (including separators) and submenus and
93because you can also specify various extra properties of a menu item this way,
a660d684
KB
94such as bitmaps and fonts.
95
96\wxheading{Parameters}
97
98\docparam{id}{The menu command identifier.}
99
100\docparam{item}{The string to appear on the menu item.}
101
102\docparam{menu}{Pull-right submenu.}
103
104\docparam{checkable}{If TRUE, this item is checkable.}
105
106\docparam{helpString}{An optional help string associated with the item.
107By default, \helpref{wxFrame::OnMenuHighlight}{wxframeonmenuhighlight} displays
108this string in the status line.}
109
110\docparam{menuItem}{A menuitem object. It will be owned by the wxMenu object after this function
111is called, so do not delete it yourself.}
112
113\wxheading{Remarks}
114
115This command can be used after the menu has been shown, as well as on initial
116creation of a menu or menubar.
117
118\wxheading{See also}
119
1aaef614
VZ
120\helpref{wxMenu::AppendSeparator}{wxmenuappendseparator},\rtfsp
121\helpref{wxMenu::Insert}{wxmenuinsert},\rtfsp
122\helpref{wxMenu::SetLabel}{wxmenusetlabel}, \helpref{wxMenu::GetHelpString}{wxmenugethelpstring},\rtfsp
a660d684
KB
123\helpref{wxMenu::SetHelpString}{wxmenusethelpstring}, \helpref{wxMenuItem}{wxmenuitem}
124
06d20283
RD
125\pythonnote{In place of a single overloaded method name, wxPython
126implements 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)}}{}
131\end{twocollist}}
132}
133
a660d684
KB
134\membersection{wxMenu::AppendSeparator}\label{wxmenuappendseparator}
135
136\func{void}{AppendSeparator}{\void}
137
138Adds a separator to the end of the menu.
139
140\wxheading{See also}
141
142\helpref{wxMenu::Append}{wxmenuappend}
143
144\membersection{wxMenu::Break}\label{wxmenubreak}
145
146\func{void}{Break}{\void}
147
148Inserts a break in a menu, causing the next appended item to appear in a new column.
149
150\membersection{wxMenu::Check}\label{wxmenucheck}
151
eaaa6a06 152\func{void}{Check}{\param{int}{ id}, \param{const bool}{ check}}
a660d684
KB
153
154Checks or unchecks the menu item.
155
156\wxheading{Parameters}
157
158\docparam{id}{The menu item identifier.}
159
160\docparam{check}{If TRUE, the item will be checked, otherwise it will be unchecked.}
161
162\wxheading{See also}
163
164\helpref{wxMenu::IsChecked}{wxmenuischecked}
165
fc9c7c09
RR
166\membersection{wxMenu::Delete}\label{wxmenudelete}
167
168\func{void}{Delete}{\param{int }{id}}
169
1aaef614
VZ
170\func{void}{Delete}{\param{wxMenuItem *}{item}}
171
172Deletes 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
174delete a submenu.
fc9c7c09
RR
175
176\wxheading{Parameters}
177
1aaef614 178\docparam{id}{Id of the menu item to be deleted.}
fc9c7c09 179
1aaef614
VZ
180\docparam{item}{Menu item to be deleted.}
181
182\wxheading{See also}
183
184\helpref{wxMenu::FindItem}{wxmenufinditem},\rtfsp
185\helpref{wxMenu::Destroy}{wxmenudestroy},\rtfsp
186\helpref{wxMenu::Remove}{wxmenuremove}
187
188\membersection{wxMenu::Destroy}\label{wxmenudestroy}
189
190\func{void}{Destroy}{\param{int }{id}}
191
192\func{void}{Destroy}{\param{wxMenuItem *}{item}}
193
194Deletes the menu item from the menu. If the item is a submenu, it will
195be deleted. Use \helpref{Remove}{wxmenuremove} if you want to keep the submenu
196(for example, to reuse it later).
fc9c7c09 197
1aaef614
VZ
198\wxheading{Parameters}
199
200\docparam{id}{Id of the menu item to be deleted.}
201
202\docparam{item}{Menu item to be deleted.}
fc9c7c09
RR
203
204\wxheading{See also}
205
1aaef614
VZ
206\helpref{wxMenu::FindItem}{wxmenufinditem},\rtfsp
207\helpref{wxMenu::Deletes}{wxmenudelete},\rtfsp
208\helpref{wxMenu::Remove}{wxmenuremove}
fc9c7c09 209
a660d684
KB
210\membersection{wxMenu::Enable}\label{wxmenuenable}
211
eaaa6a06 212\func{void}{Enable}{\param{int}{ id}, \param{const bool}{ enable}}
a660d684
KB
213
214Enables or disables (greys out) a menu item.
215
216\wxheading{Parameters}
217
218\docparam{id}{The menu item identifier.}
219
220\docparam{enable}{TRUE to enable the menu item, FALSE to disable it.}
221
222\wxheading{See also}
223
224\helpref{wxMenu::IsEnabled}{wxmenuisenabled}
225
226\membersection{wxMenu::FindItem}\label{wxmenufinditem}
227
228\constfunc{int}{FindItem}{\param{const wxString\& }{itemString}}
229
230Finds the menu item id for a menu item string.
231
232\wxheading{Parameters}
233
234\docparam{itemString}{Menu item string to find.}
235
236\wxheading{Return value}
237
1aaef614 238Menu item identifier, or wxNOT\_FOUND if none is found.
a660d684
KB
239
240\wxheading{Remarks}
241
242Any special menu codes are stripped out of source and target strings
243before matching.
244
245\wxheading{See also}
246
1aaef614 247\helpref{wxMenu::FindItem}{wxmenufinditem}
a660d684 248
1aaef614 249\membersection{wxMenu::FindItem}\label{wxmenufinditem}
a660d684 250
1aaef614 251\constfunc{wxMenuItem *}{FindItem}{\param{int}{ id}, \param{wxMenu **}{menu = NULL}}
407f3681 252
1aaef614
VZ
253Finds the menu item object associated with the given menu item identifier and,
254optionally, the (sub)menu it belongs to.
a660d684
KB
255
256\wxheading{Parameters}
257
258\docparam{id}{Menu item identifier.}
259
1aaef614
VZ
260\docparam{menu}{If the pointer is not NULL, it will be filled with the items
261parent menu (if the item was found)}
262
a660d684
KB
263\wxheading{Return value}
264
265Returns the menu item object, or NULL if it is not found.
266
267\wxheading{See also}
268
269\helpref{wxMenu::FindItem}{wxmenufinditem}
270
271\membersection{wxMenu::GetHelpString}\label{wxmenugethelpstring}
272
eaaa6a06 273\constfunc{wxString}{GetHelpString}{\param{int}{ id}}
a660d684
KB
274
275Returns the help string associated with a menu item.
276
277\wxheading{Parameters}
278
279\docparam{id}{The menu item identifier.}
280
281\wxheading{Return value}
282
283The help string, or the empty string if there is no help string or the
284item was not found.
285
286\wxheading{See also}
287
288\helpref{wxMenu::SetHelpString}{wxmenusethelpstring}, \helpref{wxMenu::Append}{wxmenuappend}
289
290\membersection{wxMenu::GetLabel}\label{wxmenugetlabel}
291
eaaa6a06 292\constfunc{wxString}{GetLabel}{\param{int}{ id}}
a660d684
KB
293
294Returns a menu item label.
295
296\wxheading{Parameters}
297
298\docparam{id}{The menu item identifier.}
299
300\wxheading{Return value}
301
302The item label, or the empty string if the item was not found.
303
304\wxheading{See also}
305
306\helpref{wxMenu::SetLabel}{wxmenusetlabel}
307
1aaef614
VZ
308\membersection{wxMenu::GetMenuItemCount}\label{wxmenugetmenuitemcount}
309
310\constfunc{size\_t}{GetMenuItemCount}{\void}
311
312Returns the number of items in the menu.
313
314\membersection{wxMenu::GetMenuItems}\label{wxmenugetmenuitems}
315
316\constfunc{wxMenuItemList\&}{GetMenuItems}{\void}
317
318Returns the list of items in the menu. wxMenuItemList is a pseudo-template
319list class containing wxMenuItem pointers.
320
a660d684
KB
321\membersection{wxMenu::GetTitle}\label{wxmenugettitle}
322
323\constfunc{wxString}{GetTitle}{\void}
324
325Returns the title of the menu.
326
327\wxheading{Remarks}
328
329This is relevant only to popup menus.
330
331\wxheading{See also}
332
333\helpref{wxMenu::SetTitle}{wxmenusettitle}
334
1aaef614
VZ
335\membersection{wxMenu::Insert}\label{wxmenuinsert}
336
337\func{bool}{Insert}{\param{size\_t }{pos}, \param{wxMenuItem *}{item}}
338
339Inserts the given {\it item} before the position {\it pos}. Inserting the item
340at the position \helpref{GetMenuItemCount}{wxmenugetmenuitemcount} is the same
341as appending it.
342
343\wxheading{See also}
344
345\helpref{wxMenu::Append}{wxmenuappend}
346
a660d684
KB
347\membersection{wxMenu::IsChecked}\label{wxmenuischecked}
348
eaaa6a06 349\constfunc{bool}{IsChecked}{\param{int}{ id}}
a660d684
KB
350
351Determines whether a menu item is checked.
352
353\wxheading{Parameters}
354
355\docparam{id}{The menu item identifier.}
356
357\wxheading{Return value}
358
359TRUE if the menu item is checked, FALSE otherwise.
360
361\wxheading{See also}
362
363\helpref{wxMenu::Check}{wxmenucheck}
364
365\membersection{wxMenu::IsEnabled}\label{wxmenuisenabled}
366
eaaa6a06 367\constfunc{bool}{IsEnabled}{\param{int}{ id}}
a660d684
KB
368
369Determines whether a menu item is enabled.
370
371\wxheading{Parameters}
372
373\docparam{id}{The menu item identifier.}
374
375\wxheading{Return value}
376
377TRUE if the menu item is enabled, FALSE otherwise.
378
379\wxheading{See also}
380
381\helpref{wxMenu::Enable}{wxmenuenable}
382
1aaef614
VZ
383\membersection{wxMenu::Remove}\label{wxmenuremove}
384
385\func{wxMenuItem *}{Remove}{\param{int }{id}}
386
387\func{wxMenuItem *}{Remove}{\param{wxMenuItem *}{item}}
388
389Removes the menu item from the menu but doesn't delete the associated C++
390object. This allows to reuse the same item later by adding it back to the menu
391(especially useful with submenus).
392
393\wxheading{Parameters}
394
395\docparam{id}{The identifier of the menu item to remove.}
396
397\docparam{item}{The menu item to remove.}
398
399\wxheading{Return value}
400
401The item which was detached from the menu.
402
a660d684
KB
403\membersection{wxMenu::SetHelpString}\label{wxmenusethelpstring}
404
eaaa6a06 405\func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}}
a660d684
KB
406
407Sets an item's help string.
408
409\wxheading{Parameters}
410
411\docparam{id}{The menu item identifier.}
412
413\docparam{helpString}{The help string to set.}
414
415\wxheading{See also}
416
417\helpref{wxMenu::GetHelpString}{wxmenugethelpstring}
418
419\membersection{wxMenu::SetLabel}\label{wxmenusetlabel}
420
eaaa6a06 421\func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}}
a660d684
KB
422
423Sets the label of a menu item.
424
425\wxheading{Parameters}
426
427\docparam{id}{The menu item identifier.}
428
429\docparam{label}{The menu item label to set.}
430
431\wxheading{See also}
432
433\helpref{wxMenu::Append}{wxmenuappend}, \helpref{wxMenu::GetLabel}{wxmenugetlabel}
434
435\membersection{wxMenu::SetTitle}\label{wxmenusettitle}
436
437\func{void}{SetTitle}{\param{const wxString\& }{title}}
438
439Sets the title of the menu.
440
441\wxheading{Parameters}
442
443\docparam{title}{The title to set.}
444
445\wxheading{Remarks}
446
447This is relevant only to popup menus.
448
449\wxheading{See also}
450
451\helpref{wxMenu::SetTitle}{wxmenusettitle}
452
631f1bfe
JS
453\membersection{wxMenu::UpdateUI}\label{wxmenuupdateui}
454
455\constfunc{void}{UpdateUI}{\param{wxEvtHandler*}{ source = NULL}}
456
457Sends events to {\it source} (or owning window if NULL) to update the
458menu UI. This is called just before the menu is popped up with \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu}, but
459the application may call it at other times if required.
460
461\wxheading{See also}
462
463\helpref{wxUpdateUIEvent}{wxupdateuievent}
464
a660d684
KB
465\section{\class{wxMenuBar}}\label{wxmenubar}
466
467A menu bar is a series of menus accessible from the top of a frame.
468
469\wxheading{Derived from}
470
471\helpref{wxEvtHandler}{wxevthandler}\\
472\helpref{wxObject}{wxobject}
473
954b8ae6
JS
474\wxheading{Include files}
475
476<wx/menu.h>
477
a660d684
KB
478\wxheading{Event handling}
479
480To respond to a menu selection, provide a handler for EVT\_MENU, in the frame
e702ff0f
JS
481that contains the menu bar. If you have a toolbar which uses the same identifiers
482as your EVT\_MENU entries, events from the toolbar will also be processed by your
483EVT\_MENU event handlers.
484
485Note that menu commands (and UI update events for menus) are first sent to
486the focus window within the frame. If no window within the frame has the focus,
487then the events are sent directly to the frame. This allows command and UI update
488handling to be processed by specific windows and controls, and not necessarily
489by the application frame.
a660d684
KB
490
491\wxheading{See also}
492
493\helpref{wxMenu}{wxmenu}, \helpref{Event handling overview}{eventhandlingoverview}
494
495\latexignore{\rtfignore{\wxheading{Members}}}
496
497\membersection{wxMenuBar::wxMenuBar}\label{wxmenubarconstr}
498
499\func{void}{wxMenuBar}{\void}
500
501Default constructor.
502
eaaa6a06 503\func{void}{wxMenuBar}{\param{int}{ n}, \param{wxMenu*}{ menus[]}, \param{const wxString }{titles[]}}
a660d684
KB
504
505Construct a menu bar from arrays of menus and titles.
506
507\wxheading{Parameters}
508
509\docparam{n}{The number of menus.}
510
511\docparam{menus}{An array of menus. Do not use this array again - it now belongs to the
512menu bar.}
513
514\docparam{titles}{An array of title strings. Deallocate this array after creating the menu bar.}
515
06d20283
RD
516\pythonnote{Only the default constructor is supported in wxPython.
517Use wxMenuBar.Append instead.}
518
a660d684
KB
519\membersection{wxMenuBar::\destruct{wxMenuBar}}
520
521\func{void}{\destruct{wxMenuBar}}{\void}
522
523Destructor, destroying the menu bar and removing it from the parent frame (if any).
524
525\membersection{wxMenuBar::Append}\label{wxmenubarappend}
526
1aaef614 527\func{bool}{Append}{\param{wxMenu *}{menu}, \param{const wxString\& }{title}}
a660d684
KB
528
529Adds the item to the end of the menu bar.
530
531\wxheading{Parameters}
532
533\docparam{menu}{The menu to add. Do not deallocate this menu after calling {\bf Append}.}
534
535\docparam{title}{The title of the menu.}
536
1aaef614
VZ
537\wxheading{Return value}
538
539TRUE on success, FALSE if an error occured.
540
541\wxheading{See also}
542
543\helpref{wxMenuBar::Insert}{wxmenubarinsert}
544
a660d684
KB
545\membersection{wxMenuBar::Check}\label{wxmenubarcheck}
546
eaaa6a06 547\func{void}{Check}{\param{int}{ id}, \param{const bool}{ check}}
a660d684
KB
548
549Checks or unchecks a menu item.
550
551\wxheading{Parameters}
552
553\docparam{id}{The menu item identifier.}
554
555\docparam{check}{If TRUE, checks the menu item, otherwise the item is unchecked.}
556
557\wxheading{Remarks}
558
559Only use this when the menu bar has been associated
560with a frame; otherwise, use the wxMenu equivalent call.
561
562\membersection{wxMenuBar::Enable}\label{wxmenubarenable}
563
eaaa6a06 564\func{void}{Enable}{\param{int}{ id}, \param{const bool}{ enable}}
a660d684
KB
565
566Enables or disables (greys out) a menu item.
567
568\wxheading{Parameters}
569
570\docparam{id}{The menu item identifier.}
571
572\docparam{enable}{TRUE to enable the item, FALSE to disable it.}
573
574\wxheading{Remarks}
575
576Only use this when the menu bar has been
577associated with a frame; otherwise, use the wxMenu equivalent call.
578
579\membersection{wxMenuBar::EnableTop}\label{wxmenubarenabletop}
580
eaaa6a06 581\func{void}{EnableTop}{\param{int}{ pos}, \param{const bool}{ enable}}
a660d684
KB
582
583Enables or disables a whole menu.
584
585\wxheading{Parameters}
586
587\docparam{pos}{The position of the menu, starting from zero.}
588
589\docparam{enable}{TRUE to enable the menu, FALSE to disable it.}
590
591\wxheading{Remarks}
592
593Only use this when the menu bar has been
594associated with a frame.
595
596\membersection{wxMenuBar::FindMenuItem}\label{wxmenubarfindmenuitem}
597
598\constfunc{int}{FindMenuItem}{\param{const wxString\& }{menuString}, \param{const wxString\& }{itemString}}
599
600Finds the menu item id for a menu name/menu item string pair.
601
602\wxheading{Parameters}
603
604\docparam{menuString}{Menu title to find.}
605
606\docparam{itemString}{Item to find.}
607
608\wxheading{Return value}
609
1aaef614 610The menu item identifier, or wxNOT\_FOUND if none was found.
a660d684
KB
611
612\wxheading{Remarks}
613
614Any special menu codes are stripped out of source and target strings
615before matching.
616
fc9c7c09 617\membersection{wxMenuBar::FindItem}\label{wxmenubarfinditem}
a660d684 618
407f3681 619\constfunc{wxMenuItem *}{FindItem}{\param{int}{ id}, \param{wxMenu}{ **menu = NULL}}
a660d684 620
fc9c7c09 621Finds the menu item object associated with the given menu item identifier.
a660d684
KB
622
623\wxheading{Parameters}
624
625\docparam{id}{Menu item identifier.}
407f3681 626
fc9c7c09 627\docparam{menu}{If not NULL, menu will get set to the associated menu.}
a660d684
KB
628
629\wxheading{Return value}
630
631The found menu item object, or NULL if one was not found.
632
633\membersection{wxMenuBar::GetHelpString}\label{wxmenubargethelpstring}
634
eaaa6a06 635\constfunc{wxString}{GetHelpString}{\param{int}{ id}}
a660d684
KB
636
637Gets the help string associated with the menu item identifer.
638
639\wxheading{Parameters}
640
641\docparam{id}{The menu item identifier.}
642
643\wxheading{Return value}
644
645The help string, or the empty string if there was no help string or the menu item
646was not found.
647
648\wxheading{See also}
649
650\helpref{wxMenuBar::SetHelpString}{wxmenubarsethelpstring}
651
652\membersection{wxMenuBar::GetLabel}\label{wxmenubargetlabel}
653
eaaa6a06 654\constfunc{wxString}{GetLabel}{\param{int}{ id}}
a660d684
KB
655
656Gets the label associated with a menu item.
657
658\wxheading{Parameters}
659
660\docparam{id}{The menu item identifier.}
661
662\wxheading{Return value}
663
664The menu item label, or the empty string if the item was not found.
665
666\wxheading{Remarks}
667
668Use only after the menubar has been associated with a frame.
669
670\membersection{wxMenuBar::GetLabelTop}\label{wxmenubargetlabeltop}
671
eaaa6a06 672\constfunc{wxString}{GetLabelTop}{\param{int}{ pos}}
a660d684
KB
673
674Returns the label of a top-level menu.
675
676\wxheading{Parameters}
677
678\docparam{pos}{Position of the menu on the menu bar, starting from zero.}
679
680\wxheading{Return value}
681
682The menu label, or the empty string if the menu was not found.
683
684\wxheading{Remarks}
685
686Use only after the menubar has been associated with a frame.
687
688\wxheading{See also}
689
690\helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop}
691
7f555861
JS
692\membersection{wxMenuBar::GetMenu}\label{wxmenubargetmenu}
693
694\constfunc{wxMenu*}{GetMenu}{\param{int}{ menuIndex}}
695
696Returns the menu at {\it menuIndex} (zero-based).
697
698\membersection{wxMenuBar::GetMenuCount}\label{wxmenubargetmenucount}
699
700\constfunc{int}{GetMenuCount}{\void}
701
702Returns the number of menus in this menubar.
703
1aaef614
VZ
704\membersection{wxMenuBar::Insert}{wxmenubarinsert}
705
706\func{bool}{Insert}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}}
707
708Inserts the menu at the given position into the menu bar. Inserting menu at
709position $0$ will insert it in the very beginning of it, inserting at position
710\helpref{GetMenuCount()}{wxmenubargetmenucount} is the same as calling
711\helpref{Append()}{wxmenubarappend}.
712
713\wxheading{Parameters}
714
715\docparam{pos}{The position of the new menu in the menu bar}
716
717\docparam{menu}{The menu to add. wxMenuBar owns the menu and will free it.}
718
719\docparam{title}{The title of the menu.}
720
721\wxheading{Return value}
722
723TRUE on success, FALSE if an error occured.
724
725\wxheading{See also}
726
727\helpref{wxMenuBar::Append}{wxmenubarappend}
728
a660d684
KB
729\membersection{wxMenuBar::IsChecked}\label{wxmenubarischecked}
730
eaaa6a06 731\constfunc{bool}{IsChecked}{\param{int}{ id}}
a660d684
KB
732
733Determines whether an item is checked.
734
735\wxheading{Parameters}
736
737\docparam{id}{The menu item identifier.}
738
739\wxheading{Return value}
740
741TRUE if the item was found and is checked, FALSE otherwise.
742
743\membersection{wxMenuBar::IsEnabled}\label{wxmenubarisenabled}
744
eaaa6a06 745\constfunc{bool}{IsEnabled}{\param{int}{ id}}
a660d684
KB
746
747Determines whether an item is enabled.
748
749\wxheading{Parameters}
750
751\docparam{id}{The menu item identifier.}
752
753\wxheading{Return value}
754
755TRUE if the item was found and is enabled, FALSE otherwise.
756
63dcfc15
PA
757\membersection{wxMenuBar::Refresh}\label{wxmenubarrefresh}
758
759\func{void}{Refresh}{\void}
760
761Redraw the menu bar
762
1aaef614
VZ
763\membersection{wxMenuBar::Remove}\label{wxmenubarremove}
764
765\func{wxMenu *}{Remove}{\param{size\_t }{pos}}
766
767Removes the menu from the menu bar and returns the menu object - the caller is
768reposnbile for deleting it. This function may be used together with
769\helpref{wxMenuBar::Insert}{wxmenubarinsert} to change the menubar
770dynamically.
771
772\wxheading{See also}
773
2182e26f 774\helpref{wxMenuBar::Replace}{wxmenubarreplace}
1aaef614
VZ
775
776\membersection{wxMenuBar::Replace}\label{wxmenubarreplace}
777
778\func{wxMenu *}{Replace}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}}
779
780Replaces the menu at givenm position with another one.
781
782\wxheading{Parameters}
783
784\docparam{pos}{The position of the new menu in the menu bar}
785
786\docparam{menu}{The menu to add.}
787
788\docparam{title}{The title of the menu.}
789
790\wxheading{Return value}
791
792The menu which was previously at the position {\it pos}. The caller is
793responsible for deleting it.
794
795\wxheading{See also}
796
797\helpref{wxMenuBar::Insert}{wxmenubarinsert},\rtfsp
798\helpref{wxMenuBar::Remove}{wxmenubarremove}
799
800\membersection{wxMenuBar::IsChecked}\label{wxmenubarischecked}
801
a660d684
KB
802\membersection{wxMenuBar::SetHelpString}\label{wxmenubarsethelpstring}
803
eaaa6a06 804\func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}}
a660d684
KB
805
806Sets the help string associated with a menu item.
807
808\wxheading{Parameters}
809
810\docparam{id}{Menu item identifier.}
811
812\docparam{helpString}{Help string to associate with the menu item.}
813
814\wxheading{See also}
815
816\helpref{wxMenuBar::GetHelpString}{wxmenubargethelpstring}
817
818\membersection{wxMenuBar::SetLabel}\label{wxmenubarsetlabel}
819
eaaa6a06 820\func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}}
a660d684
KB
821
822Sets the label of a menu item.
823
824\wxheading{Parameters}
825
826\docparam{id}{Menu item identifier.}
827
828\docparam{label}{Menu item label.}
829
830\wxheading{Remarks}
831
832Use only after the menubar has been associated with a frame.
833
834\wxheading{See also}
835
836\helpref{wxMenuBar::GetLabel}{wxmenubargetlabel}
837
838\membersection{wxMenuBar::SetLabelTop}\label{wxmenubarsetlabeltop}
839
eaaa6a06 840\func{void}{SetLabelTop}{\param{int}{ pos}, \param{const wxString\& }{label}}
a660d684
KB
841
842Sets the label of a top-level menu.
843
844\wxheading{Parameters}
845
846\docparam{pos}{The position of a menu on the menu bar, starting from zero.}
847
848\docparam{label}{The menu label.}
849
850\wxheading{Remarks}
851
852Use only after the menubar has been associated with a frame.
853
854\wxheading{See also}
855
856\helpref{wxMenuBar::GetLabelTop}{wxmenubargetlabeltop}
857