]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/dataviewctrl.tex
Let various AppendXXXColumn helplers return the column created within
[wxWidgets.git] / docs / latex / wx / dataviewctrl.tex
1
2 \section{\class{wxDataViewCtrl}}\label{wxdataviewctrl}
3
4 wxDataViewCtrl is a control to display data either
5 in a tree like fashion or in a tabular form or both.
6
7 Unlike \helpref{wxListCtrl}{wxlistctrl} wxDataViewCtrl doesn't
8 get its data from the user through virtual functions or by
9 setting it directly. Instead you need to write your own
10 \helpref{wxDataViewModel}{wxdataviewmodel} and associate
11 it with this control. Then you need to add a number of
12 \helpref{wxDataViewColumn}{wxdataviewcolumn} to this control to
13 define what each column shall display. Each wxDataViewColumn
14 in turn owns 1 instance of a
15 \helpref{wxDataViewRenderer}{wxdataviewrenderer} to render its
16 cells. A number of standard renderers for rendering text, dates,
17 images, toggle, a progress bar etc. are provided. Additionally,
18 the user can write custom renderes deriving from
19 \helpref{wxDataViewCustomRenderer}{wxdataviewcustomrenderer}
20 for displaying anything.
21
22 All data transfer from the control to the model and the user
23 code is done through \helpref{wxVariant}{wxvariant} which can
24 be extended to support more data formats as necessary.
25 Accordingly, all type information uses the strings returned
26 from \helpref{wxVariant::GetType}{wxvariantgettype}.
27
28 \wxheading{Window styles}
29
30 \twocolwidtha{5cm}
31 \begin{twocollist}\itemsep=0pt
32 \twocolitem{\windowstyle{wxDV\_SINGLE}}{Single selection mode. This is the default.}
33 \twocolitem{\windowstyle{wxDV\_MULTIPLE}}{Multiple selection mode.}
34 \end{twocollist}
35
36
37 \wxheading{Event handling}
38
39 To process input from a dataview control, use the following event handler
40 macros to direct input to member functions that take a
41 \helpref{wxDataViewEvent}{wxdataviewevent} argument.
42
43 \twocolwidtha{7cm}
44 \begin{twocollist}\itemsep=0pt
45
46 \twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_SELECTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_SELECTED event.}
47 \twocolitem{{\bf EVT\_DATAVIEW\_ITEM\_ACTIVATED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ITEM\_ACTIVATED event.}
48 \twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_CLICKED event.}
49 \twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICK(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_RIGHT\_CLICKED event.}
50 \twocolitem{{\bf EVT\_DATAVIEW\_COLUMN\_HEADER\_SORTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_COLUMN\_HEADER\_SORTED event.}
51
52 \end{twocollist}
53
54
55 \wxheading{Derived from}
56
57 \helpref{wxControl}{wxcontrol}\\
58 \helpref{wxWindow}{wxwindow}\\
59 \helpref{wxEvtHandler}{wxevthandler}\\
60 \helpref{wxObject}{wxobject}
61
62 \wxheading{Include files}
63
64 <wx/dataview.h>
65
66 \wxheading{Library}
67
68 \helpref{wxAdv}{librarieslist}
69
70
71 \latexignore{\rtfignore{\wxheading{Members}}}
72
73 \membersection{wxDataViewCtrl::wxDataViewCtrl}\label{wxdataviewctrlwxdataviewctrl}
74
75 \func{}{wxDataViewCtrl}{\void}
76
77 \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}}
78
79 Constructor. Calls \helpref{Create}{wxdataviewctrlcreate}.
80
81 \membersection{wxDataViewCtrl::\destruct{wxDataViewCtrl}}\label{wxdataviewctrldtor}
82
83 \func{}{\destruct{wxDataViewCtrl}}{\void}
84
85 Destructor.
86
87 \membersection{wxDataViewCtrl::AppendColumn}\label{wxdataviewctrlappendcolumn}
88
89 \func{virtual bool}{AppendColumn}{\param{wxDataViewColumn* }{col}}
90
91 Add a \helpref{wxDataViewColumn}{wxdataviewcolumn} to the control. Returns
92 {\it true} on success.
93
94 Note that there is a number of short cut methods which implicitly create
95 a \helpref{wxDataViewColumn}{wxdataviewcolumn} and a
96 \helpref{wxDataViewRenderer}{wxdataviewrenderer} for it (see below).
97
98 \membersection{wxDataViewCtrl::AppendBitmapColumn}\label{wxdataviewctrlappendbitmapcolumn}
99
100 \func{wxDataViewColumn*}{AppendBitmapColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
101
102 \func{wxDataViewColumn*}{AppendBitmapColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
103
104 Appends a column for rendering a bitmap. Returns the wxDataViewColumn
105 created in the function or NULL on failure.
106
107 \membersection{wxDataViewCtrl::AppendDateColumn}\label{wxdataviewctrlappenddatecolumn}
108
109 \func{wxDataViewColumn*}{AppendDateColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
110
111 \func{wxDataViewColumn*}{AppendDateColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
112
113 Appends a column for rendering a date. Returns the wxDataViewColumn
114 created in the function or NULL on failure.
115
116 \membersection{wxDataViewCtrl::AppendProgressColumn}\label{wxdataviewctrlappendprogresscolumn}
117
118 \func{wxDataViewColumn*}{AppendProgressColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
119
120 \func{wxDataViewColumn*}{AppendProgressColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
121
122 Appends a column for rendering a progress indicator. Returns the wxDataViewColumn
123 created in the function or NULL on failure.
124
125 \membersection{wxDataViewCtrl::AppendTextColumn}\label{wxdataviewctrlappendtextcolumn}
126
127 \func{wxDataViewColumn*}{AppendTextColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
128
129 \func{wxDataViewColumn*}{AppendTextColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
130
131 Appends a column for rendering text. Returns the wxDataViewColumn
132 created in the function or NULL on failure.
133
134 \membersection{wxDataViewCtrl::AppendToggleColumn}\label{wxdataviewctrlappendtogglecolumn}
135
136 \func{wxDataViewColumn*}{AppendToggleColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
137
138 \func{wxDataViewColumn*}{AppendToggleColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
139
140 Appends a column for rendering a toggle. Returns the wxDataViewColumn
141 created in the function or NULL on failure.
142
143 \membersection{wxDataViewCtrl::AssociateModel}\label{wxdataviewctrlassociatemodel}
144
145 \func{virtual bool}{AssociateModel}{\param{wxDataViewModel* }{model}}
146
147 Associates a \helpref{wxDataViewModel}{wxdataviewmodel} with the
148 control.
149
150 \membersection{wxDataViewCtrl::Create}\label{wxdataviewctrlcreate}
151
152 \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}}
153
154 Create the control. Useful for two step creation.
155
156 \membersection{wxDataViewCtrl::ClearColumns}\label{wxdataviewctrlclearcolumns}
157
158 \func{virtual bool}{ClearColumns}{\void}
159
160 Removes all columns.
161
162 \membersection{wxDataViewCtrl::ClearSelection}\label{wxdataviewctrlclearselection}
163
164 \func{void}{ClearSelection}{\void}
165
166 Unselects all rows.
167
168 \membersection{wxDataViewCtrl::DeleteColumn}\label{wxdataviewctrldeletecolumn}
169
170 \func{virtual bool}{DeleteColumn}{\param{unsigned int }{pos}}
171
172 Deletes given column.
173
174 \membersection{wxDataViewCtrl::GetColumn}\label{wxdataviewctrlgetcolumn}
175
176 \func{virtual wxDataViewColumn*}{GetColumn}{\param{unsigned int }{pos}}
177
178 Returns pointer to the column.
179
180 \membersection{wxDataViewCtrl::GetModel}\label{wxdataviewctrlgetmodel}
181
182 \func{virtual wxDataViewModel*}{GetModel}{\void}
183
184 Returns pointer to the data model associated with the
185 control (if any).
186
187 \membersection{wxDataViewCtrl::GetColumnCount}\label{wxdataviewctrlgetcolumncount}
188
189 \func{virtual unsigned int}{GetColumnCount}{\void}
190
191 Returns the number of columns.
192
193 \membersection{wxDataViewCtrl::EnsureVisible}\label{wxdataviewctrlensurevisible}
194
195 \func{void}{EnsureVisible}{\param{const wxDataViewItem \& }{item}, \param{wxDataViewColumn* }{column = NULL}}
196
197 Call this to ensure that the given item is visible.
198
199 \membersection{wxDataViewCtrl::GetExpanderColumn}\label{wxdataviewctrlgetexpandercolumn}
200
201 \constfunc{unsigned int}{GetExpanderColumn}{\void}
202
203 Returns column containing the expanders.
204
205 \membersection{wxDataViewCtrl::GetIndent}\label{wxdataviewctrlgetindent}
206
207 \constfunc{int}{GetIndent}{\void}
208
209 Returns indentation.
210
211 \membersection{wxDataViewCtrl::GetItemRect}\label{wxdataviewctrlgetitemrect}
212
213 \constfunc{wxRect}{GetItemRect}{\param{const wxDataViewItem\& }{item}, \param{unsigned int }{column}}
214
215 Returns item rect.
216
217 \membersection{wxDataViewCtrl::GetSelection}\label{wxdataviewctrlgetselection}
218
219 \func{wxDataViewItem}{GetSelection}{\void}
220
221 Returns first selected item or an invalid item if none is selected.
222
223 \membersection{wxDataViewCtrl::GetSelections}\label{wxdataviewctrlgetselections}
224
225 \constfunc{int}{GetSelections}{\param{wxDataViewItemArray \& }{sel}}
226
227 Fills {\it sel} with currently selected items and returns
228 their number.
229
230 \membersection{wxDataViewCtrl::HitTest}\label{wxdataviewctrlhittest}
231
232 \constfunc{void}{HitTest}{\param{const wxPoint\& }{point}, \param{wxDataViewItem\& }{item}, \param{unsigned int\& }{column}}
233
234 Hittest.
235
236 \membersection{wxDataViewCtrl::IsSelected}\label{wxdataviewctrlisselected}
237
238 \constfunc{bool}{IsSelected}{\param{const wxDataViewItem \& }{item}}
239
240 Return true if the item is selected.
241
242 \membersection{wxDataViewCtrl::Select}\label{wxdataviewctrlselect}
243
244 \func{void}{Select}{\param{const wxDataViewItem \& }{item}}
245
246 Select the given item.
247
248 \membersection{wxDataViewCtrl::SelectAll}\label{wxdataviewctrlselectall}
249
250 \func{void}{SelectAll}{\void}
251
252 Select all items.
253
254 \membersection{wxDataViewCtrl::SetExpanderColumn}\label{wxdataviewctrlsetexpandercolumn}
255
256 \func{void}{SetExpanderColumn}{\param{unsigned int }{col}}
257
258 Set which column shall contain the tree-like expanders.
259
260 \membersection{wxDataViewCtrl::SetIndent}\label{wxdataviewctrlsetindent}
261
262 \func{void}{SetIndent}{\param{int }{indent}}
263
264 Sets the indendation.
265
266 \membersection{wxDataViewCtrl::SetSelections}\label{wxdataviewctrlsetselections}
267
268 \func{void}{SetSelections}{\param{const wxDataViewItemArray \& }{sel}}
269
270 Sets the selection to the array of wxDataViewItems.
271
272 \membersection{wxDataViewCtrl::Unselect}\label{wxdataviewctrlunselect}
273
274 \func{void}{Unselect}{\param{const wxDataViewItem \& }{item}}
275
276 Unselect the given item.
277
278 \membersection{wxDataViewCtrl::UnselectAll}\label{wxdataviewctrlunselectall}
279
280 \func{void}{UnselectAll}{\void}
281
282 Unselect all item. This method only has effect if multiple
283 selections are allowed.
284