2 \section{\class{wxDataViewModel
}}\label{wxdataviewmodel
}
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.
14 \wxheading{Derived from
}
16 \helpref{wxObjectRefData
}{wxobjectrefdata
}
18 \wxheading{Include files
}
24 \helpref{wxAdv
}{librarieslist
}
26 \membersection{wxDataViewModel::wxDataViewModel
}\label{wxdataviewmodelwxdataviewmodel
}
28 \func{}{wxDataViewModel
}{\void}
32 \membersection{wxDataViewModel::
\destruct{wxDataViewModel
}}\label{wxdataviewmodeldtor
}
34 \func{}{\destruct{wxDataViewModel
}}{\void}
38 \section{\class{wxDataViewListModel
}}\label{wxdataviewlistmodel
}
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.
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
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
}.
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.
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.
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.
96 \wxheading{Derived from
}
98 \helpref{wxDataViewModel
}{wxdataviewmodel
}\\
99 \helpref{wxObject
}{wxobject
}
101 \wxheading{Include files
}
106 \membersection{wxDataViewListModel::wxDataViewListModel
}\label{wxdataviewlistmodelwxdataviewlistmodel
}
108 \func{}{wxDataViewListModel
}{\void}
112 \membersection{wxDataViewListModel::
\destruct{wxDataViewListModel
}}\label{wxdataviewlistmodeldtor
}
114 \func{}{\destruct{wxDataViewListModel
}}{\void}
118 \membersection{wxDataViewListModel::AddNotifier
}\label{wxdataviewlistmodeladdnotifier
}
120 \func{void
}{AddNotifier
}{\param{wxDataViewListModelNotifier*
}{notifier
}}
122 Adds
{\it notifier
} to the internal list of notifers.
124 See also
\helpref{RemoveNotifier
}{wxdataviewlistmodelremovenotifier
}.
126 \membersection{wxDataViewListModel::Cleared
}\label{wxdataviewlistmodelcleared
}
128 \func{bool
}{virtual Cleared
}{\void}
130 Call this if all data in your model has been cleared.
132 \membersection{wxDataViewListModel::GetColumnCount
}\label{wxdataviewlistmodelgetcolumncount
}
134 \func{virtual unsigned int
}{GetColumnCount
}{\void}
136 Override this to indicate, how many columns the list
139 \membersection{wxDataViewListModel::GetColumnType
}\label{wxdataviewlistmodelgetcolumntype
}
141 \func{virtual wxString
}{GetColType
}{\param{unsigned int
}{col
}}
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
}.
147 \membersection{wxDataViewListModel::GetRowCount
}\label{wxdataviewlistmodelgetrowcount
}
149 \func{virtual unsigned int
}{GetRowCount
}{\void}
151 Override this to indicate, how many rows the list
154 \membersection{wxDataViewListModel::GetValue
}\label{wxdataviewlistmodelgetvalue
}
156 \func{virtual void
}{GetValue
}{\param{wxVariant\&
}{variant
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
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.
162 \membersection{wxDataViewListModel::RemoveNotifier
}\label{wxdataviewlistmodelremovenotifier
}
164 \func{void
}{RemoveNotifier
}{\param{wxDataViewListModelNotifier*
}{notifier
}}
166 Removes the notifier from the list of notifiers.
168 See also
\helpref{AddNotifier
}{wxdataviewlistmodeladdnotifier
}.
170 \membersection{wxDataViewListModel::RowAppended
}\label{wxdataviewlistmodelrowappended
}
172 \func{virtual bool
}{RowAppended
}{\void}
174 Call this if a row has been appended to the list model.
176 \membersection{wxDataViewListModel::RowChanged
}\label{wxdataviewlistmodelrowchanged
}
178 \func{virtual bool
}{RowChanged
}{\param{unsigned int
}{row
}}
180 Call this if the values of this row have been changed.
182 \membersection{wxDataViewListModel::RowDeleted
}\label{wxdataviewlistmodelrowdeleted
}
184 \func{virtual bool
}{RowDeleted
}{\param{unsigned int
}{row
}}
186 Call this if this row has been deleted.
188 \membersection{wxDataViewListModel::RowInserted
}\label{wxdataviewlistmodelrowinserted
}
190 \func{virtual bool
}{RowInserted
}{\param{unsigned int
}{before
}}
192 Call this if a row has been inserted.
194 \membersection{wxDataViewListModel::RowPrepended
}\label{wxdataviewlistmodelrowprepended
}
196 \func{virtual bool
}{RowPrepended
}{\void}
198 Call this if a row has been prepended.
200 \membersection{wxDataViewListModel::RowsReordered
}\label{wxdataviewlistmodelrowsreordered
}
202 \func{virtual bool
}{RowsReordered
}{\param{unsigned int*
}{new
\_order}}
204 Call this if the rows have been reorderd.
206 \membersection{wxDataViewListModel::SetValue
}\label{wxdataviewlistmodelsetvalue
}
208 \func{virtual bool
}{SetValue
}{\param{const wxVariant\&
}{variant
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
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.
217 \membersection{wxDataViewListModel::ValueChanged
}\label{wxdataviewlistmodelvaluechanged
}
219 \func{virtual bool
}{ValueChanged
}{\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
221 Call this if a value in the model has been changed.
224 \section{\class{wxDataViewSortedListModel
}}\label{wxdataviewsortedlistmodel
}
226 This class is used for sorting data. It does not contain any
227 data itself. Rather, it provides a sorted interface for
230 Currently, the sorting algorithm isn't thread safe. This needs
233 \wxheading{Derived from
}
235 \helpref{wxDataViewListModel
}{wxdataviewlistmodel
}\\
236 \helpref{wxDataViewModel
}{wxdataviewmodel
}\\
237 \helpref{wxObject
}{wxobject
}
239 \wxheading{Include files
}
243 \membersection{wxDataViewSortedListModel::wxDataViewSortedListModel
}\label{wxdataviewsortedlistmodelwxdataviewsortedlistmodel
}
245 \func{}{wxDataViewSortedListModel
}{\param{wxDataViewListModel*
}{child
}}
247 Constructor.
{\it child
} is the child data model the data of
248 which this model is supposed to present in a sorted way.
250 \membersection{wxDataViewSortedListModel::
\destruct{wxDataViewSortedListModel
}}\label{wxdataviewsortedlistmodeldtor
}
252 \func{}{\destruct{wxDataViewSortedListModel
}}{\void}
256 \membersection{wxDataViewSortedListModel::GetAscending
}\label{wxdataviewsortedlistmodelgetascending
}
258 \func{bool
}{GetAscending
}{\void}
260 Returns true if the data is sorted in ascending order.
262 \membersection{wxDataViewSortedListModel::Resort
}\label{wxdataviewsortedlistmodelresort
}
264 \func{void
}{Resort
}{\void}
266 Tell the model to resort its data.
268 \membersection{wxDataViewSortedListModel::SetAscending
}\label{wxdataviewsortedlistmodelsetascending
}
270 \func{void
}{SetAscending
}{\param{bool
}{ascending
}}
272 Set the sort order of the data.