File: wx.lib.agw.flatmenu.FlatMenuItem.txt

package info (click to toggle)
wxpython4.0 4.2.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 232,540 kB
  • sloc: cpp: 958,937; python: 233,059; ansic: 150,441; makefile: 51,662; sh: 8,687; perl: 1,563; javascript: 584; php: 326; xml: 200
file content (404 lines) | stat: -rw-r--r-- 15,969 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.agw.flatmenu

.. highlight:: python



.. _wx.lib.agw.flatmenu.FlatMenuItem:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.flatmenu.FlatMenuItem**
==========================================================================================================================================

A class that represents an item in a menu.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>FlatMenuItem</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.agw.flatmenu.FlatMenuItem_inheritance.png" alt="Inheritance diagram of FlatMenuItem" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.flatmenu.FlatMenuItem.html" title="wx.lib.agw.flatmenu.FlatMenuItem" alt="" coords="5,5,252,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.__init__`                               Default class constructor.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.Check`                                  Checks or unchecks the menu item.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.Enable`                                 Enables or disables a menu item.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetAcceleratorEntry`                    Returns the accelerator entry associated to this menu item.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetAccelString`                         Returns the accelerator string.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetBitmap`                              Returns the normal bitmap associated to the menu item or :class:`NullBitmap` if
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetContextMenu`                         Returns the context menu associated with this item (if any).
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetDisabledBitmap`                      Returns the disabled bitmap associated to the menu item or :class:`NullBitmap`
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetFont`                                Returns this :class:`FlatMenuItem` font.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetHeight`                              Returns the menu item height, in pixels.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetHelp`                                Returns the item help string.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetHotBitmap`                           Returns the hot bitmap associated to the menu item or :class:`NullBitmap` if
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetId`                                  Returns the item id.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetKind`                                Returns the menu item kind, can be one of ``wx.ITEM_SEPARATOR``, ``wx.ITEM_NORMAL``,
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetLabel`                               Returns the menu item label (without the accelerator if it is part of the string).
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetLongHelp`                            Returns the item long help string (displayed in the parent frame :class:`StatusBar`).
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetMenu`                                Returns the parent menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetMnemonicChar`                        Returns the shortcut char for this menu item.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetRect`                                Returns the menu item client rectangle.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetShortHelp`                           Returns the item short help string (displayed in the tool's tooltip).
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetSubMenu`                             Returns the sub-menu of this menu item (if any).
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetSuitableBitmap`                      Gets the bitmap that should be used based on the item state.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetText`                                Returns the text associated with the menu item including the accelerator.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.GetTextColour`                          Returns this :class:`FlatMenuItem` foreground text colour.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.IsCheckable`                            Returns ``True`` if this item is of type ``wx.ITEM_CHECK``, ``False`` otherwise.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.IsChecked`                              Returns whether an item is checked or not.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.IsEnabled`                              Returns whether an item is enabled or not.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.IsRadioItem`                            Returns ``True`` if this item is of type ``wx.ITEM_RADIO``, ``False`` otherwise.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.IsSeparator`                            Returns ``True`` if this item is of type ``wx.ITEM_SEPARATOR``, ``False`` otherwise.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.IsShown`                                Returns whether an item is shown or not.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.IsSubMenu`                              Returns whether an item is a sub-menu or not.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetContextMenu`                         Assigns a context menu to this item.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetDisabledBitmap`                      Sets the menu item disabled bitmap.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetFont`                                Sets the :class:`FlatMenuItem` font.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetHelp`                                Sets the menu item help string.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetHotBitmap`                           Sets the menu item hot bitmap.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetLabel`                               Sets the label text for this item from the text (excluding the accelerator).
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetLongHelp`                            Sets the item long help string (displayed in the parent frame :class:`StatusBar`).
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetMenu`                                Sets the menu item parent menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetMenuBar`                             Links the current menu item with the main :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetNormalBitmap`                        Sets the menu item normal bitmap.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetRect`                                Sets the menu item client rectangle.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetSubMenu`                             Sets the menu item sub-menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetText`                                Sets the text for this menu item (including accelerators).
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.SetTextColour`                          Sets the :class:`FlatMenuItem` foreground colour for the menu label.
:meth:`~wx.lib.agw.flatmenu.FlatMenuItem.Show`                                   Actually shows/hides the menu item.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: FlatMenuItem(object)

   A class that represents an item in a menu.

   .. method:: __init__(self, parent, id=wx.ID_SEPARATOR, label="", helpString="", kind=wx.ITEM_NORMAL, subMenu=None, normalBmp=wx.NullBitmap, disabledBmp=wx.NullBitmap, hotBmp=wx.NullBitmap)

      Default class constructor.
      
      :param `parent`: menu that the menu item belongs to, an instance of :class:`FlatMenu`;
      :param integer `id`: the menu item identifier;
      :param string `label`: text for the menu item, as shown on the menu. An accelerator
       key can be specified using the ampersand '&' character. In order to embed
       an ampersand character in the menu item text, the ampersand must be doubled;
      :param string `helpString`: optional help string that will be shown on the status bar;
      :param integer `kind`: may be ``wx.ITEM_SEPARATOR``, ``wx.ITEM_NORMAL``, ``wx.ITEM_CHECK``
       or ``wx.ITEM_RADIO``;
      :param `subMenu`: if not ``None``, the sub menu this item belongs to (an instance of :class:`FlatMenu`);
      :param `normalBmp`: normal bitmap to draw to the side of the text, this bitmap
       is used when the menu is enabled (an instance of :class:`wx.Bitmap`);
      :param `disabledBmp`: 'greyed' bitmap to draw to the side of the text, this
       bitmap is used when the menu is disabled, if none supplied normal is used (an instance of :class:`wx.Bitmap`);
      :param `hotBmp`: hot bitmap to draw to the side of the text, this bitmap is
       used when the menu is hovered, if non supplied, normal is used (an instance of :class:`wx.Bitmap`).


   .. method:: Check(self, check=True)

      Checks or unchecks the menu item.
      
      :param bool `check`: ``True`` to check the menu item, ``False`` to uncheck it.
      
      :note: This method is meaningful only for menu items of ``wx.ITEM_CHECK``
       or ``wx.ITEM_RADIO`` kind.


   .. method:: Enable(self, enable=True)

      Enables or disables a menu item.
      
      :param bool `enable`: ``True`` to enable the menu item, ``False`` to disable it.


   .. method:: GetAcceleratorEntry(self)

      Returns the accelerator entry associated to this menu item. 


   .. method:: GetAccelString(self)

      Returns the accelerator string. 


   .. method:: GetBitmap(self)

      Returns the normal bitmap associated to the menu item or :class:`NullBitmap` if
      none has been supplied.


   .. method:: GetContextMenu(self)

      Returns the context menu associated with this item (if any). 


   .. method:: GetDisabledBitmap(self)

      Returns the disabled bitmap associated to the menu item or :class:`NullBitmap`
      if none has been supplied.


   .. method:: GetFont(self)

      Returns this :class:`FlatMenuItem` font. 


   .. method:: GetHeight(self)

      Returns the menu item height, in pixels. 


   .. method:: GetHelp(self)

      Returns the item help string. 


   .. method:: GetHotBitmap(self)

      Returns the hot bitmap associated to the menu item or :class:`NullBitmap` if
      none has been supplied.


   .. method:: GetId(self)

      Returns the item id. 


   .. method:: GetKind(self)

      Returns the menu item kind, can be one of ``wx.ITEM_SEPARATOR``, ``wx.ITEM_NORMAL``,
      ``wx.ITEM_CHECK`` or ``wx.ITEM_RADIO``.


   .. method:: GetLabel(self)

      Returns the menu item label (without the accelerator if it is part of the string). 


   .. method:: GetLongHelp(self)

      Returns the item long help string (displayed in the parent frame :class:`StatusBar`). 


   .. method:: GetMenu(self)

      Returns the parent menu. 


   .. method:: GetMnemonicChar(self)

      Returns the shortcut char for this menu item. 


   .. method:: GetRect(self)

      Returns the menu item client rectangle. 


   .. method:: GetShortHelp(self)

      Returns the item short help string (displayed in the tool's tooltip). 


   .. method:: GetSubMenu(self)

      Returns the sub-menu of this menu item (if any). 


   .. method:: GetSuitableBitmap(self, selected)

      Gets the bitmap that should be used based on the item state.
      
      :param bool `selected`: ``True`` if this menu item is currently hovered by the mouse,
       ``False`` otherwise.


   .. method:: GetText(self)

      Returns the text associated with the menu item including the accelerator. 


   .. method:: GetTextColour(self)

      Returns this :class:`FlatMenuItem` foreground text colour. 


   .. method:: IsCheckable(self)

      Returns ``True`` if this item is of type ``wx.ITEM_CHECK``, ``False`` otherwise. 


   .. method:: IsChecked(self)

      Returns whether an item is checked or not.
      
      :note: This method is meaningful only for items of kind ``wx.ITEM_CHECK`` or
       ``wx.ITEM_RADIO``.


   .. method:: IsEnabled(self)

      Returns whether an item is enabled or not. 


   .. method:: IsRadioItem(self)

      Returns ``True`` if this item is of type ``wx.ITEM_RADIO``, ``False`` otherwise. 


   .. method:: IsSeparator(self)

      Returns ``True`` if this item is of type ``wx.ITEM_SEPARATOR``, ``False`` otherwise. 


   .. method:: IsShown(self)

      Returns whether an item is shown or not. 


   .. method:: IsSubMenu(self)

      Returns whether an item is a sub-menu or not. 


   .. method:: SetContextMenu(self, context_menu)

      Assigns a context menu to this item.
      
      :param `context_menu`: an instance of :class:`FlatMenu`.


   .. method:: SetDisabledBitmap(self, bmp)

      Sets the menu item disabled bitmap.
      
      :param `bmp`: an instance of :class:`wx.Bitmap`.


   .. method:: SetFont(self, font=None)

      Sets the :class:`FlatMenuItem` font.
      
      :param `font`: an instance of a valid :class:`wx.Font`.


   .. method:: SetHelp(self, helpString)

      Sets the menu item help string.
      
      :param string `helpString`: the new menu item help string.


   .. method:: SetHotBitmap(self, bmp)

      Sets the menu item hot bitmap.
      
      :param `bmp`: an instance of :class:`wx.Bitmap`.


   .. method:: SetLabel(self, text)

      Sets the label text for this item from the text (excluding the accelerator).
      
      :param string `text`: the new item label (excluding the accelerator).


   .. method:: SetLongHelp(self, help)

      Sets the item long help string (displayed in the parent frame :class:`StatusBar`).
      
      :param string `help`: the new item long help string.


   .. method:: SetMenu(self, menu)

      Sets the menu item parent menu.
      
      :param `menu`: an instance of :class:`FlatMenu`.


   .. method:: SetMenuBar(self)

      Links the current menu item with the main :class:`FlatMenuBar`. 


   .. method:: SetNormalBitmap(self, bmp)

      Sets the menu item normal bitmap.
      
      :param `bmp`: an instance of :class:`wx.Bitmap`.


   .. method:: SetRect(self, rect)

      Sets the menu item client rectangle.
      
      :param `rect`: the menu item client rectangle, an instance of :class:`wx.Rect`.


   .. method:: SetSubMenu(self, menu)

      Sets the menu item sub-menu.
      
      :param `menu`: an instance of :class:`FlatMenu`.


   .. method:: SetText(self, text)

      Sets the text for this menu item (including accelerators).
      
      :param string `text`: the new item label (including the accelerator).


   .. method:: SetTextColour(self, colour=None)

      Sets the :class:`FlatMenuItem` foreground colour for the menu label.
      
      :param `colour`: an instance of a valid :class:`wx.Colour`.


   .. method:: Show(self, show=True)

      Actually shows/hides the menu item.
      
      :param bool `show`: ``True`` to show the menu item, ``False`` to hide it.