X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a82e28dd0336e2829496fa1ea0f6a327cf0099c6..538f284a44001ff8285eaafebcc384bf638b5d66:/samples/dataview/mymodels.h?ds=sidebyside diff --git a/samples/dataview/mymodels.h b/samples/dataview/mymodels.h index ba4397c1f1..996bd3ec6e 100644 --- a/samples/dataview/mymodels.h +++ b/samples/dataview/mymodels.h @@ -6,7 +6,7 @@ // Created: 06/01/06 // RCS-ID: $Id$ // Copyright: (c) Robert Roebling -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -163,6 +163,9 @@ public: virtual bool SetValue( const wxVariant &variant, const wxDataViewItem &item, unsigned int col ); + virtual bool IsEnabled( const wxDataViewItem &item, + unsigned int col ) const; + virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const; virtual bool IsContainer( const wxDataViewItem &item ) const; virtual unsigned int GetChildren( const wxDataViewItem &parent, @@ -188,6 +191,15 @@ private: class MyListModel: public wxDataViewVirtualListModel { public: + enum + { + Col_EditableText, + Col_IconText, + Col_TextWithAttr, + Col_Custom, + Col_Max + }; + MyListModel(); // helper methods to change the model @@ -202,31 +214,36 @@ public: virtual unsigned int GetColumnCount() const { - return 3; + return Col_Max; } virtual wxString GetColumnType( unsigned int col ) const { - if (col == 1) + if (col == Col_IconText) return wxT("wxDataViewIconText"); return wxT("string"); } - virtual unsigned int GetRowCount() - { - return m_array.GetCount(); - } - virtual void GetValueByRow( wxVariant &variant, unsigned int row, unsigned int col ) const; - virtual bool GetAttrByRow( unsigned int row, unsigned int col, wxDataViewItemAttr &attr ); + virtual bool GetAttrByRow( unsigned int row, unsigned int col, + wxDataViewItemAttr &attr ) const; virtual bool SetValueByRow( const wxVariant &variant, unsigned int row, unsigned int col ); private: - wxArrayString m_array; + wxArrayString m_textColValues; + wxArrayString m_iconColValues; wxIcon m_icon[2]; - int m_virtualItems; }; +// ---------------------------------------------------------------------------- +// MyListStoreDerivedModel +// ---------------------------------------------------------------------------- + +class MyListStoreDerivedModel : public wxDataViewListStore +{ +public: + virtual bool IsEnabledByRow(unsigned int row, unsigned int col) const; +};