| Version: 3.2.8

Public Member Functions | List of all members
wxGridStringTable Class Reference

`#include <wx/grid.h>`

Inheritance diagram for wxGridStringTable:
[legend]

## Detailed Description

Simplest type of data table for a grid for small tables of strings that are stored in memory.

The number of rows and columns in the table can be specified initially but may also be changed later dynamically.

## Public Member Functions
| wxGridStringTable ()
| Default constructor creates an empty table. More...
| wxGridStringTable (int numRows, int numCols)
| Constructor taking number of rows and columns. More...
virtual int | GetNumberRows ()
| Must be overridden to return the number of rows in the table. More...
virtual int | GetNumberCols ()
| Must be overridden to return the number of columns in the table. More...
virtual wxString | GetValue (int row, int col)
| Must be overridden to implement accessing the table values as text. More...
virtual void | SetValue (int row, int col, const wxString &s)
| Must be overridden to implement setting the table values as text. More...
void | Clear ()
| Clear the table contents. More...
bool | InsertRows (size_t pos=0, size_t numRows=1)
| Insert additional rows into the table. More...
bool | AppendRows (size_t numRows=1)
| Append additional rows at the end of the table. More...
bool | DeleteRows (size_t pos=0, size_t numRows=1)
| Delete rows from the table. More...
bool | InsertCols (size_t pos=0, size_t numCols=1)
| Exactly the same as InsertRows() but for columns. More...
bool | AppendCols (size_t numCols=1)
| Exactly the same as AppendRows() but for columns. More...
bool | DeleteCols (size_t pos=0, size_t numCols=1)
| Exactly the same as DeleteRows() but for columns. More...
void | SetRowLabelValue (int row, const wxString &)
| Set the given label for the specified row. More...
void | SetColLabelValue (int col, const wxString &)
| Exactly the same as SetRowLabelValue() but for columns. More...
void | SetCornerLabelValue (const wxString &)
| Set the given label for the grid's corner. More...
wxString | GetRowLabelValue (int row)
| Return the label of the specified row. More...
wxString | GetColLabelValue (int col)
| Return the label of the specified column. More...
wxString | GetCornerLabelValue () const
| Return the label of the grid's corner. More...
Public Member Functions inherited from wxGridTableBase
| wxGridTableBase ()
| Default constructor. More...
virtual | ~wxGridTableBase ()
| Destructor frees the attribute provider if it was created. More...
int | GetRowsCount () const
| Return the number of rows in the table. More...
int | GetColsCount () const
| Return the number of columns in the table. More...
virtual void | SetView (wxGrid *grid)
| Called by the grid when the table is associated with it. More...
virtual wxGrid * | GetView () const
| Returns the last grid passed to SetView(). More...
virtual bool | CanHaveAttributes ()
| Returns true if this table supports attributes or false otherwise. More...
virtual bool | CanMeasureColUsingSameAttr (int col) const
| Override to return true if the same attribute can be used for measuring all cells in the given column. More...
virtual bool | IsEmptyCell (int row, int col)
| May be overridden to implement testing for empty cells. More...
bool | IsEmpty (const wxGridCellCoords &coords)
| Same as IsEmptyCell() but taking wxGridCellCoords. More...
virtual wxString | GetTypeName (int row, int col)
| Returns the type of the value in the given cell. More...
virtual bool | CanGetValueAs (int row, int col, const wxString &typeName)
| Returns true if the value of the given cell can be accessed as if it were of the specified type. More...
virtual bool | CanSetValueAs (int row, int col, const wxString &typeName)
| Returns true if the value of the given cell can be set as if it were of the specified type. More...
virtual long | GetValueAsLong (int row, int col)
| Returns the value of the given cell as a long. More...
virtual double | GetValueAsDouble (int row, int col)
| Returns the value of the given cell as a double. More...
virtual bool | GetValueAsBool (int row, int col)
| Returns the value of the given cell as a boolean. More...
virtual void * | GetValueAsCustom (int row, int col, const wxString &typeName)
| Returns the value of the given cell as a user-defined type. More...
virtual void | SetValueAsLong (int row, int col, long value)
| Sets the value of the given cell as a long. More...
virtual void | SetValueAsDouble (int row, int col, double value)
| Sets the value of the given cell as a double. More...
virtual void | SetValueAsBool (int row, int col, bool value)
| Sets the value of the given cell as a boolean. More...
virtual void | SetValueAsCustom (int row, int col, const wxString &typeName, void *value)
| Sets the value of the given cell as a user-defined type. More...
void | SetAttrProvider (wxGridCellAttrProvider *attrProvider)
| Associate this attributes provider with the table. More...
wxGridCellAttrProvider * | GetAttrProvider () const
| Returns the attribute provider currently being used. More...
virtual wxGridCellAttr * | GetAttr (int row, int col, wxGridCellAttr::wxAttrKind kind)
| Return the attribute for the given cell. More...
wxGridCellAttrPtr | GetAttrPtr (int row, int col, wxGridCellAttr::wxAttrKind kind)
| Return the attribute for the given cell. More...
virtual void | SetAttr (wxGridCellAttr *attr, int row, int col)
| Set attribute of the specified cell. More...
virtual void | SetRowAttr (wxGridCellAttr *attr, int row)
| Set attribute of the specified row. More...
virtual void | SetColAttr (wxGridCellAttr *attr, int col)
| Set attribute of the specified column. More...
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data. More...
| wxObject (const wxObject &other)
| Copy ctor. More...
virtual | ~wxObject ()
| Destructor. More...
virtual wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class. More...
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj. More...
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone. More...
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer. More...
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
void | UnShare ()
| This is the same of AllocExclusive() but this method is public. More...
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...

