.. 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.grid.GridCellAttrProvider:

==========================================================================================================================================
|phoenix_title|  **wx.grid.GridCellAttrProvider**
==========================================================================================================================================

Class providing attributes to be used for the grid cells.          

This class both defines an interface which grid cell attributes providers should implement  

An object of this class can be associated with a :ref:`wx.grid.Grid`  using :meth:`wx.grid.GridTableBase.SetAttrProvider`   but it's not necessary to call it if you intend to use the default provider as it is used by :ref:`wx.grid.GridTableBase`  by default anyhow. 

Notice that while attributes provided by this class can be set for individual cells using :meth:`~wx.grid.GridCellAttrProvider.SetAttr`  or the entire rows or columns using :meth:`~wx.grid.GridCellAttrProvider.SetRowAttr`  and :meth:`~wx.grid.GridCellAttrProvider.SetColAttr`  they are always retrieved using :meth:`~wx.grid.GridCellAttrProvider.GetAttr`  function. 

The default implementation of this class stores the attributes passed to its :meth:`~wx.grid.GridCellAttrProvider.SetAttr`, :meth:`~wx.grid.GridCellAttrProvider.SetRowAttr`  and :meth:`~wx.grid.GridCellAttrProvider.SetColAttr`  in a straightforward way. A derived class may use its knowledge about how the attributes are used in your program to implement it much more efficiently: for example, using a special background colour for all even-numbered rows can be implemented by simply returning the same attribute from :meth:`~wx.grid.GridCellAttrProvider.GetAttr`  if the row number is even instead of having to store N/2 row attributes where N is the total number of rows in the grid. 

Notice that objects of this class can't be copied.           




|

|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>GridCellAttrProvider</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.grid.GridCellAttrProvider_inheritance.png" alt="Inheritance diagram of GridCellAttrProvider" 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.ClientDataContainer.html" title="wx.ClientDataContainer" alt="" coords="17,5,188,35"/> <area shape="rect" id="node2" href="wx.grid.GridCellAttrProvider.html" title="wx.grid.GridCellAttrProvider" alt="" coords="5,83,200,112"/> </map> 
   </p>

|


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

================================================================================ ================================================================================
:meth:`~wx.grid.GridCellAttrProvider.__init__`                                   Trivial default constructor.
:meth:`~wx.grid.GridCellAttrProvider.GetAttr`                                    Get the attribute to use for the specified cell.
:meth:`~wx.grid.GridCellAttrProvider.GetColumnHeaderRenderer`                    Return the renderer used for drawing column headers.
:meth:`~wx.grid.GridCellAttrProvider.GetCornerRenderer`                          Return the renderer used for drawing the corner window.
:meth:`~wx.grid.GridCellAttrProvider.GetRowHeaderRenderer`                       Return the renderer used for drawing row headers.
:meth:`~wx.grid.GridCellAttrProvider.SetAttr`                                    Set attribute for the specified cell.
:meth:`~wx.grid.GridCellAttrProvider.SetColAttr`                                 Set attribute for the specified column.
:meth:`~wx.grid.GridCellAttrProvider.SetRowAttr`                                 Set attribute for the specified row.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.grid.GridCellAttrProvider.CornerRenderer`                             See :meth:`~wx.grid.GridCellAttrProvider.GetCornerRenderer`
================================================================================ ================================================================================


|


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


.. class:: wx.grid.GridCellAttrProvider(ClientDataContainer)

   **Possible constructors**::

       GridCellAttrProvider()
       
   
   Class providing attributes to be used for the grid cells.



   .. method:: __init__(self)

      Trivial default constructor.                   





   .. method:: GetAttr(self, row, col, kind)

      Get the attribute to use for the specified cell.                  

      If :meth:`wx.grid.GridCellAttr.Any`   is used as `kind`  value, this function combines the attributes set for this cell using :meth:`SetAttr`   and those for its row or column (set with :meth:`SetRowAttr`   or :meth:`SetColAttr`   respectively), with the cell attribute having the highest precedence. 

      Notice that the caller must call DecRef() on the returned pointer if it is non-NULL. 




      :param `row`: The row of the cell.   
      :type `row`: int
      :param `col`: The column of the cell.   
      :type `col`: int
      :param `kind`: The kind of the attribute to return.   
      :type `kind`: GridCellAttr.wxAttrKind










      :rtype: :ref:`wx.grid.GridCellAttr`



                  



      :returns: 

         The attribute to use which should be DecRef()'d by caller or ``None`` if no attributes are defined for this cell.   








   .. method:: GetColumnHeaderRenderer(self, col)

      Return the renderer used for drawing column headers.                  

      By default :ref:`wx.grid.GridColumnHeaderRendererDefault`  is returned. 

                


      :param `col`: 
      :type `col`: int




      :rtype: :ref:`wx.grid.GridColumnHeaderRenderer`







      .. versionadded:: 2.9.1 
     







      .. seealso:: :meth:`wx.grid.Grid.SetUseNativeColLabels` , :meth:`wx.grid.Grid.UseNativeColHeader`   








   .. method:: GetCornerRenderer(self)

      Return the renderer used for drawing the corner window.                  

      By default :ref:`wx.grid.GridCornerHeaderRendererDefault`  is returned. 

                

      :rtype: :ref:`wx.grid.GridCornerHeaderRenderer`







      .. versionadded:: 2.9.1 
     








   .. method:: GetRowHeaderRenderer(self, row)

      Return the renderer used for drawing row headers.                  

      By default :ref:`wx.grid.GridRowHeaderRendererDefault`  is returned. 

                


      :param `row`: 
      :type `row`: int




      :rtype: :ref:`wx.grid.GridRowHeaderRenderer`







      .. versionadded:: 2.9.1 
     








   .. method:: SetAttr(self, attr, row, col)

      Set attribute for the specified cell.                  


      :param `attr`: 
      :type `attr`: wx.grid.GridCellAttr
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int







   .. method:: SetColAttr(self, attr, col)

      Set attribute for the specified column.                  


      :param `attr`: 
      :type `attr`: wx.grid.GridCellAttr
      :param `col`: 
      :type `col`: int







   .. method:: SetRowAttr(self, attr, row)

      Set attribute for the specified row.                  


      :param `attr`: 
      :type `attr`: wx.grid.GridCellAttr
      :param `row`: 
      :type `row`: int







   .. attribute:: CornerRenderer

      See :meth:`~wx.grid.GridCellAttrProvider.GetCornerRenderer`

