Version: 3.1.0
wxGridStringTable Class Reference

#include <wx/grid.h>

+ Inheritance diagram for wxGridStringTable:

Detailed Description

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

Public Member Functions

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

Additional Inherited Members

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

Constructor & Destructor Documentation

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

Member Function Documentation

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

Exactly the same as AppendRows() but for columns.

Reimplemented from wxGridTableBase.

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
numRowsThe number of rows to add.

Reimplemented from wxGridTableBase.

void wxGridStringTable::Clear ( )
virtual

Clear the table contents.

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

Reimplemented from wxGridTableBase.

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

Exactly the same as DeleteRows() but for columns.

Reimplemented from wxGridTableBase.

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

Delete rows from the table.

Notice that currently deleting a row intersecting a multi-cell (see SetCellSize()) is not supported and will result in a crash.

Parameters
posThe first row to delete.
numRowsThe number of rows to delete.

Reimplemented from wxGridTableBase.

wxString wxGridStringTable::GetColLabelValue ( int  col)
virtual

Return the label of the specified column.

Reimplemented from wxGridTableBase.

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.

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.

wxString wxGridStringTable::GetRowLabelValue ( int  row)
virtual

Return the label of the specified row.

Reimplemented from wxGridTableBase.

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

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

Implements wxGridTableBase.

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

Exactly the same as InsertRows() but for columns.

Reimplemented from wxGridTableBase.

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

Insert additional rows into the table.

Parameters
posThe position of the first new row.
numRowsThe number of rows to insert.

Reimplemented from wxGridTableBase.

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

Exactly the same as SetRowLabelValue() but for columns.

Reimplemented from wxGridTableBase.

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.

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.