## Additional Inherited Members
Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object. More...
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data. More...

## Constructor & Destructor Documentation

## ◆ wxGridStringTable() [1/2]

wxGridStringTable::wxGridStringTable | ( |  | ) |

Default constructor creates an empty table.

## ◆ wxGridStringTable() [2/2]

wxGridStringTable::wxGridStringTable | ( | int | numRows,
|  | int | numCols
| ) |  |

Constructor taking number of rows and columns.

## Member Function Documentation

## ◆ AppendCols()

bool wxGridStringTable::AppendCols | ( | size_t | numCols = `1` | ) |
| virtual

Exactly the same as AppendRows() but for columns.

Reimplemented from wxGridTableBase.

## ◆ AppendRows()

bool wxGridStringTable::AppendRows | ( | size_t | numRows = `1` | ) |
| virtual

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.

Parameters

  numRows | The number of rows to add.

Reimplemented from wxGridTableBase.

## ◆ Clear()

void wxGridStringTable::Clear | ( |  | ) |
| virtual

Clear the table contents.

This method is used by wxGrid::ClearGrid().

Reimplemented from wxGridTableBase.

## ◆ DeleteCols()

bool wxGridStringTable::DeleteCols | ( | size_t | pos = `0`,
|  | size_t | numCols = `1`
| ) |  |
| virtual

Exactly the same as DeleteRows() but for columns.

Reimplemented from wxGridTableBase.

## ◆ DeleteRows()

bool wxGridStringTable::DeleteRows | ( | size_t | pos = `0`,
|  | size_t | numRows = `1`
| ) |  |
| virtual

Delete rows from the table.

Parameters

  pos | The first row to delete.
  numRows | The number of rows to delete.

Reimplemented from wxGridTableBase.

## ◆ GetColLabelValue()

wxString wxGridStringTable::GetColLabelValue | ( | int | col | ) |
| virtual

Return the label of the specified column.

Reimplemented from wxGridTableBase.

## ◆ GetCornerLabelValue()

wxString wxGridStringTable::GetCornerLabelValue | ( |  | ) | const
| virtual

Return the label of the grid's corner.

Since
  3.1.2

Reimplemented from wxGridTableBase.

## ◆ GetNumberCols()

virtual int wxGridStringTable::GetNumberCols | ( |  | ) |
| virtual

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 const methods of derived table classes,

Implements wxGridTableBase.

## ◆ GetNumberRows()

virtual int wxGridStringTable::GetNumberRows | ( |  | ) |
| virtual

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 const methods of derived table classes.

Implements wxGridTableBase.

## ◆ GetRowLabelValue()

wxString wxGridStringTable::GetRowLabelValue | ( | int | row | ) |
| virtual

Return the label of the specified row.

Reimplemented from wxGridTableBase.

## ◆ GetValue()

virtual wxString wxGridStringTable::GetValue | ( | int | row,
|  | int | col
| ) |  |
| virtual

Must be overridden to implement accessing the table values as text.

Implements wxGridTableBase.

## ◆ InsertCols()

bool wxGridStringTable::InsertCols | ( | size_t | pos = `0`,
|  | size_t | numCols = `1`
| ) |  |
| virtual

Exactly the same as InsertRows() but for columns.

Reimplemented from wxGridTableBase.

## ◆ InsertRows()

bool wxGridStringTable::InsertRows | ( | size_t | pos = `0`,
|  | size_t | numRows = `1`
| ) |  |
| virtual

Insert additional rows into the table.

Parameters

  pos | The position of the first new row.
  numRows | The number of rows to insert.

Reimplemented from wxGridTableBase.

## ◆ SetColLabelValue()

void wxGridStringTable::SetColLabelValue | ( | int | col,
|  | const wxString & | label
| ) |  |
| virtual

Exactly the same as SetRowLabelValue() but for columns.

Reimplemented from wxGridTableBase.

## ◆ SetCornerLabelValue()

void wxGridStringTable::SetCornerLabelValue | ( | const wxString & |  | ) |
| virtual

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 wxGrid::GetCornerLabelValue() to work.

Since
  3.1.2

Reimplemented from wxGridTableBase.

## ◆ SetRowLabelValue()

void wxGridStringTable::SetRowLabelValue | ( | int | row,
|  | const wxString & | label
| ) |  |
| virtual

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 wxGrid::SetRowLabelValue() to work.

Reimplemented from wxGridTableBase.

## ◆ SetValue()

virtual void wxGridStringTable::SetValue | ( | int | row,
|  | int | col,
|  | const wxString & | value
| ) |  |
| virtual

Must be overridden to implement setting the table values as text.

Implements wxGridTableBase.