The almost abstract base class for grid tables.
A grid table is responsible for storing the grid data and, indirectly, grid cell attributes. The data can be stored in the way most convenient for the application but has to be provided in string form to wx.grid.Grid. It is also possible to provide cells values in other formats if appropriate, e.g. as numbers.
This base class is not quite abstract as it implements a trivial strategy for storing the attributes by forwarding it to wx.grid.GridCellAttrProvider and also provides stubs for some other functions. However it does have a number of pure virtual methods which must be implemented in the derived classes.
Class Hierarchy¶Inheritance diagram for class
GridTableBase:
Known Subclasses¶ Methods Summary¶ Properties Summary¶ Class API¶Possible constructors:
The almost abstract base class for grid tables.
Default constructor.
None
Exactly the same as AppendRows
but for columns.
numCols (int)
bool
Append additional rows at the end of the table.
This method is provided in addition to InsertRows
as some data models may only support appending rows to them but not inserting them at arbitrary locations. In such case you may implement this method only and leave InsertRows
unimplemented.
numRows (int) â The number of rows to add.
bool
Returns True
if the value of the given cell can be accessed as if it were of the specified type.
By default the cells can only be accessed as strings. Note that a cell could be accessible in different ways, e.g. a numeric cell may return True
for GRID_VALUE_NUMBER
but also for GRID_VALUE_STRING
indicating that the value can be coerced to a string form.
row (int)
col (int)
typeName (string)
bool
Returns True
if this table supports attributes or False
otherwise.
By default, the table automatically creates a wx.grid.GridCellAttrProvider when this function is called if it had no attribute provider before and returns True
.
bool
Override to return True
if the same attribute can be used for measuring all cells in the given column.
This function is provided for optimization purposes: it returns False
by default, but can be overridden to return True
when all the cells in the same grid column use sensibly the same attribute, i.e. they use the same renderer (either explicitly, or implicitly, due to their type as returned by GetTypeName
) and the font of the same size.
Returning True
from this function allows AutoSizeColumns() to skip looking up the attribute and the renderer for each individual cell, which results in very noticeable performance improvements for the grids with many rows.
col (int)
bool
Added in version 4.1/wxWidgets-3.1.4.
Returns True
if the value of the given cell can be set as if it were of the specified type.
row (int)
col (int)
typeName (string)
bool
Clear the table contents.
This method is used by wx.grid.Grid.ClearGrid
.
None
Exactly the same as DeleteRows
but for columns.
pos (int)
numCols (int)
bool
Delete rows from the table.
pos (int) â The first row to delete.
numRows (int) â The number of rows to delete.
bool
Return the attribute for the given cell.
By default this function is simply forwarded to wx.grid.GridCellAttrProvider.GetAttr
but it may be overridden to handle attributes directly in the table.
Prefer to use GetAttrPtr
to avoid the need to call DecRef() on the returned pointer manually.
row (int)
col (int)
kind (GridCellAttr.wxAttrKind)
Returns the attribute provider currently being used.
This function may return None
if the attribute provider hasnât been either associated with this table by SetAttrProvider
nor created on demand by any other methods.
Return the attribute for the given cell.
This method is identical to GetAttr
, but returns a smart pointer, which frees the caller from the need to call DecRef() manually.
row (int)
col (int)
kind (GridCellAttr.wxAttrKind)
wx.grid.GridCellAttrPtr
Added in version 4.1/wxWidgets-3.1.4.
Return the label of the specified column.
col (int)
str
Return the number of columns in the table.
This method is not virtual and is only provided as a convenience for the derived classes which canât call GetNumberCols
without a const_cast
from their methods.
int
Return the label of the gridâs corner.
str
Added in version 4.1/wxWidgets-3.1.2.
Must be overridden to return the number of columns in the table.
For backwards compatibility reasons, this method is not const. Use GetColsCount
instead of it in methods of derived table classes,
int
Must be overridden to return the number of rows in the table.
For backwards compatibility reasons, this method is not const. Use GetRowsCount
instead of it in methods of derived table classes.
int
Return the label of the specified row.
row (int)
str
Return the number of rows in the table.
This method is not virtual and is only provided as a convenience for the derived classes which canât call GetNumberRows
without a const_cast
from their methods.
int
Returns the type of the value in the given cell.
By default all cells are strings and this method returns GRID_VALUE_STRING
.
row (int)
col (int)
str
Must be overridden to implement accessing the table values as text.
row (int)
col (int)
Any
Returns the value of the given cell as a boolean.
This should only be called if CanGetValueAs
returns True
when called with GRID_VALUE_BOOL
argument. Default implementation always return False
.
row (int)
col (int)
bool
Returns the value of the given cell as a double.
This should only be called if CanGetValueAs
returns True
when called with GRID_VALUE_FLOAT
argument. Default implementation always return 0.0.
row (int)
col (int)
float
Returns the value of the given cell as a long.
This should only be called if CanGetValueAs
returns True
when called with GRID_VALUE_NUMBER
argument. Default implementation always return 0.
row (int)
col (int)
int
Returns the last grid passed to SetView
.
Exactly the same as InsertRows
but for columns.
pos (int)
numCols (int)
bool
Insert additional rows into the table.
pos (int) â The position of the first new row.
numRows (int) â The number of rows to insert.
bool
Same as IsEmptyCell
but taking wx.grid.GridCellCoords.
Notice that this method is not virtual, only IsEmptyCell
should be overridden.
coords (wx.grid.GridCellCoords)
bool
May be overridden to implement testing for empty cells.
This method is used by the grid to test if the given cell is not used and so whether a neighbouring cell may overflow into it. By default it only returns True
if the value of the given cell, as returned by GetValue
, is empty.
row (int)
col (int)
bool
Set attribute of the specified cell.
By default this function is simply forwarded to wx.grid.GridCellAttrProvider.SetAttr
.
The table takes ownership of attr
, i.e. will call DecRef() on it.
attr (wx.grid.GridCellAttr)
row (int)
col (int)
None
Associate this attributes provider with the table.
The table takes ownership of attrProvider pointer and will delete it when it doesnât need it any more. The pointer can be None
, however this wonât disable attributes management in the table but will just result in a default attributes being recreated the next time any of the other functions in this section is called. To completely disable the attributes support, should this be needed, you need to override CanHaveAttributes
to return False
.
attrProvider (wx.grid.GridCellAttrProvider)
None
Set attribute of the specified column.
By default this function is simply forwarded to wx.grid.GridCellAttrProvider.SetColAttr
.
The table takes ownership of attr
, i.e. will call DecRef() on it.
attr (wx.grid.GridCellAttr)
col (int)
None
Exactly the same as SetRowLabelValue
but for columns.
col (int)
label (string)
None
Set the given label for the gridâs corner.
The default version does nothing, i.e. the label is not stored. You must override this method in your derived class if you wish wx.grid.Grid.GetCornerLabelValue
to work.
`` (string)
None
Added in version 4.1/wxWidgets-3.1.2.
Set attribute of the specified row.
By default this function is simply forwarded to wx.grid.GridCellAttrProvider.SetRowAttr
.
The table takes ownership of attr
, i.e. will call DecRef() on it.
attr (wx.grid.GridCellAttr)
row (int)
None
Set the given label for the specified row.
The default version does nothing, i.e. the label is not stored. You must override this method in your derived class if you wish wx.grid.Grid.SetRowLabelValue
to work.
row (int)
label (string)
None
Must be overridden to implement setting the table values as text.
row (int)
col (int)
value (string)
None
Sets the value of the given cell as a boolean.
This should only be called if CanSetValueAs
returns True
when called with GRID_VALUE_BOOL
argument. Default implementation doesnât do anything.
row (int)
col (int)
value (bool)
None
Sets the value of the given cell as a double.
This should only be called if CanSetValueAs
returns True
when called with GRID_VALUE_FLOAT
argument. Default implementation doesnât do anything.
row (int)
col (int)
value (float)
None
Sets the value of the given cell as a long.
This should only be called if CanSetValueAs
returns True
when called with GRID_VALUE_NUMBER
argument. Default implementation doesnât do anything.
row (int)
col (int)
value (long)
None
Called by the grid when the table is associated with it.
The default implementation stores the pointer and returns it from its GetView
and so only makes sense if the table cannot be associated with more than one grid at a time.
grid (wx.grid.Grid)
None
See GetAttrProvider
and SetAttrProvider
See GetColsCount
See GetNumberCols
See GetNumberRows
See GetRowsCount
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4