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