.. wxPython Phoenix documentation

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

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

.. include:: headings.inc

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

.. highlight:: python



.. _wx.lib.agw.flatmenu.FlatMenu:

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

A Flat popup menu generic implementation.



|

|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>FlatMenu</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.FlatMenu_inheritance.png" alt="Inheritance diagram of FlatMenu" 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.PopupWindow.html" title="wx.PopupWindow" alt="" coords="83,392,212,421"/> <area shape="rect" id="node10" href="wx.lib.agw.flatmenu.ShadowPopupWindow.html" title="wx.lib.agw.flatmenu.ShadowPopupWindow" alt="" coords="5,469,291,499"/> <area shape="rect" id="node2" href="wx.NonOwnedWindow.html" title="wx.NonOwnedWindow" alt="" coords="69,315,227,344"/> <area shape="rect" id="node3" href="wx.Window.html" title="wx.Window" alt="" coords="103,237,192,267"/> <area shape="rect" id="node4" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="40,5,141,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="92,83,203,112"/> <area shape="rect" id="node9" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="87,160,208,189"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="165,5,247,35"/> <area shape="rect" id="node7" href="wx.lib.agw.flatmenu.FlatMenu.html" title="wx.lib.agw.flatmenu.FlatMenu" alt="" coords="45,624,251,653"/> <area shape="rect" id="node8" href="wx.lib.agw.flatmenu.FlatMenuBase.html" title="wx.lib.agw.flatmenu.FlatMenuBase" alt="" coords="29,547,267,576"/> </map> 
   </p>

|


|super_classes| Known Superclasses
==================================

