.. 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>
   <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="BPArt is an art provider class which does all of the drawing for ButtonPanel." alt="" coords="5,5,224,35"/> </map> 
   </p>
   </div>

|


|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.
      
      .. seealso:: :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.
      
      .. seealso:: :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.
      
      .. seealso:: :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.
      
      .. seealso:: :meth:`~BPArt.GetMetric` for a list of meaningful size ids.