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



.. _wx.DelegateRendererNative:

==========================================================================================================================================
|phoenix_title|  **wx.DelegateRendererNative**
==========================================================================================================================================

:ref:`wx.DelegateRendererNative`  allows reuse of renderers code by forwarding all the :ref:`wx.RendererNative`  methods to the given object and thus allowing you to only modify some of its methods          

Note that the "normal", inheritance-based approach, doesn't work with the renderers as it is impossible to derive from a class unknown at compile-time and the renderer is only chosen at run-time. So suppose that you want to only add something to the drawing of the tree control buttons but leave all the other methods unchanged  

Except for the constructor, it has exactly the same methods as :ref:`wx.RendererNative`  and their implementation is trivial: they are simply forwarded to the real renderer. Note that the "real" renderer may, in turn, be a :ref:`wx.DelegateRendererNative`  as well and that there may be arbitrarily many levels like this  







         



.. seealso:: :ref:`wx.RendererNative`    







|

|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>DelegateRendererNative</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.DelegateRendererNative_inheritance.png" alt="Inheritance diagram of DelegateRendererNative" 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.RendererNative.html" title="wx.RendererNative" alt="" coords="34,5,173,35"/> <area shape="rect" id="node2" href="wx.DelegateRendererNative.html" title="wx.DelegateRendererNative" alt="" coords="5,83,203,112"/> </map> 
   </p>

|


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

