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
This commit is contained in:
Robert Roebling
2009-01-19 14:44:47 +00:00
parent 8653e1e780
commit 95b20f41b6
4 changed files with 104 additions and 33 deletions

View File

@@ -992,20 +992,25 @@ public:
const wxDataViewListStore *GetStore() const const wxDataViewListStore *GetStore() const
{ return (const wxDataViewListStore*) GetModel(); } { return (const wxDataViewListStore*) GetModel(); }
void AppendCol( wxDataViewColumn *column, const wxString &varianttype ); bool AppendColumn( wxDataViewColumn *column, const wxString &varianttype );
void PrependCol( wxDataViewColumn *column, const wxString &varianttype ); bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype );
void InsertCol( unsigned int pos, 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, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); 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, wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); 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, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); 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, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );

View File

@@ -1493,8 +1493,8 @@ public:
@code @code
wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, -1 ); wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, -1 );
listctrl->AppendToggleCol( "Toggle" ); listctrl->AppendToggleColumn( "Toggle" );
listctrl->AppendTextCol( "Text" ); listctrl->AppendTextColumn( "Text" );
wxVector<wxVariant> data; wxVector<wxVariant> data;
data.push_back( true ); data.push_back( true );
@@ -1552,45 +1552,69 @@ public:
Appends a column to the control and additonally appends a Appends a column to the control and additonally appends a
column to the store with the type @a varianttype. 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 Prepends a column to the control and additonally prepends a
column to the store with the type @a varianttype. 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 Inserts a column to the control and additonally inserts a
column to the store with the type @a varianttype. 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. 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, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
/** /**
Inserts a toggle column to the control and the store. 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, wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
/** /**
Inserts a progress column to the control and the store. 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, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
/** /**
Inserts a icon and text column to the control and the store. 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, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );

View File

@@ -926,8 +926,8 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( panel, -1, wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( panel, -1,
wxDefaultPosition, wxSize(100,200) ); wxDefaultPosition, wxSize(100,200) );
listctrl->AppendToggleCol( wxT("Toggle") ); listctrl->AppendToggleColumn( wxT("Toggle") );
listctrl->AppendTextCol( wxT("Text") ); listctrl->AppendTextColumn( wxT("Text") );
wxVector<wxVariant> data; wxVector<wxVariant> data;
data.push_back( true ); data.push_back( true );

View File

@@ -946,7 +946,6 @@ wxDataViewColumn *
wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column, wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags ) wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{ {
wxDataViewColumn *ret = new wxDataViewColumn( label, wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewToggleRenderer( wxT("bool"), mode ), new wxDataViewToggleRenderer( wxT("bool"), mode ),
model_column, width, align, flags ); 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 ); 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 ); 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 ); 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 ); GetStore()->InsertColumn( pos, varianttype );
InsertColumn( pos, column ); return wxDataViewCtrl::InsertColumn( pos, column );
} }
wxDataViewColumn *wxDataViewListCtrl::AppendTextCol( const wxString &label, 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::AppendTextColumn( const wxString &label,
wxDataViewCellMode mode, int width, wxAlignment align, int flags ) wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{ {
GetStore()->AppendColumn( wxT("string") ); 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 ) wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{ {
GetStore()->AppendColumn( wxT("bool") ); 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 ) wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{ {
GetStore()->AppendColumn( wxT("long") ); 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 ) wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{ {
GetStore()->AppendColumn( wxT("wxDataViewIconText") ); 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 ) void wxDataViewListCtrl::OnSize( wxSizeEvent &event )