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 isEnabled(This, Id) -> boolean()
298
299 Types:
300
301 This = wxMenuBar()
302 Id = integer()
303
304 Determines whether an item is enabled.
305
306 Return: true if the item was found and is enabled, false other‐
307 wise.
308
309 remove(This, Pos) -> wxMenu:wxMenu()
310
311 Types:
312
313 This = wxMenuBar()
314 Pos = integer()
315
316 Removes the menu from the menu bar and returns the menu object -
317 the caller is responsible for deleting it.
318
319 This function may be used together with insert/4 to change the
320 menubar dynamically.
321
322 See: replace/4
323
324 replace(This, Pos, Menu, Title) -> wxMenu:wxMenu()
325
326 Types:
327
328 This = wxMenuBar()
329 Pos = integer()
330 Menu = wxMenu:wxMenu()
331 Title = unicode:chardata()
332
333 Replaces the menu at the given position with another one.
334
335 Return: The menu which was previously at position pos. The
336 caller is responsible for deleting it.
337
338 See: insert/4, remove/2
339
340 setHelpString(This, Id, HelpString) -> ok
341
342 Types:
343
344 This = wxMenuBar()
345 Id = integer()
346 HelpString = unicode:chardata()
347
348 Sets the help string associated with a menu item.
349
350 See: getHelpString/2
351
352 setLabel(This, Id, Label) -> ok
353
354 Types:
355
356 This = wxMenuBar()
357 Id = integer()
358 Label = unicode:chardata()
359
360 Sets the label of a menu item.
361
362 Remark: Use only after the menubar has been associated with a
363 frame.
364
365 See: getLabel/2
366
367 setLabelTop(This, Pos, Label) -> ok
368
369 Types:
370
371 This = wxMenuBar()
372 Pos = integer()
373 Label = unicode:chardata()
374
375 See: setMenuLabel/3.
376
377 setMenuLabel(This, Pos, Label) -> ok
378
379 Types:
380
381 This = wxMenuBar()
382 Pos = integer()
383 Label = unicode:chardata()
384
385 Sets the label of a top-level menu.
386
387 Remark: Use only after the menubar has been associated with a
388 frame.
389
390
391
392wxWidgets team. wx 2.1 wxMenuBar(3)