Let various AppendXXXColumn helplers return the column created within

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48330 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2007-08-22 13:39:32 +00:00
parent cd722937d8
commit c7074d4419
4 changed files with 101 additions and 66 deletions

View File

@ -11,7 +11,7 @@ this class to render its data.
\wxheading{Constants}
These flags define behavi
These flags define behaviour of the column:
{\small
\begin{verbatim}
@ -122,9 +122,7 @@ Set the bitmap of the column header.
Indicate the sort order if the implementation of the
wxDataViewCtrl supports it, most commonly by showing
a little arrow. Use this in conjunction with
\helpref{wxDataViewSortedListModel::SetAscending}{wxdataviewsortedlistmodelsetascending}
to sort the actual data.
a little arrow.
\membersection{wxDataViewColumn::SetSortable}\label{wxdataviewcolumnsetsortable}
@ -132,9 +130,7 @@ to sort the actual data.
Indicate that the column is sortable. This is only to provide a
visual hint in the column (such as a sort order indicator). It
will not actually sort the data. Use a
\helpref{wxDataViewSortedListModel}{wxdataviewsortedlistmodel}
to so the sorting.
will not actually sort the data.
\membersection{wxDataViewColumn::SetTitle}\label{wxdataviewcolumnsettitle}

View File

@ -88,51 +88,57 @@ Destructor.
\func{virtual bool}{AppendColumn}{\param{wxDataViewColumn* }{col}}
Add a \helpref{wxDataViewColumn}{wxdataviewcolumn} to the control. Note
that there is a number of short cut methods which implicitly create
Add a \helpref{wxDataViewColumn}{wxdataviewcolumn} to the control. Returns
{\it true} on success.
Note that there is a number of short cut methods which implicitly create
a \helpref{wxDataViewColumn}{wxdataviewcolumn} and a
\helpref{wxDataViewRenderer}{wxdataviewrenderer} for it (see below).
\membersection{wxDataViewCtrl::AppendBitmapColumn}\label{wxdataviewctrlappendbitmapcolumn}
\func{bool}{AppendBitmapColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
\func{wxDataViewColumn*}{AppendBitmapColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
\func{bool}{AppendBitmapColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
\func{wxDataViewColumn*}{AppendBitmapColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
Appends a column for rendering a bitmap.
Appends a column for rendering a bitmap. Returns the wxDataViewColumn
created in the function or NULL on failure.
\membersection{wxDataViewCtrl::AppendDateColumn}\label{wxdataviewctrlappenddatecolumn}
\func{bool}{AppendDateColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
\func{wxDataViewColumn*}{AppendDateColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
\func{bool}{AppendDateColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
\func{wxDataViewColumn*}{AppendDateColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
Appends a column for rendering a date.
Appends a column for rendering a date. Returns the wxDataViewColumn
created in the function or NULL on failure.
\membersection{wxDataViewCtrl::AppendProgressColumn}\label{wxdataviewctrlappendprogresscolumn}
\func{bool}{AppendProgressColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
\func{wxDataViewColumn*}{AppendProgressColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
\func{bool}{AppendProgressColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
\func{wxDataViewColumn*}{AppendProgressColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
Appends a column for rendering a progress indicator.
Appends a column for rendering a progress indicator. Returns the wxDataViewColumn
created in the function or NULL on failure.
\membersection{wxDataViewCtrl::AppendTextColumn}\label{wxdataviewctrlappendtextcolumn}
\func{bool}{AppendTextColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
\func{wxDataViewColumn*}{AppendTextColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
\func{bool}{AppendTextColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
\func{wxDataViewColumn*}{AppendTextColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
Appends a column for rendering text.
Appends a column for rendering text. Returns the wxDataViewColumn
created in the function or NULL on failure.
\membersection{wxDataViewCtrl::AppendToggleColumn}\label{wxdataviewctrlappendtogglecolumn}
\func{bool}{AppendToggleColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
\func{wxDataViewColumn*}{AppendToggleColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
\func{bool}{AppendToggleColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
\func{wxDataViewColumn*}{AppendToggleColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
Appends a column for rendering a toggle.
Appends a column for rendering a toggle. Returns the wxDataViewColumn
created in the function or NULL on failure.
\membersection{wxDataViewCtrl::AssociateModel}\label{wxdataviewctrlassociatemodel}

View File

@ -413,43 +413,44 @@ public:
wxDataViewModel* GetModel();
// short cuts
bool AppendTextColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *AppendTextColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
bool AppendToggleColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *AppendToggleColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
bool AppendProgressColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *AppendProgressColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
bool AppendDateColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *AppendDateColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
bool AppendBitmapColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *AppendBitmapColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
bool AppendTextColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *AppendTextColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
bool AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
bool AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
bool AppendDateColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *AppendDateColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
bool AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );

View File

@ -579,87 +579,119 @@ wxDataViewModel* wxDataViewCtrlBase::GetModel()
return m_model;
}
bool wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewTextRenderer( wxT("string"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewToggleRenderer( wxT("bool"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendProgressColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendProgressColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendDateColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendDateColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewDateRenderer( wxT("datetime"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendBitmapColumn( const wxString &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendBitmapColumn( const wxString &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendTextColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendTextColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewTextRenderer( wxT("string"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewToggleRenderer( wxT("bool"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendDateColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendDateColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewDateRenderer( wxT("datetime"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewColumn *
wxDataViewCtrlBase::AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
return AppendColumn( new wxDataViewColumn( label,
wxDataViewColumn *ret = new wxDataViewColumn( label,
new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode, (int)align ),
model_column, width, align, flags ) );
model_column, width, align, flags );
AppendColumn( ret );
return ret;
}
bool wxDataViewCtrlBase::AppendColumn( wxDataViewColumn *col )
bool
wxDataViewCtrlBase::AppendColumn( wxDataViewColumn *col )
{
m_cols.Append( (wxObject*) col );
col->SetOwner( (wxDataViewCtrl*) this );