
\section{\class{wxDataViewCtrl}}\label{wxdataviewctrl}

wxDataViewCtrl is a control to display data either
in a tree like fashion or in a tabular form or both. 

A \helpref{wxDataViewItem}{wxdataviewitem} is used
to represent a (visible) item in the control.

Unlike \helpref{wxListCtrl}{wxlistctrl} wxDataViewCtrl doesn't 
get its data from the user through virtual functions or by
setting it directly. Instead you need to write your own 
\helpref{wxDataViewModel}{wxdataviewmodel} and associate
it with this control. Then you need to add a number of
\helpref{wxDataViewColumn}{wxdataviewcolumn} to this control to
define what each column shall display. Each wxDataViewColumn
in turn owns 1 instance of a 
\helpref{wxDataViewRenderer}{wxdataviewrenderer} to render its
cells. A number of standard renderers for rendering text, dates,
images, toggle, a progress bar etc. are provided. Additionally,
the user can write custom renderes deriving from 
\helpref{wxDataViewCustomRenderer}{wxdataviewcustomrenderer}
for displaying anything.

All data transfer from the control to the model and the user
code is done through \helpref{wxVariant}{wxvariant} which can
be extended to support more data formats as necessary. 
Accordingly, all type information uses the strings returned
from \helpref{wxVariant::GetType}{wxvariantgettype}.

\wxheading{Window styles}

\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxDV\_SINGLE}}{Single selection mode. This is the default.}
\twocolitem{\windowstyle{wxDV\_MULTIPLE}}{Multiple selection mode.}
\end{twocollist}


\wxheading{Event handling}

To process input from a dataview control, use the following event handler
macros to direct input to member functions that take a 
\helpref{wxDataViewEvent}{wxdataviewevent} argument.

\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt

\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_SELECTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_SELECTED event.}
\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_ACTIVATED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_ACTIVATED event.}
\twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_CLICKED event.}
\twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICKED event.}
\twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_SORTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_SORTED event.}

\end{twocollist}


\wxheading{Derived from}

\helpref{wxControl}{wxcontrol}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/dataview.h>

\wxheading{Library}

\helpref{wxAdv}{librarieslist}


\latexignore{\rtfignore{\wxheading{Members}}}

\membersection{wxDataViewCtrl::wxDataViewCtrl}\label{wxdataviewctrlwxdataviewctrl}

\func{}{wxDataViewCtrl}{\void}

\func{}{wxDataViewCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}}

Constructor. Calls \helpref{Create}{wxdataviewctrlcreate}.

\membersection{wxDataViewCtrl::\destruct{wxDataViewCtrl}}\label{wxdataviewctrldtor}

\func{}{\destruct{wxDataViewCtrl}}{\void}

Destructor.

\membersection{wxDataViewCtrl::AppendColumn}\label{wxdataviewctrlappendcolumn}

\func{virtual bool}{AppendColumn}{\param{wxDataViewColumn* }{col}}

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{wxDataViewColumn*}{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 wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}

Appends a column for rendering a bitmap. Returns the wxDataViewColumn
created in the function or NULL on failure.

\membersection{wxDataViewCtrl::AppendDateColumn}\label{wxdataviewctrlappenddatecolumn}

\func{wxDataViewColumn*}{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 wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}

Appends a column for rendering a date. Returns the wxDataViewColumn
created in the function or NULL on failure.

\membersection{wxDataViewCtrl::AppendProgressColumn}\label{wxdataviewctrlappendprogresscolumn}

\func{wxDataViewColumn*}{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 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. Returns the wxDataViewColumn
created in the function or NULL on failure.

\membersection{wxDataViewCtrl::AppendTextColumn}\label{wxdataviewctrlappendtextcolumn}

\func{wxDataViewColumn*}{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 wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}

Appends a column for rendering text. Returns the wxDataViewColumn
created in the function or NULL on failure.

\membersection{wxDataViewCtrl::AppendToggleColumn}\label{wxdataviewctrlappendtogglecolumn}

\func{wxDataViewColumn*}{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 wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}

Appends a column for rendering a toggle. Returns the wxDataViewColumn
created in the function or NULL on failure.

\membersection{wxDataViewCtrl::AssociateModel}\label{wxdataviewctrlassociatemodel}

\func{virtual bool}{AssociateModel}{\param{wxDataViewModel* }{model}}

Associates a \helpref{wxDataViewModel}{wxdataviewmodel} with the
control. 

\membersection{wxDataViewCtrl::Create}\label{wxdataviewctrlcreate}

\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}}

Create the control. Useful for two step creation.