:class:`wx.lib.agw.flatmenu.FlatMenuBase`

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.agw.flatmenu.FlatMenu.__init__`                                   Default class constructor.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.AddItem`                                    Internal function to add the item to this menu. The item must
:meth:`~wx.lib.agw.flatmenu.FlatMenu.AdvanceSelection`                           Advance forward or backward the current selection.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.Append`                                     Appends an item to this menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.AppendCheckItem`                            Adds a checkable item to the end of the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.AppendItem`                                 Appends an item to this menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.AppendMenu`                                 Adds a pull-right submenu to the end of the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.AppendRadioItem`                            Adds a radio item to the end of the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.AppendSeparator`                            Appends a separator item to the end of this menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.AppendSubMenu`                              Adds a pull-right submenu to the end of the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.Clear`                                      Clears the menu items.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.CloseSubMenu`                               Closes a child sub-menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.DestroyItem`                                Deletes the menu item from the menu. If the item is a submenu, it will be
:meth:`~wx.lib.agw.flatmenu.FlatMenu.Dismiss`                                    Dismisses the popup window.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.DoAction`                                   Performs an action based on user selection.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.DrawSelection`                              Redraws the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.FindItem`                                   Finds the menu item object associated with the given menu item identifier and,
:meth:`~wx.lib.agw.flatmenu.FlatMenu.FindMenuItemPos`                            Finds an item and its position inside the menu based on its id.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.FindMenuItemPosSimple`                      Finds an item and its position inside the menu based on its id.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetAccelArray`                              Returns a list filled with the accelerator entries for the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetAccelTable`                              Returns the menu accelerator table, an instance of :class:`AcceleratorTable`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetAllItems`                                Internal function to help recurse through all the menu items.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetBackgroundBitmap`                        Returns the background bitmap for this particular :class:`FlatMenu`, if any.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetBorderXWidth`                            Returns the menu border x-width, in pixels.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetBorderYWidth`                            Returns the menu border y-width, in pixels.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetItemFont`                                Returns this :class:`FlatMenuItem` font.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetItemHeight`                              Returns the height of a particular item, in pixels.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetItemTextColour`                          Returns this :class:`FlatMenuItem` foreground text colour.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetLabel`                                   Returns the label of a :class:`FlatMenuItem`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetLeftMarginWidth`                         Returns the menu left margin width, in pixels.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetMenuBar`                                 Returns the menubar associated with this menu item.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetMenuBarForSubMenu`                       Returns the menubar associated with this menu item.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetMenuItemCount`                           Returns the number of items in the :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetMenuItems`                               Returns the list of menu items in the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetMenuItemWidth`                           Returns the width of a particular item.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetMenuRect`                                Returns the menu client rectangle.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetMenuWidth`                               Returns the menu width in pixels.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetNumberColumns`                           Returns the number of columns for a menu window.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetRightMarginWidth`                        Returns the menu right margin width, in pixels.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.GetSiblingGroupItem`                        Used internally.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.HitTest`                                    HitTest method for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.Insert`                                     Inserts the given `item` before the position `pos`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.InsertItem`                                 Inserts an item into the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.InsertSeparator`                            Inserts a separator at the given position.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnChar`                                     Handles key events for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnEraseBackground`                          Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnKeyDown`                                  Handles the ``wx.EVT_KEY_DOWN`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnKillFocus`                                Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnMouseEnterWindow`                         Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnMouseLeaveWindow`                         Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnMouseLeftDown`                            Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnMouseLeftUp`                              Handles the ``wx.EVT_LEFT_UP`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnMouseMove`                                Handles the ``wx.EVT_MOTION`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnMouseRightDown`                           Handles the ``wx.EVT_RIGHT_DOWN`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnPaint`                                    Handles the ``wx.EVT_PAINT`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OnTimer`                                    Handles the ``wx.EVT_TIMER`` event for :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.OpenItemContextMenu`                        Open an item's context menu (if any).
:meth:`~wx.lib.agw.flatmenu.FlatMenu.Popup`                                      Pops up the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.Prepend`                                    Prepends an item to this menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.PrependItem`                                Prepends an item to this menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.ProcessMouseLClick`                         Processes mouse left clicks.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.ProcessMouseLClickEnd`                      Processes mouse left clicks.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.ProcessMouseMove`                           Processes mouse movements.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.ProcessMouseRClick`                         Processes mouse right clicks.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.RefreshChilds`                              In some cases, we need to perform a recursive refresh for all opened submenu
:meth:`~wx.lib.agw.flatmenu.FlatMenu.Remove`                                     Removes the menu item from the menu but doesn't delete the associated menu
:meth:`~wx.lib.agw.flatmenu.FlatMenu.ResizeMenu`                                 Resizes the menu to the correct size.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.ScrollDown`                                 Scrolls the menu down (for very tall menus).
:meth:`~wx.lib.agw.flatmenu.FlatMenu.ScrollUp`                                   Scrolls the menu up (for very tall menus).
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SendCmdEvent`                               Actually sends menu command events.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SendOverItem`                               Sends the ``EVT_FLAT_MENU_ITEM_MOUSE_OVER`` and ``EVT_FLAT_MENU_ITEM_MOUSE_OUT``
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SendUIEvent`                                Actually sends menu UI events.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SetBackgroundBitmap`                        Sets a background bitmap for this particular :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SetItemFont`                                Sets the :class:`FlatMenuItem` font.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SetItemTextColour`                          Sets the :class:`FlatMenuItem` foreground text colour.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SetLabel`                                   Sets the label of a :class:`FlatMenuItem`.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SetMenuBar`                                 Attaches this menu to a menubar.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SetNumberColumns`                           Sets the number of columns for a menu window.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.SetSubMenuBar`                              Attaches this menu to a menubar.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.TryOpenSubMenu`                             If `itemIdx` is an item with submenu, open it.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.TryScrollButtons`                           Used internally.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.UpdateItem`                                 Updates an item.
:meth:`~wx.lib.agw.flatmenu.FlatMenu.UpdateRadioGroup`                           Updates a group of radio items.
================================================================================ ================================================================================


|


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


