File: dataviewmodel.tex

package info (click to toggle)
wxwidgets2.8 2.8.12.1-12
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 242,920 kB
  • sloc: cpp: 1,840,772; xml: 385,749; python: 334,729; makefile: 51,774; ansic: 30,987; sh: 7,716; sql: 258; lex: 194; perl: 139; yacc: 128; pascal: 95; php: 45; lisp: 38; tcl: 38; java: 22; haskell: 20; cs: 18; erlang: 17; ruby: 16; asm: 15; ada: 9; ml: 9; csh: 9
file content (285 lines) | stat: -rw-r--r-- 10,105 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285

\section{\class{wxDataViewModel}}\label{wxdataviewmodel}

wxDataViewModel is the base class for all data model to be
displayed by a \helpref{wxDataViewCtrl}{wxdataviewctrl}. 
Currently, this class has no functionality at all and the
only existing implementation of it is the 
\helpref{wxDataViewListModel}{wxdataviewlistmodel}. The
plan is to move all functionality of wxDataViewListModel
and a to-be-written wxDataViewTreeModel into wxDataViewModel
and make wxDataViewListModel and wxDataViewTreeModel subsets
of the abstract wxDataViewModel.

\wxheading{Derived from}

\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/dataview.h>

\membersection{wxDataViewModel::wxDataViewModel}\label{wxdataviewmodelwxdataviewmodel}

\func{}{wxDataViewModel}{\void}

Constructor.

\membersection{wxDataViewModel::\destruct{wxDataViewModel}}\label{wxdataviewmodeldtor}

\func{}{\destruct{wxDataViewModel}}{\void}

Destructor.

\section{\class{wxDataViewListModel}}\label{wxdataviewlistmodel}

wxDataViewListModel is currently the only existing variant
of a \helpref{wxDataViewModel}{wxdataviewmodel}. It allows
to define a table like data model to be displayed by a
\helpref{wxDataViewCtrl}{wxdataviewctrl}. You need to derive
from this class to define your own data model.

You need to override \helpref{GetNumberOfRows}{wxdataviewlistmodelgetnumberofrows},
\helpref{GetNumberOfCols}{wxdataviewlistmodelgetnumberofcols},
\helpref{GetColType}{wxdataviewlistmodelgetcoltype} and
\helpref{GetValue}{wxdataviewlistmodelgetvalue} in order to
define the data model (which acts as an interface between 
your actual data and the wxDataViewCtrl). Since you will
usually also allow the wxDataViewCtrl to change your data
through its graphical interface, you will also have to override
\helpref{SetValue}{wxdataviewlistmodelsetvalue} which the
wxDataViewCtrl will call when a change to some data has been
commited.

The data that is presented through this data model is expected
to change at run-time. You need to inform the data model that
a change happens. Depending on what happened you need to call
one of the following methods: 
\helpref{ValueChanged}{wxdataviewlistmodelvaluechanged},
\helpref{RowChanged}{wxdataviewlistmodelrowchanged},
\helpref{RowAppended}{wxdataviewlistmodelrowappended},
\helpref{RowPrepended}{wxdataviewlistmodelrowprepended},
\helpref{RowInserted}{wxdataviewlistmodelrowinserted},
\helpref{RowDeleted}{wxdataviewlistmodelrowdeleted},
\helpref{RowsReordered}{wxdataviewlistmodelrowsreordered} or
\helpref{RowsCleared}{wxdataviewlistmodelcleared}.



wxDataViewModel and this class (as indeed the entire wxDataViewCtrl
code) is using \helpref{wxVariant}{wxvariant} to store data and
its type in a generic way. wxVariant can be extended to contain
almost any data without changes to the original class.

