]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/dataviewmodel.tex
Typo fix
[wxWidgets.git] / docs / latex / wx / dataviewmodel.tex
... / ...
CommitLineData
1
2\section{\class{wxDataViewModel}}\label{wxdataviewmodel}
3
4wxDataViewModel is the base class for all data model to be
5displayed by a \helpref{wxDataViewCtrl}{wxdataviewctrl}.
6Currently, this class has no functionality at all and the
7only existing implementation of it is the
8\helpref{wxDataViewListModel}{wxdataviewlistmodel}. The
9plan is to move all functionality of wxDataViewListModel
10and a to-be-written wxDataViewTreeModel into wxDataViewModel
11and make wxDataViewListModel and wxDataViewTreeModel subsets
12of 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
30Constructor.
31
32\membersection{wxDataViewModel::\destruct{wxDataViewModel}}\label{wxdataviewmodeldtor}
33
34\func{}{\destruct{wxDataViewModel}}{\void}
35
36Destructor.
37
38\section{\class{wxDataViewListModel}}\label{wxdataviewlistmodel}
39
40wxDataViewListModel is currently the only existing variant
41of a \helpref{wxDataViewModel}{wxdataviewmodel}. It allows
42to define a table like data model to be displayed by a
43\helpref{wxDataViewCtrl}{wxdataviewctrl}. You need to derive
44from this class to define your own data model.
45
46You need to override \helpref{GetRowCount}{wxdataviewlistmodelgetrowcount},
47\helpref{GetColumnCount}{wxdataviewlistmodelgetcolumncount},
48\helpref{GetColumnType}{wxdataviewlistmodelgetcolumntype} and
49\helpref{GetValue}{wxdataviewlistmodelgetvalue} in order to
50define the data model (which acts as an interface between
51your actual data and the wxDataViewCtrl). Since you will
52usually also allow the wxDataViewCtrl to change your data
53through its graphical interface, you will also have to override
54\helpref{SetValue}{wxdataviewlistmodelsetvalue} which the
55wxDataViewCtrl will call when a change to some data has been
56commited.
57
58The data that is presented through this data model is expected
59to change at run-time. You need to inform the data model that
60a change happens. Depending on what happened you need to call
61one 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
73wxDataViewModel and this class (as indeed the entire wxDataViewCtrl
74code) is using \helpref{wxVariant}{wxvariant} to store data and
75its type in a generic way. wxVariant can be extended to contain
76almost any data without changes to the original class.
77
78This class maintains a list of
79\helpref{wxDataListViewListModelNotifier}{wxdataviewlistmodelnotifier}
80which link this class to the specific implementations on the
81supported platforms so that e.g. calling
82\helpref{ValueChanged}{wxdataviewlistmodelvaluechanged}
83on this model will just call
84\helpref{wxDataListViewListModelNotifier::ValueChanged}{wxdataviewlistmodelnotifiervaluechanged}
85for each notifier that has been added. This is used both for
86informing the native controls to redraw themselves and for informing
87e.g. the \helpref{wxDataViewSortedListModel}{wxdataviewsortedlistmodel}
88to resort itself. You can also add your own notifier in order
89to get informed about any changes to the data in the list model.
90
91Additionally, this class maintains a list of all
92\helpref{wxDataViewColumns}{wxdataviewcolumn} which
93display a certain column of this list model. This is
94mostly used internally.
95
96\wxheading{Derived from}
97
98\helpref{wxDataViewModel}{wxdataviewmodel}\\
99\helpref{wxObject}{wxobject}
100
101\wxheading{Include files}
102
103<wx/dataview.h>
104
105
106\membersection{wxDataViewListModel::wxDataViewListModel}\label{wxdataviewlistmodelwxdataviewlistmodel}
107
108\func{}{wxDataViewListModel}{\void}
109
110Constructor.
111
112\membersection{wxDataViewListModel::\destruct{wxDataViewListModel}}\label{wxdataviewlistmodeldtor}
113
114\func{}{\destruct{wxDataViewListModel}}{\void}
115
116Destructor.
117
118\membersection{wxDataViewListModel::AddNotifier}\label{wxdataviewlistmodeladdnotifier}
119
120\func{void}{AddNotifier}{\param{wxDataViewListModelNotifier* }{notifier}}
121
122Adds {\it notifier} to the internal list of notifers.
123
124See also \helpref{RemoveNotifier}{wxdataviewlistmodelremovenotifier}.
125
126\membersection{wxDataViewListModel::Cleared}\label{wxdataviewlistmodelcleared}
127
128\func{bool}{virtual Cleared}{\void}
129
130Call 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
136Override this to indicate, how many columns the list
137model has.
138
139\membersection{wxDataViewListModel::GetColumnType}\label{wxdataviewlistmodelgetcolumntype}
140
141\func{virtual wxString}{GetColType}{\param{unsigned int }{col}}
142
143Override this to indicate what type of data is stored in the
144column specified by {\it col}. This should return a string
145indicating 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
151Override this to indicate, how many rows the list
152model 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
158Override this to indicate the value of a given value
159in the list model. A \helpref{wxVariant}{wxvariant}
160is used to store the data.
161
162\membersection{wxDataViewListModel::RemoveNotifier}\label{wxdataviewlistmodelremovenotifier}
163
164\func{void}{RemoveNotifier}{\param{wxDataViewListModelNotifier* }{notifier}}
165
166Removes the notifier from the list of notifiers.
167
168See also \helpref{AddNotifier}{wxdataviewlistmodeladdnotifier}.
169
170\membersection{wxDataViewListModel::RowAppended}\label{wxdataviewlistmodelrowappended}
171
172\func{virtual bool}{RowAppended}{\void}
173
174Call 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
180Call 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
186Call 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
192Call this if a row has been inserted.
193
194\membersection{wxDataViewListModel::RowPrepended}\label{wxdataviewlistmodelrowprepended}
195
196\func{virtual bool}{RowPrepended}{\void}
197
198Call 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
204Call 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
210This method gets called by e.g. the wxDataViewCtrl class if a
211value has been changed through its graphical interface. You
212need to override this method in order to update the data in
213the 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
221Call this if a value in the model has been changed.
222
223
224\section{\class{wxDataViewSortedListModel}}\label{wxdataviewsortedlistmodel}
225
226This class is used for sorting data. It does not contain any
227data itself. Rather, it provides a sorted interface for
228another list model.
229
230Currently, the sorting algorithm isn't thread safe. This needs
231to be fixed.
232
233\wxheading{Derived from}
234
235\helpref{wxDataViewListModel}{wxdataviewlistmodel}\\
236\helpref{wxDataViewModel}{wxdataviewmodel}\\
237\helpref{wxObject}{wxobject}
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
247Constructor. {\it child} is the child data model the data of
248which 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
254Destructor.
255
256\membersection{wxDataViewSortedListModel::GetAscending}\label{wxdataviewsortedlistmodelgetascending}
257
258\func{bool}{GetAscending}{\void}
259
260Returns true if the data is sorted in ascending order.
261
262\membersection{wxDataViewSortedListModel::Resort}\label{wxdataviewsortedlistmodelresort}
263
264\func{void}{Resort}{\void}
265
266Tell the model to resort its data.
267
268\membersection{wxDataViewSortedListModel::SetAscending}\label{wxdataviewsortedlistmodelsetascending}
269
270\func{void}{SetAscending}{\param{bool }{ascending}}
271
272Set the sort order of the data.
273