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