729a8b9b44
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
332 lines
15 KiB
TeX
332 lines
15 KiB
TeX
|
|
\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\_SELECTION\_CHANGED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_SELECTION\_CHANGED event.}
|
|
\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_ACTIVATED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_ACTIVATED event.}
|
|
\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_EDITING\_STARTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_EDITING\_STARTED event.}
|
|
\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_EDITING\_DONE(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_EDITING\_DONE event.}
|
|
\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_COLLAPSING(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_COLLAPSING event.}
|
|
\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_COLLAPSED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_COLLAPSED event.}
|
|
\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_EXPANDING(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_EXPANDING event.}
|
|
\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_EXPANDED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_EXPANDED event.}
|
|
\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_VALUE\_CHANGED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_VALUE\_CHANGED 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}, \param{wxAlignment }{align = wxALIGN\_CENTER}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
\func{wxDataViewColumn*}{AppendBitmapColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}, \param{wxAlignment }{align = wxALIGN\_CENTER}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
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}, \param{wxAlignment }{align = wxALIGN\_CENTER}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
\func{wxDataViewColumn*}{AppendDateColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}, \param{wxAlignment }{align = wxALIGN\_CENTER}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
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}, \param{wxAlignment }{align = wxALIGN\_CENTER}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
\func{wxDataViewColumn*}{AppendProgressColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}, \param{wxAlignment }{align = wxALIGN\_CENTER}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
Appends a column for rendering a progress indicator. Returns the wxDataViewColumn
|
|
created in the function or NULL on failure.
|
|
|
|
\membersection{wxDataViewCtrl::AppendIconTextColumn}\label{wxdataviewctrlappendicontextcolumn}
|
|
|
|
\func{wxDataViewColumn*}{AppendIconTextColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}, \param{wxAlignment }{align = wxALIGN\_LEFT}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
\func{wxDataViewColumn*}{AppendIconTextColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}, \param{wxAlignment }{align = wxALIGN\_LEFT}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
Appends a column for rendering text with an icon. Returns the wxDataViewColumn
|
|
created in the function or NULL on failure. This uses the
|
|
\helpref{wxDataViewIconTextRenderer}{wxdataviewicontextrenderer}.
|
|
|
|
\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}, \param{wxAlignment }{align = wxALIGN\_LEFT}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
\func{wxDataViewColumn*}{AppendTextColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}, \param{wxAlignment }{align = wxALIGN\_LEFT}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
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}, \param{wxAlignment }{align = wxALIGN\_CENTER}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
\func{wxDataViewColumn*}{AppendToggleColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}, \param{wxAlignment }{align = wxALIGN\_CENTER}, \param{int }{flags = wxDATAVIEW\_COL\_RESIZABLE}}
|
|
|
|
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. This increases the reference count of the model by 1.
|
|
|
|
\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::Collapse}\label{wxdataviewctrlcollapse}
|
|
|
|
\func{void}{Collapse}{\param{const wxDataViewItem \& }{item}}
|
|
|
|
Collapses the item.
|
|
|
|
\membersection{wxDataViewCtrl::DeleteColumn}\label{wxdataviewctrldeletecolumn}
|
|
|
|
\func{virtual bool}{DeleteColumn}{\param{const wxDataViewColumn* }{column}}
|
|
|
|
Deletes given column.
|
|
|
|
\membersection{wxDataViewCtrl::Expand}\label{wxdataviewctrlexpand}
|
|
|
|
\func{void}{Expand}{\param{const wxDataViewItem \& }{item}}
|
|
|
|
Expands the item.
|
|
|
|
\membersection{wxDataViewCtrl::GetColumn}\label{wxdataviewctrlgetcolumn}
|
|
|
|
\constfunc{virtual wxDataViewColumn*}{GetColumn}{\param{unsigned int }{pos}}
|
|
|
|
Returns pointer to the column. {\it pos} refers to the
|
|
position in the control which may change after reordering
|
|
columns by the user.
|
|
|
|
\membersection{wxDataViewCtrl::GetColumnCount}\label{wxdataviewctrlgetcolumncount}
|
|
|
|
\constfunc{virtual unsigned int}{GetColumnCount}{\void}
|
|
|
|
Returns the number of columns.
|
|
|
|
\membersection{wxDataViewCtrl::GetColumnPosition}\label{wxdataviewctrlgetcolumnposition}
|
|
|
|
\constfunc{virtual int}{GetColumnPosition}{\param{const wxDataViewColumn* }{column}}
|
|
|
|
Returns the position of the column or -1 if not found in the control.
|
|
|
|
\membersection{wxDataViewCtrl::EnsureVisible}\label{wxdataviewctrlensurevisible}
|
|
|
|
\func{void}{EnsureVisible}{\param{const wxDataViewItem \& }{item}, \param{const wxDataViewColumn* }{column = NULL}}
|
|
|
|
Call this to ensure that the given item is visible.
|
|
|
|
\membersection{wxDataViewCtrl::GetExpanderColumn}\label{wxdataviewctrlgetexpandercolumn}
|
|
|
|
\constfunc{wxDataViewColumn *}{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{const wxDataViewColumn *}{col = NULL}}
|
|
|
|
Returns item rect.
|
|
|
|
\membersection{wxDataViewCtrl::GetModel}\label{wxdataviewctrlgetmodel}
|
|
|
|
\constfunc{virtual wxDataViewModel*}{GetModel}{\void}
|
|
|
|
Returns pointer to the data model associated with the
|
|
control (if any).
|
|
|
|
\membersection{wxDataViewCtrl::GetSelection}\label{wxdataviewctrlgetselection}
|
|
|
|
\constfunc{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::GetSortingColumn}\label{wxdataviewctrlgetsortingcolumn}
|
|
|
|
\constfunc{virtual wxDataViewColumn*}{GetSortingColumn}{\void}
|
|
|
|
Returns the wxDataViewColumn currently responsible for sorting
|
|
or NULL if none has been selected.
|
|
|
|
\membersection{wxDataViewCtrl::HitTest}\label{wxdataviewctrlhittest}
|
|
|
|
\constfunc{void}{HitTest}{\param{const wxPoint\& }{point}, \param{wxDataViewItem\& }{item}, \param{wxDataViewColumn *\&}{col}}
|
|
|
|
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{wxDataViewColumn *}{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.
|
|
|