File: wx.grid.GridCellAttrProvider.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (308 lines) | stat: -rw-r--r-- 8,552 bytes parent folder | download
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
.. 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



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