From 95b20f41b6d66d00173633c48bee80d6aee64625 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 19 Jan 2009 14:44:47 +0000 Subject: [PATCH] Rename XxxxCol() -> XxxxColumn() and resolve inheritance problems from it git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dataview.h | 19 +++++---- interface/wx/dataview.h | 42 +++++++++++++++----- samples/dataview/dataview.cpp | 4 +- src/common/datavcmn.cpp | 72 +++++++++++++++++++++++++++-------- 4 files changed, 104 insertions(+), 33 deletions(-) diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 81e5c31236..547ffce878 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -992,20 +992,25 @@ public: const wxDataViewListStore *GetStore() const { return (const wxDataViewListStore*) GetModel(); } - void AppendCol( wxDataViewColumn *column, const wxString &varianttype ); - void PrependCol( wxDataViewColumn *column, const wxString &varianttype ); - void InsertCol( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); + bool AppendColumn( wxDataViewColumn *column, const wxString &varianttype ); + bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); + bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); - wxDataViewColumn *AppendTextCol( const wxString &label, + // overridden from base class + virtual bool PrependColumn( wxDataViewColumn *col ); + virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ); + virtual bool AppendColumn( wxDataViewColumn *col ); + + wxDataViewColumn *AppendTextColumn( const wxString &label, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); - wxDataViewColumn *AppendToggleCol( const wxString &label, + wxDataViewColumn *AppendToggleColumn( const wxString &label, wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); - wxDataViewColumn *AppendProgressCol( const wxString &label, + wxDataViewColumn *AppendProgressColumn( const wxString &label, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); - wxDataViewColumn *AppendIconTextCol( const wxString &label, + wxDataViewColumn *AppendIconTextColumn( const wxString &label, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index 01711dad71..6e8576c961 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -1493,8 +1493,8 @@ public: @code wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, -1 ); - listctrl->AppendToggleCol( "Toggle" ); - listctrl->AppendTextCol( "Text" ); + listctrl->AppendToggleColumn( "Toggle" ); + listctrl->AppendTextColumn( "Text" ); wxVector data; data.push_back( true ); @@ -1552,45 +1552,69 @@ public: Appends a column to the control and additonally appends a column to the store with the type @a varianttype. */ - void AppendCol( wxDataViewColumn *column, const wxString &varianttype ); + void AppendColumn( wxDataViewColumn *column, const wxString &varianttype ); /** Prepends a column to the control and additonally prepends a column to the store with the type @a varianttype. */ - void PrependCol( wxDataViewColumn *column, const wxString &varianttype ); + void PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); /** Inserts a column to the control and additonally inserts a column to the store with the type @a varianttype. */ - void InsertCol( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); + void InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); + + /** + Overridden from wxDataViewCtrl + + Appends a column to the control and additonally appends a + column to the store with the type string. + */ + virtual void AppendColumn( wxDataViewColumn *column ); + + /** + Overridden from wxDataViewCtrl + + Prepends a column to the control and additonally prepends a + column to the store with the type string. + */ + virtual void PrependColumn( wxDataViewColumn *column ); + + /** + Overridden from wxDataViewCtrl + + Inserts a column to the control and additonally inserts a + column to the store with the type string. + */ + virtual void InsertColumn( unsigned int pos, wxDataViewColumn *column ); /** Inserts a text column to the control and the store. */ - wxDataViewColumn *AppendTextCol( const wxString &label, + wxDataViewColumn *AppendTextColumn( const wxString &label, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); /** Inserts a toggle column to the control and the store. */ - wxDataViewColumn *AppendToggleCol( const wxString &label, + wxDataViewColumn *AppendToggleColumn( const wxString &label, wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); /** Inserts a progress column to the control and the store. */ - wxDataViewColumn *AppendProgressCol( const wxString &label, + wxDataViewColumn *AppendProgressColumn( const wxString &label, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); /** Inserts a icon and text column to the control and the store. */ - wxDataViewColumn *AppendIconTextCol( const wxString &label, + wxDataViewColumn *AppendIconTextColumn( const wxString &label, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp index dc7fbb846d..0a3647ba0d 100644 --- a/samples/dataview/dataview.cpp +++ b/samples/dataview/dataview.cpp @@ -926,8 +926,8 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( panel, -1, wxDefaultPosition, wxSize(100,200) ); - listctrl->AppendToggleCol( wxT("Toggle") ); - listctrl->AppendTextCol( wxT("Text") ); + listctrl->AppendToggleColumn( wxT("Toggle") ); + listctrl->AppendTextColumn( wxT("Text") ); wxVector data; data.push_back( true ); diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index a850b9397f..79ed168564 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -946,7 +946,6 @@ wxDataViewColumn * wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, new wxDataViewToggleRenderer( wxT("bool"), mode ), model_column, width, align, flags ); @@ -1495,50 +1494,93 @@ bool wxDataViewListCtrl::Create( wxWindow *parent, wxWindowID id, return wxDataViewCtrl::Create( parent, id, pos, size, style, validator ); } -void wxDataViewListCtrl::AppendCol( wxDataViewColumn *column, const wxString &varianttype ) +bool wxDataViewListCtrl::AppendColumn( wxDataViewColumn *column, const wxString &varianttype ) { GetStore()->AppendColumn( varianttype ); - AppendColumn( column ); + return wxDataViewCtrl::AppendColumn( column ); } -void wxDataViewListCtrl::PrependCol( wxDataViewColumn *column, const wxString &varianttype ) +bool wxDataViewListCtrl::PrependColumn( wxDataViewColumn *column, const wxString &varianttype ) { GetStore()->PrependColumn( varianttype ); - PrependColumn( column ); + return wxDataViewCtrl::PrependColumn( column ); } -void wxDataViewListCtrl::InsertCol( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ) +bool wxDataViewListCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ) { GetStore()->InsertColumn( pos, varianttype ); - InsertColumn( pos, column ); + return wxDataViewCtrl::InsertColumn( pos, column ); +} + +bool wxDataViewListCtrl::PrependColumn( wxDataViewColumn *col ) +{ + return PrependColumn( col, "string" ); +} + +bool wxDataViewListCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *col ) +{ + return InsertColumn( pos, col, "string" ); +} + +bool wxDataViewListCtrl::AppendColumn( wxDataViewColumn *col ) +{ + return AppendColumn( col, "string" ); } -wxDataViewColumn *wxDataViewListCtrl::AppendTextCol( const wxString &label, +wxDataViewColumn *wxDataViewListCtrl::AppendTextColumn( const wxString &label, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { GetStore()->AppendColumn( wxT("string") ); - return AppendTextColumn( label, GetStore()->GetColumnCount()-1, mode, width, align, flags ); + + wxDataViewColumn *ret = new wxDataViewColumn( label, + new wxDataViewTextRenderer( wxT("string"), mode ), + GetStore()->GetColumnCount()-1, width, align, flags ); + + wxDataViewCtrl::AppendColumn( ret ); + + return ret; } -wxDataViewColumn *wxDataViewListCtrl::AppendToggleCol( const wxString &label, +wxDataViewColumn *wxDataViewListCtrl::AppendToggleColumn( const wxString &label, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { GetStore()->AppendColumn( wxT("bool") ); - return AppendToggleColumn( label, GetStore()->GetColumnCount()-1, mode, width, align, flags ); + + wxDataViewColumn *ret = new wxDataViewColumn( label, + new wxDataViewToggleRenderer( wxT("bool"), mode ), + GetStore()->GetColumnCount()-1, width, align, flags ); + + wxDataViewCtrl::AppendColumn( ret ); + + return ret; } -wxDataViewColumn *wxDataViewListCtrl::AppendProgressCol( const wxString &label, +wxDataViewColumn *wxDataViewListCtrl::AppendProgressColumn( const wxString &label, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { GetStore()->AppendColumn( wxT("long") ); - return AppendProgressColumn( label, GetStore()->GetColumnCount()-1, mode, width, align, flags ); + + wxDataViewColumn *ret = new wxDataViewColumn( label, + new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), + GetStore()->GetColumnCount()-1, width, align, flags ); + + wxDataViewCtrl::AppendColumn( ret ); + + return ret; } -wxDataViewColumn *wxDataViewListCtrl::AppendIconTextCol( const wxString &label, +wxDataViewColumn *wxDataViewListCtrl::AppendIconTextColumn( const wxString &label, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { GetStore()->AppendColumn( wxT("wxDataViewIconText") ); - return AppendIconTextColumn( label, GetStore()->GetColumnCount()-1, mode, width, align, flags ); + + wxDataViewColumn *ret = new wxDataViewColumn( label, + new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode ), + GetStore()->GetColumnCount()-1, width, align, flags ); + + wxDataViewCtrl::AppendColumn( ret ); + + return ret; } void wxDataViewListCtrl::OnSize( wxSizeEvent &event )