1wxMenuItem(3)              Erlang Module Definition              wxMenuItem(3)
2
3
4

NAME

6       wxMenuItem - Functions for wxMenuItem class
7

DESCRIPTION

9       A menu item represents an item in a menu.
10
11       Note  that  you  usually  don't have to deal with it directly as wxMenu
12       methods usually construct an object of this class for you.
13
14       Also please note that the methods related to fonts and bitmaps are cur‐
15       rently only implemented for Windows, Mac and GTK+.
16
17       See: wxMenuBar, wxMenu
18
19       wxWidgets docs: wxMenuItem
20

EVENTS

22       Event  types emitted from this class: menu_open, menu_close, menu_high‐
23       light
24

DATA TYPES

26       wxMenuItem() = wx:wx_object()
27

EXPORTS

29       new() -> wxMenuItem()
30
31       new(Options :: [Option]) -> wxMenuItem()
32
33              Types:
34
35                 Option =
36                     {parentMenu, wxMenu:wxMenu()} |
37                     {id, integer()} |
38                     {text, unicode:chardata()} |
39                     {help, unicode:chardata()} |
40                     {kind, wx:wx_enum()} |
41                     {subMenu, wxMenu:wxMenu()}
42
43              Constructs a wxMenuItem object.
44
45              Menu items can be standard, or "stock menu  items",  or  custom.
46              For  the  standard  menu items (such as commands to open a file,
47              exit the program and so on, see  page_stockitems  for  the  full
48              list)  it  is enough to specify just the stock ID and leave text
49              and help string empty. Some platforms (currently wxGTK only, and
50              see  the  remark  in  setBitmap/2  documentation) will also show
51              standard bitmaps for stock menu items.
52
53              Leaving at least text empty for the stock menu items is actually
54              strongly  recommended  as they will have appearance and keyboard
55              interface (including  standard  accelerators)  familiar  to  the
56              user.
57
58              For  the  custom  (non-stock) menu items, text must be specified
59              and while help string may be left  empty,  it's  recommended  to
60              pass  the  item description (which is automatically shown by the
61              library in the status bar when the menu  item  is  selected)  in
62              this parameter.
63
64              Finally  note  that  you can e.g. use a stock menu label without
65              using its stock help string:
66
67              that is, stock properties are set  independently  one  from  the
68              other.
69
70       destroy(This :: wxMenuItem()) -> ok
71
72              Destructor.
73
74       check(This) -> ok
75
76              Types:
77
78                 This = wxMenuItem()
79
80       check(This, Options :: [Option]) -> ok
81
82              Types:
83
84                 This = wxMenuItem()
85                 Option = {check, boolean()}
86
87              Checks or unchecks the menu item.
88
89              Note that this only works when the item is already appended to a
90              menu.
91
92       enable(This) -> ok
93
94              Types:
95
96                 This = wxMenuItem()
97
98       enable(This, Options :: [Option]) -> ok
99
100              Types:
101
102                 This = wxMenuItem()
103                 Option = {enable, boolean()}
104
105              Enables or disables the menu item.
106
107       getBitmap(This) -> wxBitmap:wxBitmap()
108
109              Types:
110
111                 This = wxMenuItem()
112
113              Returns the checked or unchecked bitmap.
114
115              Only for:wxmsw
116
117       getHelp(This) -> unicode:charlist()
118
119              Types:
120
121                 This = wxMenuItem()
122
123              Returns the help string associated with the menu item.
124
125       getId(This) -> integer()
126
127              Types:
128
129                 This = wxMenuItem()
130
131              Returns the menu item identifier.
132
133       getKind(This) -> wx:wx_enum()
134
135              Types:
136
137                 This = wxMenuItem()
138
139              Returns the item kind, one of  wxITEM_SEPARATOR,  wxITEM_NORMAL,
140              wxITEM_CHECK or wxITEM_RADIO.
141
142       getLabelFromText(Text) -> unicode:charlist()
143
144              Types:
145
146                 Text = unicode:chardata()
147
148              See: getLabelText/1.
149
150       getLabelText(Text) -> unicode:charlist()
151
152              Types:
153
154                 Text = unicode:chardata()
155
156              Strips  all  accelerator characters and mnemonics from the given
157              text.
158
159              For example:
160
161              will return just "Hello".
162
163              See: getItemLabelText/1, getItemLabel/1
164
165       getText(This) -> unicode:charlist()
166
167              Types:
168
169                 This = wxMenuItem()
170
171              See: getItemLabel/1.
172
173       getItemLabel(This) -> unicode:charlist()
174
175              Types:
176
177                 This = wxMenuItem()
178
179              Returns the text associated with the menu item including any ac‐
180              celerator  characters  that  were  passed  to the constructor or
181              setItemLabel/2.
182
183              See: getItemLabelText/1, getLabelText/1
184
185       getLabel(This) -> unicode:charlist()
186
187              Types:
188
189                 This = wxMenuItem()
190
191              See: getItemLabelText/1.
192
193       getItemLabelText(This) -> unicode:charlist()
194
195              Types:
196
197                 This = wxMenuItem()
198
199              Returns the text associated with the menu item, without any  ac‐
200              celerator characters.
201
202              See: getItemLabel/1, getLabelText/1
203
204       getMenu(This) -> wxMenu:wxMenu()
205
206              Types:
207
208                 This = wxMenuItem()
209
210              Returns the menu this menu item is in, or NULL if this menu item
211              is not attached.
212
213       getSubMenu(This) -> wxMenu:wxMenu()
214
215              Types:
216
217                 This = wxMenuItem()
218
219              Returns the submenu associated with the menu item,  or  NULL  if
220              there isn't one.
221
222       isCheckable(This) -> boolean()
223
224              Types:
225
226                 This = wxMenuItem()
227
228              Returns true if the item is checkable.
229
230              Notice  that the radio buttons are considered to be checkable as
231              well, so this method returns true for them  too.  Use  IsCheck()
232              (not  implemented in wx) if you want to test for the check items
233              only.
234
235       isChecked(This) -> boolean()
236
237              Types:
238
239                 This = wxMenuItem()
240
241              Returns true if the item is checked.
242
243       isEnabled(This) -> boolean()
244
245              Types:
246
247                 This = wxMenuItem()
248
249              Returns true if the item is enabled.
250
251       isSeparator(This) -> boolean()
252
253              Types:
254
255                 This = wxMenuItem()
256
257              Returns true if the item is a separator.
258
259       isSubMenu(This) -> boolean()
260
261              Types:
262
263                 This = wxMenuItem()
264
265              Returns true if the item is a submenu.
266
267       setBitmap(This, Bmp) -> ok
268
269              Types:
270
271                 This = wxMenuItem()
272                 Bmp = wxBitmap:wxBitmap()
273
274              Sets the bitmap for the menu item.
275
276              It is equivalent to wxMenuItem::SetBitmaps(bmp, wxNullBitmap) if
277              checked is true (default value) or SetBitmaps(wxNullBitmap, bmp)
278              otherwise.
279
280              setBitmap/2 must be called before the item is  appended  to  the
281              menu,  i.e.  appending the item without a bitmap and setting one
282              later is not guaranteed to work. But the bitmap can  be  changed
283              or reset later if it had been set up initially.
284
285              Notice that GTK+ uses a global setting called gtk-menu-images to
286              determine if the images should be shown in the menus at all.  If
287              it  is off (which is the case in e.g. Gnome 2.28 by default), no
288              images will be shown, consistently with the native behaviour.
289
290              Only for:wxmsw,wxosx,wxgtk
291
292       setHelp(This, HelpString) -> ok
293
294              Types:
295
296                 This = wxMenuItem()
297                 HelpString = unicode:chardata()
298
299              Sets the help string.
300
301       setMenu(This, Menu) -> ok
302
303              Types:
304
305                 This = wxMenuItem()
306                 Menu = wxMenu:wxMenu()
307
308              Sets the parent menu which will contain this menu item.
309
310       setSubMenu(This, Menu) -> ok
311
312              Types:
313
314                 This = wxMenuItem()
315                 Menu = wxMenu:wxMenu()
316
317              Sets the submenu of this menu item.
318
319       setText(This, Label) -> ok
320
321              Types:
322
323                 This = wxMenuItem()
324                 Label = unicode:chardata()
325
326              See: setItemLabel/2.
327
328       setItemLabel(This, Label) -> ok
329
330              Types:
331
332                 This = wxMenuItem()
333                 Label = unicode:chardata()
334
335              Sets the label associated with the menu item.
336
337              Note that if the ID of this menu item corresponds to a stock ID,
338              then  it is not necessary to specify a label: wxWidgets will au‐
339              tomatically use the stock item label associated  with  that  ID.
340              See the new/1 for more info.
341
342              The  label string for the normal menu items (not separators) may
343              include the accelerator which can be used to activate  the  menu
344              item  from  keyboard.  An accelerator key can be specified using
345              the ampersand & character. In order to embed an ampersand  char‐
346              acter in the menu item text, the ampersand must be doubled.
347
348              Optionally  you can specify also an accelerator string appending
349              a tab character \t followed by a  valid  key  combination  (e.g.
350              CTRL+V). Its general syntax is any combination of "CTRL", "RAWC‐
351              TRL", "ALT" and "SHIFT" strings (case doesn't matter)  separated
352              by  either '-' or '+' characters and followed by the accelerator
353              itself. Notice that CTRL corresponds to the "Ctrl" key  on  most
354              platforms but not under macOS where it is mapped to "Cmd" key on
355              Mac keyboard. Usually this is exactly what you want in  portable
356              code  but  if  you  really need to use the (rarely used for this
357              purpose) "Ctrl" key even under Mac, you may use RAWCTRL to  pre‐
358              vent this mapping. Under the other platforms RAWCTRL is the same
359              as plain CTRL.
360
361              The accelerator may be any alphanumeric character, any  function
362              key  (from  F1  to  F12),  any numpad digit key using KP_ prefix
363              (i.e. from KP_0 to KP_9) or one of the  special  strings  listed
364              below  (again,  case doesn't matter) corresponding to the speci‐
365              fied key code:
366
367              Examples:
368
369              Note: In wxGTK using "SHIFT" with non-alphabetic characters cur‐
370              rently  doesn't  work, even in combination with other modifiers,
371              due to GTK+ limitation. E.g. Shift+Ctrl+A works but Shift+Ctrl+1
372              or  Shift+/  do not, so avoid using accelerators of this form in
373              portable code.
374
375              Note: In wxGTk, the left/right/up/down arrow keys do not work as
376              accelerator  keys for a menu item unless a modifier key is used.
377              Additionally, the following keycodes are not supported  as  menu
378              accelerator keys:
379
380              See: getItemLabel/1, getItemLabelText/1
381
382
383
384wxWidgets team.                     wx 2.1                       wxMenuItem(3)
Impressum