]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/dataviewctrl.tex
fix typo in Selecting() description (bug 1726270)
[wxWidgets.git] / docs / latex / wx / dataviewctrl.tex
... / ...
CommitLineData
1
2\section{\class{wxDataViewCtrl}}\label{wxdataviewctrl}
3
4This class and its documentation are work in progress and
5therefore subject to change.
6
7wxDataViewCtrl is planned to be a control to display data either
8in a tree like fashion or in a tabular form or both. So far,
9only the tabular form is implemented.
10
11Unlike \helpref{wxListCtrl}{wxlistctrl} wxDataViewCtrl doesn't
12get its data from the user through virtual functions or events,
13instead you need to write your own
14\helpref{wxDataViewListModel}{wxdataviewlistmodel} and associate
15it with this control. Then you need to add a number of
16\helpref{wxDataViewColumn}{wxdataviewcolumn} to this control to
17define what each column shall display. Each wxDataViewColumn
18in turn owns 1 instance of a
19\helpref{wxDataViewRenderer}{wxdataviewrenderer} to render its
20cells. A number of standard renderers for rendering text, dates,
21images, toggle, a progress bar etc. are provided. Additionally,
22the user can write custom renderes deriving from
23\helpref{wxDataViewCustomRenderer}{wxdataviewcustomrenderer}
24for displaying anything.
25
26All data transfer from the control to the model and the user
27code is done through \helpref{wxVariant}{wxvariant} which can
28be extended to support more data formats as necessary.
29Accordingly, all type information uses the strings returned
30from \helpref{wxVariant::GetType}{wxvariantgettype}.
31
32So far, this control has been implemented for GTK+ and there
33is an almost complete generic implementation including several
34additions for a native Windows look and feel (in particular
35concerning the header). It is planned to implement the control
36natively under OS X.
37
38\wxheading{Window styles}
39
40\twocolwidtha{5cm}
41\begin{twocollist}\itemsep=0pt
42\twocolitem{\windowstyle{wxDV\_SINGLE}}{Single selection mode. This is the default.}
43\twocolitem{\windowstyle{wxDV\_MULTIPLE}}{Multiple selection mode.}
44\end{twocollist}
45
46
47\wxheading{Event handling}
48
49To process input from a dataview control, use the following event handler
50macros to direct input to member functions that take a
51\helpref{wxDataViewEvent}{wxdataviewevent} argument.
52
53\twocolwidtha{7cm}
54\begin{twocollist}\itemsep=0pt
55
56\twocolitem{{\bf EVT\_DATAVIEW\_ROW\_SELECTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ROW\_SELECTED event.}
57\twocolitem{{\bf EVT\_DATAVIEW\_ROW\_ACTIVATED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_ROW\_ACTIVATED 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
61\end{twocollist}
62
63Additionally, you can get informed about changes to the
64\helpref{model}{wxDataViewListModel}, to which a wxDataViewCtrl
65has been associated. These events correspond to the interface
66offered by \helpref{wxDataViewListModelNotifier}{wxdataviewlistmodelnotifier}.
67
68\twocolwidtha{7cm}
69\begin{twocollist}\itemsep=0pt
70
71\twocolitem{{\bf EVT\_DATAVIEW\_MODEL\_ROW\_PREPENDED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_MODEL\_ROW\_PREPENDED event.}
72\twocolitem{{\bf EVT\_DATAVIEW\_MODEL\_ROW\_APPENDED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_MODEL\_ROW\_APPENDED event.}
73\twocolitem{{\bf EVT\_DATAVIEW\_MODEL\_ROW\_INSERTED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_MODEL\_ROW\_INSERTED event.}
74\twocolitem{{\bf EVT\_DATAVIEW\_MODEL\_ROW\_DELETED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_MODEL\_ROW\_DELETED event.}
75\twocolitem{{\bf EVT\_DATAVIEW\_MODEL\_ROW\_CHANGED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_MODEL\_ROW\_CHANGED event.}
76\twocolitem{{\bf EVT\_DATAVIEW\_MODEL\_VALUE\_CHANGED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_MODEL\_VALUE\_CHANGED event.}
77\twocolitem{{\bf EVT\_DATAVIEW\_MODEL\_ROWS\_REORDERED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_MODEL\_ROWS\_REORDERED event.}
78\twocolitem{{\bf EVT\_DATAVIEW\_MODEL\_CLEARED(id, func)}}{Processes a wxEVT\_COMMAND\_DATAVIEW\_MODEL\_CLEARED event.}
79
80\end{twocollist}
81
82
83\wxheading{Derived from}
84
85\helpref{wxControl}{wxcontrol}
86
87\wxheading{Include files}
88
89<wx/dataview.h>
90
91
92\membersection{wxDataViewCtrl::wxDataViewCtrl}\label{wxdataviewctrlwxdataviewctrl}
93
94\func{}{wxDataViewCtrl}{\void}
95
96\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}}
97
98Constructor. Calls \helpref{Create}{wxdataviewctrlcreate}.
99
100\membersection{wxDataViewCtrl::\destruct{wxDataViewCtrl}}\label{wxdataviewctrldtor}
101
102\func{}{\destruct{wxDataViewCtrl}}{\void}
103
104Destructor.
105
106\membersection{wxDataViewCtrl::AppendColumn}\label{wxdataviewctrlappendcolumn}
107
108\func{virtual bool}{AppendColumn}{\param{wxDataViewColumn* }{col}}
109
110Add a \helpref{wxDataViewColumn}{wxdataviewcolumn} to the control. Note
111that there is a number of short cut methods which implicitly create
112a \helpref{wxDataViewColumn}{wxdataviewcolumn} and a
113\helpref{wxDataViewRenderer}{wxdataviewrenderer} for it (see below).
114
115
116\membersection{wxDataViewCtrl::AppendBitmapColumn}\label{wxdataviewctrlappendbitmapcolumn}
117
118\func{bool}{AppendBitmapColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
119
120\func{bool}{AppendBitmapColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
121
122Appends a column for rendering a bitmap.
123
124\membersection{wxDataViewCtrl::AppendDateColumn}\label{wxdataviewctrlappenddatecolumn}
125
126\func{bool}{AppendDateColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
127
128\func{bool}{AppendDateColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_ACTIVATABLE}, \param{int }{width = -1}}
129
130Appends a column for rendering a date.
131
132\membersection{wxDataViewCtrl::AppendProgressColumn}\label{wxdataviewctrlappendprogresscolumn}
133
134\func{bool}{AppendProgressColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
135
136\func{bool}{AppendProgressColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 80}}
137
138Appends a column for rendering a progress indicator.
139
140\membersection{wxDataViewCtrl::AppendTextColumn}\label{wxdataviewctrlappendtextcolumn}
141
142\func{bool}{AppendTextColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
143
144\func{bool}{AppendTextColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = -1}}
145
146Appends a column for rendering text.
147
148\membersection{wxDataViewCtrl::AppendToggleColumn}\label{wxdataviewctrlappendtogglecolumn}
149
150\func{bool}{AppendToggleColumn}{\param{const wxString\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
151
152\func{bool}{AppendToggleColumn}{\param{const wxBitmap\& }{label}, \param{unsigned int }{model\_column}, \param{wxDataViewCellMode }{mode = wxDATAVIEW\_CELL\_INERT}, \param{int }{width = 30}}
153
154Appends a column for rendering a toggle.
155
156\membersection{wxDataViewCtrl::AssociateModel}\label{wxdataviewctrlassociatemodel}
157
158\func{virtual bool}{AssociateModel}{\param{wxDataViewListModel* }{model}}
159
160Associates a \helpref{wxDataViewListModel}{wxdataviewlistmodel} with the
161control. In the future this should be changed to supporting any data
162model including a to-be-written wxDataViewTreeModel.
163
164\membersection{wxDataViewCtrl::Create}\label{wxdataviewctrlcreate}
165
166\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}}
167
168Create the control. Useful for two step creation.
169
170\membersection{wxDataViewCtrl::ClearColumns}\label{wxdataviewctrlclearcolumns}
171
172\func{virtual bool}{ClearColumns}{\void}
173
174Removes all columns.
175
176\membersection{wxDataViewCtrl::ClearSelection}\label{wxdataviewctrlclearselection}
177
178\func{void}{ClearSelection}{\void}
179
180Unselects all rows.
181
182\membersection{wxDataViewCtrl::DeleteColumn}\label{wxdataviewctrldeletecolumn}
183
184\func{virtual bool}{DeleteColumn}{\param{unsigned int }{pos}}
185
186Deletes given column.
187
188\membersection{wxDataViewCtrl::GetColumn}\label{wxdataviewctrlgetcolumn}
189
190\func{virtual wxDataViewColumn*}{GetColumn}{\param{unsigned int }{pos}}
191
192Returns pointer to the column.
193
194\membersection{wxDataViewCtrl::GetModel}\label{wxdataviewctrlgetmodel}
195
196\func{virtual wxDataViewListModel*}{GetModel}{\void}
197
198Returns pointer to the data model associated with the
199control (if any).
200
201\membersection{wxDataViewCtrl::GetColumnCount}\label{wxdataviewctrlgetcolumncount}
202
203\func{virtual unsigned int}{GetColumnCount}{\void}
204
205Returns the number of columns.
206
207\membersection{wxDataViewCtrl::GetSelection}\label{wxdataviewctrlgetselection}
208
209\constfunc{virtual int}{GetSelection}{\void}
210
211Returns the index of the currently selected row. It will
212return -1 if no row is selected and the index of the first
213selected row if more than one row are selected.
214
215\membersection{wxDataViewCtrl::GetSelections}\label{wxdataviewctrlgetselections}
216
217\constfunc{virtual int}{GetSelections}{\param{wxArrayInt\& }{aSelections}}
218
219Returns the number of selected rows and fills an array of int
220with the indeces of the selected rows.
221
222\membersection{wxDataViewCtrl::IsSelected}\label{wxdataviewctrlisselected}
223
224\constfunc{virtual bool}{IsSelected}{\param{unsigned int }{row}}
225
226Returns {\it true} if the row is selected, {\it false} otherwise.
227
228\membersection{wxDataViewCtrl::SetSelection}\label{wxdataviewctrlsetselection}
229
230\func{virtual void}{SetSelection}{\param{int }{row}}
231
232Sets the selection. Use -1 to unselect all rows.
233
234\membersection{wxDataViewCtrl::SetSelectionRange}\label{wxdataviewctrlsetselectionrange}
235
236\func{virtual void}{SetSelectionRange}{\param{unsigned int }{from}, \param{unsigned int }{to}}
237
238Set a range of selection.
239
240\membersection{wxDataViewCtrl::SetSelections}\label{wxdataviewctrlsetselections}
241
242\func{virtual void}{SetSelections}{\param{const wxArrayInt\& }{aSelections}}
243
244Set the selection to the array of int.
245
246\membersection{wxDataViewCtrl::Unselect}\label{wxdataviewctrlunselect}
247
248\func{virtual void}{Unselect}{\param{unsigned int }{row}}
249
250Unselect a particular row.
251