\membersection{wxDataViewCtrl::ClearColumns}\label{wxdataviewctrlclearcolumns}

\func{virtual bool}{ClearColumns}{\void}

Removes all columns.

\membersection{wxDataViewCtrl::ClearSelection}\label{wxdataviewctrlclearselection}

\func{void}{ClearSelection}{\void}

Unselects all rows.

\membersection{wxDataViewCtrl::DeleteColumn}\label{wxdataviewctrldeletecolumn}

\func{virtual bool}{DeleteColumn}{\param{unsigned int }{pos}}

Deletes given column.

\membersection{wxDataViewCtrl::GetColumn}\label{wxdataviewctrlgetcolumn}

\func{virtual wxDataViewColumn*}{GetColumn}{\param{unsigned int }{pos}}

Returns pointer to the column.

\membersection{wxDataViewCtrl::GetModel}\label{wxdataviewctrlgetmodel}

\func{virtual wxDataViewModel*}{GetModel}{\void}

Returns pointer to the data model associated with the
control (if any).

\membersection{wxDataViewCtrl::GetColumnCount}\label{wxdataviewctrlgetcolumncount}

\func{virtual unsigned int}{GetColumnCount}{\void}

Returns the number of columns.

\membersection{wxDataViewCtrl::EnsureVisible}\label{wxdataviewctrlensurevisible}

\func{void}{EnsureVisible}{\param{const wxDataViewItem \& }{item}, \param{wxDataViewColumn* }{column = NULL}}

Call this to ensure that the given item is visible.

\membersection{wxDataViewCtrl::GetExpanderColumn}\label{wxdataviewctrlgetexpandercolumn}

\constfunc{unsigned int}{GetExpanderColumn}{\void}

Returns column containing the expanders.

\membersection{wxDataViewCtrl::GetIndent}\label{wxdataviewctrlgetindent}

\constfunc{int}{GetIndent}{\void}

Returns indentation.

\membersection{wxDataViewCtrl::GetItemRect}\label{wxdataviewctrlgetitemrect}

\constfunc{wxRect}{GetItemRect}{\param{const wxDataViewItem\& }{item}, \param{unsigned int }{column}}

Returns item rect.

\membersection{wxDataViewCtrl::GetSelection}\label{wxdataviewctrlgetselection}

\func{wxDataViewItem}{GetSelection}{\void}

Returns first selected item or an invalid item if none is selected.

\membersection{wxDataViewCtrl::GetSelections}\label{wxdataviewctrlgetselections}

\constfunc{int}{GetSelections}{\param{wxDataViewItemArray \& }{sel}}

Fills {\it sel} with currently selected items and returns
their number.

\membersection{wxDataViewCtrl::HitTest}\label{wxdataviewctrlhittest}

\constfunc{void}{HitTest}{\param{const wxPoint\& }{point}, \param{wxDataViewItem\& }{item}, \param{unsigned int\& }{column}}

Hittest.

\membersection{wxDataViewCtrl::IsSelected}\label{wxdataviewctrlisselected}

\constfunc{bool}{IsSelected}{\param{const wxDataViewItem \& }{item}}

Return true if the item is selected.

\membersection{wxDataViewCtrl::Select}\label{wxdataviewctrlselect}

\func{void}{Select}{\param{const wxDataViewItem \& }{item}}

Select the given item.

\membersection{wxDataViewCtrl::SelectAll}\label{wxdataviewctrlselectall}

\func{void}{SelectAll}{\void}

Select all items.

\membersection{wxDataViewCtrl::SetExpanderColumn}\label{wxdataviewctrlsetexpandercolumn}

\func{void}{SetExpanderColumn}{\param{unsigned int }{col}}

Set which column shall contain the tree-like expanders.

\membersection{wxDataViewCtrl::SetIndent}\label{wxdataviewctrlsetindent}

\func{void}{SetIndent}{\param{int }{indent}}

Sets the indendation.

\membersection{wxDataViewCtrl::SetSelections}\label{wxdataviewctrlsetselections}

\func{void}{SetSelections}{\param{const wxDataViewItemArray \& }{sel}}

Sets the selection to the array of wxDataViewItems.

\membersection{wxDataViewCtrl::Unselect}\label{wxdataviewctrlunselect}

\func{void}{Unselect}{\param{const wxDataViewItem \& }{item}}

Unselect the given item.

\membersection{wxDataViewCtrl::UnselectAll}\label{wxdataviewctrlunselectall}

\func{void}{UnselectAll}{\void}

Unselect all item. This method only has effect if multiple
selections are allowed.

