]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/dataviewctrl.tex
remove C++ comment
[wxWidgets.git] / docs / latex / wx / dataviewctrl.tex
CommitLineData
b6b9d556
RR
1
2\section{\class{wxDataViewCtrl}}\label{wxdataviewctrl}
3
1ab4aff2
RR
4wxDataViewCtrl is a control to display data either
5in a tree like fashion or in a tabular form or both.
305c49a1 6
4f76c1a2
RR
7A \helpref{wxDataViewItem}{wxdataviewitem} is used
8to represent a (visible) item in the control.
9
305c49a1 10Unlike \helpref{wxListCtrl}{wxlistctrl} wxDataViewCtrl doesn't
1ab4aff2
RR
11get its data from the user through virtual functions or by
12setting it directly. Instead you need to write your own
13\helpref{wxDataViewModel}{wxdataviewmodel} and associate
b6b9d556
RR
14it with this control. Then you need to add a number of
15\helpref{wxDataViewColumn}{wxdataviewcolumn} to this control to
16define what each column shall display. Each wxDataViewColumn
17in turn owns 1 instance of a
18\helpref{wxDataViewRenderer}{wxdataviewrenderer} to render its
19cells. A number of standard renderers for rendering text, dates,
20images, toggle, a progress bar etc. are provided. Additionally,
21the user can write custom renderes deriving from
22\helpref{wxDataViewCustomRenderer}{wxdataviewcustomrenderer}
23for displaying anything.
24
25All data transfer from the control to the model and the user
26code is done through \helpref{wxVariant}{wxvariant} which can
27be extended to support more data formats as necessary.
28Accordingly, all type information uses the strings returned
29from \helpref{wxVariant::GetType}{wxvariantgettype}.
30
b6b9d556
RR
31\wxheading{Window styles}
32
33\twocolwidtha{5cm}
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.}
37\end{twocollist}
38
39
40\wxheading{Event handling}
41
42To process input from a dataview control, use the following event handler
43macros to direct input to member functions that take a
44\helpref{wxDataViewEvent}{wxdataviewevent} argument.
45
46\twocolwidtha{7cm}
47\begin{twocollist}\itemsep=0pt
48
d86c1870 49\twocolitem{{\bf EVT\_DATAVIEW\_SELECTION\_CHANGED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_SELECTION\_CHANGED event.}
1ab4aff2 50\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_ACTIVATED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_ACTIVATED event.}
e0000f94
RR
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.}
7f733b26 57\twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_VALUE\_CHANGED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_VALUE\_CHANGED event.}
b6b9d556
RR
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.}
1ab4aff2 60\twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_SORTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_SORTED event.}
1821abd1
RR
61
62\end{twocollist}
b6b9d556
RR
63
64
65\wxheading{Derived from}
66
7376079d
VZ
67\helpref{wxControl}{wxcontrol}\\
68\helpref{wxWindow}{wxwindow}\\
69\helpref{wxEvtHandler}{wxevthandler}\\
70\helpref{wxObject}{wxobject}
b6b9d556
RR
71
72\wxheading{Include files}
73
74<wx/dataview.h>
75
a7af285d
VZ
76\wxheading{Library}
77
78\helpref{wxAdv}{librarieslist}
79
b6b9d556 80
809e21b5
FM
81\latexignore{\rtfignore{\wxheading{Members}}}
82
b6b9d556
RR
83\membersection{wxDataViewCtrl::wxDataViewCtrl}\label{wxdataviewctrlwxdataviewctrl}
84
85\func{}{wxDataViewCtrl}{\void}
86
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}}
88
89Constructor. Calls \helpref{Create}{wxdataviewctrlcreate}.
90
91\membersection{wxDataViewCtrl::\destruct{wxDataViewCtrl}}\label{wxdataviewctrldtor}
92
93\func{}{\destruct{wxDataViewCtrl}}{\void}
94
95Destructor.
96
97\membersection{wxDataViewCtrl::AppendColumn}\label{wxdataviewctrlappendcolumn}
98
99\func{virtual bool}{AppendColumn}{\param{wxDataViewColumn* }{col}}
100
c7074d44
RR
101Add a \helpref{wxDataViewColumn}{wxdataviewcolumn} to the control. Returns
102{\it true} on success.
103
104Note that there is a number of short cut methods which implicitly create
b6b9d556 105a \helpref{wxDataViewColumn}{wxdataviewcolumn} and a
314cd032 106\helpref{wxDataViewRenderer}{wxdataviewrenderer} for it (see below).
b6b9d556 107
b6b9d556
RR
108\membersection{wxDataViewCtrl::AppendBitmapColumn}\label{wxdataviewctrlappendbitmapcolumn}
109
ab514608 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}}
b6b9d556 111
ab514608 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}}
b6b9d556 113
c7074d44
RR
114Appends a column for rendering a bitmap. Returns the wxDataViewColumn
115created in the function or NULL on failure.
b6b9d556
RR
116
117\membersection{wxDataViewCtrl::AppendDateColumn}\label{wxdataviewctrlappenddatecolumn}
118
ab514608 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}}
b6b9d556 120
ab514608 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}}
b6b9d556 122
c7074d44
RR
123Appends a column for rendering a date. Returns the wxDataViewColumn
124created in the function or NULL on failure.
b6b9d556
RR
125
126\membersection{wxDataViewCtrl::AppendProgressColumn}\label{wxdataviewctrlappendprogresscolumn}
127
ab514608 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}}
b6b9d556 129
ab514608 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}}
b6b9d556 131
c7074d44
RR
132Appends a column for rendering a progress indicator. Returns the wxDataViewColumn
133created in the function or NULL on failure.
b6b9d556 134
b04fcede
RR
135\membersection{wxDataViewCtrl::AppendIconTextColumn}\label{wxdataviewctrlappendicontextcolumn}
136
ab514608 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}}
b04fcede 138
ab514608 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}}
b04fcede
RR
140
141Appends a column for rendering text with an icon. Returns the wxDataViewColumn
142created in the function or NULL on failure. This uses the
143\helpref{wxDataViewIconTextRenderer}{wxdataviewicontextrenderer}.
144
b6b9d556
RR
145\membersection{wxDataViewCtrl::AppendTextColumn}\label{wxdataviewctrlappendtextcolumn}
146
ab514608 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}}
b6b9d556 148
ab514608 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}}
b6b9d556 150
c7074d44
RR
151Appends a column for rendering text. Returns the wxDataViewColumn
152created in the function or NULL on failure.
b6b9d556
RR
153
154\membersection{wxDataViewCtrl::AppendToggleColumn}\label{wxdataviewctrlappendtogglecolumn}
155
ab514608 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}}
b6b9d556 157
ab514608 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}}
b6b9d556 159
c7074d44
RR
160Appends a column for rendering a toggle. Returns the wxDataViewColumn
161created in the function or NULL on failure.
b6b9d556
RR
162
163\membersection{wxDataViewCtrl::AssociateModel}\label{wxdataviewctrlassociatemodel}
164
1ab4aff2 165\func{virtual bool}{AssociateModel}{\param{wxDataViewModel* }{model}}
b6b9d556 166
1ab4aff2
RR
167Associates a \helpref{wxDataViewModel}{wxdataviewmodel} with the
168control.
b6b9d556
RR
169
170\membersection{wxDataViewCtrl::Create}\label{wxdataviewctrlcreate}
171
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}}
173
174Create the control. Useful for two step creation.
175
176\membersection{wxDataViewCtrl::ClearColumns}\label{wxdataviewctrlclearcolumns}
177
178\func{virtual bool}{ClearColumns}{\void}
179
180Removes all columns.
181
182\membersection{wxDataViewCtrl::ClearSelection}\label{wxdataviewctrlclearselection}
183
184\func{void}{ClearSelection}{\void}
185
186Unselects all rows.
187
e15c84ce
RR
188\membersection{wxDataViewCtrl::Collapse}\label{wxdataviewctrlcollapse}
189
190\func{void}{Collapse}{\param{const wxDataViewItem \& }{item}}
191
192Collapses the item.
193
b6b9d556
RR
194\membersection{wxDataViewCtrl::DeleteColumn}\label{wxdataviewctrldeletecolumn}
195
91a6c655 196\func{virtual bool}{DeleteColumn}{\param{const wxDataViewColumn* }{column}}
b6b9d556
RR
197
198Deletes given column.
199
e15c84ce
RR
200\membersection{wxDataViewCtrl::Expand}\label{wxdataviewctrlexpand}
201
202\func{void}{Expand}{\param{const wxDataViewItem \& }{item}}
203
204Expands the item.
205
b6b9d556
RR
206\membersection{wxDataViewCtrl::GetColumn}\label{wxdataviewctrlgetcolumn}
207
e0976f6d 208\constfunc{virtual wxDataViewColumn*}{GetColumn}{\param{unsigned int }{pos}}
b6b9d556 209
91a6c655
RR
210Returns pointer to the column. {\it pos} refers to the
211position in the control which may change after reordering
212columns by the user.
b6b9d556 213
a29d690d 214\membersection{wxDataViewCtrl::GetColumnCount}\label{wxdataviewctrlgetcolumncount}
b6b9d556 215
e0976f6d 216\constfunc{virtual unsigned int}{GetColumnCount}{\void}
b6b9d556
RR
217
218Returns the number of columns.
219
453091c2
RR
220\membersection{wxDataViewCtrl::GetColumnPosition}\label{wxdataviewctrlgetcolumnposition}
221
222\constfunc{virtual int}{GetColumnPosition}{\param{const wxDataViewColumn* }{column}}
223
224Returns the position of the column or -1 if not found in the control.
225
1ab4aff2
RR
226\membersection{wxDataViewCtrl::EnsureVisible}\label{wxdataviewctrlensurevisible}
227
daf5b37a 228\func{void}{EnsureVisible}{\param{const wxDataViewItem \& }{item}, \param{const wxDataViewColumn* }{column = NULL}}
1ab4aff2
RR
229
230Call this to ensure that the given item is visible.
231
232\membersection{wxDataViewCtrl::GetExpanderColumn}\label{wxdataviewctrlgetexpandercolumn}
233
1b27b2bd 234\constfunc{wxDataViewColumn *}{GetExpanderColumn}{\void}
1ab4aff2
RR
235
236Returns column containing the expanders.
237
238\membersection{wxDataViewCtrl::GetIndent}\label{wxdataviewctrlgetindent}
239
240\constfunc{int}{GetIndent}{\void}
241
242Returns indentation.
243
244\membersection{wxDataViewCtrl::GetItemRect}\label{wxdataviewctrlgetitemrect}
245
e0976f6d 246\constfunc{wxRect}{GetItemRect}{\param{const wxDataViewItem\& }{item}, \param{const wxDataViewColumn *}{col = NULL}}
1ab4aff2
RR
247
248Returns item rect.
249
453091c2
RR
250\membersection{wxDataViewCtrl::GetModel}\label{wxdataviewctrlgetmodel}
251
252\constfunc{virtual wxDataViewModel*}{GetModel}{\void}
253
254Returns pointer to the data model associated with the
255control (if any).
256
b6b9d556
RR
257\membersection{wxDataViewCtrl::GetSelection}\label{wxdataviewctrlgetselection}
258
e0976f6d 259\constfunc{wxDataViewItem}{GetSelection}{\void}
b6b9d556 260
1ab4aff2 261Returns first selected item or an invalid item if none is selected.
b6b9d556
RR
262
263\membersection{wxDataViewCtrl::GetSelections}\label{wxdataviewctrlgetselections}
264
1ab4aff2 265\constfunc{int}{GetSelections}{\param{wxDataViewItemArray \& }{sel}}
b6b9d556 266
1ab4aff2
RR
267Fills {\it sel} with currently selected items and returns
268their number.
269
21f47fb9
RR
270\membersection{wxDataViewCtrl::GetSortingColumn}\label{wxdataviewctrlgetsortingcolumn}
271
272\constfunc{virtual wxDataViewColumn*}{GetSortingColumn}{\void}
273
274Returns the wxDataViewColumn currently responsible for sorting
275or NULL if none has been selected.
276
1ab4aff2
RR
277\membersection{wxDataViewCtrl::HitTest}\label{wxdataviewctrlhittest}
278
513edac2 279\constfunc{void}{HitTest}{\param{const wxPoint\& }{point}, \param{wxDataViewItem\& }{item}, \param{wxDataViewColumn *\&}{col}}
1ab4aff2
RR
280
281Hittest.
b6b9d556
RR
282
283\membersection{wxDataViewCtrl::IsSelected}\label{wxdataviewctrlisselected}
284
1ab4aff2
RR
285\constfunc{bool}{IsSelected}{\param{const wxDataViewItem \& }{item}}
286
287Return true if the item is selected.
b6b9d556 288
1ab4aff2 289\membersection{wxDataViewCtrl::Select}\label{wxdataviewctrlselect}
b6b9d556 290
1ab4aff2 291\func{void}{Select}{\param{const wxDataViewItem \& }{item}}
b6b9d556 292
1ab4aff2 293Select the given item.
b6b9d556 294
1ab4aff2 295\membersection{wxDataViewCtrl::SelectAll}\label{wxdataviewctrlselectall}
b6b9d556 296
1ab4aff2 297\func{void}{SelectAll}{\void}
b6b9d556 298
1ab4aff2 299Select all items.
b6b9d556 300
1ab4aff2
RR
301\membersection{wxDataViewCtrl::SetExpanderColumn}\label{wxdataviewctrlsetexpandercolumn}
302
1b27b2bd 303\func{void}{SetExpanderColumn}{\param{wxDataViewColumn *}{col}}
1ab4aff2
RR
304
305Set which column shall contain the tree-like expanders.
306
307\membersection{wxDataViewCtrl::SetIndent}\label{wxdataviewctrlsetindent}
308
309\func{void}{SetIndent}{\param{int }{indent}}
310
311Sets the indendation.
b6b9d556
RR
312
313\membersection{wxDataViewCtrl::SetSelections}\label{wxdataviewctrlsetselections}
314
1ab4aff2 315\func{void}{SetSelections}{\param{const wxDataViewItemArray \& }{sel}}
b6b9d556 316
1ab4aff2 317Sets the selection to the array of wxDataViewItems.
b6b9d556
RR
318
319\membersection{wxDataViewCtrl::Unselect}\label{wxdataviewctrlunselect}
320
1ab4aff2
RR
321\func{void}{Unselect}{\param{const wxDataViewItem \& }{item}}
322
323Unselect the given item.
324
325\membersection{wxDataViewCtrl::UnselectAll}\label{wxdataviewctrlunselectall}
326
327\func{void}{UnselectAll}{\void}
b6b9d556 328
1ab4aff2
RR
329Unselect all item. This method only has effect if multiple
330selections are allowed.
b6b9d556 331