================================================================================ ================================================================================
:meth:`~wx.DelegateRendererNative.__init__`                                      The default constructor does the same thing as the other one except that it uses the :ref:`generic renderer <wx.RendererNative>`  instead of the user-specified `rendererNative`.
:meth:`~wx.DelegateRendererNative.DrawCheckBox`                                  Draw a check box.
:meth:`~wx.DelegateRendererNative.DrawComboBoxDropButton`                        Draw a button like the one used by :ref:`wx.ComboBox`  to show a drop down window.
:meth:`~wx.DelegateRendererNative.DrawDropArrow`                                 Draw a drop down arrow that is suitable for use outside a combo box.
:meth:`~wx.DelegateRendererNative.DrawFocusRect`                                 Draw a focus rectangle using the specified rectangle.
:meth:`~wx.DelegateRendererNative.DrawHeaderButton`                              Draw the header control button (used, for example, by :ref:`wx.ListCtrl`).
:meth:`~wx.DelegateRendererNative.DrawHeaderButtonContents`                      Draw the contents of a header control button (label, sort arrows, etc.).
:meth:`~wx.DelegateRendererNative.DrawItemSelectionRect`                         Draw a selection rectangle underneath the text as used e.g.
:meth:`~wx.DelegateRendererNative.DrawPushButton`                                Draw a blank push button that looks very similar to :ref:`wx.Button`.
:meth:`~wx.DelegateRendererNative.DrawSplitterBorder`                            Draw the border for sash window: this border must be such that the sash drawn by :meth:`~DelegateRendererNative.DrawSplitterSash`   blends into it well.
:meth:`~wx.DelegateRendererNative.DrawSplitterSash`                              Draw a sash.
:meth:`~wx.DelegateRendererNative.DrawTreeItemButton`                            Draw the expanded/collapsed icon for a tree control item.
:meth:`~wx.DelegateRendererNative.GetCheckBoxSize`                               Returns the size of a check box.
:meth:`~wx.DelegateRendererNative.GetHeaderButtonHeight`                         Returns the height of a header button, either a fixed platform height if available, or a generic height based on the `win`  window's font.
:meth:`~wx.DelegateRendererNative.GetHeaderButtonMargin`                         Returns the horizontal margin on the left and right sides of header button's label.
:meth:`~wx.DelegateRendererNative.GetSplitterParams`                             Get the splitter parameters, see :ref:`wx.SplitterRenderParams`.
:meth:`~wx.DelegateRendererNative.GetVersion`                                    This function is used for version checking: :meth:`~DelegateRendererNative.Load`   refuses to load any shared libraries implementing an older or incompatible version.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.DelegateRendererNative.Version`                                       See :meth:`~wx.DelegateRendererNative.GetVersion`
================================================================================ ================================================================================


|


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


.. class:: wx.DelegateRendererNative(RendererNative)

   **Possible constructors**::

       DelegateRendererNative()
       
       DelegateRendererNative(rendererNative)
       
   
   DelegateRendererNative allows reuse of renderers code by forwarding
   all the RendererNative methods to the given object and thus allowing
   you to only modify some of its methods  without having to reimplement
   all of them.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self)`
      
      The default constructor does the same thing as the other one except that it uses the :ref:`generic renderer <wx.RendererNative>`  instead of the user-specified `rendererNative`.                  
      
      In any case, this sets up the delegate renderer object to follow all calls to the specified real renderer.                   
      
      
      
      
      **~~~**

      
      **__init__** `(self, rendererNative)`
      
      This constructor uses the user-specified `rendererNative`  to set up the delegate renderer object to follow all calls to the specified real renderer.                  
      
                      
      
      
      :param `rendererNative`: 
      :type `rendererNative`: wx.RendererNative
      
      
      
      
      
      
      .. note:: 
      
         This object does not take ownership of (i.e. won't delete) `rendererNative`.   
      
      
      
      
      
      
      
      **~~~**






   .. method:: DrawCheckBox(self, win, dc, rect, flags=0)

      Draw a check box.                  

      `flags`  may have the  ``CONTROL_CHECKED`` ,   ``CONTROL_CURRENT``   or   ``CONTROL_UNDETERMINED``   bit set, see  ``CONTROL_FLAGS``.                  


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int







   .. method:: DrawComboBoxDropButton(self, win, dc, rect, flags=0)

      Draw a button like the one used by :ref:`wx.ComboBox`  to show a drop down window.                  

      The usual appearance is a downwards pointing arrow. 

      `flags`  may have the  ``CONTROL_PRESSED``   or   ``CONTROL_CURRENT``   bit set, see  ``CONTROL_FLAGS``.                  


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int







   .. method:: DrawDropArrow(self, win, dc, rect, flags=0)

      Draw a drop down arrow that is suitable for use outside a combo box.                  

      Arrow will have transparent background. 

      `rect`  is not entirely filled by the arrow. Instead, you should use bounding rectangle of a drop down button which arrow matches the size you need. 

      `flags`  may have the  ``CONTROL_PRESSED``   or   ``CONTROL_CURRENT``   bit set, see  ``CONTROL_FLAGS``.                  


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int







   .. method:: DrawFocusRect(self, win, dc, rect, flags=0)

      Draw a focus rectangle using the specified rectangle.                  

      :ref:`wx.ListCtrl`. 

      The only supported flags is  ``CONTROL_SELECTED``   for items which are selected. see  ``CONTROL_FLAGS``.                  


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int







   .. method:: DrawHeaderButton(self, win, dc, rect, flags=0, sortArrow=HDR_SORT_ICON_NONE, params=None)

      Draw the header control button (used, for example, by :ref:`wx.ListCtrl`).                  

      Depending on platforms the `flags`  parameter may support the  ``CONTROL_SELECTED``       ``CONTROL_DISABLED``   and   ``CONTROL_CURRENT``   bits, see  ``CONTROL_FLAGS``. 

                


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int
      :param `sortArrow`: 
      :type `sortArrow`: wx.HeaderSortIconType
      :param `params`: 
      :type `params`: wx.HeaderButtonParams




      :rtype: `int`







      :returns: 

         The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins.   








   .. method:: DrawHeaderButtonContents(self, win, dc, rect, flags=0, sortArrow=HDR_SORT_ICON_NONE, params=None)

      Draw the contents of a header control button (label, sort arrows, etc.).                  

      This function is normally only called by :meth:`DrawHeaderButton` . 

      Depending on platforms the `flags`  parameter may support the  ``CONTROL_SELECTED``       ``CONTROL_DISABLED``   and   ``CONTROL_CURRENT``   bits, see  ``CONTROL_FLAGS``. 

                


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int
      :param `sortArrow`: 
      :type `sortArrow`: wx.HeaderSortIconType
      :param `params`: 
      :type `params`: wx.HeaderButtonParams




      :rtype: `int`







      :returns: 

         The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins.   








   .. method:: DrawItemSelectionRect(self, win, dc, rect, flags=0)

      Draw a selection rectangle underneath the text as used e.g.                  

      in a :ref:`wx.ListCtrl`. 

      The supported `flags`  are  ``CONTROL_SELECTED``   for items which are selected (e.g. often a blue rectangle) and   ``CONTROL_CURRENT``   for the item that has the focus (often a dotted line around the item's text).   ``CONTROL_FOCUSED``   may be used to indicate if the control has the focus (otherwise the selection rectangle is e.g. often grey and not blue). This may be ignored by the renderer or deduced by the code directly from the  `win`.                  


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int







   .. method:: DrawPushButton(self, win, dc, rect, flags=0)

      Draw a blank push button that looks very similar to :ref:`wx.Button`.                  

      `flags`  may have the  ``CONTROL_PRESSED`` ,   ``CONTROL_CURRENT``   or   ``CONTROL_ISDEFAULT``   bit set, see  ``CONTROL_FLAGS``.                  


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int







   .. method:: DrawSplitterBorder(self, win, dc, rect, flags=0)

      Draw the border for sash window: this border must be such that the sash drawn by :meth:`DrawSplitterSash`   blends into it well.                  


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int







   .. method:: DrawSplitterSash(self, win, dc, size, position, orient, flags=0)

      Draw a sash.                  

      The `orient`  parameter defines whether the sash should be vertical or horizontal and how the `position`  should be interpreted.                  


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `size`: 
      :type `size`: wx.Size
      :param `position`: 
      :type `position`: int
      :param `orient`: 
      :type `orient`: wx.Orientation
      :param `flags`: 
      :type `flags`: int







   .. method:: DrawTreeItemButton(self, win, dc, rect, flags=0)

      Draw the expanded/collapsed icon for a tree control item.                  

      To draw an expanded button the `flags`  parameter must contain  ``CONTROL_EXPANDED``   bit, see  ``CONTROL_FLAGS``.                  


      :param `win`: 
      :type `win`: wx.Window
      :param `dc`: 
      :type `dc`: wx.DC
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `flags`: 
      :type `flags`: int







   .. method:: GetCheckBoxSize(self, win)

      Returns the size of a check box.                  

      The `win`  parameter is not used currently and can be ``None``.                  


      :param `win`: 
      :type `win`: wx.Window




      :rtype: :ref:`wx.Size`








   .. method:: GetHeaderButtonHeight(self, win)

      Returns the height of a header button, either a fixed platform height if available, or a generic height based on the `win`  window's font.                  


      :param `win`: 
      :type `win`: wx.Window




      :rtype: `int`








   .. method:: GetHeaderButtonMargin(self, win)

      Returns the horizontal margin on the left and right sides of header button's label.                  

                


      :param `win`: 
      :type `win`: wx.Window




      :rtype: `int`







      .. versionadded:: 2.9.2 
     








   .. method:: GetSplitterParams(self, win)

      Get the splitter parameters, see :ref:`wx.SplitterRenderParams`.                  

      The `win`  parameter should be a :ref:`wx.SplitterWindow`.                  


      :param `win`: 
      :type `win`: wx.Window




      :rtype: :ref:`wx.SplitterRenderParams`








   .. method:: GetVersion(self)

      This function is used for version checking: :meth:`Load`   refuses to load any shared libraries implementing an older or incompatible version.                  

                

      :rtype: :ref:`wx.RendererVersion`







      .. note:: 

         The implementation of this method is always the same in all renderers (simply construct :ref:`wx.RendererVersion`  using the  ``RendererVersion::Current_XXX``   values), but it has to be in the derived, not base, class, to detect mismatches between the renderers versions and so you have to implement it anew in all renderers.    








   .. attribute:: Version

      See :meth:`~wx.DelegateRendererNative.GetVersion`

