From bda698ed193ccc86f3077f92c0ccaad1b4f33267 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 16 Jan 2009 15:20:42 +0000 Subject: [PATCH] Document wxDataViewListStore git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dataview.h | 7 --- interface/wx/dataview.h | 129 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 125 insertions(+), 11 deletions(-) diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 37013791d1..5437a4dc0c 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -946,13 +946,6 @@ public: void InsertColumn( unsigned int pos, const wxString &varianttype ); void AppendColumn( const wxString &varianttype ); - void PrependStringColumn() - { PrependColumn( wxT("string") ); } - void InsertStringColumn( unsigned int pos ) - { InsertColumn( pos, wxT("string") ); } - void AppendStringColumn() - { AppendColumn( wxT("string") ); } - void AppendItem( const wxVector &values, wxClientData *data = NULL ); void PrependItem( const wxVector &values, wxClientData *data = NULL ); void InsertItem( unsigned int row, const wxVector &values, wxClientData *data = NULL ); diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index 91af033806..9fd9063146 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -58,7 +58,8 @@ to the data in the list model. Currently wxWidgets provides the following models apart from the base model: - wxDataViewIndexListModel, wxDataViewVirtualListModel, wxDataViewTreeStore. + wxDataViewIndexListModel, wxDataViewVirtualListModel, wxDataViewTreeStore, + wxDataViewListStore. Note that wxDataViewModel is reference counted, derives from wxObjectRefData and cannot be deleted directly as it can be shared by several wxDataViewCtrls. @@ -1666,17 +1667,137 @@ public: }; +/** + @class wxDataViewListStore + + wxDataViewListStore is a specialised wxDataViewModel for storing + a simple table of data. Since it derives from wxDataViewIndexListModel + its data is be accessed by row (i.e. by index) instead of only + by wxDataViewItem. + + This class actually stores the values (therefore its name) + and implements all virtual methods from the base classes so it can be + used directly without having to derive any class from it, but it is + mostly used from within wxDataViewListCtrl. + + @library{wxadv} + @category{dvc} +*/ + +class wxDataViewListStore: public wxDataViewIndexListModel +{ +public: + /** + Constructor + */ + wxDataViewListStore(); + + /** + Destructor + */ + ~wxDataViewListStore(); + + /** + Prepends a data column. + + @a variantype indicates the type of values store in the column. + + This does not automatically fill in any (default) values in + rows which exist in the store already. + */ + void PrependColumn( const wxString &varianttype ); + + /** + Inserts a data column before @a pos. + + @a variantype indicates the type of values store in the column. + + This does not automatically fill in any (default) values in + rows which exist in the store already. + */ + void InsertColumn( unsigned int pos, const wxString &varianttype ); + + /** + Apppends a data column. + + @a variantype indicates the type of values store in the column. + + This does not automatically fill in any (default) values in + rows which exist in the store already. + */ + void AppendColumn( const wxString &varianttype ); + + /** + Appends an item (=row) and fills it with @a values. + + The values must match the values specifies in the column + in number and type. No (default) values are filled in + automatically. + */ + void AppendItem( const wxVector &values, wxClientData *data = NULL ); + + /** + Prepends an item (=row) and fills it with @a values. + + The values must match the values specifies in the column + in number and type. No (default) values are filled in + automatically. + */ + void PrependItem( const wxVector &values, wxClientData *data = NULL ); + + /** + Inserts an item (=row) and fills it with @a values. + + The values must match the values specifies in the column + in number and type. No (default) values are filled in + automatically. + */ + void InsertItem( unsigned int row, const wxVector &values, wxClientData *data = NULL ); + + /** + Delete the item (=row) at position @a pos. + */ + void DeleteItem( unsigned pos ); + + /** + Delete all item (=all rows) in the store. + */ + void DeleteAllItems(); + + /** + Overriden from wxDataViewModel + */ + virtual unsigned int GetColumnCount() const; + + /** + Overriden from wxDataViewModel + */ + virtual wxString GetColumnType( unsigned int col ) const; + + /** + Overriden from wxDataViewIndexListModel + */ + virtual void GetValueByRow( wxVariant &value, + unsigned int row, unsigned int col ) const; + + /** + Overriden from wxDataViewIndexListModel + */ + virtual bool SetValueByRow( const wxVariant &value, + unsigned int row, unsigned int col ); +}; + /** @class wxDataViewTreeStore - wxDataViewTreeStore is a specialised wxDataViewModel for displaying simple + wxDataViewTreeStore is a specialised wxDataViewModel for stroing simple trees very much like wxTreeCtrl does and it offers a similar API. This class actually stores the entire tree and the values (therefore its name) and implements all virtual methods from the base class so it can be used directly - without having to derive any class from it. - This comes at the price of much reduced flexibility. + without having to derive any class from it, but it is mostly used from within + wxDataViewTreeCtrl. @library{wxadv} @category{dvc} -- 2.45.2