2 \section{\class{wxDataViewCtrl
}}\label{wxdataviewctrl
}
4 wxDataViewCtrl is a control to display data either
5 in a tree like fashion or in a tabular form or both.
7 A
\helpref{wxDataViewItem
}{wxdataviewitem
} is used
8 to represent a (visible) item in the control.
10 Unlike
\helpref{wxListCtrl
}{wxlistctrl
} wxDataViewCtrl doesn't
11 get its data from the user through virtual functions or by
12 setting it directly. Instead you need to write your own
13 \helpref{wxDataViewModel
}{wxdataviewmodel
} and associate
14 it with this control. Then you need to add a number of
15 \helpref{wxDataViewColumn
}{wxdataviewcolumn
} to this control to
16 define what each column shall display. Each wxDataViewColumn
17 in turn owns
1 instance of a
18 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
} to render its
19 cells. A number of standard renderers for rendering text, dates,
20 images, toggle, a progress bar etc. are provided. Additionally,
21 the user can write custom renderes deriving from
22 \helpref{wxDataViewCustomRenderer
}{wxdataviewcustomrenderer
}
23 for displaying anything.
25 All data transfer from the control to the model and the user
26 code is done through
\helpref{wxVariant
}{wxvariant
} which can
27 be extended to support more data formats as necessary.
28 Accordingly, all type information uses the strings returned
29 from
\helpref{wxVariant::GetType
}{wxvariantgettype
}.
31 \wxheading{Window styles
}
34 \begin{twocollist
}\itemsep=
0pt
35 \twocolitem{\windowstyle{wxDV
\_SINGLE}}{Single selection mode. This is the default.
}
36 \twocolitem{\windowstyle{wxDV
\_MULTIPLE}}{Multiple selection mode.
}
40 \wxheading{Event handling
}
42 To process input from a dataview control, use the following event handler
43 macros to direct input to member functions that take a
44 \helpref{wxDataViewEvent
}{wxdataviewevent
} argument.
47 \begin{twocollist
}\itemsep=
0pt
49 \twocolitem{{\bf EVT
\_DATAVIEW\_SELECTION\_CHANGED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_SELECTION\_CHANGED event.
}
50 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_ACTIVATED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_ACTIVATED event.
}
51 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_EDITING\_STARTED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_EDITING\_STARTED event.
}
52 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_EDITING\_DONE(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_EDITING\_DONE event.
}
53 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_COLLAPSING(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_COLLAPSING event.
}
54 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_COLLAPSED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_COLLAPSED event.
}
55 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_EXPANDING(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_EXPANDING event.
}
56 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_EXPANDED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_EXPANDED event.
}
57 \twocolitem{{\bf EVT
\_DATAVIEW\_ITEM\_VALUE\_CHANGED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_ITEM\_VALUE\_CHANGED event.
}
58 \twocolitem{{\bf EVT
\_DATAVIEW\_COLUMN\_HEADER\_CLICK(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_CLICKED event.
}
59 \twocolitem{{\bf EVT
\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICK(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICKED event.
}
60 \twocolitem{{\bf EVT
\_DATAVIEW\_COLUMN\_HEADER\_SORTED(id, func)
}}{Processes a wxEVT
\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_SORTED event.
}
65 \wxheading{Derived from
}
67 \helpref{wxControl
}{wxcontrol
}\\
68 \helpref{wxWindow
}{wxwindow
}\\
69 \helpref{wxEvtHandler
}{wxevthandler
}\\
70 \helpref{wxObject
}{wxobject
}
72 \wxheading{Include files
}
78 \helpref{wxAdv
}{librarieslist
}
81 \latexignore{\rtfignore{\wxheading{Members
}}}
83 \membersection{wxDataViewCtrl::wxDataViewCtrl
}\label{wxdataviewctrlwxdataviewctrl
}
85 \func{}{wxDataViewCtrl
}{\void}
87 \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
}}
89 Constructor. Calls
\helpref{Create
}{wxdataviewctrlcreate
}.
91 \membersection{wxDataViewCtrl::
\destruct{wxDataViewCtrl
}}\label{wxdataviewctrldtor
}
93 \func{}{\destruct{wxDataViewCtrl
}}{\void}
97 \membersection{wxDataViewCtrl::AppendColumn
}\label{wxdataviewctrlappendcolumn
}
99 \func{virtual bool
}{AppendColumn
}{\param{wxDataViewColumn*
}{col
}}
101 Add a
\helpref{wxDataViewColumn
}{wxdataviewcolumn
} to the control. Returns
102 {\it true
} on success.
104 Note that there is a number of short cut methods which implicitly create
105 a
\helpref{wxDataViewColumn
}{wxdataviewcolumn
} and a
106 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
} for it (see below).
108 \membersection{wxDataViewCtrl::AppendBitmapColumn
}\label{wxdataviewctrlappendbitmapcolumn
}
110 \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
}}
112 \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
}}
114 Appends a column for rendering a bitmap. Returns the wxDataViewColumn
115 created in the function or NULL on failure.
117 \membersection{wxDataViewCtrl::AppendDateColumn
}\label{wxdataviewctrlappenddatecolumn
}
119 \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
}}
121 \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
}}
123 Appends a column for rendering a date. Returns the wxDataViewColumn
124 created in the function or NULL on failure.
126 \membersection{wxDataViewCtrl::AppendProgressColumn
}\label{wxdataviewctrlappendprogresscolumn
}
128 \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
}}
130 \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
}}
132 Appends a column for rendering a progress indicator. Returns the wxDataViewColumn
133 created in the function or NULL on failure.
135 \membersection{wxDataViewCtrl::AppendIconTextColumn
}\label{wxdataviewctrlappendicontextcolumn
}
137 \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
}}
139 \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
}}
141 Appends a column for rendering text with an icon. Returns the wxDataViewColumn
142 created in the function or NULL on failure. This uses the
143 \helpref{wxDataViewIconTextRenderer
}{wxdataviewicontextrenderer
}.
145 \membersection{wxDataViewCtrl::AppendTextColumn
}\label{wxdataviewctrlappendtextcolumn
}
147 \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
}}
149 \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
}}
151 Appends a column for rendering text. Returns the wxDataViewColumn
152 created in the function or NULL on failure.
154 \membersection{wxDataViewCtrl::AppendToggleColumn
}\label{wxdataviewctrlappendtogglecolumn
}
156 \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
}}
158 \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
}}
160 Appends a column for rendering a toggle. Returns the wxDataViewColumn
161 created in the function or NULL on failure.
163 \membersection{wxDataViewCtrl::AssociateModel
}\label{wxdataviewctrlassociatemodel
}
165 \func{virtual bool
}{AssociateModel
}{\param{wxDataViewModel*
}{model
}}
167 Associates a
\helpref{wxDataViewModel
}{wxdataviewmodel
} with the
170 \membersection{wxDataViewCtrl::Create
}\label{wxdataviewctrlcreate
}
172 \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
}}
174 Create the control. Useful for two step creation.
176 \membersection{wxDataViewCtrl::ClearColumns
}\label{wxdataviewctrlclearcolumns
}
178 \func{virtual bool
}{ClearColumns
}{\void}
182 \membersection{wxDataViewCtrl::ClearSelection
}\label{wxdataviewctrlclearselection
}
184 \func{void
}{ClearSelection
}{\void}
188 \membersection{wxDataViewCtrl::Collapse
}\label{wxdataviewctrlcollapse
}
190 \func{void
}{Collapse
}{\param{const wxDataViewItem \&
}{item
}}
194 \membersection{wxDataViewCtrl::DeleteColumn
}\label{wxdataviewctrldeletecolumn
}
196 \func{virtual bool
}{DeleteColumn
}{\param{const wxDataViewColumn*
}{column
}}
198 Deletes given column.
200 \membersection{wxDataViewCtrl::Expand
}\label{wxdataviewctrlexpand
}
202 \func{void
}{Expand
}{\param{const wxDataViewItem \&
}{item
}}
206 \membersection{wxDataViewCtrl::GetColumn
}\label{wxdataviewctrlgetcolumn
}
208 \constfunc{virtual wxDataViewColumn*
}{GetColumn
}{\param{unsigned int
}{pos
}}
210 Returns pointer to the column.
{\it pos
} refers to the
211 position in the control which may change after reordering
214 \membersection{wxDataViewCtrl::GetColumnCount
}\label{wxdataviewctrlgetcolumncount
}
216 \constfunc{virtual unsigned int
}{GetColumnCount
}{\void}
218 Returns the number of columns.
220 \membersection{wxDataViewCtrl::GetColumnPosition
}\label{wxdataviewctrlgetcolumnposition
}
222 \constfunc{virtual int
}{GetColumnPosition
}{\param{const wxDataViewColumn*
}{column
}}
224 Returns the position of the column or -
1 if not found in the control.
226 \membersection{wxDataViewCtrl::EnsureVisible
}\label{wxdataviewctrlensurevisible
}
228 \func{void
}{EnsureVisible
}{\param{const wxDataViewItem \&
}{item
},
\param{const wxDataViewColumn*
}{column = NULL
}}
230 Call this to ensure that the given item is visible.
232 \membersection{wxDataViewCtrl::GetExpanderColumn
}\label{wxdataviewctrlgetexpandercolumn
}
234 \constfunc{wxDataViewColumn *
}{GetExpanderColumn
}{\void}
236 Returns column containing the expanders.
238 \membersection{wxDataViewCtrl::GetIndent
}\label{wxdataviewctrlgetindent
}
240 \constfunc{int
}{GetIndent
}{\void}
244 \membersection{wxDataViewCtrl::GetItemRect
}\label{wxdataviewctrlgetitemrect
}
246 \constfunc{wxRect
}{GetItemRect
}{\param{const wxDataViewItem\&
}{item
},
\param{const wxDataViewColumn *
}{col = NULL
}}
250 \membersection{wxDataViewCtrl::GetModel
}\label{wxdataviewctrlgetmodel
}
252 \constfunc{virtual wxDataViewModel*
}{GetModel
}{\void}
254 Returns pointer to the data model associated with the
257 \membersection{wxDataViewCtrl::GetSelection
}\label{wxdataviewctrlgetselection
}
259 \constfunc{wxDataViewItem
}{GetSelection
}{\void}
261 Returns first selected item or an invalid item if none is selected.
263 \membersection{wxDataViewCtrl::GetSelections
}\label{wxdataviewctrlgetselections
}
265 \constfunc{int
}{GetSelections
}{\param{wxDataViewItemArray \&
}{sel
}}
267 Fills
{\it sel
} with currently selected items and returns
270 \membersection{wxDataViewCtrl::GetSortingColumn
}\label{wxdataviewctrlgetsortingcolumn
}
272 \constfunc{virtual wxDataViewColumn*
}{GetSortingColumn
}{\void}
274 Returns the wxDataViewColumn currently responsible for sorting
275 or NULL if none has been selected.
277 \membersection{wxDataViewCtrl::HitTest
}\label{wxdataviewctrlhittest
}
279 \constfunc{void
}{HitTest
}{\param{const wxPoint\&
}{point
},
\param{wxDataViewItem\&
}{item
},
\param{wxDataViewColumn *\&
}{col
}}
283 \membersection{wxDataViewCtrl::IsSelected
}\label{wxdataviewctrlisselected
}
285 \constfunc{bool
}{IsSelected
}{\param{const wxDataViewItem \&
}{item
}}
287 Return true if the item is selected.
289 \membersection{wxDataViewCtrl::Select
}\label{wxdataviewctrlselect
}
291 \func{void
}{Select
}{\param{const wxDataViewItem \&
}{item
}}
293 Select the given item.
295 \membersection{wxDataViewCtrl::SelectAll
}\label{wxdataviewctrlselectall
}
297 \func{void
}{SelectAll
}{\void}
301 \membersection{wxDataViewCtrl::SetExpanderColumn
}\label{wxdataviewctrlsetexpandercolumn
}
303 \func{void
}{SetExpanderColumn
}{\param{wxDataViewColumn *
}{col
}}
305 Set which column shall contain the tree-like expanders.
307 \membersection{wxDataViewCtrl::SetIndent
}\label{wxdataviewctrlsetindent
}
309 \func{void
}{SetIndent
}{\param{int
}{indent
}}
311 Sets the indendation.
313 \membersection{wxDataViewCtrl::SetSelections
}\label{wxdataviewctrlsetselections
}
315 \func{void
}{SetSelections
}{\param{const wxDataViewItemArray \&
}{sel
}}
317 Sets the selection to the array of wxDataViewItems.
319 \membersection{wxDataViewCtrl::Unselect
}\label{wxdataviewctrlunselect
}
321 \func{void
}{Unselect
}{\param{const wxDataViewItem \&
}{item
}}
323 Unselect the given item.
325 \membersection{wxDataViewCtrl::UnselectAll
}\label{wxdataviewctrlunselectall
}
327 \func{void
}{UnselectAll
}{\void}
329 Unselect all item. This method only has effect if multiple
330 selections are allowed.