Version: 3.3.0
wxDataViewVirtualListModel Class Reference

#include <wx/dataview.h>

+ Inheritance diagram for wxDataViewVirtualListModel:

Detailed Description

wxDataViewVirtualListModel is a specialized data model which lets you address an item by its position (row) rather than its wxDataViewItem and as such offers the exact same interface as wxDataViewIndexListModel.

The important difference is that under platforms other than macOS, using this model will result in a truly virtual control able to handle millions of items as the control doesn't store any item (a feature not supported by macOS).

See also
wxDataViewListModel for the API.

Library:  wxCore
Category:  wxDataViewCtrl Related Classes

Public Member Functions

 wxDataViewVirtualListModel (unsigned int initial_size=0)
 Constructor. More...
 
wxDataViewItem GetItem (unsigned int row) const
 Returns the wxDataViewItem at the given row. More...
 
void Reset (unsigned int new_size)
 Call this after if the data has to be read again from the model. More...
 
void RowAppended ()
 Call this after a row has been appended to the model. More...
 
void RowChanged (unsigned int row)
 Call this after a row has been changed. More...
 
void RowDeleted (unsigned int row)
 Call this after a row has been deleted. More...
 
void RowInserted (unsigned int before)
 Call this after a row has been inserted at the given position. More...
 
void RowPrepended ()
 Call this after a row has been prepended to the model. More...
 
void RowValueChanged (unsigned int row, unsigned int col)
 Call this after a value has been changed. More...
 
void RowsDeleted (const wxArrayInt &rows)
 Call this after rows have been deleted. More...
 
- Public Member Functions inherited from wxDataViewListModel
virtual ~wxDataViewListModel ()
 Destructor. More...
 
int Compare (const wxDataViewItem &item1, const wxDataViewItem &item2, unsigned int column, bool ascending) const
 Compare method that sorts the items by their index. More...
 
virtual bool GetAttrByRow (unsigned int row, unsigned int col, wxDataViewItemAttr &attr) const
 Override this to indicate that the row has special font attributes. More...
 
virtual bool IsEnabledByRow (unsigned int row, unsigned int col) const
 Override this if you want to disable specific items. More...
 
unsigned int GetCount () const =0
 Returns the number of items (or rows) in the list. More...
 
unsigned int GetRow (const wxDataViewItem &item) const =0
 Returns the position of given item. More...
 
virtual void GetValueByRow (wxVariant &variant, unsigned int row, unsigned int col) const =0
 Override this to allow getting values from the model. More...
 
virtual bool SetValueByRow (const wxVariant &variant, unsigned int row, unsigned int col)=0
 Called in order to set a value in the model. More...
 
- Public Member Functions inherited from wxDataViewModel
 wxDataViewModel ()
 Constructor. More...
 
void AddNotifier (wxDataViewModelNotifier *notifier)
 Adds a wxDataViewModelNotifier to the model. More...
 
bool ChangeValue (const wxVariant &variant, const wxDataViewItem &item, unsigned int col)
 Change the value of the given item and update the control to reflect it. More...
 
bool Cleared ()
 Called to inform the model that all of its data has been changed. More...
 
virtual bool GetAttr (const wxDataViewItem &item, unsigned int col, wxDataViewItemAttr &attr) const
 Override this to indicate that the item has special font attributes. More...
 
virtual bool IsEnabled (const wxDataViewItem &item, unsigned int col) const
 Override this to indicate that the item should be disabled. More...
 
virtual unsigned int GetChildren (const wxDataViewItem &item, wxDataViewItemArray &children) const =0
 Override this so the control can query the child items of an item. More...
 
virtual wxDataViewItem GetParent (const wxDataViewItem &item) const =0
 Override this to indicate which wxDataViewItem representing the parent of item or an invalid wxDataViewItem if the root item is the parent item. More...
 
virtual void GetValue (wxVariant &variant, const wxDataViewItem &item, unsigned int col) const =0
 Override this to indicate the value of item. More...
 
virtual bool HasContainerColumns (const wxDataViewItem &item) const
 Override this method to indicate if a container item merely acts as a headline (or for categorisation) or if it also acts a normal item with entries for further columns. More...
 
