]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/menu.tex
fixed docs of wxLocale::Init (forgotted bConvertEncoding)
[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 31\item Define a callback of type wxFunction, which you pass to the wxMenu constructor.
874a1686 32The callback takes a reference to the menu, and a reference to a
1aaef614
VZ
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}
c9110876
VS
128\twocolitem{{\bf Append(id, string, helpStr="", checkable=FALSE)}}{}
129\twocolitem{{\bf AppendMenu(id, string, aMenu, helpStr="")}}{}
130\twocolitem{{\bf AppendItem(aMenuItem)}}{}
06d20283
RD
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
874a1686 172Deletes the menu item from the menu. If the item is a submenu, it will
1aaef614
VZ
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
874a1686 194Deletes the menu item from the menu. If the item is a submenu, it will
1aaef614
VZ
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
1aaef614 232\constfunc{wxMenuItem *}{FindItem}{\param{int}{ id}, \param{wxMenu **}{menu = NULL}}
407f3681 233
1aaef614
VZ
234Finds the menu item object associated with the given menu item identifier and,
235optionally, the (sub)menu it belongs to.
a660d684 236
5873607e
VZ
237\perlnote{In wxPerl this method takes just the {\tt id} parameter;
238in scalar context it returns the associated {\tt Wx::MenuItem}, in list
239context it returns a two element list ( item, submenu )}
240
a660d684
KB
241\wxheading{Parameters}
242
e12be2f7
JS
243\docparam{itemString}{Menu item string to find.}
244
a660d684
KB
245\docparam{id}{Menu item identifier.}
246
1aaef614
VZ
247\docparam{menu}{If the pointer is not NULL, it will be filled with the items
248parent menu (if the item was found)}
249
a660d684
KB
250\wxheading{Return value}
251
e12be2f7 252First form: menu item identifier, or wxNOT\_FOUND if none is found.
a660d684 253
e12be2f7 254Second form: returns the menu item object, or NULL if it is not found.
a660d684 255
e12be2f7
JS
256\wxheading{Remarks}
257
258Any special menu codes are stripped out of source and target strings
259before matching.
a660d684 260
fa482912 261\pythonnote{The name of this method in wxPython is {\tt FindItemById}
874a1686
RD
262and it does not support the second parameter.}
263
a660d684
KB
264\membersection{wxMenu::GetHelpString}\label{wxmenugethelpstring}
265
eaaa6a06 266\constfunc{wxString}{GetHelpString}{\param{int}{ id}}
a660d684
KB
267
268Returns the help string associated with a menu item.
269
270\wxheading{Parameters}
271
272\docparam{id}{The menu item identifier.}
273
274\wxheading{Return value}
275
276The help string, or the empty string if there is no help string or the
277item was not found.
278
279\wxheading{See also}
280
281\helpref{wxMenu::SetHelpString}{wxmenusethelpstring}, \helpref{wxMenu::Append}{wxmenuappend}
282
283\membersection{wxMenu::GetLabel}\label{wxmenugetlabel}
284
eaaa6a06 285\constfunc{wxString}{GetLabel}{\param{int}{ id}}
a660d684
KB
286
287Returns a menu item label.
288
289\wxheading{Parameters}
290
291\docparam{id}{The menu item identifier.}
292
293\wxheading{Return value}
294
295The item label, or the empty string if the item was not found.
296
297\wxheading{See also}
298
299\helpref{wxMenu::SetLabel}{wxmenusetlabel}
300
1aaef614
VZ
301\membersection{wxMenu::GetMenuItemCount}\label{wxmenugetmenuitemcount}
302
303\constfunc{size\_t}{GetMenuItemCount}{\void}
304
305Returns the number of items in the menu.
306
307\membersection{wxMenu::GetMenuItems}\label{wxmenugetmenuitems}
308
309\constfunc{wxMenuItemList\&}{GetMenuItems}{\void}
310
311Returns the list of items in the menu. wxMenuItemList is a pseudo-template
312list class containing wxMenuItem pointers.
313
a660d684
KB
314\membersection{wxMenu::GetTitle}\label{wxmenugettitle}
315
316\constfunc{wxString}{GetTitle}{\void}
317
318Returns the title of the menu.
319
320\wxheading{Remarks}
321
322This is relevant only to popup menus.
323
324\wxheading{See also}
325
326\helpref{wxMenu::SetTitle}{wxmenusettitle}
327
1aaef614
VZ
328\membersection{wxMenu::Insert}\label{wxmenuinsert}
329
330\func{bool}{Insert}{\param{size\_t }{pos}, \param{wxMenuItem *}{item}}
331
332Inserts the given {\it item} before the position {\it pos}. Inserting the item
333at the position \helpref{GetMenuItemCount}{wxmenugetmenuitemcount} is the same
334as appending it.
335
336\wxheading{See also}
337
338\helpref{wxMenu::Append}{wxmenuappend}
339
a660d684
KB
340\membersection{wxMenu::IsChecked}\label{wxmenuischecked}
341
eaaa6a06 342\constfunc{bool}{IsChecked}{\param{int}{ id}}
a660d684
KB
343
344Determines whether a menu item is checked.
345
346\wxheading{Parameters}
347
348\docparam{id}{The menu item identifier.}
349
350\wxheading{Return value}
351
352TRUE if the menu item is checked, FALSE otherwise.
353
354\wxheading{See also}
355
356\helpref{wxMenu::Check}{wxmenucheck}
357
358\membersection{wxMenu::IsEnabled}\label{wxmenuisenabled}
359
eaaa6a06 360\constfunc{bool}{IsEnabled}{\param{int}{ id}}
a660d684
KB
361
362Determines whether a menu item is enabled.
363
364\wxheading{Parameters}
365
366\docparam{id}{The menu item identifier.}
367
368\wxheading{Return value}
369
370TRUE if the menu item is enabled, FALSE otherwise.
371
372\wxheading{See also}
373
374\helpref{wxMenu::Enable}{wxmenuenable}
375
1aaef614
VZ
376\membersection{wxMenu::Remove}\label{wxmenuremove}
377
378\func{wxMenuItem *}{Remove}{\param{int }{id}}
379
380\func{wxMenuItem *}{Remove}{\param{wxMenuItem *}{item}}
381
382Removes the menu item from the menu but doesn't delete the associated C++
383object. This allows to reuse the same item later by adding it back to the menu
384(especially useful with submenus).
385
386\wxheading{Parameters}
387
388\docparam{id}{The identifier of the menu item to remove.}
389
390\docparam{item}{The menu item to remove.}
391
392\wxheading{Return value}
393
394The item which was detached from the menu.
395
a660d684
KB
396\membersection{wxMenu::SetHelpString}\label{wxmenusethelpstring}
397
eaaa6a06 398\func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}}
a660d684
KB
399
400Sets an item's help string.
401
402\wxheading{Parameters}
403
404\docparam{id}{The menu item identifier.}
405
406\docparam{helpString}{The help string to set.}
407
408\wxheading{See also}
409
410\helpref{wxMenu::GetHelpString}{wxmenugethelpstring}
411
412\membersection{wxMenu::SetLabel}\label{wxmenusetlabel}
413
eaaa6a06 414\func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}}
a660d684
KB
415
416Sets the label of a menu item.
417
418\wxheading{Parameters}
419
420\docparam{id}{The menu item identifier.}
421
422\docparam{label}{The menu item label to set.}
423
424\wxheading{See also}
425
426\helpref{wxMenu::Append}{wxmenuappend}, \helpref{wxMenu::GetLabel}{wxmenugetlabel}
427
428\membersection{wxMenu::SetTitle}\label{wxmenusettitle}
429
430\func{void}{SetTitle}{\param{const wxString\& }{title}}
431
432Sets the title of the menu.
433
434\wxheading{Parameters}
435
436\docparam{title}{The title to set.}
437
438\wxheading{Remarks}
439
440This is relevant only to popup menus.
441
442\wxheading{See also}
443
444\helpref{wxMenu::SetTitle}{wxmenusettitle}
445
631f1bfe
JS
446\membersection{wxMenu::UpdateUI}\label{wxmenuupdateui}
447
448\constfunc{void}{UpdateUI}{\param{wxEvtHandler*}{ source = NULL}}
449
450Sends events to {\it source} (or owning window if NULL) to update the
451menu UI. This is called just before the menu is popped up with \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu}, but
452the application may call it at other times if required.
453
454\wxheading{See also}
455
456\helpref{wxUpdateUIEvent}{wxupdateuievent}
457
a660d684
KB
458\section{\class{wxMenuBar}}\label{wxmenubar}
459
460A menu bar is a series of menus accessible from the top of a frame.
461
462\wxheading{Derived from}
463
464\helpref{wxEvtHandler}{wxevthandler}\\
465\helpref{wxObject}{wxobject}
466
954b8ae6
JS
467\wxheading{Include files}
468
469<wx/menu.h>
470
a660d684
KB
471\wxheading{Event handling}
472
473To respond to a menu selection, provide a handler for EVT\_MENU, in the frame
e702ff0f
JS
474that contains the menu bar. If you have a toolbar which uses the same identifiers
475as your EVT\_MENU entries, events from the toolbar will also be processed by your
476EVT\_MENU event handlers.
477
478Note that menu commands (and UI update events for menus) are first sent to
479the focus window within the frame. If no window within the frame has the focus,
480then the events are sent directly to the frame. This allows command and UI update
481handling to be processed by specific windows and controls, and not necessarily
482by the application frame.
a660d684
KB
483
484\wxheading{See also}
485
486\helpref{wxMenu}{wxmenu}, \helpref{Event handling overview}{eventhandlingoverview}
487
488\latexignore{\rtfignore{\wxheading{Members}}}
489
490\membersection{wxMenuBar::wxMenuBar}\label{wxmenubarconstr}
491
17e79918 492\func{void}{wxMenuBar}{\param{long }{style = 0}}
a660d684
KB
493
494Default constructor.
495
eaaa6a06 496\func{void}{wxMenuBar}{\param{int}{ n}, \param{wxMenu*}{ menus[]}, \param{const wxString }{titles[]}}
a660d684
KB
497
498Construct a menu bar from arrays of menus and titles.
499
500\wxheading{Parameters}
501
502\docparam{n}{The number of menus.}
503
504\docparam{menus}{An array of menus. Do not use this array again - it now belongs to the
505menu bar.}
506
507\docparam{titles}{An array of title strings. Deallocate this array after creating the menu bar.}
508
d17f05af 509\docparam{style}{If {\tt wxMB\_DOCKABLE} the menu bar can be detached (wxGTK only).}
17e79918 510
06d20283
RD
511\pythonnote{Only the default constructor is supported in wxPython.
512Use wxMenuBar.Append instead.}
513
5873607e
VZ
514\perlnote{wxPerl only supports the first contructor:
515use {\tt Append} instead.}
516
a660d684
KB
517\membersection{wxMenuBar::\destruct{wxMenuBar}}
518
519\func{void}{\destruct{wxMenuBar}}{\void}
520
521Destructor, destroying the menu bar and removing it from the parent frame (if any).
522
523\membersection{wxMenuBar::Append}\label{wxmenubarappend}
524
1aaef614 525\func{bool}{Append}{\param{wxMenu *}{menu}, \param{const wxString\& }{title}}
a660d684
KB
526
527Adds the item to the end of the menu bar.
528
529\wxheading{Parameters}
530
531\docparam{menu}{The menu to add. Do not deallocate this menu after calling {\bf Append}.}
532
533\docparam{title}{The title of the menu.}
534
1aaef614
VZ
535\wxheading{Return value}
536
f6bcfd97 537TRUE on success, FALSE if an error occurred.
1aaef614
VZ
538
539\wxheading{See also}
540
541\helpref{wxMenuBar::Insert}{wxmenubarinsert}
542
a660d684
KB
543\membersection{wxMenuBar::Check}\label{wxmenubarcheck}
544
eaaa6a06 545\func{void}{Check}{\param{int}{ id}, \param{const bool}{ check}}
a660d684
KB
546
547Checks or unchecks a menu item.
548
549\wxheading{Parameters}
550
551\docparam{id}{The menu item identifier.}
552
553\docparam{check}{If TRUE, checks the menu item, otherwise the item is unchecked.}
554
555\wxheading{Remarks}
556
557Only use this when the menu bar has been associated
558with a frame; otherwise, use the wxMenu equivalent call.
559
560\membersection{wxMenuBar::Enable}\label{wxmenubarenable}
561
eaaa6a06 562\func{void}{Enable}{\param{int}{ id}, \param{const bool}{ enable}}
a660d684
KB
563
564Enables or disables (greys out) a menu item.
565
566\wxheading{Parameters}
567
568\docparam{id}{The menu item identifier.}
569
570\docparam{enable}{TRUE to enable the item, FALSE to disable it.}
571
572\wxheading{Remarks}
573
574Only use this when the menu bar has been
575associated with a frame; otherwise, use the wxMenu equivalent call.
576
577\membersection{wxMenuBar::EnableTop}\label{wxmenubarenabletop}
578
eaaa6a06 579\func{void}{EnableTop}{\param{int}{ pos}, \param{const bool}{ enable}}
a660d684
KB
580
581Enables or disables a whole menu.
582
583\wxheading{Parameters}
584
585\docparam{pos}{The position of the menu, starting from zero.}
586
587\docparam{enable}{TRUE to enable the menu, FALSE to disable it.}
588
589\wxheading{Remarks}
590
591Only use this when the menu bar has been
592associated with a frame.
593
270e8b6a
VZ
594\membersection{wxMenuBar::FindMenu}\label{wxmenubarfindmenu}
595
596\constfunc{int}{FindMenu}{\param{const wxString\& }{title}}
597
598Returns the index of the menu with the given {\it title} or wxNOT\_FOUND if no
599such menu exists in this menubar. The {\it title} parameter may specify either
600the menu title (with accelerator characters, i.e. {\tt "\&File"}) or just the
601menu label ({\tt "File"}) indifferently.
602
a660d684
KB
603\membersection{wxMenuBar::FindMenuItem}\label{wxmenubarfindmenuitem}
604
605\constfunc{int}{FindMenuItem}{\param{const wxString\& }{menuString}, \param{const wxString\& }{itemString}}
606
607Finds the menu item id for a menu name/menu item string pair.
608
609\wxheading{Parameters}
610
611\docparam{menuString}{Menu title to find.}
612
613\docparam{itemString}{Item to find.}
614
615\wxheading{Return value}
616
1aaef614 617The menu item identifier, or wxNOT\_FOUND if none was found.
a660d684
KB
618
619\wxheading{Remarks}
620
621Any special menu codes are stripped out of source and target strings
622before matching.
623
fc9c7c09 624\membersection{wxMenuBar::FindItem}\label{wxmenubarfinditem}
a660d684 625
407f3681 626\constfunc{wxMenuItem *}{FindItem}{\param{int}{ id}, \param{wxMenu}{ **menu = NULL}}
a660d684 627
fc9c7c09 628Finds the menu item object associated with the given menu item identifier.
a660d684
KB
629
630\wxheading{Parameters}
631
632\docparam{id}{Menu item identifier.}
407f3681 633
fc9c7c09 634\docparam{menu}{If not NULL, menu will get set to the associated menu.}
a660d684
KB
635
636\wxheading{Return value}
637
638The found menu item object, or NULL if one was not found.
639
640\membersection{wxMenuBar::GetHelpString}\label{wxmenubargethelpstring}
641
eaaa6a06 642\constfunc{wxString}{GetHelpString}{\param{int}{ id}}
a660d684
KB
643
644Gets the help string associated with the menu item identifer.
645
646\wxheading{Parameters}
647
648\docparam{id}{The menu item identifier.}
649
650\wxheading{Return value}
651
652The help string, or the empty string if there was no help string or the menu item
653was not found.
654
655\wxheading{See also}
656
657\helpref{wxMenuBar::SetHelpString}{wxmenubarsethelpstring}
658
659\membersection{wxMenuBar::GetLabel}\label{wxmenubargetlabel}
660
eaaa6a06 661\constfunc{wxString}{GetLabel}{\param{int}{ id}}
a660d684
KB
662
663Gets the label associated with a menu item.
664
665\wxheading{Parameters}
666
667\docparam{id}{The menu item identifier.}
668
669\wxheading{Return value}
670
671The menu item label, or the empty string if the item was not found.
672
673\wxheading{Remarks}
674
675Use only after the menubar has been associated with a frame.
676
677\membersection{wxMenuBar::GetLabelTop}\label{wxmenubargetlabeltop}
678
eaaa6a06 679\constfunc{wxString}{GetLabelTop}{\param{int}{ pos}}
a660d684
KB
680
681Returns the label of a top-level menu.
682
683\wxheading{Parameters}
684
685\docparam{pos}{Position of the menu on the menu bar, starting from zero.}
686
687\wxheading{Return value}
688
689The menu label, or the empty string if the menu was not found.
690
691\wxheading{Remarks}
692
693Use only after the menubar has been associated with a frame.
694
695\wxheading{See also}
696
697\helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop}
698
7f555861
JS
699\membersection{wxMenuBar::GetMenu}\label{wxmenubargetmenu}
700
701\constfunc{wxMenu*}{GetMenu}{\param{int}{ menuIndex}}
702
703Returns the menu at {\it menuIndex} (zero-based).
704
705\membersection{wxMenuBar::GetMenuCount}\label{wxmenubargetmenucount}
706
707\constfunc{int}{GetMenuCount}{\void}
708
709Returns the number of menus in this menubar.
710
e12be2f7 711\membersection{wxMenuBar::Insert}\label{wxmenubarinsert}
1aaef614
VZ
712
713\func{bool}{Insert}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}}
714
715Inserts the menu at the given position into the menu bar. Inserting menu at
fa482912
JS
716position $0$ will insert it in the very beginning of it, inserting at position
717\helpref{GetMenuCount()}{wxmenubargetmenucount} is the same as calling
1aaef614
VZ
718\helpref{Append()}{wxmenubarappend}.
719
720\wxheading{Parameters}
721
722\docparam{pos}{The position of the new menu in the menu bar}
723
724\docparam{menu}{The menu to add. wxMenuBar owns the menu and will free it.}
725
726\docparam{title}{The title of the menu.}
727
728\wxheading{Return value}
729
f6bcfd97 730TRUE on success, FALSE if an error occurred.
1aaef614
VZ
731
732\wxheading{See also}
733
734\helpref{wxMenuBar::Append}{wxmenubarappend}
735
a660d684
KB
736\membersection{wxMenuBar::IsChecked}\label{wxmenubarischecked}
737
eaaa6a06 738\constfunc{bool}{IsChecked}{\param{int}{ id}}
a660d684
KB
739
740Determines whether an item is checked.
741
742\wxheading{Parameters}
743
744\docparam{id}{The menu item identifier.}
745
746\wxheading{Return value}
747
748TRUE if the item was found and is checked, FALSE otherwise.
749
750\membersection{wxMenuBar::IsEnabled}\label{wxmenubarisenabled}
751
eaaa6a06 752\constfunc{bool}{IsEnabled}{\param{int}{ id}}
a660d684
KB
753
754Determines whether an item is enabled.
755
756\wxheading{Parameters}
757
758\docparam{id}{The menu item identifier.}
759
760\wxheading{Return value}
761
762TRUE if the item was found and is enabled, FALSE otherwise.
763
63dcfc15
PA
764\membersection{wxMenuBar::Refresh}\label{wxmenubarrefresh}
765
766\func{void}{Refresh}{\void}
767
768Redraw the menu bar
769
1aaef614
VZ
770\membersection{wxMenuBar::Remove}\label{wxmenubarremove}
771
772\func{wxMenu *}{Remove}{\param{size\_t }{pos}}
773
774Removes the menu from the menu bar and returns the menu object - the caller is
fa482912 775reposnbile for deleting it. This function may be used together with
1aaef614
VZ
776\helpref{wxMenuBar::Insert}{wxmenubarinsert} to change the menubar
777dynamically.
778
779\wxheading{See also}
780
2182e26f 781\helpref{wxMenuBar::Replace}{wxmenubarreplace}
1aaef614
VZ
782
783\membersection{wxMenuBar::Replace}\label{wxmenubarreplace}
784
785\func{wxMenu *}{Replace}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}}
786
fa482912 787Replaces the menu at the given position with another one.
1aaef614
VZ
788
789\wxheading{Parameters}
790
791\docparam{pos}{The position of the new menu in the menu bar}
792
793\docparam{menu}{The menu to add.}
794
795\docparam{title}{The title of the menu.}
796
797\wxheading{Return value}
798
799The menu which was previously at the position {\it pos}. The caller is
800responsible for deleting it.
801
802\wxheading{See also}
803
804\helpref{wxMenuBar::Insert}{wxmenubarinsert},\rtfsp
805\helpref{wxMenuBar::Remove}{wxmenubarremove}
806
a660d684
KB
807\membersection{wxMenuBar::SetHelpString}\label{wxmenubarsethelpstring}
808
eaaa6a06 809\func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}}
a660d684
KB
810
811Sets the help string associated with a menu item.
812
813\wxheading{Parameters}
814
815\docparam{id}{Menu item identifier.}
816
817\docparam{helpString}{Help string to associate with the menu item.}
818
819\wxheading{See also}
820
821\helpref{wxMenuBar::GetHelpString}{wxmenubargethelpstring}
822
823\membersection{wxMenuBar::SetLabel}\label{wxmenubarsetlabel}
824
eaaa6a06 825\func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}}
a660d684
KB
826
827Sets the label of a menu item.
828
829\wxheading{Parameters}
830
831\docparam{id}{Menu item identifier.}
832
833\docparam{label}{Menu item label.}
834
835\wxheading{Remarks}
836
837Use only after the menubar has been associated with a frame.
838
839\wxheading{See also}
840
841\helpref{wxMenuBar::GetLabel}{wxmenubargetlabel}
842
843\membersection{wxMenuBar::SetLabelTop}\label{wxmenubarsetlabeltop}
844
eaaa6a06 845\func{void}{SetLabelTop}{\param{int}{ pos}, \param{const wxString\& }{label}}
a660d684
KB
846
847Sets the label of a top-level menu.
848
849\wxheading{Parameters}
850
851\docparam{pos}{The position of a menu on the menu bar, starting from zero.}
852
853\docparam{label}{The menu label.}
854
855\wxheading{Remarks}
856
857Use only after the menubar has been associated with a frame.
858
859\wxheading{See also}
860
861\helpref{wxMenuBar::GetLabelTop}{wxmenubargetlabeltop}
862