From: Robert Roebling Date: Sat, 7 Oct 2006 14:15:53 +0000 (+0000) Subject: Not everything has to be virtual. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1286b7ba6c0e4d1513a0109cb6f57db622012881 Not everything has to be virtual. Made short cuts for adding columns more useful. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41670 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 2eb0882ae5..b321f98e01 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -131,11 +131,11 @@ public: virtual bool Cleared(); // Used internally - virtual void AddViewingColumn( wxDataViewColumn *view_column, unsigned int model_column ); - virtual void RemoveViewingColumn( wxDataViewColumn *column ); + void AddViewingColumn( wxDataViewColumn *view_column, unsigned int model_column ); + void RemoveViewingColumn( wxDataViewColumn *column ); - virtual void AddNotifier( wxDataViewListModelNotifier *notifier ); - virtual void RemoveNotifier( wxDataViewListModelNotifier *notifier ); + void AddNotifier( wxDataViewListModelNotifier *notifier ); + void RemoveNotifier( wxDataViewListModelNotifier *notifier ); wxList m_notifiers; wxList m_viewingColumns; @@ -320,16 +320,26 @@ public: wxDataViewListModel* GetModel(); // short cuts - virtual bool AppendTextColumn( const wxString &label, unsigned int model_column ); - virtual bool AppendToggleColumn( const wxString &label, unsigned int model_column ); - virtual bool AppendProgressColumn( const wxString &label, unsigned int model_column ); - virtual bool AppendDateColumn( const wxString &label, unsigned int model_column ); - virtual bool AppendBitmapColumn( const wxString &label, unsigned int model_column ); - virtual bool AppendTextColumn( const wxBitmap &label, unsigned int model_column ); - virtual bool AppendToggleColumn( const wxBitmap &label, unsigned int model_column ); - virtual bool AppendProgressColumn( const wxBitmap &label, unsigned int model_column ); - virtual bool AppendDateColumn( const wxBitmap &label, unsigned int model_column ); - virtual bool AppendBitmapColumn( const wxBitmap &label, unsigned int model_column ); + bool AppendTextColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); + bool AppendToggleColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 30 ); + bool AppendProgressColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 80 ); + bool AppendDateColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1 ); + bool AppendBitmapColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); + bool AppendTextColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); + bool AppendToggleColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 30 ); + bool AppendProgressColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = 80 ); + bool AppendDateColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1 ); + bool AppendBitmapColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1 ); virtual bool AppendColumn( wxDataViewColumn *col ); virtual unsigned int GetNumberOfColumns(); diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index 26d78c6b4d..1094b1ebca 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -798,54 +798,74 @@ wxDataViewListModel* wxDataViewCtrlBase::GetModel() return m_model; } -bool wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewTextRenderer(), model_column ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewTextRenderer( wxT("string"), mode ), model_column, width ) ); } -bool wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewToggleRenderer(), model_column, 30 ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewToggleRenderer( wxT("bool"), mode ), model_column, width ) ); } -bool wxDataViewCtrlBase::AppendProgressColumn( const wxString &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendProgressColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewProgressRenderer(), model_column, 70 ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), model_column, width ) ); } -bool wxDataViewCtrlBase::AppendDateColumn( const wxString &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendDateColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewDateRenderer(), model_column ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewDateRenderer( wxT("datetime"), mode), model_column, width ) ); } -bool wxDataViewCtrlBase::AppendBitmapColumn( const wxString &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendBitmapColumn( const wxString &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewBitmapRenderer(), model_column ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode ), model_column, width ) ); } -bool wxDataViewCtrlBase::AppendTextColumn( const wxBitmap &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendTextColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewTextRenderer(), model_column ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewTextRenderer( wxT("string"), mode ), model_column, width ) ); } -bool wxDataViewCtrlBase::AppendToggleColumn( const wxBitmap &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendToggleColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewToggleRenderer(), model_column, 30 ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewToggleRenderer( wxT("bool"), mode ), model_column, width ) ); } -bool wxDataViewCtrlBase::AppendProgressColumn( const wxBitmap &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendProgressColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewProgressRenderer(), model_column, 70 ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), model_column, width ) ); } -bool wxDataViewCtrlBase::AppendDateColumn( const wxBitmap &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendDateColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewDateRenderer(), model_column ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewDateRenderer( wxT("datetime"), mode ), model_column, width ) ); } -bool wxDataViewCtrlBase::AppendBitmapColumn( const wxBitmap &label, unsigned int model_column ) +bool wxDataViewCtrlBase::AppendBitmapColumn( const wxBitmap &label, unsigned int model_column, + wxDataViewCellMode mode, int width ) { - return AppendColumn( new wxDataViewColumn( label, new wxDataViewBitmapRenderer(), model_column ) ); + return AppendColumn( new wxDataViewColumn( label, + new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode ), model_column, width ) ); } bool wxDataViewCtrlBase::AppendColumn( wxDataViewColumn *col )