# wxDataViewListModel Class Reference
[wxDataViewCtrl Related Classes]

`#include <wx/dataview.h>`

Inheritance diagram for wxDataViewListModel:
[legend]

## Detailed Description

Base class with abstract API for wxDataViewIndexListModel and wxDataViewVirtualListModel.

##

Library: wxAdvanced

Category: wxDataViewCtrl Related Classes

## Public Member Functions
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.
virtual bool | IsEnabledByRow (unsigned int row, unsigned int col) const
| Override this if you want to disable specific items.
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.

List of all members.

## Constructor & Destructor Documentation

virtual wxDataViewListModel::~wxDataViewIndexListModel | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

int wxDataViewListModel::Compare | ( | const wxDataViewItem & | item1,
|  | const wxDataViewItem & | item2,
|  | unsigned int | column,
|  | bool | ascending |
| ) |  |  |

Compare method that sorts the items by their index.

virtual bool wxDataViewListModel::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.

See also:
  wxDataViewItemAttr.

Parameters:

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

Returns:
  true if this item has an attribute or false otherwise.

unsigned int wxDataViewListModel::GetCount | ( |  | ) | const

Returns the number of items (i.e.

rows) in the list.

wxDataViewItem wxDataViewListModel::GetItem | ( | unsigned int | row | ) | const

Returns the wxDataViewItem at the given row.

unsigned int wxDataViewListModel::GetRow | ( | const wxDataViewItem & | item | ) | const

Returns the position of given item.

virtual void wxDataViewListModel::GetValueByRow | ( | wxVariant & | variant,
|  | unsigned int | row,
|  | unsigned int | col |
| ) |  |  | const`[pure virtual]`

Override this to allow getting values from the model.

Implemented in wxDataViewListStore.

virtual bool wxDataViewListModel::IsEnabledByRow | ( | unsigned int | row,
|  | unsigned int | col |
| ) |  |  | const`[virtual]`

Override this if you want to disable specific items.

The base class version always returns true, thus making all items enabled by default.

Parameters:

  | row | The row of the item whose enabled status is requested.
  | col | The column of the item whose enabled status is requested.

Returns:
  true if the item at this row and column should be enabled, false otherwise.

Note:
  See wxDataViewModel::IsEnabled() for the current status of support for disabling the items under different platforms.

Since:
  2.9.2

void wxDataViewListModel::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 wxDataViewListModel::RowAppended | ( |  | ) |

Call this after a row has been appended to the model.

void wxDataViewListModel::RowChanged | ( | unsigned int | row | ) |

Call this after a row has been changed.

void wxDataViewListModel::RowDeleted | ( | unsigned int | row | ) |

Call this after a row has been deleted.

void wxDataViewListModel::RowInserted | ( | unsigned int | before | ) |

Call this after a row has been inserted at the given position.

void wxDataViewListModel::RowPrepended | ( |  | ) |

Call this after a row has been prepended to the model.

void wxDataViewListModel::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 wxDataViewListModel::RowValueChanged | ( | unsigned int | row,
|  | unsigned int | col |
| ) |  |  |

Call this after a value has been changed.

virtual bool wxDataViewListModel::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 ]