This class maintains a list of 
\helpref{wxDataListViewListModelNotifier}{wxdataviewlistmodelnotifier}
which link this class to the specific implementations on the
supported platforms so that e.g. calling 
\helpref{ValueChanged}{wxdataviewlistmodelvaluechanged}
on this model will just call 
\helpref{wxDataListViewListModelNotifier::ValueChanged}{wxdataviewlistmodelnotifiervaluechanged}
for each notifier that has been added. This is used both for
informing the native controls to redraw themselves and for informing
e.g. the \helpref{wxDataViewSortedListModel}{wxdataviewsortedlistmodel}
to resort itself. You can also add your own notifier in order
to get informed about any changes to the data in the list model.

Additionally, this class maintains a list of all 
\helpref{wxDataViewColumns}{wxdataviewcolumn} which
display a certain column of this list model. This is
mostly used internally.

\wxheading{Derived from}

\helpref{wxDataViewModel}{wxdataviewmodel}\\
\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/dataview.h>


\membersection{wxDataViewListModel::wxDataViewListModel}\label{wxdataviewlistmodelwxdataviewlistmodel}

\func{}{wxDataViewListModel}{\void}

Constructor.

\membersection{wxDataViewListModel::\destruct{wxDataViewListModel}}\label{wxdataviewlistmodeldtor}

\func{}{\destruct{wxDataViewListModel}}{\void}

Destructor.

\membersection{wxDataViewListModel::AddNotifier}\label{wxdataviewlistmodeladdnotifier}

\func{void}{AddNotifier}{\param{wxDataViewListModelNotifier* }{notifier}}

Adds {\it notifier} to the internal list of notifers.

See also \helpref{RemoveNotifier}{wxdataviewlistmodelremovenotifier}.

\membersection{wxDataViewListModel::AddViewingColumn}\label{wxdataviewlistmodeladdviewingcolumn}

\func{void}{AddViewingColumn}{\param{wxDataViewColumn* }{view\_column}, \param{unsigned int }{model\_column}}

Used internally. Used for maintaining a list of
\helpref{wxDataViewColumn}{wxdataviewcolumn} that
display a certain column of this model.

\membersection{wxDataViewListModel::Cleared}\label{wxdataviewlistmodelcleared}

\func{bool}{virtual Cleared}{\void}

Call this if all data in your model has been cleared.

\membersection{wxDataViewListModel::GetColType}\label{wxdataviewlistmodelgetcoltype}

\func{virtual wxString}{GetColType}{\param{unsigned int }{col}}

Override this to indicate what type of data is stored in the
column specified by {\it col}. This should return a string
indicating the type of data as reported by \helpref{wxVariant}{wxvariant}.

\membersection{wxDataViewListModel::GetNumberOfCols}\label{wxdataviewlistmodelgetnumberofcols}

\func{virtual unsigned int}{GetNumberOfCols}{\void}

Override this to indicate, how many columns the list
model has.

\membersection{wxDataViewListModel::GetNumberOfRows}\label{wxdataviewlistmodelgetnumberofrows}

\func{virtual unsigned int}{GetNumberOfRows}{\void}

Override this to indicate, how many rows the list
model has.

\membersection{wxDataViewListModel::GetValue}\label{wxdataviewlistmodelgetvalue}

\func{virtual void}{GetValue}{\param{wxVariant\& }{variant}, \param{unsigned int }{col}, \param{unsigned int }{row}}

Override this to indicate the value of a given value
in the list model. A \helpref{wxVariant}{wxvariant}
is used to store the data.

\membersection{wxDataViewListModel::RemoveNotifier}\label{wxdataviewlistmodelremovenotifier}

\func{void}{RemoveNotifier}{\param{wxDataViewListModelNotifier* }{notifier}}

Removes the notifier from the list of notifiers.

See also \helpref{AddNotifier}{wxdataviewlistmodeladdnotifier}.

\membersection{wxDataViewListModel::RemoveViewingColumn}\label{wxdataviewlistmodelremoveviewingcolumn}

\func{void}{RemoveViewingColumn}{\param{wxDataViewColumn* }{column}}

