From b955766e883accfd019d7ebd8261afb8098213ef Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 13 Sep 2010 20:12:57 +0000 Subject: [PATCH] Document wxDataViewListModel as common abstract base class for wxDataViewIndexListModel and wxDataViewVirtualListModel. Add wxDataViewListModel::GetCount() as both have it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65539 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dataview.h | 3 +++ interface/wx/dataview.h | 59 +++++++++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 0daadfc7ed..173039c072 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -305,6 +305,8 @@ public: // helper methods provided by list models only virtual unsigned GetRow( const wxDataViewItem &item ) const = 0; + // returns the number of rows + virtual unsigned int GetCount() const = 0; // implement some base class pure virtual directly virtual wxDataViewItem @@ -339,6 +341,7 @@ public: return GetAttrByRow( GetRow(item), col, attr ); } + virtual bool IsListModel() const { return true; } }; diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index 4947ed44ed..bfbf14018c 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -327,28 +327,17 @@ protected: /** - @class wxDataViewIndexListModel + @class wxDataViewListModel - 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. + Base class with abstract API for wxDataViewIndexListModel and + wxDataViewVirtualListModel. @library{wxadv} @category{dvc} */ -class wxDataViewIndexListModel : public wxDataViewModel +class wxDataViewListModel : public wxDataViewModel { public: - /** - Constructor. - */ - wxDataViewIndexListModel(unsigned int initial_size = 0); /** Destructor. @@ -455,6 +444,34 @@ public: }; +/** + @class wxDataViewIndexListModel + + 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. + + @see wxDataViewListModel for the API. + + @library{wxadv} + @category{dvc} +*/ + +class wxDataViewIndexListModel : public wxDataViewListModel +{ +public: + /** + Constructor. + */ + wxDataViewIndexListModel(unsigned int initial_size = 0); + +}; /** @class wxDataViewVirtualListModel @@ -464,15 +481,15 @@ public: the exact same interface as wxDataViewIndexListModel. The important difference is that under platforms other than OS X, 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 the - Carbon API under OS X). + as the control doesn't store any item (a feature not supported by OS X). - @see wxDataViewIndexListModel for the API. + @see wxDataViewListModel for the API. @library{wxadv} @category{dvc} */ -class wxDataViewVirtualListModel : public wxDataViewModel + +class wxDataViewVirtualListModel : public wxDataViewListModel { public: /** @@ -480,10 +497,6 @@ public: */ wxDataViewVirtualListModel(unsigned int initial_size = 0); - /** - Returns the number of virtual items (i.e. rows) in the list. - */ - unsigned int GetCount() const; }; -- 2.45.2