.. wxPython Phoenix documentation

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

   Copyright: (c) 2011-2017 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>
   </div>
   <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,240,35"/> </map> 
   </p>

|


|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.


