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