.. class:: FlatMenu(FlatMenuBase)

   A Flat popup menu generic implementation.

   .. method:: __init__(self, parent=None)

      Default class constructor.
      
      :param `parent`: the :class:`FlatMenu` parent window (used to initialize the
       underlying :class:`ShadowPopupWindow`).


   .. method:: AddItem(self, menuItem)

      Internal function to add the item to this menu. The item must
      already be in the `self._itemsArr` attribute.
      
      :param `menuItem`: an instance of :class:`FlatMenuItem`.


   .. method:: AdvanceSelection(self, down=True)

      Advance forward or backward the current selection.
      
      :param bool `down`: ``True`` to advance the selection forward, ``False`` otherwise.


   .. method:: Append(self, id, item, helpString="", kind=wx.ITEM_NORMAL)

      Appends an item to this menu.
      
      :param integer `id`: the menu item identifier;
      :param string `item`: the string to appear on the menu item;
      :param string `helpString`: an optional help string associated with the item. By default,
       the handler for the ``EVT_FLAT_MENU_ITEM_MOUSE_OVER`` event displays this string
       in the status line;
      :param integer `kind`: may be ``wx.ITEM_NORMAL`` for a normal button (default),
       ``wx.ITEM_CHECK`` for a checkable tool (such tool stays pressed after it had been
       toggled) or ``wx.ITEM_RADIO`` for a checkable tool which makes part of a radio
       group of tools each of which is automatically unchecked whenever another button
       in the group is checked;


   .. method:: AppendCheckItem(self, id, item, helpString="")

      Adds a checkable item to the end of the menu.
      
      :see: :meth:`~FlatMenu.Append` for the explanation of the input parameters.


   .. method:: AppendItem(self, menuItem)

      Appends an item to this menu.
      
      :param `menuItem`: an instance of :class:`FlatMenuItem`.


   .. method:: AppendMenu(self, id, item, subMenu, helpString="")

      Adds a pull-right submenu to the end of the menu.
      
      :param integer `id`: the menu item identifier;
      :param string `item`: the string to appear on the menu item;
      :param `subMenu`: an instance of :class:`FlatMenu`, the submenu to append;
      :param string `helpString`: an optional help string associated with the item. By default,
       the handler for the ``EVT_FLAT_MENU_ITEM_MOUSE_OVER`` event displays this string
       in the status line.


   .. method:: AppendRadioItem(self, id, item, helpString="")

      Adds a radio item to the end of the menu.
      
      All consequent radio items form a group and when an item in the group is
      checked, all the others are automatically unchecked.
      
      :see: :meth:`~FlatMenu.Append` for the explanation of the input parameters.


   .. method:: AppendSeparator(self)

      Appends a separator item to the end of this menu. 


   .. method:: AppendSubMenu(self, subMenu, item, helpString="")

      Adds a pull-right submenu to the end of the menu.
      
      This function is added to duplicate the API of :class:`wx.Menu`.
      
      :see: :meth:`~FlatMenu.AppendMenu` for an explanation of the input parameters.


   .. method:: Clear(self)

      Clears the menu items. 


   .. method:: CloseSubMenu(self, itemIdx, alwaysClose=False)

      Closes a child sub-menu.
      
      :param integer `itemIdx`: the index of the item for which we want to close the submenu;
      :param bool `alwaysClose`: if ``True``, always close the submenu irrespectively of
       other conditions.


   .. method:: DestroyItem(self, item)

      Deletes the menu item from the menu. If the item is a submenu, it will be
      deleted. Use :meth:`~FlatMenu.Remove` if you want to keep the submenu (for example, to reuse
      it later).
      
      :param `item`: can be either a menu item identifier or a plain :class:`FlatMenuItem`.


   .. method:: Dismiss(self, dismissParent, resetOwner)

      Dismisses the popup window.
      
      :param bool `dismissParent`: whether to dismiss the parent menu or not;
      :param bool `resetOwner`: ``True`` to delete the link between this menu and the
       owner menu, ``False`` otherwise.


   .. method:: DoAction(self, itemIdx)

      Performs an action based on user selection.
      
      :param integer `itemIdx`: the index of the item for which we want to perform the action.


   .. method:: DrawSelection(self, dc, oldSelection=-1)

      Redraws the menu.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param integer `oldSelection`: if non-negative, the index representing the previous selected
       menu item.


   .. method:: FindItem(self, itemId, menu=None)

      Finds the menu item object associated with the given menu item identifier and,
      optionally, the (sub)menu it belongs to.
      
      :param integer `itemId`: menu item identifier;
      :param `menu`: if not ``None``, it will be filled with the item's parent menu
       (if the item was found).
      
      :return: The found menu item object, or ``None`` if one was not found.


   .. method:: FindMenuItemPos(self, itemId, menu=None)

      Finds an item and its position inside the menu based on its id.
      
      :param integer `itemId`: menu item identifier;
      :param `menu`: if not ``None``, it will be filled with the item's parent menu
       (if the item was found).
      
      :return: The found menu item object, or ``None`` if one was not found.


   .. method:: FindMenuItemPosSimple(self, item)

      Finds an item and its position inside the menu based on its id.
      
      :param `item`: an instance of :class:`FlatMenuItem`.
      
      :return: An integer specifying the index found menu item object, or
       ``wx.NOT_FOUND`` if one was not found.


   .. method:: GetAccelArray(self)

      Returns a list filled with the accelerator entries for the menu. 


   .. method:: GetAccelTable(self)

      Returns the menu accelerator table, an instance of :class:`AcceleratorTable`. 


   .. method:: GetAllItems(self, menu=None, items=[])

      Internal function to help recurse through all the menu items.
      
      :param `menu`: the menu from which we start accumulating items;
      :param list `items`: the array which is recursively filled with menu items.
      
      :return: a list of :class:`FlatMenuItem`.


   .. method:: GetBackgroundBitmap(self)

      Returns the background bitmap for this particular :class:`FlatMenu`, if any. 


   .. method:: GetBorderXWidth(self)

      Returns the menu border x-width, in pixels. 


   .. method:: GetBorderYWidth(self)

      Returns the menu border y-width, in pixels. 


   .. method:: GetItemFont(self, itemId)

      Returns this :class:`FlatMenuItem` font.
      
      :param integer `itemId`: the menu item identifier.


   .. method:: GetItemHeight(self)

      Returns the height of a particular item, in pixels. 


   .. method:: GetItemTextColour(self, itemId)

      Returns this :class:`FlatMenuItem` foreground text colour.
      
      :param integer `itemId`: the menu item identifier.


   .. method:: GetLabel(self, itemId)

      Returns the label of a :class:`FlatMenuItem`.
      
      :param integer `id`: the menu item identifier;
      
      :see: :meth:`~FlatMenu.SetLabel`.


   .. method:: GetLeftMarginWidth(self)

      Returns the menu left margin width, in pixels. 


   .. method:: GetMenuBar(self)

      Returns the menubar associated with this menu item. 


   .. method:: GetMenuBarForSubMenu(self)

      Returns the menubar associated with this menu item. 


   .. method:: GetMenuItemCount(self)

      Returns the number of items in the :class:`FlatMenu`. 


   .. method:: GetMenuItems(self)

      Returns the list of menu items in the menu. 


   .. method:: GetMenuItemWidth(self, menuItem)

      Returns the width of a particular item.
      
      :param `menuItem`: an instance of :class:`FlatMenuItem`.


   .. method:: GetMenuRect(self)

      Returns the menu client rectangle. 


   .. method:: GetMenuWidth(self)

      Returns the menu width in pixels. 


   .. method:: GetNumberColumns(self)

      Returns the number of columns for a menu window. 


   .. method:: GetRightMarginWidth(self)

      Returns the menu right margin width, in pixels. 


   .. method:: GetSiblingGroupItem(self, item)

      Used internally.
      
      :param `item`: an instance of :class:`FlatMenuItem`.


   .. method:: HitTest(self, pos)

      HitTest method for :class:`FlatMenu`.
      
      :param `pos`: an instance of :class:`wx.Point`, a point to test for hits.
      
      :return: A tuple representing one of the following combinations:
      
       ========================= ==================================================
       Return Tuple              Description
       ========================= ==================================================
       (0, -1)                   The :meth:`~FlatMenu.HitTest` method didn't find any item with the specified input point `pt` (``MENU_HT_NONE`` = 0)
       (1, `integer`)            A menu item has been hit (``MENU_HT_ITEM`` = 1)
       (2, -1)                   The `Scroll Up` button has been hit (``MENU_HT_SCROLL_UP`` = 2)
       (3, -1)                   The `Scroll Down` button has been hit (``MENU_HT_SCROLL_DOWN`` = 3)
       ========================= ==================================================


   .. method:: Insert(self, pos, id, item, helpString="", kind=wx.ITEM_NORMAL)

      Inserts the given `item` before the position `pos`.
      
      :param integer `pos`: the position at which to insert the new menu item;
      :param integer `id`: the menu item identifier;
      :param string `item`: the string to appear on the menu item;
      :param string `helpString`: an optional help string associated with the item. By default,
       the handler for the ``EVT_FLAT_MENU_ITEM_MOUSE_OVER`` event displays this string
       in the status line;
      :param integer `kind`: may be ``wx.ITEM_NORMAL`` for a normal button (default),
       ``wx.ITEM_CHECK`` for a checkable tool (such tool stays pressed after it had been
       toggled) or ``wx.ITEM_RADIO`` for a checkable tool which makes part of a radio
       group of tools each of which is automatically unchecked whenever another button
       in the group is checked;


   .. method:: InsertItem(self, pos, item)

      Inserts an item into the menu.
      
      :param integer `pos`: the position at which to insert the new menu item;
      :param `item`: an instance of :class:`FlatMenuItem`.


   .. method:: InsertSeparator(self, pos)

      Inserts a separator at the given position.
      
      :param integer `pos`: the index at which we want to insert the separator.


   .. method:: OnChar(self, key)

      Handles key events for :class:`FlatMenu`.
      
      :param `key`: the keyboard key integer code.


   .. method:: OnEraseBackground(self, event)

      Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`EraseEvent` event to be processed.
      
      :note: This method is intentionally empty to avoid flicker.


   .. method:: OnKeyDown(self, event)

      Handles the ``wx.EVT_KEY_DOWN`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`KeyEvent` event to be processed.


   .. method:: OnKillFocus(self, event)

      Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`FocusEvent` event to be processed.


   .. method:: OnMouseEnterWindow(self, event)

      Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnMouseLeaveWindow(self, event)

      Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnMouseLeftDown(self, event)

      Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnMouseLeftUp(self, event)

      Handles the ``wx.EVT_LEFT_UP`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnMouseMove(self, event)

      Handles the ``wx.EVT_MOTION`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnMouseRightDown(self, event)

      Handles the ``wx.EVT_RIGHT_DOWN`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnPaint(self, event)

      Handles the ``wx.EVT_PAINT`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`PaintEvent` event to be processed.


   .. method:: OnTimer(self, event)

      Handles the ``wx.EVT_TIMER`` event for :class:`FlatMenu`.
      
      :param `event`: a :class:`TimerEvent` event to be processed.


   .. method:: OpenItemContextMenu(self, itemIdx)

      Open an item's context menu (if any).
      
      :param integer `itemIdx`: the index of the item for which we want to open the context menu.


   .. method:: Popup(self, pt, owner=None, parent=None)

      Pops up the menu.
      
      :param `pt`: the point at which the menu should be popped up (an instance
       of :class:`wx.Point`);
      :param `owner`: the owner of the menu. The owner does not necessarly mean the
       menu parent, it can also be the window that popped up it;
      :param `parent`: the menu parent window.


   .. method:: Prepend(self, id, item, helpString="", kind=wx.ITEM_NORMAL)

      Prepends an item to this menu.
      
      :param integer `id`: the menu item identifier;
      :param string `item`: the string to appear on the menu item;
      :param string `helpString`: an optional help string associated with the item. By default,
       the handler for the ``EVT_FLAT_MENU_ITEM_MOUSE_OVER`` event displays this string
       in the status line;
      :param integer `kind`: may be ``wx.ITEM_NORMAL`` for a normal button (default),
       ``wx.ITEM_CHECK`` for a checkable tool (such tool stays pressed after it had been
       toggled) or ``wx.ITEM_RADIO`` for a checkable tool which makes part of a radio
       group of tools each of which is automatically unchecked whenever another button
       in the group is checked;


   .. method:: PrependItem(self, menuItem)

      Prepends an item to this menu.
      
      :param `menuItem`: an instance of :class:`FlatMenuItem`.


   .. method:: ProcessMouseLClick(self, pos)

      Processes mouse left clicks.
      
      :param `pos`: the position at which the mouse left button was pressed,
       an instance of :class:`wx.Point`.


   .. method:: ProcessMouseLClickEnd(self, pos)

      Processes mouse left clicks.
      
      :param `pos`: the position at which the mouse left button was pressed,
       an instance of :class:`wx.Point`.


   .. method:: ProcessMouseMove(self, pos)

      Processes mouse movements.
      
      :param `pos`: the position at which the mouse was moved, an instance of :class:`wx.Point`.


   .. method:: ProcessMouseRClick(self, pos)

      Processes mouse right clicks.
      
      :param `pos`: the position at which the mouse right button was pressed,
       an instance of :class:`wx.Point`.


   .. method:: RefreshChilds(self)

      In some cases, we need to perform a recursive refresh for all opened submenu
      from this.


   .. method:: Remove(self, item)

      Removes the menu item from the menu but doesn't delete the associated menu
      object. This allows to reuse the same item later by adding it back to the
      menu (especially useful with submenus).
      
      :param `item`: can be either a menu item identifier or a plain :class:`FlatMenuItem`.


   .. method:: ResizeMenu(self)

      Resizes the menu to the correct size. 


   .. method:: ScrollDown(self)

      Scrolls the menu down (for very tall menus). 


   .. method:: ScrollUp(self)

      Scrolls the menu up (for very tall menus). 


   .. method:: SendCmdEvent(self, itemIdx)

      Actually sends menu command events.
      
      :param integer `itemIdx`: the menu item index for which we want to send a command event.


   .. method:: SendOverItem(self, itemIdx, over)

      Sends the ``EVT_FLAT_MENU_ITEM_MOUSE_OVER`` and ``EVT_FLAT_MENU_ITEM_MOUSE_OUT``
      events.
      
      :param integer `itemIdx`: the menu item index for which we want to send an event;
      :param bool `over`: ``True`` to send a ``EVT_FLAT_MENU_ITEM_MOUSE_OVER`` event, ``False`` to
       send a ``EVT_FLAT_MENU_ITEM_MOUSE_OUT`` event.


   .. method:: SendUIEvent(self, itemIdx)

      Actually sends menu UI events.
      
      :param integer `itemIdx`: the menu item index for which we want to send a UI event.


   .. method:: SetBackgroundBitmap(self, bitmap=None)

      Sets a background bitmap for this particular :class:`FlatMenu`.
      
      :param `bitmap`: an instance of :class:`wx.Bitmap`. Set `bitmap` to ``None`` if you
       wish to remove the background bitmap altogether.
      
      :note: the bitmap is rescaled to fit the menu width and height.


   .. method:: SetItemFont(self, itemId, font=None)

      Sets the :class:`FlatMenuItem` font.
      
      :param integer `itemId`: the menu item identifier;
      :param `font`: an instance of a valid :class:`wx.Font`.


   .. method:: SetItemTextColour(self, itemId, colour=None)

      Sets the :class:`FlatMenuItem` foreground text colour.
      
      :param integer `itemId`: the menu item identifier;
      :param `colour`: an instance of a valid :class:`wx.Colour`.


   .. method:: SetLabel(self, itemId, label)

      Sets the label of a :class:`FlatMenuItem`.
      
      :param integer `itemId`: the menu item identifier;
      :param string `label`: the menu item label to set.
      
      :see: :meth:`~FlatMenu.GetLabel`.


   .. method:: SetMenuBar(self, mb)

      Attaches this menu to a menubar.
      
      :param `mb`: an instance of :class:`FlatMenuBar`.


   .. method:: SetNumberColumns(self, numCols)

      Sets the number of columns for a menu window.
      
      :param integer `numCols`: the number of columns for this :class:`FlatMenu` window.


   .. method:: SetSubMenuBar(self, mb)

      Attaches this menu to a menubar.
      
      :param `mb`: an instance of :class:`FlatMenuBar`.


   .. method:: TryOpenSubMenu(self, itemIdx, selectFirst=False)

      If `itemIdx` is an item with submenu, open it.
      
      :param integer `itemIdx`: the index of the item for which we want to open the submenu;
      :param bool `selectFirst`: if ``True``, the first item of the submenu will be shown
       as selected.


   .. method:: TryScrollButtons(self, event)

      Used internally. 


   .. method:: UpdateItem(self, item)

      Updates an item.
      
      :param `item`: an instance of :class:`FlatMenuItem`.


   .. method:: UpdateRadioGroup(self, item)

      Updates a group of radio items.
      
      :param `item`: an instance of :class:`FlatMenuItem`.


