]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
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 | |
0472ece7 | 5 | menu). Menus may be used to construct either menu bars or popup menus. |
a660d684 KB |
6 | |
7 | A menu item has an integer ID associated with it which can be used to | |
0472ece7 VZ |
8 | identify the selection, or to change the menu item in some way. A menu item |
9 | with a special identifier $-1$ is a separator item and doesn't have an | |
10 | associated command but just makes a separator line appear in the menu. | |
11 | ||
bb772a8e | 12 | {\bf NB:} Please note that {\it wxID\_ABOUT} and {\it wxID\_EXIT} are |
c436b310 RR |
13 | predefined by wxWidgets and have a special meaning since entries |
14 | using these IDs will be taken out of the normal menus under MacOS X | |
15 | and will be inserted into the system menu (following the appropriate | |
16 | MacOS X interface guideline). | |
17 | ||
0472ece7 VZ |
18 | Menu items may be either normal items, check items or radio items. Normal items |
19 | don't have any special properties while the check items have a boolean flag | |
20 | associated to them and they show a checkmark in the menu when the flag is set. | |
fc2171bd | 21 | wxWidgets automatically toggles the flag value when the item is clicked and its |
0472ece7 VZ |
22 | value may be retrieved using either \helpref{IsChecked}{wxmenuischecked} method |
23 | of wxMenu or wxMenuBar itself or by using | |
24 | \helpref{wxEvent::IsChecked}{wxcommandeventischecked} when you get the menu | |
25 | notification for the item in question. | |
26 | ||
27 | The radio items are similar to the check items except that all the other items | |
28 | in the same radio group are unchecked when a radio item is checked. The radio | |
29 | group is formed by a contiguous range of radio items, i.e. it starts at the | |
30 | first item of this kind and ends with the first item of a different kind (or | |
31 | the end of the menu). Notice that because the radio groups are defined in terms | |
32 | of the item positions inserting or removing the items in the menu containing | |
25057aba JS |
33 | the radio items risks to not work correctly. Finally note that radio items |
34 | are not supported under Motif. | |
a660d684 | 35 | |
2b5f62a0 VZ |
36 | \wxheading{Allocation strategy} |
37 | ||
38 | All menus except the popup ones must be created on the heap. All menus | |
39 | attached to a menubar or to another menu will be deleted by their parent when | |
40 | it is deleted. As the frame menubar is deleted by the frame itself, it means | |
41 | that normally all menus used are deleted automatically. | |
42 | ||
a660d684 KB |
43 | \wxheading{Derived from} |
44 | ||
45 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
46 | \helpref{wxObject}{wxobject} | |
47 | ||
954b8ae6 JS |
48 | \wxheading{Include files} |
49 | ||
50 | <wx/menu.h> | |
51 | ||
a660d684 KB |
52 | \wxheading{Event handling} |
53 | ||
54 | If the menu is part of a menubar, then \helpref{wxMenuBar}{wxmenubar} event processing is used. | |
55 | ||
56 | With a popup menu, there is a variety of ways to handle a menu selection event | |
57 | (wxEVT\_COMMAND\_MENU\_SELECTED). | |
58 | ||
59 | \begin{enumerate}\itemsep=0pt | |
a660d684 KB |
60 | \item Derive a new class from wxMenu and define event table entries using the EVT\_MENU macro. |
61 | \item Set a new event handler for wxMenu, using an object whose class has EVT\_MENU entries. | |
62 | \item Provide EVT\_MENU handlers in the window which pops up the menu, or in an ancestor of | |
63 | this window. | |
1aaef614 | 64 | \item Define a callback of type wxFunction, which you pass to the wxMenu constructor. |
874a1686 | 65 | The callback takes a reference to the menu, and a reference to a |
1aaef614 VZ |
66 | \helpref{wxCommandEvent}{wxcommandevent}. This method is deprecated and should |
67 | not be used in the new code, it is provided for backwards compatibility only. | |
a660d684 KB |
68 | \end{enumerate} |
69 | ||
70 | \wxheading{See also} | |
71 | ||
72 | \helpref{wxMenuBar}{wxmenubar}, \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu},\rtfsp | |
73 | \helpref{Event handling overview}{eventhandlingoverview} | |
74 | ||
75 | \latexignore{\rtfignore{\wxheading{Members}}} | |
76 | ||
dcbd177f | 77 | \membersection{wxMenu::wxMenu}\label{wxmenuctor} |
a660d684 | 78 | |
b1462dfa | 79 | \func{}{wxMenu}{\param{const wxString\& }{title = ""}, \param{long}{ style = 0}} |
a660d684 KB |
80 | |
81 | Constructs a wxMenu object. | |
82 | ||
83 | \wxheading{Parameters} | |
84 | ||
85 | \docparam{title}{A title for the popup menu: the empty string denotes no title.} | |
86 | ||
809f39fe | 87 | \docparam{style}{If set to {\tt wxMENU\_TEAROFF}, the menu will be detachable (wxGTK only).} |
06d20283 | 88 | |
407f3681 | 89 | \func{}{wxMenu}{\param{long}{ style}} |
4e986502 KB |
90 | |
91 | Constructs a wxMenu object. | |
92 | ||
93 | \wxheading{Parameters} | |
407f3681 | 94 | |
809f39fe | 95 | \docparam{style}{If set to {\tt wxMENU\_TEAROFF}, the menu will be detachable (wxGTK only).} |
4e986502 | 96 | |
dcbd177f | 97 | \membersection{wxMenu::\destruct{wxMenu}}\label{wxmenudtor} |
a660d684 KB |
98 | |
99 | \func{}{\destruct{wxMenu}}{\void} | |
100 | ||
101 | Destructor, destroying the menu. | |
102 | ||
b412f9be JS |
103 | Note: under Motif, a popup menu must have a valid parent (the window |
104 | it was last popped up on) when being destroyed. Therefore, make sure | |
105 | you delete or re-use the popup menu {\it before} destroying the | |
106 | parent window. Re-use in this context means popping up the menu on | |
107 | a different window from last time, which causes an implicit destruction | |
108 | and recreation of internal data structures. | |
109 | ||
a660d684 KB |
110 | \membersection{wxMenu::Append}\label{wxmenuappend} |
111 | ||
9add9367 | 112 | \func{wxMenuItem*}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp |
98322660 | 113 | \param{wxItemKind}{ kind = wxITEM\_NORMAL}} |
a660d684 KB |
114 | |
115 | Adds a string item to the end of the menu. | |
116 | ||
9add9367 | 117 | \func{wxMenuItem*}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{wxMenu *}{subMenu},\rtfsp |
a660d684 KB |
118 | \param{const wxString\& }{helpString = ""}} |
119 | ||
2b5f62a0 VZ |
120 | Adds a pull-right submenu to the end of the menu. Append the submenu to the parent |
121 | menu {\it after} you have added your menu items, or accelerators may not be | |
122 | registered properly. | |
a660d684 | 123 | |
9add9367 | 124 | \func{wxMenuItem*}{Append}{\param{wxMenuItem*}{ menuItem}} |
a660d684 | 125 | |
1aaef614 VZ |
126 | Adds a menu item object. This is the most generic variant of Append() method |
127 | because it may be used for both items (including separators) and submenus and | |
128 | because you can also specify various extra properties of a menu item this way, | |
a660d684 KB |
129 | such as bitmaps and fonts. |
130 | ||
131 | \wxheading{Parameters} | |
132 | ||
133 | \docparam{id}{The menu command identifier.} | |
134 | ||
135 | \docparam{item}{The string to appear on the menu item.} | |
136 | ||
137 | \docparam{menu}{Pull-right submenu.} | |
138 | ||
98322660 JS |
139 | \docparam{kind}{May be {\tt wxITEM\_SEPARATOR}, {\tt wxITEM\_NORMAL}, |
140 | {\tt wxITEM\_CHECK} or {\tt wxITEM\_RADIO}} | |
a660d684 KB |
141 | |
142 | \docparam{helpString}{An optional help string associated with the item. | |
684761db | 143 | By default, the handler for the wxEVT\_MENU\_HIGHLIGHT event displays |
a660d684 KB |
144 | this string in the status line.} |
145 | ||
146 | \docparam{menuItem}{A menuitem object. It will be owned by the wxMenu object after this function | |
147 | is called, so do not delete it yourself.} | |
148 | ||
149 | \wxheading{Remarks} | |
150 | ||
151 | This command can be used after the menu has been shown, as well as on initial | |
152 | creation of a menu or menubar. | |
153 | ||
69440cd2 VZ |
154 | The {\it item} string for the normal menu items (not submenus or separators) |
155 | may include the accelerator which can be used to activate the menu item | |
156 | from keyboard. The accelerator string follows the item label and is separated | |
157 | from it by a {\tt TAB} character ({\tt '$\backslash$t'}). Its general syntax is | |
158 | any combination of {\tt "CTRL"}, {\tt "ALT"} and {\tt "SHIFT"} strings (case | |
159 | doesn't matter) separated by either {\tt '-'} or {\tt '+'} characters and | |
160 | followed by the accelerator itself. The accelerator may be any alphanumeric | |
161 | character, any function key (from {\tt F1} to {\tt F12}) or one of the special | |
162 | characters listed in the table below (again, case doesn't matter): | |
d2c2afc9 | 163 | |
69440cd2 VZ |
164 | \begin{twocollist}\itemsep=0pt |
165 | \twocolitem{{\tt DEL} or {\tt DELETE}}{Delete key} | |
166 | \twocolitem{{\tt INS} or {\tt INSERT}}{Insert key} | |
167 | \twocolitem{{\tt ENTER} or {\tt RETURN}}{Enter key} | |
168 | \twocolitem{{\tt PGUP}}{PageUp key} | |
169 | \twocolitem{{\tt PGDN}}{PageDown key} | |
170 | \twocolitem{{\tt LEFT}}{Left cursor arrow key} | |
171 | \twocolitem{{\tt RIGHT}}{Right cursor arrow key} | |
172 | \twocolitem{{\tt UP}}{Up cursor arrow key} | |
173 | \twocolitem{{\tt DOWN}}{Down cursor arrow key} | |
174 | \twocolitem{{\tt HOME}}{Home key} | |
175 | \twocolitem{{\tt END}}{End key} | |
176 | \twocolitem{{\tt SPACE}}{Space} | |
177 | \twocolitem{{\tt TAB}}{Tab key} | |
41b78190 | 178 | \twocolitem{{\tt ESC} or {\tt ESCAPE}}{Escape key (Windows only)} |
69440cd2 VZ |
179 | \end{twocollist} |
180 | ||
a660d684 KB |
181 | \wxheading{See also} |
182 | ||
1aaef614 | 183 | \helpref{wxMenu::AppendSeparator}{wxmenuappendseparator},\rtfsp |
d65c269b VZ |
184 | \helpref{wxMenu::AppendCheckItem}{wxmenuappendcheckitem},\rtfsp |
185 | \helpref{wxMenu::AppendRadioItem}{wxmenuappendradioitem},\rtfsp | |
1aaef614 VZ |
186 | \helpref{wxMenu::Insert}{wxmenuinsert},\rtfsp |
187 | \helpref{wxMenu::SetLabel}{wxmenusetlabel}, \helpref{wxMenu::GetHelpString}{wxmenugethelpstring},\rtfsp | |
a660d684 KB |
188 | \helpref{wxMenu::SetHelpString}{wxmenusethelpstring}, \helpref{wxMenuItem}{wxmenuitem} |
189 | ||
06d20283 | 190 | \pythonnote{In place of a single overloaded method name, wxPython |
d2c2afc9 JS |
191 | implements the following methods: |
192 | ||
06d20283 | 193 | \indented{2cm}{\begin{twocollist} |
cc81d32f | 194 | \twocolitem{{\bf Append(id, string, helpStr="", checkable=false)}}{} |
c9110876 VS |
195 | \twocolitem{{\bf AppendMenu(id, string, aMenu, helpStr="")}}{} |
196 | \twocolitem{{\bf AppendItem(aMenuItem)}}{} | |
06d20283 RD |
197 | \end{twocollist}} |
198 | } | |
199 | ||
d65c269b VZ |
200 | \membersection{wxMenu::AppendCheckItem}\label{wxmenuappendcheckitem} |
201 | ||
9add9367 | 202 | \func{wxMenuItem*}{AppendCheckItem}{\param{int}{ id},\rtfsp |
d65c269b VZ |
203 | \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}} |
204 | ||
205 | Adds a checkable item to the end of the menu. | |
206 | ||
207 | \wxheading{See also} | |
208 | ||
209 | \helpref{wxMenu::Append}{wxmenuappend},\rtfsp | |
210 | \helpref{wxMenu::InsertCheckItem}{wxmenuinsertcheckitem} | |
211 | ||
212 | \membersection{wxMenu::AppendRadioItem}\label{wxmenuappendradioitem} | |
213 | ||
9add9367 | 214 | \func{wxMenuItem*}{AppendRadioItem}{\param{int}{ id},\rtfsp |
d65c269b VZ |
215 | \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}} |
216 | ||
217 | Adds a radio item to the end of the menu. All consequent radio items form a | |
218 | group and when an item in the group is checked, all the others are | |
219 | automatically unchecked. | |
220 | ||
221 | {\bf NB:} Currently only implemented under Windows and GTK, use | |
7af3ca16 | 222 | {\tt\#if wxHAS\_RADIO\_MENU\_ITEMS} to test for availability of this feature. |
d65c269b VZ |
223 | |
224 | \wxheading{See also} | |
225 | ||
226 | \helpref{wxMenu::Append}{wxmenuappend},\rtfsp | |
227 | \helpref{wxMenu::InsertRadioItem}{wxmenuinsertradioitem} | |
228 | ||
a660d684 KB |
229 | \membersection{wxMenu::AppendSeparator}\label{wxmenuappendseparator} |
230 | ||
9add9367 | 231 | \func{wxMenuItem*}{AppendSeparator}{\void} |
a660d684 KB |
232 | |
233 | Adds a separator to the end of the menu. | |
234 | ||
235 | \wxheading{See also} | |
236 | ||
d65c269b VZ |
237 | \helpref{wxMenu::Append}{wxmenuappend},\rtfsp |
238 | \helpref{wxMenu::InsertSeparator}{wxmenuinsertseparator} | |
a660d684 KB |
239 | |
240 | \membersection{wxMenu::Break}\label{wxmenubreak} | |
241 | ||
242 | \func{void}{Break}{\void} | |
243 | ||
244 | Inserts a break in a menu, causing the next appended item to appear in a new column. | |
245 | ||
246 | \membersection{wxMenu::Check}\label{wxmenucheck} | |
247 | ||
eaaa6a06 | 248 | \func{void}{Check}{\param{int}{ id}, \param{const bool}{ check}} |
a660d684 KB |
249 | |
250 | Checks or unchecks the menu item. | |
251 | ||
252 | \wxheading{Parameters} | |
253 | ||
254 | \docparam{id}{The menu item identifier.} | |
255 | ||
cc81d32f | 256 | \docparam{check}{If true, the item will be checked, otherwise it will be unchecked.} |
a660d684 KB |
257 | |
258 | \wxheading{See also} | |
259 | ||
260 | \helpref{wxMenu::IsChecked}{wxmenuischecked} | |
261 | ||
fc9c7c09 RR |
262 | \membersection{wxMenu::Delete}\label{wxmenudelete} |
263 | ||
264 | \func{void}{Delete}{\param{int }{id}} | |
265 | ||
1aaef614 VZ |
266 | \func{void}{Delete}{\param{wxMenuItem *}{item}} |
267 | ||
874a1686 | 268 | Deletes the menu item from the menu. If the item is a submenu, it will |
1aaef614 VZ |
269 | {\bf not} be deleted. Use \helpref{Destroy}{wxmenudestroy} if you want to |
270 | delete a submenu. | |
fc9c7c09 RR |
271 | |
272 | \wxheading{Parameters} | |
273 | ||
1aaef614 | 274 | \docparam{id}{Id of the menu item to be deleted.} |
fc9c7c09 | 275 | |
1aaef614 VZ |
276 | \docparam{item}{Menu item to be deleted.} |
277 | ||
278 | \wxheading{See also} | |
279 | ||
280 | \helpref{wxMenu::FindItem}{wxmenufinditem},\rtfsp | |
281 | \helpref{wxMenu::Destroy}{wxmenudestroy},\rtfsp | |
282 | \helpref{wxMenu::Remove}{wxmenuremove} | |
283 | ||
284 | \membersection{wxMenu::Destroy}\label{wxmenudestroy} | |
285 | ||
286 | \func{void}{Destroy}{\param{int }{id}} | |
287 | ||
288 | \func{void}{Destroy}{\param{wxMenuItem *}{item}} | |
289 | ||
874a1686 | 290 | Deletes the menu item from the menu. If the item is a submenu, it will |
1aaef614 VZ |
291 | be deleted. Use \helpref{Remove}{wxmenuremove} if you want to keep the submenu |
292 | (for example, to reuse it later). | |
fc9c7c09 | 293 | |
1aaef614 VZ |
294 | \wxheading{Parameters} |
295 | ||
296 | \docparam{id}{Id of the menu item to be deleted.} | |
297 | ||
298 | \docparam{item}{Menu item to be deleted.} | |
fc9c7c09 RR |
299 | |
300 | \wxheading{See also} | |
301 | ||
1aaef614 VZ |
302 | \helpref{wxMenu::FindItem}{wxmenufinditem},\rtfsp |
303 | \helpref{wxMenu::Deletes}{wxmenudelete},\rtfsp | |
304 | \helpref{wxMenu::Remove}{wxmenuremove} | |
fc9c7c09 | 305 | |
a660d684 KB |
306 | \membersection{wxMenu::Enable}\label{wxmenuenable} |
307 | ||
eaaa6a06 | 308 | \func{void}{Enable}{\param{int}{ id}, \param{const bool}{ enable}} |
a660d684 KB |
309 | |
310 | Enables or disables (greys out) a menu item. | |
311 | ||
312 | \wxheading{Parameters} | |
313 | ||
314 | \docparam{id}{The menu item identifier.} | |
315 | ||
cc81d32f | 316 | \docparam{enable}{true to enable the menu item, false to disable it.} |
a660d684 KB |
317 | |
318 | \wxheading{See also} | |
319 | ||
320 | \helpref{wxMenu::IsEnabled}{wxmenuisenabled} | |
321 | ||
322 | \membersection{wxMenu::FindItem}\label{wxmenufinditem} | |
323 | ||
324 | \constfunc{int}{FindItem}{\param{const wxString\& }{itemString}} | |
325 | ||
326 | Finds the menu item id for a menu item string. | |
327 | ||
1aaef614 | 328 | \constfunc{wxMenuItem *}{FindItem}{\param{int}{ id}, \param{wxMenu **}{menu = NULL}} |
407f3681 | 329 | |
1aaef614 VZ |
330 | Finds the menu item object associated with the given menu item identifier and, |
331 | optionally, the (sub)menu it belongs to. | |
a660d684 | 332 | |
5873607e VZ |
333 | \perlnote{In wxPerl this method takes just the {\tt id} parameter; |
334 | in scalar context it returns the associated {\tt Wx::MenuItem}, in list | |
9722642d | 335 | context it returns a 2-element list {\tt ( item, submenu )}} |
5873607e | 336 | |
a660d684 KB |
337 | \wxheading{Parameters} |
338 | ||
e12be2f7 JS |
339 | \docparam{itemString}{Menu item string to find.} |
340 | ||
a660d684 KB |
341 | \docparam{id}{Menu item identifier.} |
342 | ||
3980000c | 343 | \docparam{menu}{If the pointer is not NULL, it will be filled with the item's |
1aaef614 VZ |
344 | parent menu (if the item was found)} |
345 | ||
a660d684 KB |
346 | \wxheading{Return value} |
347 | ||
a8d08dbd | 348 | First form: menu item identifier, or {\tt wxNOT\_FOUND} if none is found. |
a660d684 | 349 | |
e12be2f7 | 350 | Second form: returns the menu item object, or NULL if it is not found. |
a660d684 | 351 | |
e12be2f7 JS |
352 | \wxheading{Remarks} |
353 | ||
354 | Any special menu codes are stripped out of source and target strings | |
355 | before matching. | |
a660d684 | 356 | |
fa482912 | 357 | \pythonnote{The name of this method in wxPython is {\tt FindItemById} |
874a1686 RD |
358 | and it does not support the second parameter.} |
359 | ||
bd582574 JS |
360 | \membersection{wxMenu::FindItemByPosition}\label{wxmenufinditembyposition} |
361 | ||
62313dec | 362 | \constfunc{wxMenuItem*}{FindItemByPosition}{\param{size\_t }{position}} |
bd582574 JS |
363 | |
364 | Returns the wxMenuItem given a position in the menu. | |
365 | ||
a660d684 KB |
366 | \membersection{wxMenu::GetHelpString}\label{wxmenugethelpstring} |
367 | ||
eaaa6a06 | 368 | \constfunc{wxString}{GetHelpString}{\param{int}{ id}} |
a660d684 KB |
369 | |
370 | Returns the help string associated with a menu item. | |
371 | ||
372 | \wxheading{Parameters} | |
373 | ||
374 | \docparam{id}{The menu item identifier.} | |
375 | ||
376 | \wxheading{Return value} | |
377 | ||
378 | The help string, or the empty string if there is no help string or the | |
379 | item was not found. | |
380 | ||
381 | \wxheading{See also} | |
382 | ||
383 | \helpref{wxMenu::SetHelpString}{wxmenusethelpstring}, \helpref{wxMenu::Append}{wxmenuappend} | |
384 | ||
385 | \membersection{wxMenu::GetLabel}\label{wxmenugetlabel} | |
386 | ||
eaaa6a06 | 387 | \constfunc{wxString}{GetLabel}{\param{int}{ id}} |
a660d684 KB |
388 | |
389 | Returns a menu item label. | |
390 | ||
391 | \wxheading{Parameters} | |
392 | ||
393 | \docparam{id}{The menu item identifier.} | |
394 | ||
395 | \wxheading{Return value} | |
396 | ||
397 | The item label, or the empty string if the item was not found. | |
398 | ||
399 | \wxheading{See also} | |
400 | ||
401 | \helpref{wxMenu::SetLabel}{wxmenusetlabel} | |
402 | ||
1aaef614 VZ |
403 | \membersection{wxMenu::GetMenuItemCount}\label{wxmenugetmenuitemcount} |
404 | ||
405 | \constfunc{size\_t}{GetMenuItemCount}{\void} | |
406 | ||
407 | Returns the number of items in the menu. | |
408 | ||
409 | \membersection{wxMenu::GetMenuItems}\label{wxmenugetmenuitems} | |
410 | ||
411 | \constfunc{wxMenuItemList\&}{GetMenuItems}{\void} | |
412 | ||
413 | Returns the list of items in the menu. wxMenuItemList is a pseudo-template | |
414 | list class containing wxMenuItem pointers. | |
415 | ||
a660d684 KB |
416 | \membersection{wxMenu::GetTitle}\label{wxmenugettitle} |
417 | ||
418 | \constfunc{wxString}{GetTitle}{\void} | |
419 | ||
420 | Returns the title of the menu. | |
421 | ||
422 | \wxheading{Remarks} | |
423 | ||
706f30f8 VZ |
424 | This is relevant only to popup menus, use |
425 | \helpref{wxMenuBar::GetLabelTop}{wxmenubargetlabeltop} for the menus in the | |
426 | menubar. | |
a660d684 KB |
427 | |
428 | \wxheading{See also} | |
429 | ||
430 | \helpref{wxMenu::SetTitle}{wxmenusettitle} | |
431 | ||
1aaef614 VZ |
432 | \membersection{wxMenu::Insert}\label{wxmenuinsert} |
433 | ||
9add9367 | 434 | \func{wxMenuItem*}{Insert}{\param{size\_t }{pos}, \param{wxMenuItem *}{item}} |
1aaef614 | 435 | |
9add9367 | 436 | \func{wxMenuItem*}{Insert}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp |
d65c269b | 437 | \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp |
98322660 | 438 | \param{wxItemKind}{ kind = wxITEM\_NORMAL}} |
d65c269b | 439 | |
1aaef614 | 440 | Inserts the given {\it item} before the position {\it pos}. Inserting the item |
3980000c | 441 | at position \helpref{GetMenuItemCount}{wxmenugetmenuitemcount} is the same |
1aaef614 VZ |
442 | as appending it. |
443 | ||
444 | \wxheading{See also} | |
445 | ||
d65c269b VZ |
446 | \helpref{wxMenu::Append}{wxmenuappend},\rtfsp |
447 | \helpref{wxMenu::Prepend}{wxmenuprepend} | |
448 | ||
449 | \membersection{wxMenu::InsertCheckItem}\label{wxmenuinsertcheckitem} | |
450 | ||
9add9367 | 451 | \func{wxMenuItem*}{InsertCheckItem}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp |
d65c269b VZ |
452 | \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}} |
453 | ||
454 | Inserts a checkable item at the given position. | |
455 | ||
456 | \wxheading{See also} | |
457 | ||
458 | \helpref{wxMenu::Insert}{wxmenuinsert},\rtfsp | |
459 | \helpref{wxMenu::AppendCheckItem}{wxmenuappendcheckitem} | |
460 | ||
461 | \membersection{wxMenu::InsertRadioItem}\label{wxmenuinsertradioitem} | |
462 | ||
9add9367 | 463 | \func{wxMenuItem*}{InsertRadioItem}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp |
d65c269b VZ |
464 | \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}} |
465 | ||
466 | Inserts a radio item at the given position. | |
467 | ||
468 | \wxheading{See also} | |
469 | ||
470 | \helpref{wxMenu::Insert}{wxmenuinsert},\rtfsp | |
471 | \helpref{wxMenu::AppendRadioItem}{wxmenuappendradioitem} | |
472 | ||
473 | \membersection{wxMenu::InsertSeparator}\label{wxmenuinsertseparator} | |
474 | ||
9add9367 | 475 | \func{wxMenuItem*}{InsertSeparator}{\param{size\_t }{pos}} |
d65c269b VZ |
476 | |
477 | Inserts a separator at the given position. | |
478 | ||
479 | \wxheading{See also} | |
480 | ||
481 | \helpref{wxMenu::Insert}{wxmenuinsert},\rtfsp | |
482 | \helpref{wxMenu::AppendSeparator}{wxmenuappendseparator} | |
1aaef614 | 483 | |
a660d684 KB |
484 | \membersection{wxMenu::IsChecked}\label{wxmenuischecked} |
485 | ||
eaaa6a06 | 486 | \constfunc{bool}{IsChecked}{\param{int}{ id}} |
a660d684 KB |
487 | |
488 | Determines whether a menu item is checked. | |
489 | ||
490 | \wxheading{Parameters} | |
491 | ||
492 | \docparam{id}{The menu item identifier.} | |
493 | ||
494 | \wxheading{Return value} | |
495 | ||
cc81d32f | 496 | true if the menu item is checked, false otherwise. |
a660d684 KB |
497 | |
498 | \wxheading{See also} | |
499 | ||
500 | \helpref{wxMenu::Check}{wxmenucheck} | |
501 | ||
502 | \membersection{wxMenu::IsEnabled}\label{wxmenuisenabled} | |
503 | ||
eaaa6a06 | 504 | \constfunc{bool}{IsEnabled}{\param{int}{ id}} |
a660d684 KB |
505 | |
506 | Determines whether a menu item is enabled. | |
507 | ||
508 | \wxheading{Parameters} | |
509 | ||
510 | \docparam{id}{The menu item identifier.} | |
511 | ||
512 | \wxheading{Return value} | |
513 | ||
cc81d32f | 514 | true if the menu item is enabled, false otherwise. |
a660d684 KB |
515 | |
516 | \wxheading{See also} | |
517 | ||
518 | \helpref{wxMenu::Enable}{wxmenuenable} | |
519 | ||
d65c269b VZ |
520 | \membersection{wxMenu::Prepend}\label{wxmenuprepend} |
521 | ||
9add9367 | 522 | \func{wxMenuItem*}{Prepend}{\param{wxMenuItem *}{item}} |
d65c269b | 523 | |
9add9367 | 524 | \func{wxMenuItem*}{Prepend}{\param{int}{ id},\rtfsp |
d65c269b | 525 | \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp |
98322660 | 526 | \param{wxItemKind}{ kind = wxITEM\_NORMAL}} |
d65c269b | 527 | |
3980000c | 528 | Inserts the given {\it item} at position $0$, i.e. before all the other |
0cde01ae | 529 | existing items. |
d65c269b VZ |
530 | |
531 | \wxheading{See also} | |
532 | ||
533 | \helpref{wxMenu::Append}{wxmenuappend},\rtfsp | |
3980000c | 534 | \helpref{wxMenu::Insert}{wxmenuinsert} |
d65c269b VZ |
535 | |
536 | \membersection{wxMenu::PrependCheckItem}\label{wxmenuprependcheckitem} | |
537 | ||
9add9367 | 538 | \func{wxMenuItem*}{PrependCheckItem}{\param{int}{ id},\rtfsp |
d65c269b VZ |
539 | \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}} |
540 | ||
3980000c | 541 | Inserts a checkable item at position $0$. |
d65c269b VZ |
542 | |
543 | \wxheading{See also} | |
544 | ||
545 | \helpref{wxMenu::Prepend}{wxmenuprepend},\rtfsp | |
546 | \helpref{wxMenu::AppendCheckItem}{wxmenuappendcheckitem} | |
547 | ||
548 | \membersection{wxMenu::PrependRadioItem}\label{wxmenuprependradioitem} | |
549 | ||
9add9367 | 550 | \func{wxMenuItem*}{PrependRadioItem}{\param{int}{ id},\rtfsp |
d65c269b VZ |
551 | \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}} |
552 | ||
3980000c | 553 | Inserts a radio item at position $0$. |
d65c269b VZ |
554 | |
555 | \wxheading{See also} | |
556 | ||
557 | \helpref{wxMenu::Prepend}{wxmenuprepend},\rtfsp | |
558 | \helpref{wxMenu::AppendRadioItem}{wxmenuappendradioitem} | |
559 | ||
560 | \membersection{wxMenu::PrependSeparator}\label{wxmenuprependseparator} | |
561 | ||
f6e9a818 | 562 | \func{wxMenuItem*}{PrependSeparator}{\void} |
d65c269b | 563 | |
3980000c | 564 | Inserts a separator at position $0$. |
d65c269b VZ |
565 | |
566 | \wxheading{See also} | |
567 | ||
568 | \helpref{wxMenu::Prepend}{wxmenuprepend},\rtfsp | |
569 | \helpref{wxMenu::AppendSeparator}{wxmenuappendseparator} | |
570 | ||
1aaef614 VZ |
571 | \membersection{wxMenu::Remove}\label{wxmenuremove} |
572 | ||
573 | \func{wxMenuItem *}{Remove}{\param{int }{id}} | |
574 | ||
575 | \func{wxMenuItem *}{Remove}{\param{wxMenuItem *}{item}} | |
576 | ||
577 | Removes the menu item from the menu but doesn't delete the associated C++ | |
578 | object. This allows to reuse the same item later by adding it back to the menu | |
579 | (especially useful with submenus). | |
580 | ||
581 | \wxheading{Parameters} | |
582 | ||
583 | \docparam{id}{The identifier of the menu item to remove.} | |
584 | ||
585 | \docparam{item}{The menu item to remove.} | |
586 | ||
587 | \wxheading{Return value} | |
588 | ||
589 | The item which was detached from the menu. | |
590 | ||
a660d684 KB |
591 | \membersection{wxMenu::SetHelpString}\label{wxmenusethelpstring} |
592 | ||
eaaa6a06 | 593 | \func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}} |
a660d684 KB |
594 | |
595 | Sets an item's help string. | |
596 | ||
597 | \wxheading{Parameters} | |
598 | ||
599 | \docparam{id}{The menu item identifier.} | |
600 | ||
601 | \docparam{helpString}{The help string to set.} | |
602 | ||
603 | \wxheading{See also} | |
604 | ||
605 | \helpref{wxMenu::GetHelpString}{wxmenugethelpstring} | |
606 | ||
607 | \membersection{wxMenu::SetLabel}\label{wxmenusetlabel} | |
608 | ||
eaaa6a06 | 609 | \func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}} |
a660d684 KB |
610 | |
611 | Sets the label of a menu item. | |
612 | ||
613 | \wxheading{Parameters} | |
614 | ||
615 | \docparam{id}{The menu item identifier.} | |
616 | ||
617 | \docparam{label}{The menu item label to set.} | |
618 | ||
619 | \wxheading{See also} | |
620 | ||
621 | \helpref{wxMenu::Append}{wxmenuappend}, \helpref{wxMenu::GetLabel}{wxmenugetlabel} | |
622 | ||
623 | \membersection{wxMenu::SetTitle}\label{wxmenusettitle} | |
624 | ||
625 | \func{void}{SetTitle}{\param{const wxString\& }{title}} | |
626 | ||
627 | Sets the title of the menu. | |
628 | ||
629 | \wxheading{Parameters} | |
630 | ||
631 | \docparam{title}{The title to set.} | |
632 | ||
633 | \wxheading{Remarks} | |
634 | ||
706f30f8 VZ |
635 | This is relevant only to popup menus, use |
636 | \helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop} for the menus in the | |
637 | menubar. | |
a660d684 KB |
638 | |
639 | \wxheading{See also} | |
640 | ||
706f30f8 | 641 | \helpref{wxMenu::GetTitle}{wxmenugettitle} |
a660d684 | 642 | |
631f1bfe JS |
643 | \membersection{wxMenu::UpdateUI}\label{wxmenuupdateui} |
644 | ||
645 | \constfunc{void}{UpdateUI}{\param{wxEvtHandler*}{ source = NULL}} | |
646 | ||
647 | Sends events to {\it source} (or owning window if NULL) to update the | |
648 | menu UI. This is called just before the menu is popped up with \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu}, but | |
649 | the application may call it at other times if required. | |
650 | ||
651 | \wxheading{See also} | |
652 | ||
653 | \helpref{wxUpdateUIEvent}{wxupdateuievent} | |
654 | ||
a660d684 KB |
655 | \section{\class{wxMenuBar}}\label{wxmenubar} |
656 | ||
657 | A menu bar is a series of menus accessible from the top of a frame. | |
658 | ||
659 | \wxheading{Derived from} | |
660 | ||
2138129e | 661 | \helpref{wxWindow}{wxwindow}\\ |
a660d684 KB |
662 | \helpref{wxEvtHandler}{wxevthandler}\\ |
663 | \helpref{wxObject}{wxobject} | |
664 | ||
954b8ae6 JS |
665 | \wxheading{Include files} |
666 | ||
667 | <wx/menu.h> | |
668 | ||
a660d684 KB |
669 | \wxheading{Event handling} |
670 | ||
671 | To respond to a menu selection, provide a handler for EVT\_MENU, in the frame | |
e702ff0f JS |
672 | that contains the menu bar. If you have a toolbar which uses the same identifiers |
673 | as your EVT\_MENU entries, events from the toolbar will also be processed by your | |
674 | EVT\_MENU event handlers. | |
675 | ||
0ddef74d JS |
676 | {\bf Tip:} under Windows, if you discover that menu shortcuts (for example, Alt-F to show the file menu) |
677 | are not working, check any EVT\_CHAR events you are handling in child windows. | |
678 | If you are not calling {\tt event.Skip()} for events that you don't process in these event handlers, | |
679 | menu shortcuts may cease to work. | |
680 | ||
a660d684 KB |
681 | \wxheading{See also} |
682 | ||
683 | \helpref{wxMenu}{wxmenu}, \helpref{Event handling overview}{eventhandlingoverview} | |
684 | ||
685 | \latexignore{\rtfignore{\wxheading{Members}}} | |
686 | ||
dcbd177f | 687 | \membersection{wxMenuBar::wxMenuBar}\label{wxmenubarctor} |
a660d684 | 688 | |
f6e9a818 | 689 | \func{}{wxMenuBar}{\param{long }{style = 0}} |
a660d684 KB |
690 | |
691 | Default constructor. | |
692 | ||
f6e9a818 | 693 | \func{}{wxMenuBar}{\param{int}{ n}, \param{wxMenu*}{ menus[]}, \param{const wxString }{titles[]}} |
a660d684 KB |
694 | |
695 | Construct a menu bar from arrays of menus and titles. | |
696 | ||
697 | \wxheading{Parameters} | |
698 | ||
699 | \docparam{n}{The number of menus.} | |
700 | ||
701 | \docparam{menus}{An array of menus. Do not use this array again - it now belongs to the | |
702 | menu bar.} | |
703 | ||
704 | \docparam{titles}{An array of title strings. Deallocate this array after creating the menu bar.} | |
705 | ||
d17f05af | 706 | \docparam{style}{If {\tt wxMB\_DOCKABLE} the menu bar can be detached (wxGTK only).} |
17e79918 | 707 | |
06d20283 RD |
708 | \pythonnote{Only the default constructor is supported in wxPython. |
709 | Use wxMenuBar.Append instead.} | |
710 | ||
2edb0bde | 711 | \perlnote{wxPerl only supports the first constructor: |
5873607e VZ |
712 | use {\tt Append} instead.} |
713 | ||
dcbd177f | 714 | \membersection{wxMenuBar::\destruct{wxMenuBar}}\label{wxmenubardtor} |
a660d684 KB |
715 | |
716 | \func{void}{\destruct{wxMenuBar}}{\void} | |
717 | ||
718 | Destructor, destroying the menu bar and removing it from the parent frame (if any). | |
719 | ||
720 | \membersection{wxMenuBar::Append}\label{wxmenubarappend} | |
721 | ||
1aaef614 | 722 | \func{bool}{Append}{\param{wxMenu *}{menu}, \param{const wxString\& }{title}} |
a660d684 KB |
723 | |
724 | Adds the item to the end of the menu bar. | |
725 | ||
726 | \wxheading{Parameters} | |
727 | ||
728 | \docparam{menu}{The menu to add. Do not deallocate this menu after calling {\bf Append}.} | |
729 | ||
730 | \docparam{title}{The title of the menu.} | |
731 | ||
1aaef614 VZ |
732 | \wxheading{Return value} |
733 | ||
cc81d32f | 734 | true on success, false if an error occurred. |
1aaef614 VZ |
735 | |
736 | \wxheading{See also} | |
737 | ||
738 | \helpref{wxMenuBar::Insert}{wxmenubarinsert} | |
739 | ||
a660d684 KB |
740 | \membersection{wxMenuBar::Check}\label{wxmenubarcheck} |
741 | ||
eaaa6a06 | 742 | \func{void}{Check}{\param{int}{ id}, \param{const bool}{ check}} |
a660d684 KB |
743 | |
744 | Checks or unchecks a menu item. | |
745 | ||
746 | \wxheading{Parameters} | |
747 | ||
748 | \docparam{id}{The menu item identifier.} | |
749 | ||
cc81d32f | 750 | \docparam{check}{If true, checks the menu item, otherwise the item is unchecked.} |
a660d684 KB |
751 | |
752 | \wxheading{Remarks} | |
753 | ||
754 | Only use this when the menu bar has been associated | |
755 | with a frame; otherwise, use the wxMenu equivalent call. | |
756 | ||
757 | \membersection{wxMenuBar::Enable}\label{wxmenubarenable} | |
758 | ||
eaaa6a06 | 759 | \func{void}{Enable}{\param{int}{ id}, \param{const bool}{ enable}} |
a660d684 KB |
760 | |
761 | Enables or disables (greys out) a menu item. | |
762 | ||
763 | \wxheading{Parameters} | |
764 | ||
765 | \docparam{id}{The menu item identifier.} | |
766 | ||
cc81d32f | 767 | \docparam{enable}{true to enable the item, false to disable it.} |
a660d684 KB |
768 | |
769 | \wxheading{Remarks} | |
770 | ||
771 | Only use this when the menu bar has been | |
772 | associated with a frame; otherwise, use the wxMenu equivalent call. | |
773 | ||
774 | \membersection{wxMenuBar::EnableTop}\label{wxmenubarenabletop} | |
775 | ||
eaaa6a06 | 776 | \func{void}{EnableTop}{\param{int}{ pos}, \param{const bool}{ enable}} |
a660d684 KB |
777 | |
778 | Enables or disables a whole menu. | |
779 | ||
780 | \wxheading{Parameters} | |
781 | ||
782 | \docparam{pos}{The position of the menu, starting from zero.} | |
783 | ||
cc81d32f | 784 | \docparam{enable}{true to enable the menu, false to disable it.} |
a660d684 KB |
785 | |
786 | \wxheading{Remarks} | |
787 | ||
788 | Only use this when the menu bar has been | |
789 | associated with a frame. | |
790 | ||
270e8b6a VZ |
791 | \membersection{wxMenuBar::FindMenu}\label{wxmenubarfindmenu} |
792 | ||
793 | \constfunc{int}{FindMenu}{\param{const wxString\& }{title}} | |
794 | ||
a8d08dbd | 795 | Returns the index of the menu with the given {\it title} or {\tt wxNOT\_FOUND} if no |
270e8b6a VZ |
796 | such menu exists in this menubar. The {\it title} parameter may specify either |
797 | the menu title (with accelerator characters, i.e. {\tt "\&File"}) or just the | |
798 | menu label ({\tt "File"}) indifferently. | |
799 | ||
a660d684 KB |
800 | \membersection{wxMenuBar::FindMenuItem}\label{wxmenubarfindmenuitem} |
801 | ||
802 | \constfunc{int}{FindMenuItem}{\param{const wxString\& }{menuString}, \param{const wxString\& }{itemString}} | |
803 | ||
804 | Finds the menu item id for a menu name/menu item string pair. | |
805 | ||
806 | \wxheading{Parameters} | |
807 | ||
808 | \docparam{menuString}{Menu title to find.} | |
809 | ||
810 | \docparam{itemString}{Item to find.} | |
811 | ||
812 | \wxheading{Return value} | |
813 | ||
a8d08dbd | 814 | The menu item identifier, or {\tt wxNOT\_FOUND} if none was found. |
a660d684 KB |
815 | |
816 | \wxheading{Remarks} | |
817 | ||
818 | Any special menu codes are stripped out of source and target strings | |
819 | before matching. | |
820 | ||
fc9c7c09 | 821 | \membersection{wxMenuBar::FindItem}\label{wxmenubarfinditem} |
a660d684 | 822 | |
407f3681 | 823 | \constfunc{wxMenuItem *}{FindItem}{\param{int}{ id}, \param{wxMenu}{ **menu = NULL}} |
a660d684 | 824 | |
fc9c7c09 | 825 | Finds the menu item object associated with the given menu item identifier. |
a660d684 KB |
826 | |
827 | \wxheading{Parameters} | |
828 | ||
829 | \docparam{id}{Menu item identifier.} | |
407f3681 | 830 | |
fc9c7c09 | 831 | \docparam{menu}{If not NULL, menu will get set to the associated menu.} |
a660d684 KB |
832 | |
833 | \wxheading{Return value} | |
834 | ||
835 | The found menu item object, or NULL if one was not found. | |
836 | ||
837 | \membersection{wxMenuBar::GetHelpString}\label{wxmenubargethelpstring} | |
838 | ||
eaaa6a06 | 839 | \constfunc{wxString}{GetHelpString}{\param{int}{ id}} |
a660d684 | 840 | |
2edb0bde | 841 | Gets the help string associated with the menu item identifier. |
a660d684 KB |
842 | |
843 | \wxheading{Parameters} | |
844 | ||
845 | \docparam{id}{The menu item identifier.} | |
846 | ||
847 | \wxheading{Return value} | |
848 | ||
849 | The help string, or the empty string if there was no help string or the menu item | |
850 | was not found. | |
851 | ||
852 | \wxheading{See also} | |
853 | ||
854 | \helpref{wxMenuBar::SetHelpString}{wxmenubarsethelpstring} | |
855 | ||
856 | \membersection{wxMenuBar::GetLabel}\label{wxmenubargetlabel} | |
857 | ||
eaaa6a06 | 858 | \constfunc{wxString}{GetLabel}{\param{int}{ id}} |
a660d684 KB |
859 | |
860 | Gets the label associated with a menu item. | |
861 | ||
862 | \wxheading{Parameters} | |
863 | ||
864 | \docparam{id}{The menu item identifier.} | |
865 | ||
866 | \wxheading{Return value} | |
867 | ||
868 | The menu item label, or the empty string if the item was not found. | |
869 | ||
870 | \wxheading{Remarks} | |
871 | ||
872 | Use only after the menubar has been associated with a frame. | |
873 | ||
874 | \membersection{wxMenuBar::GetLabelTop}\label{wxmenubargetlabeltop} | |
875 | ||
eaaa6a06 | 876 | \constfunc{wxString}{GetLabelTop}{\param{int}{ pos}} |
a660d684 | 877 | |
706f30f8 VZ |
878 | Returns the label of a top-level menu. Note that the returned string does not |
879 | include the accelerator characters which could have been specified in the menu | |
880 | title string during its construction. | |
a660d684 KB |
881 | |
882 | \wxheading{Parameters} | |
883 | ||
884 | \docparam{pos}{Position of the menu on the menu bar, starting from zero.} | |
885 | ||
886 | \wxheading{Return value} | |
887 | ||
888 | The menu label, or the empty string if the menu was not found. | |
889 | ||
890 | \wxheading{Remarks} | |
891 | ||
892 | Use only after the menubar has been associated with a frame. | |
893 | ||
894 | \wxheading{See also} | |
895 | ||
896 | \helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop} | |
897 | ||
7f555861 JS |
898 | \membersection{wxMenuBar::GetMenu}\label{wxmenubargetmenu} |
899 | ||
900 | \constfunc{wxMenu*}{GetMenu}{\param{int}{ menuIndex}} | |
901 | ||
902 | Returns the menu at {\it menuIndex} (zero-based). | |
903 | ||
904 | \membersection{wxMenuBar::GetMenuCount}\label{wxmenubargetmenucount} | |
905 | ||
906 | \constfunc{int}{GetMenuCount}{\void} | |
907 | ||
908 | Returns the number of menus in this menubar. | |
909 | ||
e12be2f7 | 910 | \membersection{wxMenuBar::Insert}\label{wxmenubarinsert} |
1aaef614 VZ |
911 | |
912 | \func{bool}{Insert}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}} | |
913 | ||
914 | Inserts the menu at the given position into the menu bar. Inserting menu at | |
fa482912 JS |
915 | position $0$ will insert it in the very beginning of it, inserting at position |
916 | \helpref{GetMenuCount()}{wxmenubargetmenucount} is the same as calling | |
1aaef614 VZ |
917 | \helpref{Append()}{wxmenubarappend}. |
918 | ||
919 | \wxheading{Parameters} | |
920 | ||
921 | \docparam{pos}{The position of the new menu in the menu bar} | |
922 | ||
923 | \docparam{menu}{The menu to add. wxMenuBar owns the menu and will free it.} | |
924 | ||
925 | \docparam{title}{The title of the menu.} | |
926 | ||
927 | \wxheading{Return value} | |
928 | ||
cc81d32f | 929 | true on success, false if an error occurred. |
1aaef614 VZ |
930 | |
931 | \wxheading{See also} | |
932 | ||
933 | \helpref{wxMenuBar::Append}{wxmenubarappend} | |
934 | ||
a660d684 KB |
935 | \membersection{wxMenuBar::IsChecked}\label{wxmenubarischecked} |
936 | ||
eaaa6a06 | 937 | \constfunc{bool}{IsChecked}{\param{int}{ id}} |
a660d684 KB |
938 | |
939 | Determines whether an item is checked. | |
940 | ||
941 | \wxheading{Parameters} | |
942 | ||
943 | \docparam{id}{The menu item identifier.} | |
944 | ||
945 | \wxheading{Return value} | |
946 | ||
cc81d32f | 947 | true if the item was found and is checked, false otherwise. |
a660d684 KB |
948 | |
949 | \membersection{wxMenuBar::IsEnabled}\label{wxmenubarisenabled} | |
950 | ||
eaaa6a06 | 951 | \constfunc{bool}{IsEnabled}{\param{int}{ id}} |
a660d684 KB |
952 | |
953 | Determines whether an item is enabled. | |
954 | ||
955 | \wxheading{Parameters} | |
956 | ||
957 | \docparam{id}{The menu item identifier.} | |
958 | ||
959 | \wxheading{Return value} | |
960 | ||
cc81d32f | 961 | true if the item was found and is enabled, false otherwise. |
a660d684 | 962 | |
63dcfc15 PA |
963 | \membersection{wxMenuBar::Refresh}\label{wxmenubarrefresh} |
964 | ||
965 | \func{void}{Refresh}{\void} | |
966 | ||
967 | Redraw the menu bar | |
968 | ||
1aaef614 VZ |
969 | \membersection{wxMenuBar::Remove}\label{wxmenubarremove} |
970 | ||
971 | \func{wxMenu *}{Remove}{\param{size\_t }{pos}} | |
972 | ||
973 | Removes the menu from the menu bar and returns the menu object - the caller is | |
d7d17624 | 974 | responsible for deleting it. This function may be used together with |
1aaef614 VZ |
975 | \helpref{wxMenuBar::Insert}{wxmenubarinsert} to change the menubar |
976 | dynamically. | |
977 | ||
978 | \wxheading{See also} | |
979 | ||
2182e26f | 980 | \helpref{wxMenuBar::Replace}{wxmenubarreplace} |
1aaef614 VZ |
981 | |
982 | \membersection{wxMenuBar::Replace}\label{wxmenubarreplace} | |
983 | ||
984 | \func{wxMenu *}{Replace}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}} | |
985 | ||
fa482912 | 986 | Replaces the menu at the given position with another one. |
1aaef614 VZ |
987 | |
988 | \wxheading{Parameters} | |
989 | ||
990 | \docparam{pos}{The position of the new menu in the menu bar} | |
991 | ||
992 | \docparam{menu}{The menu to add.} | |
993 | ||
994 | \docparam{title}{The title of the menu.} | |
995 | ||
996 | \wxheading{Return value} | |
997 | ||
3980000c | 998 | The menu which was previously at position {\it pos}. The caller is |
1aaef614 VZ |
999 | responsible for deleting it. |
1000 | ||
1001 | \wxheading{See also} | |
1002 | ||
1003 | \helpref{wxMenuBar::Insert}{wxmenubarinsert},\rtfsp | |
1004 | \helpref{wxMenuBar::Remove}{wxmenubarremove} | |
1005 | ||
a660d684 KB |
1006 | \membersection{wxMenuBar::SetHelpString}\label{wxmenubarsethelpstring} |
1007 | ||
eaaa6a06 | 1008 | \func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}} |
a660d684 KB |
1009 | |
1010 | Sets the help string associated with a menu item. | |
1011 | ||
1012 | \wxheading{Parameters} | |
1013 | ||
1014 | \docparam{id}{Menu item identifier.} | |
1015 | ||
1016 | \docparam{helpString}{Help string to associate with the menu item.} | |
1017 | ||
1018 | \wxheading{See also} | |
1019 | ||
1020 | \helpref{wxMenuBar::GetHelpString}{wxmenubargethelpstring} | |
1021 | ||
1022 | \membersection{wxMenuBar::SetLabel}\label{wxmenubarsetlabel} | |
1023 | ||
eaaa6a06 | 1024 | \func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}} |
a660d684 KB |
1025 | |
1026 | Sets the label of a menu item. | |
1027 | ||
1028 | \wxheading{Parameters} | |
1029 | ||
1030 | \docparam{id}{Menu item identifier.} | |
1031 | ||
1032 | \docparam{label}{Menu item label.} | |
1033 | ||
1034 | \wxheading{Remarks} | |
1035 | ||
1036 | Use only after the menubar has been associated with a frame. | |
1037 | ||
1038 | \wxheading{See also} | |
1039 | ||
1040 | \helpref{wxMenuBar::GetLabel}{wxmenubargetlabel} | |
1041 | ||
1042 | \membersection{wxMenuBar::SetLabelTop}\label{wxmenubarsetlabeltop} | |
1043 | ||
eaaa6a06 | 1044 | \func{void}{SetLabelTop}{\param{int}{ pos}, \param{const wxString\& }{label}} |
a660d684 KB |
1045 | |
1046 | Sets the label of a top-level menu. | |
1047 | ||
1048 | \wxheading{Parameters} | |
1049 | ||
1050 | \docparam{pos}{The position of a menu on the menu bar, starting from zero.} | |
1051 | ||
1052 | \docparam{label}{The menu label.} | |
1053 | ||
1054 | \wxheading{Remarks} | |
1055 | ||
1056 | Use only after the menubar has been associated with a frame. | |
1057 | ||
1058 | \wxheading{See also} | |
1059 | ||
1060 | \helpref{wxMenuBar::GetLabelTop}{wxmenubargetlabeltop} | |
1061 |