1wxMenuBar(3) Erlang Module Definition wxMenuBar(3)
2
3
4
6 wxMenuBar - Functions for wxMenuBar class
7
9 A menu bar is a series of menus accessible from the top of a frame.
10
11 Remark: To respond to a menu selection, provide a handler for EVT_MENU,
12 in the frame that contains the menu bar.
13
14 If you have a toolbar which uses the same identifiers as your EVT_MENU
15 entries, events from the toolbar will also be processed by your
16 EVT_MENU event handlers.
17
18 Tip: under Windows, if you discover that menu shortcuts (for example,
19 Alt-F to show the file menu) are not working, check any EVT_CHAR events
20 you are handling in child windows. If you are not calling event.Skip()
21 for events that you don't process in these event handlers, menu short‐
22 cuts may cease to work.
23
24 See: wxMenu, Overview events
25
26 This class is derived (and can use functions) from: wxWindow wx‐
27 EvtHandler
28
29 wxWidgets docs: wxMenuBar
30
32 wxMenuBar() = wx:wx_object()
33
35 new() -> wxMenuBar()
36
37 Construct an empty menu bar.
38
39 new(Style) -> wxMenuBar()
40
41 Types:
42
43 Style = integer()
44
45 destroy(This :: wxMenuBar()) -> ok
46
47 Destructor, destroying the menu bar and removing it from the
48 parent frame (if any).
49
50 append(This, Menu, Title) -> boolean()
51
52 Types:
53
54 This = wxMenuBar()
55 Menu = wxMenu:wxMenu()
56 Title = unicode:chardata()
57
58 Adds the item to the end of the menu bar.
59
60 Return: true on success, false if an error occurred.
61
62 See: insert/4
63
64 check(This, Id, Check) -> ok
65
66 Types:
67
68 This = wxMenuBar()
69 Id = integer()
70 Check = boolean()
71
72 Checks or unchecks a menu item.
73
74 Remark: Only use this when the menu bar has been associated with
75 a frame; otherwise, use the wxMenu equivalent call.
76
77 enable(This, Id, Enable) -> ok
78
79 Types:
80
81 This = wxMenuBar()
82 Id = integer()
83 Enable = boolean()
84
85 Enables or disables (greys out) a menu item.
86
87 Remark: Only use this when the menu bar has been associated with
88 a frame; otherwise, use the wxMenu equivalent call.
89
90 enableTop(This, Pos, Enable) -> ok
91
92 Types:
93
94 This = wxMenuBar()
95 Pos = integer()
96 Enable = boolean()
97
98 Enables or disables a whole menu.
99
100 Remark: Only use this when the menu bar has been associated with
101 a frame.
102
103 findMenu(This, Title) -> integer()
104
105 Types:
106
107 This = wxMenuBar()
108 Title = unicode:chardata()
109
110 Returns the index of the menu with the given title or
111 wxNOT_FOUND if no such menu exists in this menubar.
112
113 The title parameter may specify either the menu title (with ac‐
114 celerator characters, i.e. "&File") or just the menu label
115 ("File") indifferently.
116
117 findMenuItem(This, MenuString, ItemString) -> integer()
118
119 Types:
120
121 This = wxMenuBar()
122 MenuString = ItemString = unicode:chardata()
123
124 Finds the menu item id for a menu name/menu item string pair.
125
126 Return: The menu item identifier, or wxNOT_FOUND if none was
127 found.
128
129 Remark: Any special menu codes are stripped out of source and
130 target strings before matching.
131
132 findItem(This, Id) -> wxMenuItem:wxMenuItem()
133
134 Types:
135
136 This = wxMenuBar()
137 Id = integer()
138
139 Finds the menu item object associated with the given menu item
140 identifier.
141
142 Return: The found menu item object, or NULL if one was not
143 found.
144
145 getHelpString(This, Id) -> unicode:charlist()
146
147 Types:
148
149 This = wxMenuBar()
150 Id = integer()
151
152 Gets the help string associated with the menu item identifier.
153
154 Return: The help string, or the empty string if there was no
155 help string or the menu item was not found.
156
157 See: setHelpString/3
158
159 getLabel(This, Id) -> unicode:charlist()
160
161 Types:
162
163 This = wxMenuBar()
164 Id = integer()
165
166 Gets the label associated with a menu item.
167
168 Return: The menu item label, or the empty string if the item was
169 not found.
170
171 Remark: Use only after the menubar has been associated with a
172 frame.
173
174 getLabelTop(This, Pos) -> unicode:charlist()
175
176 Types:
177
178 This = wxMenuBar()
179 Pos = integer()
180
181 See: getMenuLabel/2.
182
183 getMenuLabel(This, Pos) -> unicode:charlist()
184
185 Types:
186
187 This = wxMenuBar()
188 Pos = integer()
189
190 Returns the label of a top-level menu.
191
192 Note that the returned string includes the accelerator charac‐
193 ters that have been specified in the menu title string during
194 its construction.
195
196 Return: The menu label, or the empty string if the menu was not
197 found.
198
199 Remark: Use only after the menubar has been associated with a
200 frame.
201
202 See: getMenuLabelText/2, setMenuLabel/3
203
204 getMenuLabelText(This, Pos) -> unicode:charlist()
205
206 Types:
207
208 This = wxMenuBar()
209 Pos = integer()
210
211 Returns the label of a top-level menu.
212
213 Note that the returned string does not include any accelerator
214 characters that may have been specified in the menu title string
215 during its construction.
216
217 Return: The menu label, or the empty string if the menu was not
218 found.
219
220 Remark: Use only after the menubar has been associated with a
221 frame.
222
223 See: getMenuLabel/2, setMenuLabel/3
224
225 getMenu(This, MenuIndex) -> wxMenu:wxMenu()
226
227 Types:
228
229 This = wxMenuBar()
230 MenuIndex = integer()
231
232 Returns the menu at menuIndex (zero-based).
233
234 getMenuCount(This) -> integer()
235
236 Types:
237
238 This = wxMenuBar()
239
240 Returns the number of menus in this menubar.
241
242 insert(This, Pos, Menu, Title) -> boolean()
243
244 Types:
245
246 This = wxMenuBar()
247 Pos = integer()
248 Menu = wxMenu:wxMenu()
249 Title = unicode:chardata()
250
251 Inserts the menu at the given position into the menu bar.
252
253 Inserting menu at position 0 will insert it in the very begin‐
254 ning of it, inserting at position getMenuCount/1 is the same as
255 calling append/3.
256
257 Return: true on success, false if an error occurred.
258
259 See: append/3
260
261 isChecked(This, Id) -> boolean()
262
263 Types:
264
265 This = wxMenuBar()
266 Id = integer()
267
268 Determines whether an item is checked.
269
270 Return: true if the item was found and is checked, false other‐
271 wise.
272
273 setAutoWindowMenu(Enable) -> ok
274
275 Types:
276
277 Enable = boolean()
278
279 getAutoWindowMenu() -> boolean()
280
281 oSXGetAppleMenu(This) -> wxMenu:wxMenu()
282
283 Types:
284
285 This = wxMenuBar()
286
287 Returns the Apple menu.
288
289 This is the leftmost menu with application's name as its title.
290 You shouldn't remove any items from it, but it is safe to insert
291 extra menu items or submenus into it.
292
293 Only for:wxosx
294
295 Since: 3.0.1
296
297 macGetCommonMenuBar() -> wxMenuBar()
298
299 Enables you to get the global menubar on Mac, that is, the
300 menubar displayed when the app is running without any frames
301 open.
302
303 Return: The global menubar.
304
305 Remark: Only exists on Mac, other platforms do not have this
306 method.
307
308 Only for:wxosx
309
310 macSetCommonMenuBar(Menubar) -> ok
311
312 Types:
313
314 Menubar = wxMenuBar()
315
316 Enables you to set the global menubar on Mac, that is, the
317 menubar displayed when the app is running without any frames
318 open.
319
320 Remark: Only exists on Mac, other platforms do not have this
321 method.
322
323 Only for:wxosx
324
325 isEnabled(This, Id) -> boolean()
326
327 Types:
328
329 This = wxMenuBar()
330 Id = integer()
331
332 Determines whether an item is enabled.
333
334 Return: true if the item was found and is enabled, false other‐
335 wise.
336
337 remove(This, Pos) -> wxMenu:wxMenu()
338
339 Types:
340
341 This = wxMenuBar()
342 Pos = integer()
343
344 Removes the menu from the menu bar and returns the menu object -
345 the caller is responsible for deleting it.
346
347 This function may be used together with insert/4 to change the
348 menubar dynamically.
349
350 See: replace/4
351
352 replace(This, Pos, Menu, Title) -> wxMenu:wxMenu()
353
354 Types:
355
356 This = wxMenuBar()
357 Pos = integer()
358 Menu = wxMenu:wxMenu()
359 Title = unicode:chardata()
360
361 Replaces the menu at the given position with another one.
362
363 Return: The menu which was previously at position pos. The
364 caller is responsible for deleting it.
365
366 See: insert/4, remove/2
367
368 setHelpString(This, Id, HelpString) -> ok
369
370 Types:
371
372 This = wxMenuBar()
373 Id = integer()
374 HelpString = unicode:chardata()
375
376 Sets the help string associated with a menu item.
377
378 See: getHelpString/2
379
380 setLabel(This, Id, Label) -> ok
381
382 Types:
383
384 This = wxMenuBar()
385 Id = integer()
386 Label = unicode:chardata()
387
388 Sets the label of a menu item.
389
390 Remark: Use only after the menubar has been associated with a
391 frame.
392
393 See: getLabel/2
394
395 setLabelTop(This, Pos, Label) -> ok
396
397 Types:
398
399 This = wxMenuBar()
400 Pos = integer()
401 Label = unicode:chardata()
402
403 See: setMenuLabel/3.
404
405 setMenuLabel(This, Pos, Label) -> ok
406
407 Types:
408
409 This = wxMenuBar()
410 Pos = integer()
411 Label = unicode:chardata()
412
413 Sets the label of a top-level menu.
414
415 Remark: Use only after the menubar has been associated with a
416 frame.
417
418
419
420wxWidgets team. wx 2.3.1 wxMenuBar(3)