Used internally. Used for maintaining a list of
\helpref{wxDataViewColumn}{wxdataviewcolumn} that
display a certain column of this model.

\membersection{wxDataViewListModel::RowAppended}\label{wxdataviewlistmodelrowappended}

\func{virtual bool}{RowAppended}{\void}

Call this if a row has been appended to the list model.

\membersection{wxDataViewListModel::RowChanged}\label{wxdataviewlistmodelrowchanged}

\func{virtual bool}{RowChanged}{\param{unsigned int }{row}}

Call this if the values of this row have been changed.

\membersection{wxDataViewListModel::RowDeleted}\label{wxdataviewlistmodelrowdeleted}

\func{virtual bool}{RowDeleted}{\param{unsigned int }{row}}

Call this if this row has been deleted.

\membersection{wxDataViewListModel::RowInserted}\label{wxdataviewlistmodelrowinserted}

\func{virtual bool}{RowInserted}{\param{unsigned int }{before}}

Call this if a row has been inserted.

\membersection{wxDataViewListModel::RowPrepended}\label{wxdataviewlistmodelrowprepended}

\func{virtual bool}{RowPrepended}{\void}

Call this if a row has been prepended.

\membersection{wxDataViewListModel::RowsReordered}\label{wxdataviewlistmodelrowsreordered}

\func{virtual bool}{RowsReordered}{\param{unsigned int* }{new\_order}}

Call this if the rows have been reorderd.

\membersection{wxDataViewListModel::SetValue}\label{wxdataviewlistmodelsetvalue}

\func{virtual bool}{SetValue}{\param{wxVariant\& }{variant}, \param{unsigned int }{col}, \param{unsigned int }{row}}

This method gets called by e.g. the wxDataViewCtrl class if a 
value has been changed through its graphical interface. You
need to override this method in order to update the data in
the underlying data structur. Afterwards, 
\helpref{ValueChanged}{wxdataviewlistmodelvaluechanged} is called.


\membersection{wxDataViewListModel::ValueChanged}\label{wxdataviewlistmodelvaluechanged}

\func{virtual bool}{ValueChanged}{\param{unsigned int }{col}, \param{unsigned int }{row}}

Call this if a value in the model has been changed.


\section{\class{wxDataViewSortedListModel}}\label{wxdataviewsortedlistmodel}

This class is used for sorting data. It does not contain any
data itself. Rather, it provides a sorted interface for 
another list model.

Currently, the sorting algorithm isn't thread safe. This needs
to be fixed.

\wxheading{Derived from}

\helpref{wxDataViewListModel}{wxdataviewlistmodel}\\
\helpref{wxDataViewModel}{wxdataviewmodel}\\
\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/dataview.h>

\membersection{wxDataViewSortedListModel::wxDataViewSortedListModel}\label{wxdataviewsortedlistmodelwxdataviewsortedlistmodel}

\func{}{wxDataViewSortedListModel}{\param{wxDataViewListModel* }{child}}

Constructor. {\it child} is the child data model the data of
which this model is supposed to present in a sorted way.

\membersection{wxDataViewSortedListModel::\destruct{wxDataViewSortedListModel}}\label{wxdataviewsortedlistmodeldtor}

\func{}{\destruct{wxDataViewSortedListModel}}{\void}

Destructor.

\membersection{wxDataViewSortedListModel::GetAscending}\label{wxdataviewsortedlistmodelgetascending}

\func{bool}{GetAscending}{\void}

Returns true if the data is sorted in ascending order.

\membersection{wxDataViewSortedListModel::Resort}\label{wxdataviewsortedlistmodelresort}

\func{void}{Resort}{\void}

Tell the model to resort its data.

\membersection{wxDataViewSortedListModel::SetAscending}\label{wxdataviewsortedlistmodelsetascending}

\func{void}{SetAscending}{\param{bool }{ascending}}

Set the sort order of the data.