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
|
.. 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.buttonpanel
.. highlight:: python
.. _wx.lib.agw.buttonpanel.BPArt:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.buttonpanel.BPArt**
==========================================================================================================================================
:class:`BPArt` is an art provider class which does all of the drawing for :class:`ButtonPanel`.
This allows the library caller to customize the :class:`BPArt` or to completely replace
all drawing with custom BPArts.
|
|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>BPArt</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.buttonpanel.BPArt_inheritance.png" alt="Inheritance diagram of BPArt" 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.buttonpanel.BPArt.html" title="wx.lib.agw.buttonpanel.BPArt" alt="" coords="5,5,208,35"/> </map>
</p>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.buttonpanel.BPArt.__init__` Default class constructor.
:meth:`~wx.lib.agw.buttonpanel.BPArt.DrawButton` Draws a button in :class:`ButtonPanel`, together with its text (if any).
:meth:`~wx.lib.agw.buttonpanel.BPArt.DrawButtonPanel` Paint the :class:`ButtonPanel`'s background.
:meth:`~wx.lib.agw.buttonpanel.BPArt.DrawCaption` Draws the main caption text in :class:`ButtonPanel`.
:meth:`~wx.lib.agw.buttonpanel.BPArt.DrawLabel` Draws the label for a button.
:meth:`~wx.lib.agw.buttonpanel.BPArt.DrawSeparator` Draws a separator in :class:`ButtonPanel`.
:meth:`~wx.lib.agw.buttonpanel.BPArt.FillGradientColour` Gradient fill from colour 1 to colour 2 with top to bottom or left to right.
:meth:`~wx.lib.agw.buttonpanel.BPArt.GetColour` Returns the option value for the specified colour `id`.
:meth:`~wx.lib.agw.buttonpanel.BPArt.GetFont` Returns the option value for the specified font `id`.
:meth:`~wx.lib.agw.buttonpanel.BPArt.GetGradientType` Returns the gradient type for :class:`BPArt` drawings.
:meth:`~wx.lib.agw.buttonpanel.BPArt.GetMetric` Returns the option value for the specified size `id`.
:meth:`~wx.lib.agw.buttonpanel.BPArt.SetColour` Sets the option value for the specified colour `id`.
:meth:`~wx.lib.agw.buttonpanel.BPArt.SetFont` Sets the option value for the specified font `id`.
:meth:`~wx.lib.agw.buttonpanel.BPArt.SetGradientType` Sets the gradient type for :class:`BPArt` drawings.
:meth:`~wx.lib.agw.buttonpanel.BPArt.SetMetric` Sets the option value for the specified size `id`.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: BPArt(object)
:class:`BPArt` is an art provider class which does all of the drawing for :class:`ButtonPanel`.
This allows the library caller to customize the :class:`BPArt` or to completely replace
all drawing with custom BPArts.
.. method:: __init__(self, parentStyle)
Default class constructor.
:param integer `parentStyle`: the window style for :class:`ButtonPanel`.
.. method:: DrawButton(self, dc, rect, buttonBitmap, isVertical, buttonStatus, isToggled, textAlignment, text="")
Draws a button in :class:`ButtonPanel`, together with its text (if any).
:param `dc`: an instance of :class:`wx.DC`;
:param wx.Rect `rect`: the button client rectangle;
:param wx.Bitmap `buttonBitmap`: the bitmap associated with the button;
:param bool `isVertical`: ``True`` if :class:`ButtonPanel` is in vertical orientation,
``False`` otherwise;
:param string `buttonStatus`: one of "Normal", "Toggled", "Pressed", "Disabled" or "Hover";
:param bool `isToggled`: whether the button is toggled or not;
:param integer `textAlignment`: the text alignment inside the button;
:param string `text`: the button label.
.. method:: DrawButtonPanel(self, dc, rect, style)
Paint the :class:`ButtonPanel`'s background.
:param `dc`: an instance of :class:`wx.DC`;
:param wx.Rect `rect`: the :class:`ButtonPanel` client rectangle;
:param integer `style`: the :class:`ButtonPanel` window style.
.. method:: DrawCaption(self, dc, rect, captionText)
Draws the main caption text in :class:`ButtonPanel`.
:param `dc`: an instance of :class:`wx.DC`;
:param wx.Rect `rect`: the main caption text rectangle;
:param string `captionText`: the caption text string.
.. method:: DrawLabel(self, dc, text, isEnabled, xpos, ypos)
Draws the label for a button.
:param `dc`: an instance of :class:`wx.DC`;
:param string `text`: the button label;
:param bool `isEnabled`: ``True`` if the button is enabled, ``False`` otherwise;
:param integer `xpos`: the text `x` position inside the button;
:param integer `ypos`: the text `y` position inside the button.
.. method:: DrawSeparator(self, dc, rect, isVertical)
Draws a separator in :class:`ButtonPanel`.
:param `dc`: an instance of :class:`wx.DC`;
:param wx.Rect `rect`: the separator client rectangle;
:param bool `isVertical`: ``True`` if :class:`ButtonPanel` is in vertical orientation,
``False`` otherwise.
.. method:: FillGradientColour(self, dc, rect)
Gradient fill from colour 1 to colour 2 with top to bottom or left to right.
:param `dc`: an instance of :class:`wx.DC`;
:param wx.Rect `rect`: the :class:`ButtonPanel` client rectangle.
.. method:: GetColour(self, id)
Returns the option value for the specified colour `id`.
:param integer `id`: the identification bit for the colour value. This can be one of the
following bits:
================================== ======= =====================================
Colour Id Value Description
================================== ======= =====================================
``BP_BACKGROUND_COLOUR`` 0 Background brush colour when no gradient shading exists
``BP_GRADIENT_COLOUR_FROM`` 1 Starting gradient colour, used only when ``BP_USE_GRADIENT`` style is applied
``BP_GRADIENT_COLOUR_TO`` 2 Ending gradient colour, used only when ``BP_USE_GRADIENT`` style is applied
``BP_BORDER_COLOUR`` 3 Pen colour to paint the border of :class:`ButtonPanel`
``BP_TEXT_COLOUR`` 4 Main :class:`ButtonPanel` caption colour
``BP_BUTTONTEXT_COLOUR`` 5 Text colour for buttons with text
``BP_BUTTONTEXT_INACTIVE_COLOUR`` 6 Text colour for inactive buttons with text
``BP_SELECTION_BRUSH_COLOUR`` 7 Brush colour to be used when hovering or selecting a button
``BP_SELECTION_PEN_COLOUR`` 8 Pen colour to be used when hovering or selecting a button
``BP_SEPARATOR_COLOUR`` 9 Pen colour used to paint the separators
================================== ======= =====================================
:return: An instance of :class:`wx.Colour` for the input `id`.
:raise: `Exception` if the `id` is not recognized.
.. method:: GetFont(self, id)
Returns the option value for the specified font `id`.
:param integer `id`: the identification bit for the font value. This can be one of the
following bits:
============================== ======= =====================================
Size Id Value Description
============================== ======= =====================================
``BP_TEXT_FONT`` 10 Font of the :class:`ButtonPanel` main caption
``BP_BUTTONTEXT_FONT`` 11 Text font for the buttons with text
============================== ======= =====================================
:return: An instance of :class:`wx.Font` for the input `id`.
:raise: `Exception` if the `id` is not recognized.
.. method:: GetGradientType(self)
Returns the gradient type for :class:`BPArt` drawings.
:return: An integer representing the gradient type.
:see: :meth:`~BPArt.SetGradientType` for a list of possible gradient types.
.. method:: GetMetric(self, id)
Returns the option value for the specified size `id`.
:param integer `id`: the identification bit for the size value. This can be one of the
following bits:
============================== ======= =====================================
Size Id Value Description
============================== ======= =====================================
``BP_SEPARATOR_SIZE`` 14 Separator size. Note: This is not the line width, but the sum of the space before and after the separator line plus the width of the line
``BP_MARGINS_SIZE`` 15 Size of the left/right margins in :class:`ButtonPanel` (top/bottom for vertically aligned :class:`ButtonPanel`)
``BP_BORDER_SIZE`` 16 Size of the border
``BP_PADDING_SIZE`` 17 Inter-tool separator size
============================== ======= =====================================
:return: An integer representing the option value for the input `id`.
:raise: `Exception` if the `id` is not recognized.
.. method:: SetColour(self, id, colour)
Sets the option value for the specified colour `id`.
:param integer `id`: the identification bit for the colour value;
:param `colour`: the new value for the colour (a valid :class:`wx.Colour` instance).
:raise: `Exception` if the `id` is not recognized.
:see: :meth:`~BPArt.GetColour` for a list of meaningful colour ids.
.. method:: SetFont(self, id, font)
Sets the option value for the specified font `id`.
:param integer `id`: the identification bit for the font value;
:param `colour`: the new value for the font (a valid :class:`wx.Font` instance).
:raise: `Exception` if the `id` is not recognized.
:see: :meth:`~BPArt.GetFont` for a list of meaningful font ids.
.. method:: SetGradientType(self, gradient)
Sets the gradient type for :class:`BPArt` drawings.
:param integer `gradient`: can be one of the following bits:
============================ ======= ============================
Gradient Type Value Description
============================ ======= ============================
``BP_GRADIENT_NONE`` 0 No gradient shading should be used to paint the background
``BP_GRADIENT_VERTICAL`` 1 Vertical gradient shading should be used to paint the background
``BP_GRADIENT_HORIZONTAL`` 2 Horizontal gradient shading should be used to paint the background
============================ ======= ============================
.. method:: SetMetric(self, id, new_val)
Sets the option value for the specified size `id`.
:param integer `id`: the identification bit for the size value;
:param integer `new_val`: the new value for the size.
:raise: `Exception` if the `id` is not recognized.
:see: :meth:`~BPArt.GetMetric` for a list of meaningful size ids.
|