virtual bool HasDefaultCompare () const
 Override this to indicate that the model provides a default compare function that the control should use if no wxDataViewColumn has been chosen for sorting. More...
 
virtual bool HasValue (const wxDataViewItem &item, unsigned col) const
 Return true if there is a value in the given column of this item. More...
 
virtual bool IsContainer (const wxDataViewItem &item) const =0
 Override this to indicate if item is a container, i.e. if it can have child items. More...
 
bool ItemAdded (const wxDataViewItem &parent, const wxDataViewItem &item)
 Call this to inform the model that an item has been added to the data. More...
 
bool ItemChanged (const wxDataViewItem &item)
 Call this to inform the model that an item has changed. More...
 
bool ItemDeleted (const wxDataViewItem &parent, const wxDataViewItem &item)
 Call this to inform the model that an item has been deleted from the data. More...
 
bool ItemsAdded (const wxDataViewItem &parent, const wxDataViewItemArray &items)
 Call this to inform the model that several items have been added to the data. More...
 
bool ItemsChanged (const wxDataViewItemArray &items)
 Call this to inform the model that several items have changed. More...
 
bool ItemsDeleted (const wxDataViewItem &parent, const wxDataViewItemArray &items)
 Call this to inform the model that several items have been deleted. More...
 
void RemoveNotifier (wxDataViewModelNotifier *notifier)
 Remove the notifier from the list of notifiers. More...
 
virtual void Resort ()
 Call this to initiate a resort after the sort function has been changed. More...
 
virtual bool SetValue (const wxVariant &variant, const wxDataViewItem &item, unsigned int col)=0
 This gets called in order to set a value in the data model. More...
 
bool ValueChanged (const wxDataViewItem &item, unsigned int col)
 Call this to inform this model that a value in the model has been changed. More...
 
virtual bool IsListModel () const
 
virtual bool IsVirtualListModel () const
 
- Public Member Functions inherited from wxRefCounter
 wxRefCounter ()
 Default constructor. More...
 
void DecRef ()
 Decrements the reference count associated with this shared data and, if it reaches zero, destroys this instance of wxRefCounter releasing its memory. More...
 
int GetRefCount () const
 Returns the reference count associated with this shared data. More...
 
void IncRef ()
 Increments the reference count associated with this shared data. More...
 

Additional Inherited Members

- Protected Member Functions inherited from wxDataViewModel
virtual ~wxDataViewModel ()
 Destructor. More...
 
virtual int DoCompareValues (const wxVariant &value1, const wxVariant &value2) const
 Virtual method that can be overridden to define comparison for values of non-standard types. More...
 
- Protected Member Functions inherited from wxRefCounter
virtual ~wxRefCounter ()
 Destructor. More...
 

Constructor & Destructor Documentation

◆ wxDataViewVirtualListModel()

wxDataViewVirtualListModel::wxDataViewVirtualListModel ( unsigned int  initial_size = 0)

Constructor.

Member Function Documentation

◆ GetItem()

wxDataViewItem wxDataViewVirtualListModel::GetItem ( unsigned int  row) const

Returns the wxDataViewItem at the given row.

◆ Reset()

void wxDataViewVirtualListModel::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.

◆ RowAppended()

void wxDataViewVirtualListModel::RowAppended ( )

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

◆ RowChanged()

void wxDataViewVirtualListModel::RowChanged ( unsigned int  row)

Call this after a row has been changed.

◆ RowDeleted()

void wxDataViewVirtualListModel::RowDeleted ( unsigned int  row)

Call this after a row has been deleted.

◆ RowInserted()

void wxDataViewVirtualListModel::RowInserted ( unsigned int  before)

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

◆ RowPrepended()

void wxDataViewVirtualListModel::RowPrepended ( )

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

◆ RowsDeleted()

void wxDataViewVirtualListModel::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.

◆ RowValueChanged()

void wxDataViewVirtualListModel::RowValueChanged ( unsigned int  row,
unsigned int  col 
)

Call this after a value has been changed.