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

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

Base class for the :class:`FlatMenu` renderers. This class implements the common
methods of all the renderers.



|

|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>FMRenderer</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.FMRenderer_inheritance.png" alt="Inheritance diagram of FMRenderer" 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.FMRenderer.html" title="wx.lib.agw.flatmenu.FMRenderer" alt="" coords="4,5,227,35"/> </map> 
   </p>

|


|sub_classes| Known Subclasses
==============================

:class:`wx.lib.agw.flatmenu.FMRendererMSOffice2007`, :class:`wx.lib.agw.flatmenu.FMRendererXP`

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.agw.flatmenu.FMRenderer.__init__`                                 Default class constructor.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.ConvertToBitmap`                          Convert the given image to a bitmap, optionally overlaying an alpha
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawBitmapShadow`                         Draws a shadow using background bitmap.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawButton`                               Draws a button.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawLeftMargin`                           Draws the menu left margin.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawMenu`                                 Draws the menu.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawMenuBar`                              Draws everything for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawMenuBarBackground`                    Draws the menu bar background colour according to the menubar.GetBackgroundColour
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawMenuBarButton`                        Draws the highlight on a :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawMenuButton`                           Draws the highlight on a FlatMenu
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawMenuItem`                             Draws the menu item.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawScrollButton`                         Draws the scroll button
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawSeparator`                            Draws a separator inside a :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawToolBarBg`                            Draws the toolbar background
:meth:`~wx.lib.agw.flatmenu.FMRenderer.DrawToolbarSeparator`                     Draws a separator inside the toolbar in :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.GetColoursAccordingToState`               Returns a :class:`wx.Colour` according to the menu item state.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.SetMenuBarHighlightColour`                Set the colour to highlight focus on the menu bar.
:meth:`~wx.lib.agw.flatmenu.FMRenderer.SetMenuHighlightColour`                   Set the colour to highlight focus on the menu.
================================================================================ ================================================================================


|


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


.. class:: FMRenderer(object)

   Base class for the :class:`FlatMenu` renderers. This class implements the common
   methods of all the renderers.

   .. method:: __init__(self)

      Default class constructor. 


   .. method:: ConvertToBitmap(self, xpm, alpha=None)

      Convert the given image to a bitmap, optionally overlaying an alpha
      channel to it.
      
      :param `xpm`: a list of strings formatted as XPM;
      :param `alpha`: a list of alpha values, the same size as the xpm bitmap.


   .. method:: DrawBitmapShadow(self, dc, rect, where=BottomShadow|RightShadow)

      Draws a shadow using background bitmap.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: an instance of :class:`wx.Rect`, representing the bitmap client rectangle;
      :param integer `where`: where to draw the shadow. This can be any combination of the
       following bits:
      
       ========================== ======= ================================
       Shadow Settings             Value  Description
       ========================== ======= ================================
       ``RightShadow``                  1 Right side shadow
       ``BottomShadow``                 2 Not full bottom shadow
       ``BottomShadowFull``             4 Full bottom shadow
       ========================== ======= ================================


   .. method:: DrawButton(self, dc, rect, state, colour=None)

      Draws a button.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: an instance of :class:`wx.Rect`, representing the button client rectangle;
      :param integer `state`: the button state;
      :param `colour`: if not ``None``, an instance of :class:`wx.Colour` to be used to draw
       the :class:`FlatMenuItem` background.


   .. method:: DrawLeftMargin(self, item, dc, menuRect)

      Draws the menu left margin.
      
      :param `item`: an instance of :class:`FlatMenuItem`;
      :param `dc`: an instance of :class:`wx.DC`;
      :param `menuRect`: an instance of :class:`wx.Rect`, representing the menu client rectangle.


   .. method:: DrawMenu(self, flatmenu, dc)

      Draws the menu.
      
      :param `flatmenu`: the :class:`FlatMenu` instance we need to paint;
      :param `dc`: an instance of :class:`wx.DC`.


   .. method:: DrawMenuBar(self, menubar, dc)

      Draws everything for :class:`FlatMenuBar`.
      
      :param `menubar`: an instance of :class:`FlatMenuBar`.
      :param `dc`: an instance of :class:`wx.DC`.


   .. method:: DrawMenuBarBackground(self, dc, rect)

      Draws the menu bar background colour according to the menubar.GetBackgroundColour
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: an instance of :class:`wx.Rect`, representing the menubar client rectangle.


   .. method:: DrawMenuBarButton(self, dc, rect, state)

      Draws the highlight on a :class:`FlatMenuBar`.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: an instance of :class:`wx.Rect`, representing the button client rectangle;
      :param integer `state`: the button state.


   .. method:: DrawMenuButton(self, dc, rect, state)

      Draws the highlight on a FlatMenu
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: an instance of :class:`wx.Rect`, representing the button client rectangle;
      :param integer `state`: the button state.


   .. method:: DrawMenuItem(self, item, dc, xCoord, yCoord, imageMarginX, markerMarginX, textX, rightMarginX, selected=False, backgroundImage=None)

      Draws the menu item.
      
      :param `item`: a :class:`FlatMenuItem` instance;
      :param `dc`: an instance of :class:`wx.DC`;
      :param integer `xCoord`: the current x position where to draw the menu;
      :param integer `yCoord`: the current y position where to draw the menu;
      :param integer `imageMarginX`: the spacing between the image and the menu border;
      :param integer `markerMarginX`: the spacing between the checkbox/radio marker and
       the menu border;
      :param integer `textX`: the menu item label x position;
      :param integer `rightMarginX`: the right margin between the text and the menu border;
      :param bool `selected`: ``True`` if this menu item is currentl hovered by the mouse,
       ``False`` otherwise.
      :param `backgroundImage`: if not ``None``, an instance of :class:`wx.Bitmap` which will
       become the background image for this :class:`FlatMenu`.


   .. method:: DrawScrollButton(self, dc, rect, state)

      Draws the scroll button
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: an instance of :class:`wx.Rect`, representing the button client rectangle;
      :param integer `state`: the button state.


   .. method:: DrawSeparator(self, dc, xCoord, yCoord, textX, sepWidth)

      Draws a separator inside a :class:`FlatMenu`.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param integer `xCoord`: the current x position where to draw the separator;
      :param integer `yCoord`: the current y position where to draw the separator;
      :param integer `textX`: the menu item label x position;
      :param integer `sepWidth`: the width of the separator, in pixels.


   .. method:: DrawToolBarBg(self, dc, rect)

      Draws the toolbar background
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: an instance of :class:`wx.Rect`, representing the toolbar client rectangle.


   .. method:: DrawToolbarSeparator(self, dc, rect)

      Draws a separator inside the toolbar in :class:`FlatMenuBar`.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: an instance of :class:`wx.Rect`, representing the bitmap client rectangle.


   .. method:: GetColoursAccordingToState(self, state)

      Returns a :class:`wx.Colour` according to the menu item state.
      
      :param integer `state`: one of the following bits:
      
       ==================== ======= ==========================
       Item State            Value  Description
       ==================== ======= ==========================
       ``ControlPressed``         0 The item is pressed
       ``ControlFocus``           1 The item is focused
       ``ControlDisabled``        2 The item is disabled
       ``ControlNormal``          3 Normal state
       ==================== ======= ==========================


   .. method:: SetMenuBarHighlightColour(self, colour)

      Set the colour to highlight focus on the menu bar.
      
      :param `colour`: a valid instance of :class:`wx.Colour`.


   .. method:: SetMenuHighlightColour(self,colour)

      Set the colour to highlight focus on the menu.
      
      :param `colour`: a valid instance of :class:`wx.Colour`.


