]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/dataviewmodel.tex
added missing \wxheading{Parameters}
[wxWidgets.git] / docs / latex / wx / dataviewmodel.tex
1
2 \section{\class{wxDataViewModel}}\label{wxdataviewmodel}
3
4 wxDataViewModel is the base class for all data model to be
5 displayed by a \helpref{wxDataViewCtrl}{wxdataviewctrl}.
6 Currently, this class has no functionality at all and the
7 only existing implementation of it is the
8 \helpref{wxDataViewListModel}{wxdataviewlistmodel}. The
9 plan is to move all functionality of wxDataViewListModel
10 and a to-be-written wxDataViewTreeModel into wxDataViewModel
11 and make wxDataViewListModel and wxDataViewTreeModel subsets
12 of the abstract wxDataViewModel.
13
14 \wxheading{Derived from}
15
16 \helpref{wxObjectRefData}{wxobjectrefdata}
17
18 \wxheading{Include files}
19
20 <wx/dataview.h>
21
22 \wxheading{Library}
23
24 \helpref{wxAdv}{librarieslist}
25
26 \membersection{wxDataViewModel::wxDataViewModel}\label{wxdataviewmodelwxdataviewmodel}
27
28 \func{}{wxDataViewModel}{\void}
29
30 Constructor.
31
32 \membersection{wxDataViewModel::\destruct{wxDataViewModel}}\label{wxdataviewmodeldtor}
33
34 \func{}{\destruct{wxDataViewModel}}{\void}
35
36 Destructor.
37
38 \section{\class{wxDataViewListModel}}\label{wxdataviewlistmodel}
39
40 wxDataViewListModel is currently the only existing variant
41 of a \helpref{wxDataViewModel}{wxdataviewmodel}. It allows
42 to define a table like data model to be displayed by a
43 \helpref{wxDataViewCtrl}{wxdataviewctrl}. You need to derive
44 from this class to define your own data model.
45
46 You need to override \helpref{GetRowCount}{wxdataviewlistmodelgetrowcount},
47 \helpref{GetColumnCount}{wxdataviewlistmodelgetcolumncount},
48 \helpref{GetColumnType}{wxdataviewlistmodelgetcolumntype} and
49 \helpref{GetValue}{wxdataviewlistmodelgetvalue} in order to
50 define the data model (which acts as an interface between
51 your actual data and the wxDataViewCtrl). Since you will
52 usually also allow the wxDataViewCtrl to change your data
53 through its graphical interface, you will also have to override
54 \helpref{SetValue}{wxdataviewlistmodelsetvalue} which the
55 wxDataViewCtrl will call when a change to some data has been
56 commited.
57
58 The data that is presented through this data model is expected
59 to change at run-time. You need to inform the data model that
60 a change happens. Depending on what happened you need to call
61 one of the following methods:
62 \helpref{ValueChanged}{wxdataviewlistmodelvaluechanged},
63 \helpref{RowChanged}{wxdataviewlistmodelrowchanged},
64 \helpref{RowAppended}{wxdataviewlistmodelrowappended},
65 \helpref{RowPrepended}{wxdataviewlistmodelrowprepended},
66 \helpref{RowInserted}{wxdataviewlistmodelrowinserted},
67 \helpref{RowDeleted}{wxdataviewlistmodelrowdeleted},
68 \helpref{RowsReordered}{wxdataviewlistmodelrowsreordered} or
69 \helpref{RowsCleared}{wxdataviewlistmodelcleared}.
70
71
72
73 wxDataViewModel and this class (as indeed the entire wxDataViewCtrl
74 code) is using \helpref{wxVariant}{wxvariant} to store data and
75 its type in a generic way. wxVariant can be extended to contain
76 almost any data without changes to the original class.
77
78 This class maintains a list of
79 \helpref{wxDataListViewListModelNotifier}{wxdataviewlistmodelnotifier}
80 which link this class to the specific implementations on the
81 supported platforms so that e.g. calling
82 \helpref{ValueChanged}{wxdataviewlistmodelvaluechanged}
83 on this model will just call
84 \helpref{wxDataListViewListModelNotifier::ValueChanged}{wxdataviewlistmodelnotifiervaluechanged}
85 for each notifier that has been added. This is used both for
86 informing the native controls to redraw themselves and for informing
87 e.g. the \helpref{wxDataViewSortedListModel}{wxdataviewsortedlistmodel}
88 to resort itself. You can also add your own notifier in order
89 to get informed about any changes to the data in the list model.
90
91 Additionally, this class maintains a list of all
92 \helpref{wxDataViewColumns}{wxdataviewcolumn} which
93 display a certain column of this list model. This is
94 mostly used internally.
95
96 \wxheading{Derived from}
97
98 \helpref{wxDataViewModel}{wxdataviewmodel}\\
99 \helpref{wxObjectRefData}{wxobjectrefdata}
100
101 \wxheading{Include files}
102
103 <wx/dataview.h>
104
105
106 \membersection{wxDataViewListModel::wxDataViewListModel}\label{wxdataviewlistmodelwxdataviewlistmodel}
107
108 \func{}{wxDataViewListModel}{\void}
109
110 Constructor.
111
112 \membersection{wxDataViewListModel::\destruct{wxDataViewListModel}}\label{wxdataviewlistmodeldtor}
113
114 \func{}{\destruct{wxDataViewListModel}}{\void}
115
116 Destructor.
117
118 \membersection{wxDataViewListModel::AddNotifier}\label{wxdataviewlistmodeladdnotifier}
119
120 \func{void}{AddNotifier}{\param{wxDataViewListModelNotifier* }{notifier}}
121
122 Adds {\it notifier} to the internal list of notifers.
123
124 See also \helpref{RemoveNotifier}{wxdataviewlistmodelremovenotifier}.
125
126 \membersection{wxDataViewListModel::Cleared}\label{wxdataviewlistmodelcleared}
127
128 \func{bool}{virtual Cleared}{\void}
129
130 Call this if all data in your model has been cleared.
131
132 \membersection{wxDataViewListModel::GetColumnCount}\label{wxdataviewlistmodelgetcolumncount}
133
134 \func{virtual unsigned int}{GetColumnCount}{\void}
135
136 Override this to indicate, how many columns the list
137 model has.
138
139 \membersection{wxDataViewListModel::GetColumnType}\label{wxdataviewlistmodelgetcolumntype}
140
141 \func{virtual wxString}{GetColType}{\param{unsigned int }{col}}
142
143 Override this to indicate what type of data is stored in the
144 column specified by {\it col}. This should return a string
145 indicating the type of data as reported by \helpref{wxVariant}{wxvariant}.
146
147 \membersection{wxDataViewListModel::GetRowCount}\label{wxdataviewlistmodelgetrowcount}
148
149 \func{virtual unsigned int}{GetRowCount}{\void}
150
151 Override this to indicate, how many rows the list
152 model has.
153
154 \membersection{wxDataViewListModel::GetValue}\label{wxdataviewlistmodelgetvalue}
155
156 \func{virtual void}{GetValue}{\param{wxVariant\& }{variant}, \param{unsigned int }{col}, \param{unsigned int }{row}}
157
158 Override this to indicate the value of a given value
159 in the list model. A \helpref{wxVariant}{wxvariant}
160 is used to store the data.
161
162 \membersection{wxDataViewListModel::RemoveNotifier}\label{wxdataviewlistmodelremovenotifier}
163
164 \func{void}{RemoveNotifier}{\param{wxDataViewListModelNotifier* }{notifier}}
165
166 Removes the notifier from the list of notifiers.
167
168 See also \helpref{AddNotifier}{wxdataviewlistmodeladdnotifier}.
169
170 \membersection{wxDataViewListModel::RowAppended}\label{wxdataviewlistmodelrowappended}
171
172 \func{virtual bool}{RowAppended}{\void}
173
174 Call this if a row has been appended to the list model.
175
176 \membersection{wxDataViewListModel::RowChanged}\label{wxdataviewlistmodelrowchanged}
177
178 \func{virtual bool}{RowChanged}{\param{unsigned int }{row}}
179
180 Call this if the values of this row have been changed.
181
182 \membersection{wxDataViewListModel::RowDeleted}\label{wxdataviewlistmodelrowdeleted}
183
184 \func{virtual bool}{RowDeleted}{\param{unsigned int }{row}}
185
186 Call this if this row has been deleted.
187
188 \membersection{wxDataViewListModel::RowInserted}\label{wxdataviewlistmodelrowinserted}
189
190 \func{virtual bool}{RowInserted}{\param{unsigned int }{before}}
191
192 Call this if a row has been inserted.
193
194 \membersection{wxDataViewListModel::RowPrepended}\label{wxdataviewlistmodelrowprepended}
195
196 \func{virtual bool}{RowPrepended}{\void}
197
198 Call this if a row has been prepended.
199
200 \membersection{wxDataViewListModel::RowsReordered}\label{wxdataviewlistmodelrowsreordered}
201
202 \func{virtual bool}{RowsReordered}{\param{unsigned int* }{new\_order}}
203
204 Call this if the rows have been reorderd.
205
206 \membersection{wxDataViewListModel::SetValue}\label{wxdataviewlistmodelsetvalue}
207
208 \func{virtual bool}{SetValue}{\param{const wxVariant\& }{variant}, \param{unsigned int }{col}, \param{unsigned int }{row}}
209
210 This method gets called by e.g. the wxDataViewCtrl class if a
211 value has been changed through its graphical interface. You
212 need to override this method in order to update the data in
213 the underlying data structur. Afterwards,
214 \helpref{ValueChanged}{wxdataviewlistmodelvaluechanged} is called.
215
216
217 \membersection{wxDataViewListModel::ValueChanged}\label{wxdataviewlistmodelvaluechanged}
218
219 \func{virtual bool}{ValueChanged}{\param{unsigned int }{col}, \param{unsigned int }{row}}
220
221 Call this if a value in the model has been changed.
222
223
224 \section{\class{wxDataViewSortedListModel}}\label{wxdataviewsortedlistmodel}
225
226 This class is used for sorting data. It does not contain any
227 data itself. Rather, it provides a sorted interface for
228 another list model.
229
230 Currently, the sorting algorithm isn't thread safe. This needs
231 to be fixed.
232
233 \wxheading{Derived from}
234
235 \helpref{wxDataViewListModel}{wxdataviewlistmodel}\\
236 \helpref{wxDataViewModel}{wxdataviewmodel}\\
237 \helpref{wxObjectRefData}{wxobjectrefdata}
238
239 \wxheading{Include files}
240
241 <wx/dataview.h>
242
243 \membersection{wxDataViewSortedListModel::wxDataViewSortedListModel}\label{wxdataviewsortedlistmodelwxdataviewsortedlistmodel}
244
245 \func{}{wxDataViewSortedListModel}{\param{wxDataViewListModel* }{child}}
246
247 Constructor. {\it child} is the child data model the data of
248 which this model is supposed to present in a sorted way.
249
250 \membersection{wxDataViewSortedListModel::\destruct{wxDataViewSortedListModel}}\label{wxdataviewsortedlistmodeldtor}
251
252 \func{}{\destruct{wxDataViewSortedListModel}}{\void}
253
254 Destructor.
255
256 \membersection{wxDataViewSortedListModel::GetAscending}\label{wxdataviewsortedlistmodelgetascending}
257
258 \func{bool}{GetAscending}{\void}
259
260 Returns true if the data is sorted in ascending order.
261
262 \membersection{wxDataViewSortedListModel::Resort}\label{wxdataviewsortedlistmodelresort}
263
264 \func{void}{Resort}{\void}
265
266 Tell the model to resort its data.
267
268 \membersection{wxDataViewSortedListModel::SetAscending}\label{wxdataviewsortedlistmodelsetascending}
269
270 \func{void}{SetAscending}{\param{bool }{ascending}}
271
272 Set the sort order of the data.
273