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