#include <wx/dataview.h>
wxDataViewIndexListModel is a specialized data model which lets you address an item by its position (row) rather than its wxDataViewItem (which you can obtain from this class).
This model also provides its own wxDataViewIndexListModel::Compare method which sorts the model's data by the index.
This model is not a virtual model since the control stores each wxDataViewItem. Use wxDataViewVirtualListModel if you need to display millions of items or have other reason to use a virtual control.
Public Member Functions | |
wxDataViewIndexListModel (unsigned int initial_size=0) | |
Constructor. | |
virtual | ~wxDataViewIndexListModel () |
Destructor. | |
int | Compare (const wxDataViewItem &item1, const wxDataViewItem &item2, unsigned int column, bool ascending) |
Compare method that sorts the items by their index. | |
virtual bool | GetAttrByRow (unsigned int row, unsigned int col, wxDataViewItemAttr &attr) const |
Override this to indicate that the row has special font attributes. | |
unsigned int | GetCount () const |
Returns the number of items (i.e. | |
wxDataViewItem | GetItem (unsigned int row) const |
Returns the wxDataViewItem at the given row. | |
unsigned int | GetRow (const wxDataViewItem &item) const |
Returns the position of given item. | |
virtual void | GetValueByRow (wxVariant &variant, unsigned int row, unsigned int col) const =0 |
Override this to allow getting values from the model. | |
void | Reset (unsigned int new_size) |
Call this after if the data has to be read again from the model. | |
void | RowAppended () |
Call this after a row has been appended to the model. | |
void | RowChanged (unsigned int row) |
Call this after a row has been changed. | |
void | RowDeleted (unsigned int row) |
Call this after a row has been deleted. | |
void | RowInserted (unsigned int before) |
Call this after a row has been inserted at the given position. | |
void | RowPrepended () |
Call this after a row has been prepended to the model. | |
void | RowValueChanged (unsigned int row, unsigned int col) |
Call this after a value has been changed. | |
void | RowsDeleted (const wxArrayInt &rows) |
Call this after rows have been deleted. | |
virtual bool | SetValueByRow (const wxVariant &variant, unsigned int row, unsigned int col)=0 |
Called in order to set a value in the model. |
wxDataViewIndexListModel::wxDataViewIndexListModel | ( | unsigned int | initial_size = 0 |
) |
Constructor.
virtual wxDataViewIndexListModel::~wxDataViewIndexListModel | ( | ) | [virtual] |
Destructor.
int wxDataViewIndexListModel::Compare | ( | const wxDataViewItem & | item1, | |
const wxDataViewItem & | item2, | |||
unsigned int | column, | |||
bool | ascending | |||
) |
Compare method that sorts the items by their index.
virtual bool wxDataViewIndexListModel::GetAttrByRow | ( | unsigned int | row, | |
unsigned int | col, | |||
wxDataViewItemAttr & | attr | |||
) | const [virtual] |
Override this to indicate that the row has special font attributes.
This only affects the wxDataViewTextRendererText() renderer.
The base class version always simply returns false.
row | The row for which the attribute is requested. | |
col | The column for which the attribute is requested. | |
attr | The attribute to be filled in if the function returns true. |
unsigned int wxDataViewIndexListModel::GetCount | ( | ) | const |
Returns the number of items (i.e.
rows) in the list.
wxDataViewItem wxDataViewIndexListModel::GetItem | ( | unsigned int | row | ) | const |
Returns the wxDataViewItem at the given row.
unsigned int wxDataViewIndexListModel::GetRow | ( | const wxDataViewItem & | item | ) | const |
Returns the position of given item.
virtual void wxDataViewIndexListModel::GetValueByRow | ( | wxVariant & | variant, | |
unsigned int | row, | |||
unsigned int | col | |||
) | const [pure virtual] |
Override this to allow getting values from the model.
Implemented in wxDataViewListStore.
void wxDataViewIndexListModel::Reset | ( | unsigned int | new_size | ) |
Call this after if the data has to be read again from the model.
This is useful after major changes when calling the methods below (possibly thousands of times) doesn't make sense.
void wxDataViewIndexListModel::RowAppended | ( | ) |
Call this after a row has been appended to the model.
void wxDataViewIndexListModel::RowChanged | ( | unsigned int | row | ) |
Call this after a row has been changed.
void wxDataViewIndexListModel::RowDeleted | ( | unsigned int | row | ) |
Call this after a row has been deleted.
void wxDataViewIndexListModel::RowInserted | ( | unsigned int | before | ) |
Call this after a row has been inserted at the given position.
void wxDataViewIndexListModel::RowPrepended | ( | ) |
Call this after a row has been prepended to the model.
void wxDataViewIndexListModel::RowsDeleted | ( | const wxArrayInt & | rows | ) |
Call this after rows have been deleted.
The array will internally get copied and sorted in descending order so that the rows with the highest position will be deleted first.
void wxDataViewIndexListModel::RowValueChanged | ( | unsigned int | row, | |
unsigned int | col | |||
) |
Call this after a value has been changed.
virtual bool wxDataViewIndexListModel::SetValueByRow | ( | const wxVariant & | variant, | |
unsigned int | row, | |||
unsigned int | col | |||
) | [pure virtual] |
Called in order to set a value in the model.
Implemented in wxDataViewListStore.
![]() |
[ top ] |