wxdataviewlistmodelwxdataviewlistmodel is currently the only existing variant of a wxdataviewmodel. it allows to define a table like data model to be displayed by a wxdataviewctrl. you need to derive from this class to define your own data model. you need to override getnumberofrows, getnumberofcols, getcoltype and getvalue in order to define the data model (which acts as an interface between your actual data and the wxdataviewctrl). since you will usually also allow the wxdataviewctrl to change your data through its graphical interface, you will also have to override setvalue which the wxdataviewctrl will call when a change to some data has been commited. the data that is presented through this data model is expected to change at run-time. you need to inform the data model that a change happens. depending on what happened you need to call one of the following methods: valuechanged, rowchanged, rowappended, rowprepended, rowinserted, rowdeleted, rowsreordered or rowscleared.
wxdataviewmodel and this class (as indeed the entire wxdataviewctrl code) is using wxvariant to store data and its type in a generic way. wxvariant can be extended to contain almost any data without changes to the original class. this class maintains a list of wxdatalistviewlistmodelnotifier which link this class to the specific implementations on the supported platforms so that e.g. calling valuechanged on this model will just call wxdatalistviewlistmodelnotifier::valuechanged for each notifier that has been added. this is used both for informing the native controls to redraw themselves and for informing e.g. the wxdataviewsortedlistmodel to resort itself. you can also add your own notifier in order to get informed about any changes to the data in the list model. additionally, this class maintains a list of all wxdataviewcolumns which display a certain column of this list model. this is mostly used internally. derived from include files <wx/dataview.h>
wxdataviewlistmodel::wxdataviewlistmodel
wxdataviewlistmodel::wxdataviewlistmodelwxdataviewlistmodel() constructor.
wxdataviewlistmodel::~wxdataviewlistmodel~wxdataviewlistmodel() destructor.
wxdataviewlistmodel::addnotifiervoid addnotifier(wxdataviewlistmodelnotifier* notifier) adds notifier to the internal list of notifers. see also removenotifier.
wxdataviewlistmodel::addviewingcolumnvoid addviewingcolumn(wxdataviewcolumn* view_column, unsigned int model_column) used internally. used for maintaining a list of wxdataviewcolumn that display a certain column of this model.
wxdataviewlistmodel::clearedbool virtual cleared() call this if all data in your model has been cleared.
wxdataviewlistmodel::getcoltypevirtual wxstring getcoltype(unsigned int col) override this to indicate what type of data is stored in the column specified by col. this should return a string indicating the type of data as reported by wxvariant.
wxdataviewlistmodel::getnumberofcolsvirtual unsigned int getnumberofcols() override this to indicate, how many columns the list model has.
wxdataviewlistmodel::getnumberofrowsvirtual unsigned int getnumberofrows() override this to indicate, how many rows the list model has.
wxdataviewlistmodel::getvaluevirtual void getvalue(wxvariant& variant, unsigned int col, unsigned int row) override this to indicate the value of a given value in the list model. a wxvariant is used to store the data.
wxdataviewlistmodel::removenotifiervoid removenotifier(wxdataviewlistmodelnotifier* notifier) removes the notifier from the list of notifiers. see also addnotifier.
wxdataviewlistmodel::removeviewingcolumnvoid removeviewingcolumn(wxdataviewcolumn* column) used internally. used for maintaining a list of wxdataviewcolumn that display a certain column of this model.
wxdataviewlistmodel::rowappendedvirtual bool rowappended() call this if a row has been appended to the list model.
wxdataviewlistmodel::rowchangedvirtual bool rowchanged(unsigned int row) call this if the values of this row have been changed.
wxdataviewlistmodel::rowdeletedvirtual bool rowdeleted(unsigned int row) call this if this row has been deleted.
wxdataviewlistmodel::rowinsertedvirtual bool rowinserted(unsigned int before) call this if a row has been inserted.
wxdataviewlistmodel::rowprependedvirtual bool rowprepended() call this if a row has been prepended.
wxdataviewlistmodel::rowsreorderedvirtual bool rowsreordered(unsigned int* new_order) call this if the rows have been reorderd.
wxdataviewlistmodel::setvaluevirtual bool setvalue(wxvariant& variant, unsigned int col, unsigned int row) this method gets called by e.g. the wxdataviewctrl class if a value has been changed through its graphical interface. you need to override this method in order to update the data in the underlying data structur. afterwards, valuechanged is called.
wxdataviewlistmodel::valuechangedvirtual bool valuechanged(unsigned int col, unsigned int row) call this if a value in the model has been changed.
|