]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dataview.h | |
80932a3e | 3 | // Purpose: interface of wxDataView* classes |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
b321b61c | 9 | |
23324ae1 FM |
10 | /** |
11 | @class wxDataViewModel | |
7c913512 | 12 | |
c4e57202 FM |
13 | wxDataViewModel is the base class for all data model to be displayed by a |
14 | wxDataViewCtrl. | |
15 | ||
16 | All other models derive from it and must implement its pure virtual functions | |
17 | in order to define a complete data model. In detail, you need to override | |
18 | wxDataViewModel::IsContainer, wxDataViewModel::GetParent, wxDataViewModel::GetChildren, | |
19 | wxDataViewModel::GetColumnCount, wxDataViewModel::GetColumnType and | |
20 | wxDataViewModel::GetValue in order to define the data model which acts as an | |
21 | interface between your actual data and the wxDataViewCtrl. | |
22 | ||
23 | Since you will usually also allow the wxDataViewCtrl to change your data | |
23324ae1 | 24 | through its graphical interface, you will also have to override |
c4e57202 | 25 | wxDataViewModel::SetValue which the wxDataViewCtrl will call when a change |
795dac4c | 26 | to some data has been committed. |
7c913512 | 27 | |
c4e57202 FM |
28 | wxDataViewModel (as indeed the entire wxDataViewCtrl code) is using wxVariant |
29 | to store data and its type in a generic way. wxVariant can be extended to contain | |
23324ae1 | 30 | almost any data without changes to the original class. |
7c913512 | 31 | |
c4e57202 FM |
32 | The data that is presented through this data model is expected to change at |
33 | run-time. You need to inform the data model when a change happened. | |
34 | Depending on what happened you need to call one of the following methods: | |
35 | - wxDataViewModel::ValueChanged, | |
36 | - wxDataViewModel::ItemAdded, | |
37 | - wxDataViewModel::ItemDeleted, | |
38 | - wxDataViewModel::ItemChanged, | |
39 | - wxDataViewModel::Cleared. | |
40 | ||
41 | There are plural forms for notification of addition, change or removal of | |
42 | several item at once. See: | |
43 | - wxDataViewModel::ItemsAdded, | |
44 | - wxDataViewModel::ItemsDeleted, | |
45 | - wxDataViewModel::ItemsChanged. | |
46 | ||
47 | Note that wxDataViewModel does not define the position or index of any item | |
48 | in the control because different controls might display the same data differently. | |
49 | wxDataViewModel does provide a wxDataViewModel::Compare method which the | |
50 | wxDataViewCtrl may use to sort the data either in conjunction with a column | |
51 | header or without (see wxDataViewModel::HasDefaultCompare). | |
52 | ||
53 | This class maintains a list of wxDataViewModelNotifier which link this class | |
54 | to the specific implementations on the supported platforms so that e.g. calling | |
55 | wxDataViewModel::ValueChanged on this model will just call | |
56 | wxDataViewModelNotifier::ValueChanged for each notifier that has been added. | |
57 | You can also add your own notifier in order to get informed about any changes | |
23324ae1 | 58 | to the data in the list model. |
7c913512 | 59 | |
c4e57202 | 60 | Currently wxWidgets provides the following models apart from the base model: |
bda698ed RR |
61 | wxDataViewIndexListModel, wxDataViewVirtualListModel, wxDataViewTreeStore, |
62 | wxDataViewListStore. | |
7c913512 | 63 | |
e4e83d3a | 64 | Note that wxDataViewModel is reference counted, derives from wxRefCounter |
c4e57202 FM |
65 | and cannot be deleted directly as it can be shared by several wxDataViewCtrls. |
66 | This implies that you need to decrease the reference count after | |
23324ae1 | 67 | associating the model with a control like this: |
7c913512 | 68 | |
23324ae1 | 69 | @code |
14f73cf1 | 70 | wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, wxID_ANY ); |
23324ae1 | 71 | wxDataViewModel *musicModel = new MyMusicModel; |
14f73cf1 FM |
72 | m_musicCtrl->AssociateModel( musicModel ); |
73 | musicModel->DecRef(); // avoid memory leak !! | |
43c64cc6 | 74 | |
23324ae1 FM |
75 | // add columns now |
76 | @endcode | |
7c913512 | 77 | |
23324ae1 | 78 | @library{wxadv} |
b321b61c | 79 | @category{dvc} |
23324ae1 | 80 | */ |
e4e83d3a | 81 | class wxDataViewModel : public wxRefCounter |
23324ae1 FM |
82 | { |
83 | public: | |
84 | /** | |
85 | Constructor. | |
86 | */ | |
87 | wxDataViewModel(); | |
88 | ||
23324ae1 | 89 | /** |
c4e57202 | 90 | Adds a wxDataViewModelNotifier to the model. |
23324ae1 FM |
91 | */ |
92 | void AddNotifier(wxDataViewModelNotifier* notifier); | |
93 | ||
795dac4c VZ |
94 | /** |
95 | Change the value of the given item and update the control to reflect | |
96 | it. | |
97 | ||
98 | This function simply calls SetValue() and, if it succeeded, | |
99 | ValueChanged(). | |
100 | ||
101 | @since 2.9.1 | |
102 | ||
d86f721a | 103 | @param variant |
795dac4c VZ |
104 | The new value. |
105 | @param item | |
106 | The item (row) to update. | |
107 | @param col | |
108 | The column to update. | |
109 | @return | |
110 | @true if both SetValue() and ValueChanged() returned @true. | |
111 | */ | |
112 | bool ChangeValue(const wxVariant& variant, | |
113 | const wxDataViewItem& item, | |
114 | unsigned int col); | |
115 | ||
23324ae1 | 116 | /** |
c4e57202 FM |
117 | Called to inform the model that all data has been cleared. |
118 | The control will reread the data from the model again. | |
23324ae1 FM |
119 | */ |
120 | virtual bool Cleared(); | |
121 | ||
122 | /** | |
123 | The compare function to be used by control. The default compare function | |
124 | sorts by container and other items separately and in ascending order. | |
125 | Override this for a different sorting behaviour. | |
c4e57202 FM |
126 | |
127 | @see HasDefaultCompare(). | |
23324ae1 FM |
128 | */ |
129 | virtual int Compare(const wxDataViewItem& item1, | |
130 | const wxDataViewItem& item2, | |
131 | unsigned int column, | |
862de7b3 | 132 | bool ascending) const; |
23324ae1 FM |
133 | |
134 | /** | |
13f184c0 | 135 | Override this to indicate that the item has special font attributes. |
c4e57202 FM |
136 | This only affects the wxDataViewTextRendererText renderer. |
137 | ||
7fadac88 VZ |
138 | The base class version always simply returns @false. |
139 | ||
c4e57202 | 140 | @see wxDataViewItemAttr. |
7fadac88 VZ |
141 | |
142 | @param item | |
143 | The item for which the attribute is requested. | |
144 | @param col | |
145 | The column of the item for which the attribute is requested. | |
146 | @param attr | |
147 | The attribute to be filled in if the function returns @true. | |
148 | @return | |
149 | @true if this item has an attribute or @false otherwise. | |
23324ae1 | 150 | */ |
fadc2df6 | 151 | virtual bool GetAttr(const wxDataViewItem& item, unsigned int col, |
7fadac88 | 152 | wxDataViewItemAttr& attr) const; |
23324ae1 FM |
153 | |
154 | /** | |
c4e57202 FM |
155 | Override this so the control can query the child items of an item. |
156 | Returns the number of items. | |
23324ae1 FM |
157 | */ |
158 | virtual unsigned int GetChildren(const wxDataViewItem& item, | |
fadc2df6 | 159 | wxDataViewItemArray& children) const = 0; |
23324ae1 FM |
160 | |
161 | /** | |
162 | Override this to indicate the number of columns in the model. | |
163 | */ | |
b91c4601 | 164 | virtual unsigned int GetColumnCount() const = 0; |
23324ae1 FM |
165 | |
166 | /** | |
167 | Override this to indicate what type of data is stored in the | |
c4e57202 FM |
168 | column specified by @a col. |
169 | ||
170 | This should return a string indicating the type of data as reported by wxVariant. | |
23324ae1 | 171 | */ |
b91c4601 | 172 | virtual wxString GetColumnType(unsigned int col) const = 0; |
23324ae1 FM |
173 | |
174 | /** | |
175 | Override this to indicate which wxDataViewItem representing the parent | |
4cc4bfaf | 176 | of @a item or an invalid wxDataViewItem if the the root item is |
23324ae1 FM |
177 | the parent item. |
178 | */ | |
b91c4601 | 179 | virtual wxDataViewItem GetParent(const wxDataViewItem& item) const = 0; |
23324ae1 FM |
180 | |
181 | /** | |
c4e57202 | 182 | Override this to indicate the value of @a item. |
23324ae1 FM |
183 | A wxVariant is used to store the data. |
184 | */ | |
b91c4601 FM |
185 | virtual void GetValue(wxVariant& variant, const wxDataViewItem& item, |
186 | unsigned int col) const = 0; | |
23324ae1 FM |
187 | |
188 | /** | |
c4e57202 FM |
189 | Override this method to indicate if a container item merely acts as a |
190 | headline (or for categorisation) or if it also acts a normal item with | |
191 | entries for futher columns. By default returns @false. | |
23324ae1 | 192 | */ |
328f5751 | 193 | virtual bool HasContainerColumns(const wxDataViewItem& item) const; |
23324ae1 FM |
194 | |
195 | /** | |
196 | Override this to indicate that the model provides a default compare | |
197 | function that the control should use if no wxDataViewColumn has been | |
198 | chosen for sorting. Usually, the user clicks on a column header for | |
c4e57202 FM |
199 | sorting, the data will be sorted alphanumerically. |
200 | ||
201 | If any other order (e.g. by index or order of appearance) is required, | |
202 | then this should be used. | |
203 | See wxDataViewIndexListModel for a model which makes use of this. | |
23324ae1 | 204 | */ |
328f5751 | 205 | virtual bool HasDefaultCompare() const; |
23324ae1 | 206 | |
b372f20e VZ |
207 | /** |
208 | Return true if there is a value in the given column of this item. | |
209 | ||
210 | All normal items have values in all columns but the container items | |
211 | only show their label in the first column (@a col == 0) by default (but | |
212 | see HasContainerColumns()). So this function always returns true for | |
213 | the first column while for the other ones it returns true only if the | |
214 | item is not a container or HasContainerColumns() was overridden to | |
215 | return true for it. | |
216 | ||
217 | @since 2.9.1 | |
218 | */ | |
219 | bool HasValue(const wxDataViewItem& item, unsigned col) const; | |
220 | ||
23324ae1 | 221 | /** |
4cc4bfaf | 222 | Override this to indicate of @a item is a container, i.e. if |
23324ae1 FM |
223 | it can have child items. |
224 | */ | |
b91c4601 | 225 | virtual bool IsContainer(const wxDataViewItem& item) const = 0; |
23324ae1 FM |
226 | |
227 | /** | |
c4e57202 | 228 | Call this to inform the model that an item has been added to the data. |
23324ae1 FM |
229 | */ |
230 | virtual bool ItemAdded(const wxDataViewItem& parent, | |
231 | const wxDataViewItem& item); | |
232 | ||
233 | /** | |
234 | Call this to inform the model that an item has changed. | |
c4e57202 | 235 | |
23324ae1 FM |
236 | This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED |
237 | event (in which the column fields will not be set) to the user. | |
238 | */ | |
239 | virtual bool ItemChanged(const wxDataViewItem& item); | |
240 | ||
241 | /** | |
242 | Call this to inform the model that an item has been deleted from the data. | |
243 | */ | |
244 | virtual bool ItemDeleted(const wxDataViewItem& parent, | |
245 | const wxDataViewItem& item); | |
246 | ||
247 | /** | |
c4e57202 | 248 | Call this to inform the model that several items have been added to the data. |
23324ae1 FM |
249 | */ |
250 | virtual bool ItemsAdded(const wxDataViewItem& parent, | |
251 | const wxDataViewItemArray& items); | |
252 | ||
253 | /** | |
254 | Call this to inform the model that several items have changed. | |
c4e57202 | 255 | |
23324ae1 FM |
256 | This will eventually emit wxEVT_DATAVIEW_ITEM_VALUE_CHANGED |
257 | events (in which the column fields will not be set) to the user. | |
258 | */ | |
259 | virtual bool ItemsChanged(const wxDataViewItemArray& items); | |
260 | ||
261 | /** | |
262 | Call this to inform the model that several items have been deleted. | |
263 | */ | |
264 | virtual bool ItemsDeleted(const wxDataViewItem& parent, | |
265 | const wxDataViewItemArray& items); | |
266 | ||
267 | /** | |
4cc4bfaf | 268 | Remove the @a notifier from the list of notifiers. |
23324ae1 FM |
269 | */ |
270 | void RemoveNotifier(wxDataViewModelNotifier* notifier); | |
271 | ||
272 | /** | |
c4e57202 | 273 | Call this to initiate a resort after the sort function has been changed. |
23324ae1 FM |
274 | */ |
275 | virtual void Resort(); | |
276 | ||
277 | /** | |
278 | This gets called in order to set a value in the data model. | |
795dac4c | 279 | |
c4e57202 FM |
280 | The most common scenario is that the wxDataViewCtrl calls this method |
281 | after the user changed some data in the view. | |
282 | ||
795dac4c VZ |
283 | This is the function you need to override in your derived class but if |
284 | you want to call it, ChangeValue() is usually more convenient as | |
285 | otherwise you need to manually call ValueChanged() to update the | |
286 | control itself. | |
23324ae1 | 287 | */ |
795dac4c VZ |
288 | virtual bool SetValue(const wxVariant& variant, |
289 | const wxDataViewItem& item, | |
b91c4601 | 290 | unsigned int col) = 0; |
23324ae1 FM |
291 | |
292 | /** | |
c4e57202 FM |
293 | Call this to inform this model that a value in the model has been changed. |
294 | This is also called from wxDataViewCtrl's internal editing code, e.g. when | |
295 | editing a text field in the control. | |
296 | ||
23324ae1 FM |
297 | This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED |
298 | event to the user. | |
299 | */ | |
300 | virtual bool ValueChanged(const wxDataViewItem& item, | |
301 | unsigned int col); | |
5e6e278d FM |
302 | |
303 | protected: | |
304 | ||
305 | /** | |
306 | Destructor. This should not be called directly. Use DecRef() instead. | |
307 | */ | |
308 | virtual ~wxDataViewModel(); | |
23324ae1 FM |
309 | }; |
310 | ||
311 | ||
e54c96f1 | 312 | |
e39de702 RR |
313 | /** |
314 | @class wxDataViewIndexListModel | |
e39de702 | 315 | |
c4e57202 FM |
316 | wxDataViewIndexListModel is a specialized data model which lets you address |
317 | an item by its position (row) rather than its wxDataViewItem (which you can | |
318 | obtain from this class). | |
e39de702 RR |
319 | This model also provides its own wxDataViewIndexListModel::Compare |
320 | method which sorts the model's data by the index. | |
b91c4601 | 321 | |
c4e57202 FM |
322 | This model is not a virtual model since the control stores each wxDataViewItem. |
323 | Use wxDataViewVirtualListModel if you need to display millions of items or | |
324 | have other reason to use a virtual control. | |
e39de702 | 325 | |
8ed522d9 | 326 | @library{wxadv} |
b321b61c | 327 | @category{dvc} |
e39de702 RR |
328 | */ |
329 | class wxDataViewIndexListModel : public wxDataViewModel | |
330 | { | |
331 | public: | |
332 | /** | |
333 | Constructor. | |
334 | */ | |
335 | wxDataViewIndexListModel(unsigned int initial_size = 0); | |
336 | ||
337 | /** | |
338 | Destructor. | |
339 | */ | |
adaaa686 | 340 | virtual ~wxDataViewIndexListModel(); |
e39de702 RR |
341 | |
342 | /** | |
343 | Compare method that sorts the items by their index. | |
344 | */ | |
345 | int Compare(const wxDataViewItem& item1, | |
346 | const wxDataViewItem& item2, | |
347 | unsigned int column, bool ascending); | |
348 | ||
349 | /** | |
13f184c0 | 350 | Override this to indicate that the row has special font attributes. |
c4e57202 FM |
351 | This only affects the wxDataViewTextRendererText() renderer. |
352 | ||
7fadac88 VZ |
353 | The base class version always simply returns @false. |
354 | ||
c4e57202 | 355 | @see wxDataViewItemAttr. |
7fadac88 VZ |
356 | |
357 | @param row | |
358 | The row for which the attribute is requested. | |
359 | @param col | |
360 | The column for which the attribute is requested. | |
361 | @param attr | |
362 | The attribute to be filled in if the function returns @true. | |
363 | @return | |
364 | @true if this item has an attribute or @false otherwise. | |
e39de702 | 365 | */ |
8eff6c56 | 366 | virtual bool GetAttrByRow(unsigned int row, unsigned int col, |
7fadac88 | 367 | wxDataViewItemAttr& attr) const; |
e39de702 | 368 | |
74d9b8fb VZ |
369 | /** |
370 | Returns the number of items (i.e. rows) in the list. | |
371 | */ | |
372 | unsigned int GetCount() const; | |
373 | ||
e39de702 RR |
374 | /** |
375 | Returns the wxDataViewItem at the given @e row. | |
376 | */ | |
377 | wxDataViewItem GetItem(unsigned int row) const; | |
378 | ||
379 | /** | |
380 | Returns the position of given @e item. | |
381 | */ | |
382 | unsigned int GetRow(const wxDataViewItem& item) const; | |
383 | ||
384 | /** | |
385 | Override this to allow getting values from the model. | |
386 | */ | |
8eff6c56 | 387 | virtual void GetValueByRow(wxVariant& variant, unsigned int row, |
fadc2df6 | 388 | unsigned int col) const = 0; |
e39de702 RR |
389 | |
390 | /** | |
c4e57202 FM |
391 | Call this after if the data has to be read again from the model. |
392 | This is useful after major changes when calling the methods below | |
393 | (possibly thousands of times) doesn't make sense. | |
e39de702 RR |
394 | */ |
395 | void Reset(unsigned int new_size); | |
396 | ||
397 | /** | |
398 | Call this after a row has been appended to the model. | |
399 | */ | |
400 | void RowAppended(); | |
401 | ||
402 | /** | |
403 | Call this after a row has been changed. | |
404 | */ | |
405 | void RowChanged(unsigned int row); | |
406 | ||
407 | /** | |
408 | Call this after a row has been deleted. | |
409 | */ | |
410 | void RowDeleted(unsigned int row); | |
411 | ||
412 | /** | |
413 | Call this after a row has been inserted at the given position. | |
414 | */ | |
415 | void RowInserted(unsigned int before); | |
416 | ||
417 | /** | |
418 | Call this after a row has been prepended to the model. | |
419 | */ | |
420 | void RowPrepended(); | |
421 | ||
422 | /** | |
423 | Call this after a value has been changed. | |
424 | */ | |
425 | void RowValueChanged(unsigned int row, unsigned int col); | |
426 | ||
427 | /** | |
c4e57202 FM |
428 | Call this after rows have been deleted. |
429 | The array will internally get copied and sorted in descending order so | |
430 | that the rows with the highest position will be deleted first. | |
e39de702 RR |
431 | */ |
432 | void RowsDeleted(const wxArrayInt& rows); | |
433 | ||
434 | /** | |
435 | Called in order to set a value in the model. | |
436 | */ | |
8eff6c56 | 437 | virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, |
fadc2df6 | 438 | unsigned int col) = 0; |
e39de702 RR |
439 | }; |
440 | ||
441 | ||
442 | ||
443 | /** | |
444 | @class wxDataViewVirtualListModel | |
e39de702 | 445 | |
c4e57202 FM |
446 | wxDataViewVirtualListModel is a specialized data model which lets you address |
447 | an item by its position (row) rather than its wxDataViewItem and as such offers | |
448 | the exact same interface as wxDataViewIndexListModel. | |
449 | The important difference is that under platforms other than OS X, using this | |
450 | model will result in a truly virtual control able to handle millions of items | |
451 | as the control doesn't store any item (a feature not supported by the | |
e39de702 RR |
452 | Carbon API under OS X). |
453 | ||
454 | @see wxDataViewIndexListModel for the API. | |
455 | ||
8ed522d9 | 456 | @library{wxadv} |
b321b61c | 457 | @category{dvc} |
e39de702 RR |
458 | */ |
459 | class wxDataViewVirtualListModel : public wxDataViewModel | |
460 | { | |
461 | public: | |
462 | /** | |
463 | Constructor. | |
464 | */ | |
465 | wxDataViewVirtualListModel(unsigned int initial_size = 0); | |
74d9b8fb VZ |
466 | |
467 | /** | |
468 | Returns the number of virtual items (i.e. rows) in the list. | |
469 | */ | |
470 | unsigned int GetCount() const; | |
6da3d196 | 471 | }; |
e39de702 RR |
472 | |
473 | ||
474 | ||
23324ae1 FM |
475 | /** |
476 | @class wxDataViewItemAttr | |
7c913512 | 477 | |
c4e57202 FM |
478 | This class is used to indicate to a wxDataViewCtrl that a certain item |
479 | (see wxDataViewItem) has extra font attributes for its renderer. | |
480 | For this, it is required to override wxDataViewModel::GetAttr. | |
7c913512 | 481 | |
c4e57202 | 482 | Attributes are currently only supported by wxDataViewTextRendererText. |
7c913512 | 483 | |
23324ae1 | 484 | @library{wxadv} |
b321b61c | 485 | @category{dvc} |
23324ae1 | 486 | */ |
7c913512 | 487 | class wxDataViewItemAttr |
23324ae1 FM |
488 | { |
489 | public: | |
490 | /** | |
491 | Constructor. | |
492 | */ | |
493 | wxDataViewItemAttr(); | |
494 | ||
495 | /** | |
496 | Call this to indicate that the item shall be displayed in bold text. | |
497 | */ | |
498 | void SetBold(bool set); | |
499 | ||
500 | /** | |
c4e57202 | 501 | Call this to indicate that the item shall be displayed with that colour. |
23324ae1 FM |
502 | */ |
503 | void SetColour(const wxColour& colour); | |
504 | ||
505 | /** | |
506 | Call this to indicate that the item shall be displayed in italic text. | |
507 | */ | |
508 | void SetItalic(bool set); | |
509 | }; | |
510 | ||
511 | ||
e54c96f1 | 512 | |
23324ae1 FM |
513 | /** |
514 | @class wxDataViewItem | |
7c913512 | 515 | |
c4e57202 | 516 | wxDataViewItem is a small opaque class that represents an item in a wxDataViewCtrl |
fe45d6ff | 517 | in a persistent way, i.e. independent of the position of the item in the control |
c4e57202 FM |
518 | or changes to its contents. |
519 | ||
520 | It must hold a unique ID of type @e void* in its only field and can be converted | |
521 | to and from it. | |
522 | ||
523 | If the ID is @NULL the wxDataViewItem is invalid and wxDataViewItem::IsOk will | |
524 | return @false which used in many places in the API of wxDataViewCtrl to | |
525 | indicate that e.g. no item was found. An ID of @NULL is also used to indicate | |
526 | the invisible root. Examples for this are wxDataViewModel::GetParent and | |
23324ae1 | 527 | wxDataViewModel::GetChildren. |
7c913512 | 528 | |
23324ae1 | 529 | @library{wxadv} |
b321b61c | 530 | @category{dvc} |
23324ae1 | 531 | */ |
7c913512 | 532 | class wxDataViewItem |
23324ae1 FM |
533 | { |
534 | public: | |
535 | //@{ | |
536 | /** | |
c4e57202 | 537 | Constructor. |
23324ae1 | 538 | */ |
4cc4bfaf | 539 | wxDataViewItem(void* id = NULL); |
7c913512 | 540 | wxDataViewItem(const wxDataViewItem& item); |
23324ae1 FM |
541 | //@} |
542 | ||
543 | /** | |
544 | Returns the ID. | |
545 | */ | |
328f5751 | 546 | void* GetID() const; |
23324ae1 FM |
547 | |
548 | /** | |
c4e57202 | 549 | Returns @true if the ID is not @NULL. |
23324ae1 | 550 | */ |
328f5751 | 551 | bool IsOk() const; |
23324ae1 FM |
552 | }; |
553 | ||
554 | ||
e54c96f1 | 555 | |
23324ae1 FM |
556 | /** |
557 | @class wxDataViewCtrl | |
7c913512 | 558 | |
c4e57202 FM |
559 | wxDataViewCtrl is a control to display data either in a tree like fashion or |
560 | in a tabular form or both. | |
02b51ae5 | 561 | |
c4e57202 FM |
562 | If you only need to display a simple tree structure with an API more like the |
563 | older wxTreeCtrl class, then the specialized wxDataViewTreeCtrl can be used. | |
02b51ae5 | 564 | Likewise, if you only want to display simple table structure you can use |
832df171 RR |
565 | the specialized wxDataViewListCtrl class. Both wxDataViewTreeCtrl and |
566 | wxDataViewListCtrl can be used without defining your own wxDataViewModel. | |
c4e57202 FM |
567 | |
568 | A wxDataViewItem is used to represent a (visible) item in the control. | |
569 | ||
80932a3e | 570 | Unlike wxListCtrl, wxDataViewCtrl doesn't get its data from the user through |
c4e57202 FM |
571 | virtual functions or by setting it directly. Instead you need to write your own |
572 | wxDataViewModel and associate it with this control. | |
573 | Then you need to add a number of wxDataViewColumn to this control to define | |
574 | what each column shall display. Each wxDataViewColumn in turn owns 1 instance | |
575 | of a wxDataViewRenderer to render its cells. | |
576 | ||
577 | A number of standard renderers for rendering text, dates, images, toggle, | |
578 | a progress bar etc. are provided. Additionally, the user can write custom | |
80932a3e | 579 | renderers deriving from wxDataViewCustomRenderer for displaying anything. |
c4e57202 FM |
580 | |
581 | All data transfer from the control to the model and the user code is done | |
582 | through wxVariant which can be extended to support more data formats as necessary. | |
583 | Accordingly, all type information uses the strings returned from wxVariant::GetType. | |
7c913512 | 584 | |
23324ae1 | 585 | @beginStyleTable |
8c6791e4 | 586 | @style{wxDV_SINGLE} |
23324ae1 | 587 | Single selection mode. This is the default. |
8c6791e4 | 588 | @style{wxDV_MULTIPLE} |
23324ae1 | 589 | Multiple selection mode. |
8c6791e4 | 590 | @style{wxDV_ROW_LINES} |
23324ae1 | 591 | Use alternating colours for rows if supported by platform and theme. |
8c6791e4 | 592 | @style{wxDV_HORIZ_RULES} |
23324ae1 | 593 | Display fine rules between row if supported. |
8c6791e4 | 594 | @style{wxDV_VERT_RULES} |
23324ae1 | 595 | Display fine rules between columns is supported. |
d7c6d397 | 596 | @style{wxDV_VARIABLE_LINE_HEIGHT} |
c4e57202 | 597 | Allow variable line heights. |
14f73cf1 | 598 | This can be inefficient when displaying large number of items. |
b5123fb6 VZ |
599 | @style{wxDV_NO_HEADER} |
600 | Do not show column headers (which are shown by default). | |
23324ae1 | 601 | @endStyleTable |
7c913512 | 602 | |
3051a44a | 603 | @beginEventEmissionTable{wxDataViewEvent} |
7d01d660 | 604 | @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)} |
14f73cf1 | 605 | Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event. |
7d01d660 | 606 | @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)} |
14f73cf1 | 607 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. |
3e978cf7 RR |
608 | @event{EVT_DATAVIEW_ITEM_START_EDITING(id, func)} |
609 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. This | |
610 | event can be vetoed in order to prevent editing on an item by item | |
611 | basis. Still experimental. | |
7d01d660 | 612 | @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)} |
14f73cf1 | 613 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. |
7d01d660 | 614 | @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)} |
14f73cf1 | 615 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event. |
7d01d660 | 616 | @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)} |
14f73cf1 | 617 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event. |
7d01d660 | 618 | @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)} |
14f73cf1 | 619 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event. |
7d01d660 | 620 | @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)} |
14f73cf1 | 621 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event. |
7d01d660 | 622 | @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)} |
14f73cf1 | 623 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event. |
7d01d660 | 624 | @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)} |
14f73cf1 | 625 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event. |
7d01d660 | 626 | @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)} |
14f73cf1 | 627 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event. |
7d01d660 | 628 | @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)} |
14f73cf1 | 629 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event. |
7d01d660 | 630 | @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)} |
14f73cf1 | 631 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event. |
7d01d660 | 632 | @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)} |
14f73cf1 | 633 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event. |
7d01d660 | 634 | @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)} |
14f73cf1 | 635 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event. |
591cc82d | 636 | @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)} |
14f73cf1 | 637 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event. |
e4de825e | 638 | @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)} |
14f73cf1 | 639 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event. |
e4de825e | 640 | @event{EVT_DATAVIEW_ITEM_DROP(id, func)} |
14f73cf1 | 641 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event. |
7d01d660 | 642 | @endEventTable |
b91c4601 | 643 | |
23324ae1 | 644 | @library{wxadv} |
b321b61c | 645 | @category{ctrl,dvc} |
7e59b885 | 646 | @appearance{dataviewctrl.png} |
23324ae1 FM |
647 | */ |
648 | class wxDataViewCtrl : public wxControl | |
649 | { | |
650 | public: | |
23324ae1 | 651 | /** |
19723525 | 652 | Default Constructor. |
23324ae1 FM |
653 | */ |
654 | wxDataViewCtrl(); | |
b91c4601 | 655 | |
19723525 RR |
656 | /** |
657 | Constructor. Calls Create(). | |
658 | */ | |
7c913512 FM |
659 | wxDataViewCtrl(wxWindow* parent, wxWindowID id, |
660 | const wxPoint& pos = wxDefaultPosition, | |
661 | const wxSize& size = wxDefaultSize, | |
662 | long style = 0, | |
663 | const wxValidator& validator = wxDefaultValidator); | |
23324ae1 FM |
664 | |
665 | /** | |
666 | Destructor. | |
667 | */ | |
adaaa686 | 668 | virtual ~wxDataViewCtrl(); |
23324ae1 | 669 | |
e39de702 | 670 | /** |
19723525 | 671 | Appends a wxDataViewColumn to the control. Returns @true on success. |
c4e57202 | 672 | |
e39de702 RR |
673 | Note that there is a number of short cut methods which implicitly create |
674 | a wxDataViewColumn and a wxDataViewRenderer for it (see below). | |
675 | */ | |
676 | virtual bool AppendColumn(wxDataViewColumn* col); | |
677 | ||
19723525 RR |
678 | /** |
679 | Prepends a wxDataViewColumn to the control. Returns @true on success. | |
c4e57202 | 680 | |
19723525 RR |
681 | Note that there is a number of short cut methods which implicitly create |
682 | a wxDataViewColumn and a wxDataViewRenderer for it. | |
683 | */ | |
684 | virtual bool PrependColumn(wxDataViewColumn* col); | |
685 | ||
686 | /** | |
687 | Inserts a wxDataViewColumn to the control. Returns @true on success. | |
688 | */ | |
689 | virtual bool InsertColumn(unsigned int pos, wxDataViewColumn* col); | |
b91c4601 | 690 | |
23324ae1 FM |
691 | //@{ |
692 | /** | |
693 | Appends a column for rendering a bitmap. Returns the wxDataViewColumn | |
694 | created in the function or @NULL on failure. | |
695 | */ | |
696 | wxDataViewColumn* AppendBitmapColumn(const wxString& label, | |
697 | unsigned int model_column, | |
698 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
699 | int width = -1, | |
700 | wxAlignment align = wxALIGN_CENTER, | |
701 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
702 | wxDataViewColumn* AppendBitmapColumn(const wxBitmap& label, |
703 | unsigned int model_column, | |
704 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
705 | int width = -1, | |
706 | wxAlignment align = wxALIGN_CENTER, | |
707 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
708 | //@} |
709 | ||
23324ae1 FM |
710 | //@{ |
711 | /** | |
712 | Appends a column for rendering a date. Returns the wxDataViewColumn | |
713 | created in the function or @NULL on failure. | |
b91c4601 | 714 | |
c4e57202 FM |
715 | @note The @a align parameter is applied to both the column header and |
716 | the column renderer. | |
23324ae1 FM |
717 | */ |
718 | wxDataViewColumn* AppendDateColumn(const wxString& label, | |
719 | unsigned int model_column, | |
720 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
721 | int width = -1, | |
882678eb | 722 | wxAlignment align = wxALIGN_NOT, |
23324ae1 | 723 | int flags = wxDATAVIEW_COL_RESIZABLE); |
7c913512 FM |
724 | wxDataViewColumn* AppendDateColumn(const wxBitmap& label, |
725 | unsigned int model_column, | |
726 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
727 | int width = -1, | |
882678eb | 728 | wxAlignment align = wxALIGN_NOT, |
7c913512 | 729 | int flags = wxDATAVIEW_COL_RESIZABLE); |
23324ae1 FM |
730 | //@} |
731 | ||
732 | //@{ | |
733 | /** | |
734 | Appends a column for rendering text with an icon. Returns the wxDataViewColumn | |
c4e57202 FM |
735 | created in the function or @NULL on failure. |
736 | This method uses the wxDataViewIconTextRenderer class. | |
b91c4601 | 737 | |
c4e57202 FM |
738 | @note The @a align parameter is applied to both the column header and |
739 | the column renderer. | |
23324ae1 FM |
740 | */ |
741 | wxDataViewColumn* AppendIconTextColumn(const wxString& label, | |
742 | unsigned int model_column, | |
743 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
744 | int width = -1, | |
882678eb | 745 | wxAlignment align = wxALIGN_NOT, |
23324ae1 | 746 | int flags = wxDATAVIEW_COL_RESIZABLE); |
7c913512 FM |
747 | wxDataViewColumn* AppendIconTextColumn(const wxBitmap& label, |
748 | unsigned int model_column, | |
749 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
750 | int width = -1, | |
882678eb | 751 | wxAlignment align = wxALIGN_NOT, |
7c913512 | 752 | int flags = wxDATAVIEW_COL_RESIZABLE); |
23324ae1 FM |
753 | //@} |
754 | ||
755 | //@{ | |
756 | /** | |
757 | Appends a column for rendering a progress indicator. Returns the | |
e39de702 | 758 | wxDataViewColumn created in the function or @NULL on failure. |
b91c4601 | 759 | |
c4e57202 FM |
760 | @note The @a align parameter is applied to both the column header and |
761 | the column renderer. | |
23324ae1 FM |
762 | */ |
763 | wxDataViewColumn* AppendProgressColumn(const wxString& label, | |
764 | unsigned int model_column, | |
765 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
766 | int width = 80, | |
767 | wxAlignment align = wxALIGN_CENTER, | |
768 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
769 | wxDataViewColumn* AppendProgressColumn(const wxBitmap& label, |
770 | unsigned int model_column, | |
771 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
772 | int width = 80, | |
773 | wxAlignment align = wxALIGN_CENTER, | |
774 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
775 | //@} |
776 | ||
777 | //@{ | |
778 | /** | |
779 | Appends a column for rendering text. Returns the wxDataViewColumn | |
780 | created in the function or @NULL on failure. | |
b91c4601 | 781 | |
c4e57202 FM |
782 | @note The @a align parameter is applied to both the column header and |
783 | the column renderer. | |
23324ae1 FM |
784 | */ |
785 | wxDataViewColumn* AppendTextColumn(const wxString& label, | |
786 | unsigned int model_column, | |
787 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
788 | int width = -1, | |
882678eb | 789 | wxAlignment align = wxALIGN_NOT, |
23324ae1 | 790 | int flags = wxDATAVIEW_COL_RESIZABLE); |
7c913512 FM |
791 | wxDataViewColumn* AppendTextColumn(const wxBitmap& label, |
792 | unsigned int model_column, | |
793 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
794 | int width = -1, | |
882678eb | 795 | wxAlignment align = wxALIGN_NOT, |
7c913512 | 796 | int flags = wxDATAVIEW_COL_RESIZABLE); |
23324ae1 FM |
797 | //@} |
798 | ||
799 | //@{ | |
800 | /** | |
801 | Appends a column for rendering a toggle. Returns the wxDataViewColumn | |
802 | created in the function or @NULL on failure. | |
b91c4601 | 803 | |
c4e57202 FM |
804 | @note The @a align parameter is applied to both the column header and |
805 | the column renderer. | |
23324ae1 FM |
806 | */ |
807 | wxDataViewColumn* AppendToggleColumn(const wxString& label, | |
808 | unsigned int model_column, | |
809 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
810 | int width = 30, | |
811 | wxAlignment align = wxALIGN_CENTER, | |
812 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
813 | wxDataViewColumn* AppendToggleColumn(const wxBitmap& label, |
814 | unsigned int model_column, | |
815 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
816 | int width = 30, | |
817 | wxAlignment align = wxALIGN_CENTER, | |
818 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
819 | //@} |
820 | ||
821 | /** | |
c4e57202 FM |
822 | Associates a wxDataViewModel with the control. |
823 | This increases the reference count of the model by 1. | |
23324ae1 FM |
824 | */ |
825 | virtual bool AssociateModel(wxDataViewModel* model); | |
826 | ||
827 | /** | |
828 | Removes all columns. | |
829 | */ | |
830 | virtual bool ClearColumns(); | |
831 | ||
23324ae1 FM |
832 | /** |
833 | Collapses the item. | |
834 | */ | |
adaaa686 | 835 | virtual void Collapse(const wxDataViewItem& item); |
23324ae1 FM |
836 | |
837 | /** | |
838 | Create the control. Useful for two step creation. | |
839 | */ | |
840 | bool Create(wxWindow* parent, wxWindowID id, | |
841 | const wxPoint& pos = wxDefaultPosition, | |
842 | const wxSize& size = wxDefaultSize, | |
843 | long style = 0, | |
844 | const wxValidator& validator = wxDefaultValidator); | |
845 | ||
846 | /** | |
847 | Deletes given column. | |
848 | */ | |
50ec54b6 | 849 | virtual bool DeleteColumn(wxDataViewColumn* column); |
23324ae1 | 850 | |
e4de825e RR |
851 | /** |
852 | Enable drag operations using the given @a format. | |
853 | */ | |
854 | virtual bool EnableDragSource( const wxDataFormat &format ); | |
02b51ae5 | 855 | |
e4de825e RR |
856 | /** |
857 | Enable drop operations using the given @a format. | |
858 | */ | |
859 | virtual bool EnableDropTarget( const wxDataFormat &format ); | |
02b51ae5 | 860 | |
23324ae1 FM |
861 | /** |
862 | Call this to ensure that the given item is visible. | |
863 | */ | |
fadc2df6 FM |
864 | virtual void EnsureVisible(const wxDataViewItem& item, |
865 | const wxDataViewColumn* column = NULL); | |
23324ae1 FM |
866 | |
867 | /** | |
868 | Expands the item. | |
869 | */ | |
adaaa686 | 870 | virtual void Expand(const wxDataViewItem& item); |
23324ae1 | 871 | |
4219d8b0 RR |
872 | /** |
873 | Expands all ancestors of the @a item. This method also | |
874 | ensures that the item itself as well as all ancestor | |
875 | items have been read from the model by the control. | |
876 | */ | |
877 | virtual void ExpandAncestors( const wxDataViewItem & item ); | |
798c0d87 | 878 | |
23324ae1 | 879 | /** |
c4e57202 FM |
880 | Returns pointer to the column. @a pos refers to the position in the |
881 | control which may change after reordering columns by the user. | |
23324ae1 | 882 | */ |
328f5751 | 883 | virtual wxDataViewColumn* GetColumn(unsigned int pos) const; |
23324ae1 FM |
884 | |
885 | /** | |
886 | Returns the number of columns. | |
887 | */ | |
328f5751 | 888 | virtual unsigned int GetColumnCount() const; |
23324ae1 FM |
889 | |
890 | /** | |
891 | Returns the position of the column or -1 if not found in the control. | |
892 | */ | |
328f5751 | 893 | virtual int GetColumnPosition(const wxDataViewColumn* column) const; |
23324ae1 FM |
894 | |
895 | /** | |
896 | Returns column containing the expanders. | |
897 | */ | |
328f5751 | 898 | wxDataViewColumn* GetExpanderColumn() const; |
23324ae1 FM |
899 | |
900 | /** | |
901 | Returns indentation. | |
902 | */ | |
328f5751 | 903 | int GetIndent() const; |
23324ae1 FM |
904 | |
905 | /** | |
906 | Returns item rect. | |
907 | */ | |
fadc2df6 FM |
908 | virtual wxRect GetItemRect(const wxDataViewItem& item, |
909 | const wxDataViewColumn* col = NULL) const; | |
23324ae1 FM |
910 | |
911 | /** | |
c4e57202 | 912 | Returns pointer to the data model associated with the control (if any). |
23324ae1 | 913 | */ |
adaaa686 | 914 | wxDataViewModel* GetModel(); |
23324ae1 FM |
915 | |
916 | /** | |
917 | Returns first selected item or an invalid item if none is selected. | |
918 | */ | |
adaaa686 | 919 | virtual wxDataViewItem GetSelection() const; |
23324ae1 FM |
920 | |
921 | /** | |
c4e57202 | 922 | Fills @a sel with currently selected items and returns their number. |
23324ae1 | 923 | */ |
adaaa686 | 924 | virtual int GetSelections(wxDataViewItemArray& sel) const; |
23324ae1 FM |
925 | |
926 | /** | |
927 | Returns the wxDataViewColumn currently responsible for sorting | |
928 | or @NULL if none has been selected. | |
929 | */ | |
328f5751 | 930 | virtual wxDataViewColumn* GetSortingColumn() const; |
23324ae1 FM |
931 | |
932 | /** | |
933 | Hittest. | |
934 | */ | |
fadc2df6 FM |
935 | virtual void HitTest(const wxPoint& point, wxDataViewItem& item, |
936 | wxDataViewColumn*& col) const; | |
23324ae1 | 937 | |
739a8399 RR |
938 | /** |
939 | Return @true if the item is expanded. | |
739a8399 RR |
940 | */ |
941 | virtual bool IsExpanded(const wxDataViewItem& item) const; | |
942 | ||
23324ae1 FM |
943 | /** |
944 | Return @true if the item is selected. | |
945 | */ | |
adaaa686 | 946 | virtual bool IsSelected(const wxDataViewItem& item) const; |
23324ae1 FM |
947 | |
948 | /** | |
949 | Select the given item. | |
950 | */ | |
adaaa686 | 951 | virtual void Select(const wxDataViewItem& item); |
23324ae1 FM |
952 | |
953 | /** | |
954 | Select all items. | |
955 | */ | |
adaaa686 | 956 | virtual void SelectAll(); |
23324ae1 FM |
957 | |
958 | /** | |
959 | Set which column shall contain the tree-like expanders. | |
960 | */ | |
4cc4bfaf | 961 | void SetExpanderColumn(wxDataViewColumn* col); |
23324ae1 FM |
962 | |
963 | /** | |
964 | Sets the indendation. | |
965 | */ | |
966 | void SetIndent(int indent); | |
967 | ||
968 | /** | |
969 | Sets the selection to the array of wxDataViewItems. | |
970 | */ | |
adaaa686 | 971 | virtual void SetSelections(const wxDataViewItemArray& sel); |
23324ae1 FM |
972 | |
973 | /** | |
974 | Unselect the given item. | |
975 | */ | |
adaaa686 | 976 | virtual void Unselect(const wxDataViewItem& item); |
23324ae1 FM |
977 | |
978 | /** | |
c4e57202 FM |
979 | Unselect all item. |
980 | This method only has effect if multiple selections are allowed. | |
23324ae1 | 981 | */ |
adaaa686 | 982 | virtual void UnselectAll(); |
23324ae1 FM |
983 | }; |
984 | ||
985 | ||
e54c96f1 | 986 | |
23324ae1 FM |
987 | /** |
988 | @class wxDataViewModelNotifier | |
7c913512 | 989 | |
c4e57202 FM |
990 | A wxDataViewModelNotifier instance is owned by a wxDataViewModel and mirrors |
991 | its notification interface. | |
992 | See the documentation of that class for further information. | |
7c913512 | 993 | |
8ed522d9 | 994 | @library{wxadv} |
b321b61c | 995 | @category{dvc} |
23324ae1 | 996 | */ |
7c913512 | 997 | class wxDataViewModelNotifier |
23324ae1 FM |
998 | { |
999 | public: | |
1000 | /** | |
1001 | Constructor. | |
1002 | */ | |
1003 | wxDataViewModelNotifier(); | |
1004 | ||
1005 | /** | |
1006 | Destructor. | |
1007 | */ | |
adaaa686 | 1008 | virtual ~wxDataViewModelNotifier(); |
23324ae1 FM |
1009 | |
1010 | /** | |
1011 | Called by owning model. | |
1012 | */ | |
b91c4601 | 1013 | virtual bool Cleared() = 0; |
23324ae1 FM |
1014 | |
1015 | /** | |
1016 | Get owning wxDataViewModel. | |
1017 | */ | |
e51bf699 | 1018 | wxDataViewModel* GetOwner() const; |
23324ae1 FM |
1019 | |
1020 | /** | |
1021 | Called by owning model. | |
1022 | */ | |
fadc2df6 FM |
1023 | virtual bool ItemAdded(const wxDataViewItem& parent, |
1024 | const wxDataViewItem& item) = 0; | |
23324ae1 FM |
1025 | |
1026 | /** | |
1027 | Called by owning model. | |
1028 | */ | |
b91c4601 | 1029 | virtual bool ItemChanged(const wxDataViewItem& item) = 0; |
23324ae1 FM |
1030 | |
1031 | /** | |
1032 | Called by owning model. | |
1033 | */ | |
fadc2df6 FM |
1034 | virtual bool ItemDeleted(const wxDataViewItem& parent, |
1035 | const wxDataViewItem& item) = 0; | |
23324ae1 FM |
1036 | |
1037 | /** | |
1038 | Called by owning model. | |
1039 | */ | |
fadc2df6 FM |
1040 | virtual bool ItemsAdded(const wxDataViewItem& parent, |
1041 | const wxDataViewItemArray& items); | |
23324ae1 FM |
1042 | |
1043 | /** | |
1044 | Called by owning model. | |
1045 | */ | |
adaaa686 | 1046 | virtual bool ItemsChanged(const wxDataViewItemArray& items); |
23324ae1 FM |
1047 | |
1048 | /** | |
1049 | Called by owning model. | |
1050 | */ | |
fadc2df6 FM |
1051 | virtual bool ItemsDeleted(const wxDataViewItem& parent, |
1052 | const wxDataViewItemArray& items); | |
23324ae1 FM |
1053 | |
1054 | /** | |
1055 | Called by owning model. | |
1056 | */ | |
b91c4601 | 1057 | virtual void Resort() = 0; |
23324ae1 FM |
1058 | |
1059 | /** | |
1060 | Set owner of this notifier. Used internally. | |
1061 | */ | |
1062 | void SetOwner(wxDataViewModel* owner); | |
1063 | ||
1064 | /** | |
1065 | Called by owning model. | |
1066 | */ | |
b91c4601 | 1067 | virtual bool ValueChanged(const wxDataViewItem& item, unsigned int col) = 0; |
23324ae1 FM |
1068 | }; |
1069 | ||
1070 | ||
c4e57202 FM |
1071 | /** |
1072 | The mode of a data-view cell; see wxDataViewRenderer for more info. | |
1073 | */ | |
1074 | enum wxDataViewCellMode | |
1075 | { | |
1076 | wxDATAVIEW_CELL_INERT, | |
1077 | ||
1078 | /** | |
1079 | Indicates that the user can double click the cell and something will | |
1080 | happen (e.g. a window for editing a date will pop up). | |
1081 | */ | |
1082 | wxDATAVIEW_CELL_ACTIVATABLE, | |
1083 | ||
1084 | /** | |
1085 | Indicates that the user can edit the data in-place, i.e. an control | |
1086 | will show up after a slow click on the cell. This behaviour is best | |
1087 | known from changing the filename in most file managers etc. | |
1088 | */ | |
1089 | wxDATAVIEW_CELL_EDITABLE | |
1090 | }; | |
1091 | ||
1092 | /** | |
1093 | The values of this enum controls how a wxDataViewRenderer should display | |
1094 | its contents in a cell. | |
1095 | */ | |
1096 | enum wxDataViewCellRenderState | |
1097 | { | |
1098 | wxDATAVIEW_CELL_SELECTED = 1, | |
1099 | wxDATAVIEW_CELL_PRELIT = 2, | |
1100 | wxDATAVIEW_CELL_INSENSITIVE = 4, | |
1101 | wxDATAVIEW_CELL_FOCUSED = 8 | |
1102 | }; | |
e54c96f1 | 1103 | |
23324ae1 FM |
1104 | /** |
1105 | @class wxDataViewRenderer | |
7c913512 | 1106 | |
5b99d5d8 | 1107 | This class is used by wxDataViewCtrl to render the individual cells. |
c4e57202 FM |
1108 | One instance of a renderer class is owned by a wxDataViewColumn. |
1109 | There is a number of ready-to-use renderers provided: | |
1110 | - wxDataViewTextRenderer, | |
c4e57202 FM |
1111 | - wxDataViewIconTextRenderer, |
1112 | - wxDataViewToggleRenderer, | |
1113 | - wxDataViewProgressRenderer, | |
1114 | - wxDataViewBitmapRenderer, | |
1115 | - wxDataViewDateRenderer, | |
1116 | - wxDataViewSpinRenderer. | |
f4fcd648 | 1117 | - wxDataViewChoiceRenderer. |
7c913512 | 1118 | |
23324ae1 FM |
1119 | Additionally, the user can write own renderers by deriving from |
1120 | wxDataViewCustomRenderer. | |
7c913512 | 1121 | |
c4e57202 FM |
1122 | The ::wxDataViewCellMode and ::wxDataViewCellRenderState flags accepted |
1123 | by the constructors respectively controls what actions the cell data allows | |
1124 | and how the renderer should display its contents in a cell. | |
7c913512 | 1125 | |
23324ae1 | 1126 | @library{wxadv} |
b321b61c | 1127 | @category{dvc} |
23324ae1 FM |
1128 | */ |
1129 | class wxDataViewRenderer : public wxObject | |
1130 | { | |
1131 | public: | |
1132 | /** | |
b91c4601 | 1133 | Constructor. |
23324ae1 FM |
1134 | */ |
1135 | wxDataViewRenderer(const wxString& varianttype, | |
1136 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
f2b7492a | 1137 | int align = wxDVR_DEFAULT_ALIGNMENT ); |
23324ae1 | 1138 | |
c937bcac VZ |
1139 | /** |
1140 | Enable or disable replacing parts of the item text with ellipsis to | |
1141 | make it fit the column width. | |
1142 | ||
1143 | This method only makes sense for the renderers working with text, such | |
1144 | as wxDataViewTextRenderer or wxDataViewIconTextRenderer. | |
1145 | ||
1146 | By default wxELLIPSIZE_MIDDLE is used. | |
1147 | ||
1148 | @param mode | |
1149 | Ellipsization mode, use wxELLIPSIZE_NONE to disable. | |
1150 | ||
1151 | @since 2.9.1 | |
1152 | */ | |
1153 | void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE); | |
1154 | ||
1155 | /** | |
1156 | Disable replacing parts of the item text with ellipsis. | |
1157 | ||
1158 | If ellipsizing is disabled, the string will be truncated if it doesn't | |
1159 | fit. | |
1160 | ||
1161 | This is the same as @code EnableEllipsize(wxELLIPSIZE_NONE) @endcode. | |
1162 | ||
1163 | @since 2.9.1 | |
1164 | */ | |
1165 | void DisableEllipsize(); | |
1166 | ||
20c36737 | 1167 | /** |
f2b7492a | 1168 | Returns the alignment. See SetAlignment() |
20c36737 RR |
1169 | */ |
1170 | virtual int GetAlignment() const; | |
1171 | ||
c937bcac VZ |
1172 | /** |
1173 | Returns the ellipsize mode used by the renderer. | |
1174 | ||
1175 | If the return value is wxELLIPSIZE_NONE, the text is simply truncated | |
1176 | if it doesn't fit. | |
1177 | ||
1178 | @see EnableEllipsize() | |
1179 | */ | |
1180 | wxEllipsizeMode GetEllipsizeMode() const; | |
1181 | ||
23324ae1 FM |
1182 | /** |
1183 | Returns the cell mode. | |
1184 | */ | |
adaaa686 | 1185 | virtual wxDataViewCellMode GetMode() const; |
23324ae1 FM |
1186 | |
1187 | /** | |
1188 | Returns pointer to the owning wxDataViewColumn. | |
1189 | */ | |
adaaa686 | 1190 | wxDataViewColumn* GetOwner() const; |
23324ae1 FM |
1191 | |
1192 | /** | |
1193 | This methods retrieves the value from the renderer in order to | |
c4e57202 FM |
1194 | transfer the value back to the data model. |
1195 | ||
1196 | Returns @false on failure. | |
23324ae1 | 1197 | */ |
b91c4601 | 1198 | virtual bool GetValue(wxVariant& value) const = 0; |
23324ae1 FM |
1199 | |
1200 | /** | |
c4e57202 | 1201 | Returns a string with the type of the wxVariant supported by this renderer. |
23324ae1 | 1202 | */ |
adaaa686 | 1203 | wxString GetVariantType() const; |
23324ae1 | 1204 | |
20c36737 | 1205 | /** |
c4e57202 FM |
1206 | Sets the alignment of the renderer's content. |
1207 | The default value of @c wxDVR_DEFAULT_ALIGMENT indicates that the content | |
1208 | should have the same alignment as the column header. | |
1209 | ||
1210 | The method is not implemented under OS X and the renderer always aligns | |
1211 | its contents as the column header on that platform. The other platforms | |
f2b7492a | 1212 | support both vertical and horizontal alignment. |
20c36737 RR |
1213 | */ |
1214 | virtual void SetAlignment( int align ); | |
23324ae1 | 1215 | /** |
c4e57202 FM |
1216 | Sets the owning wxDataViewColumn. |
1217 | This is usually called from within wxDataViewColumn. | |
23324ae1 | 1218 | */ |
adaaa686 | 1219 | void SetOwner(wxDataViewColumn* owner); |
23324ae1 FM |
1220 | |
1221 | /** | |
c4e57202 | 1222 | Set the value of the renderer (and thus its cell) to @a value. |
23324ae1 FM |
1223 | The internal code will then render this cell with this data. |
1224 | */ | |
b91c4601 | 1225 | virtual bool SetValue(const wxVariant& value) = 0; |
23324ae1 FM |
1226 | |
1227 | /** | |
1228 | Before data is committed to the data model, it is passed to this | |
1229 | method where it can be checked for validity. This can also be | |
1230 | used for checking a valid range or limiting the user input in | |
1231 | a certain aspect (e.g. max number of characters or only alphanumeric | |
c4e57202 FM |
1232 | input, ASCII only etc.). Return @false if the value is not valid. |
1233 | ||
23324ae1 FM |
1234 | Please note that due to implementation limitations, this validation |
1235 | is done after the editing control already is destroyed and the | |
1236 | editing process finished. | |
1237 | */ | |
1238 | virtual bool Validate(wxVariant& value); | |
1239 | }; | |
1240 | ||
1241 | ||
e54c96f1 | 1242 | |
23324ae1 FM |
1243 | /** |
1244 | @class wxDataViewTextRenderer | |
7c913512 | 1245 | |
c4e57202 FM |
1246 | wxDataViewTextRenderer is used for rendering text. |
1247 | It supports in-place editing if desired. | |
7c913512 | 1248 | |
23324ae1 | 1249 | @library{wxadv} |
b321b61c | 1250 | @category{dvc} |
23324ae1 FM |
1251 | */ |
1252 | class wxDataViewTextRenderer : public wxDataViewRenderer | |
1253 | { | |
1254 | public: | |
1255 | /** | |
c4e57202 | 1256 | The ctor. |
23324ae1 FM |
1257 | */ |
1258 | wxDataViewTextRenderer(const wxString& varianttype = "string", | |
05303ccd RR |
1259 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
1260 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
23324ae1 FM |
1261 | }; |
1262 | ||
1263 | ||
e54c96f1 | 1264 | |
f2b7492a RR |
1265 | /** |
1266 | @class wxDataViewIconTextRenderer | |
f2b7492a RR |
1267 | |
1268 | The wxDataViewIconTextRenderer class is used to display text with | |
1269 | a small icon next to it as it is typically done in a file manager. | |
c4e57202 FM |
1270 | |
1271 | This classes uses the wxDataViewIconText helper class to store its data. | |
4d68a949 BP |
1272 | wxDataViewIconText can be converted to and from a wxVariant using the left |
1273 | shift operator. | |
f2b7492a RR |
1274 | |
1275 | @library{wxadv} | |
b321b61c | 1276 | @category{dvc} |
f2b7492a RR |
1277 | */ |
1278 | class wxDataViewIconTextRenderer : public wxDataViewRenderer | |
1279 | { | |
1280 | public: | |
1281 | /** | |
c4e57202 | 1282 | The ctor. |
f2b7492a RR |
1283 | */ |
1284 | wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText", | |
1285 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
1286 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
1287 | }; | |
1288 | ||
1289 | ||
1290 | ||
23324ae1 FM |
1291 | /** |
1292 | @class wxDataViewProgressRenderer | |
7c913512 | 1293 | |
c4e57202 | 1294 | This class is used by wxDataViewCtrl to render progress bars. |
7c913512 | 1295 | |
23324ae1 | 1296 | @library{wxadv} |
b321b61c | 1297 | @category{dvc} |
23324ae1 FM |
1298 | */ |
1299 | class wxDataViewProgressRenderer : public wxDataViewRenderer | |
1300 | { | |
1301 | public: | |
1302 | /** | |
c4e57202 | 1303 | The ctor. |
23324ae1 FM |
1304 | */ |
1305 | wxDataViewProgressRenderer(const wxString& label = wxEmptyString, | |
1306 | const wxString& varianttype = "long", | |
05303ccd RR |
1307 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
1308 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
23324ae1 FM |
1309 | }; |
1310 | ||
1311 | ||
e54c96f1 | 1312 | |
23324ae1 FM |
1313 | /** |
1314 | @class wxDataViewSpinRenderer | |
7c913512 | 1315 | |
c4e57202 FM |
1316 | This is a specialized renderer for rendering integer values. |
1317 | It supports modifying the values in-place by using a wxSpinCtrl. | |
23324ae1 | 1318 | The renderer only support variants of type @e long. |
7c913512 | 1319 | |
8ed522d9 | 1320 | @library{wxadv} |
b321b61c | 1321 | @category{dvc} |
23324ae1 FM |
1322 | */ |
1323 | class wxDataViewSpinRenderer : public wxDataViewCustomRenderer | |
1324 | { | |
1325 | public: | |
1326 | /** | |
c4e57202 FM |
1327 | Constructor. |
1328 | @a min and @a max indicate the minimum and maximum values for the wxSpinCtrl. | |
23324ae1 FM |
1329 | */ |
1330 | wxDataViewSpinRenderer(int min, int max, | |
1331 | wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, | |
05303ccd | 1332 | int align = wxDVR_DEFAULT_ALIGNMENT); |
23324ae1 FM |
1333 | }; |
1334 | ||
1335 | ||
e54c96f1 | 1336 | |
23324ae1 FM |
1337 | /** |
1338 | @class wxDataViewToggleRenderer | |
7c913512 | 1339 | |
c4e57202 | 1340 | This class is used by wxDataViewCtrl to render toggle controls. |
7c913512 | 1341 | |
23324ae1 | 1342 | @library{wxadv} |
b321b61c | 1343 | @category{dvc} |
23324ae1 FM |
1344 | */ |
1345 | class wxDataViewToggleRenderer : public wxDataViewRenderer | |
1346 | { | |
1347 | public: | |
1348 | /** | |
c4e57202 | 1349 | The ctor. |
23324ae1 FM |
1350 | */ |
1351 | wxDataViewToggleRenderer(const wxString& varianttype = "bool", | |
50ec54b6 FM |
1352 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
1353 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
23324ae1 FM |
1354 | }; |
1355 | ||
1356 | ||
f4fcd648 RR |
1357 | /** |
1358 | @class wxDataViewChoiceRenderer | |
1359 | ||
1360 | This class is used by wxDataViewCtrl to render choice controls. | |
1361 | It stores a string so that SetValue() and GetValue() operate | |
1362 | on a variant holding a string. | |
1363 | ||
1364 | @library{wxadv} | |
1365 | @category{dvc} | |
1366 | */ | |
1367 | ||
1368 | class wxDataViewChoiceRenderer: public wxDataViewRenderer | |
1369 | { | |
1370 | public: | |
1371 | /** | |
1372 | The ctor. | |
1373 | */ | |
1374 | wxDataViewChoiceRenderer( const wxArrayString &choices, | |
1375 | wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, | |
1376 | int alignment = wxDVR_DEFAULT_ALIGNMENT ); | |
1377 | ||
1378 | /** | |
1379 | Returns the choice referred to by index. | |
1380 | */ | |
1381 | wxString GetChoice(size_t index) const; | |
1382 | ||
1383 | /** | |
1384 | Returns all choices. | |
1385 | */ | |
1386 | const wxArrayString& GetChoices() const; | |
1387 | }; | |
1388 | ||
e54c96f1 | 1389 | |
23324ae1 | 1390 | /** |
5b99d5d8 | 1391 | @class wxDataViewDateRenderer |
7c913512 | 1392 | |
c4e57202 | 1393 | This class is used by wxDataViewCtrl to render calendar controls. |
7c913512 | 1394 | |
5b99d5d8 | 1395 | @library{wxadv} |
b321b61c | 1396 | @category{dvc} |
23324ae1 | 1397 | */ |
5b99d5d8 | 1398 | class wxDataViewDateRenderer : public wxDataViewRenderer |
23324ae1 FM |
1399 | { |
1400 | public: | |
23324ae1 | 1401 | /** |
c4e57202 | 1402 | The ctor. |
23324ae1 | 1403 | */ |
5b99d5d8 | 1404 | wxDataViewDateRenderer(const wxString& varianttype = "datetime", |
50ec54b6 FM |
1405 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, |
1406 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
5b99d5d8 | 1407 | }; |
23324ae1 | 1408 | |
3c4f71cc | 1409 | |
23324ae1 | 1410 | |
5b99d5d8 RR |
1411 | /** |
1412 | @class wxDataViewCustomRenderer | |
23324ae1 | 1413 | |
5b99d5d8 | 1414 | You need to derive a new class from wxDataViewCustomRenderer in |
c4e57202 FM |
1415 | order to write a new renderer. |
1416 | ||
1417 | You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue, | |
1418 | wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render. | |
1419 | ||
1420 | If you want your renderer to support in-place editing then you also need to override | |
1421 | wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl | |
5b99d5d8 | 1422 | and wxDataViewCustomRenderer::GetValueFromEditorCtrl. |
c4e57202 FM |
1423 | |
1424 | Note that a special event handler will be pushed onto that editor control | |
1425 | which handles @e \<ENTER\> and focus out events in order to end the editing. | |
23324ae1 | 1426 | |
5b99d5d8 | 1427 | @library{wxadv} |
b321b61c | 1428 | @category{dvc} |
5b99d5d8 RR |
1429 | */ |
1430 | class wxDataViewCustomRenderer : public wxDataViewRenderer | |
1431 | { | |
1432 | public: | |
23324ae1 | 1433 | /** |
5b99d5d8 | 1434 | Constructor. |
23324ae1 | 1435 | */ |
5b99d5d8 RR |
1436 | wxDataViewCustomRenderer(const wxString& varianttype = "string", |
1437 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
b91c4601 | 1438 | int align = -1, bool no_init = false); |
23324ae1 FM |
1439 | |
1440 | /** | |
5b99d5d8 | 1441 | Destructor. |
23324ae1 | 1442 | */ |
adaaa686 | 1443 | virtual ~wxDataViewCustomRenderer(); |
23324ae1 | 1444 | |
23324ae1 | 1445 | /** |
c4e57202 FM |
1446 | Override this to react to double clicks or ENTER. |
1447 | This method will only be called in wxDATAVIEW_CELL_ACTIVATABLE mode. | |
23324ae1 | 1448 | */ |
5b99d5d8 RR |
1449 | virtual bool Activate( wxRect cell, |
1450 | wxDataViewModel* model, | |
1451 | const wxDataViewItem & item, | |
1452 | unsigned int col ); | |
23324ae1 FM |
1453 | |
1454 | /** | |
5b99d5d8 | 1455 | Override this to create the actual editor control once editing |
c4e57202 FM |
1456 | is about to start. |
1457 | ||
1458 | @a parent is the parent of the editor control, @a labelRect indicates the | |
1459 | position and size of the editor control and @a value is its initial value: | |
1460 | @code | |
1461 | { | |
1462 | long l = value; | |
1463 | return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString, | |
1464 | labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l ); | |
1465 | } | |
1466 | @endcode | |
23324ae1 | 1467 | */ |
5b99d5d8 RR |
1468 | virtual wxControl* CreateEditorCtrl(wxWindow* parent, |
1469 | wxRect labelRect, | |
1470 | const wxVariant& value); | |
23324ae1 FM |
1471 | |
1472 | /** | |
62265c2c VZ |
1473 | Return the attribute to be used for rendering. |
1474 | ||
1475 | This function may be called from Render() implementation to use the | |
1476 | attributes defined for the item if the renderer supports them. | |
1477 | ||
1478 | Notice that when Render() is called, the wxDC object passed to it is | |
1479 | already set up to use the correct attributes (e.g. its font is set to | |
1480 | bold or italic version if wxDataViewItemAttr::GetBold() or GetItalic() | |
1481 | returns true) so it may not be necessary to call it explicitly if you | |
1482 | only want to render text using the items attributes. | |
1483 | ||
1484 | @since 2.9.1 | |
1485 | */ | |
1486 | const wxDataViewItemAttr& GetAttr() const; | |
23324ae1 FM |
1487 | |
1488 | /** | |
5b99d5d8 | 1489 | Return size required to show content. |
23324ae1 | 1490 | */ |
b91c4601 | 1491 | virtual wxSize GetSize() const = 0; |
23324ae1 FM |
1492 | |
1493 | /** | |
80093617 | 1494 | Override this so that the renderer can get the value from the editor |
c4e57202 FM |
1495 | control (pointed to by @a editor): |
1496 | @code | |
1497 | { | |
1498 | wxSpinCtrl *sc = (wxSpinCtrl*) editor; | |
1499 | long l = sc->GetValue(); | |
1500 | value = l; | |
1501 | return true; | |
1502 | } | |
1503 | @endcode | |
23324ae1 | 1504 | */ |
5b99d5d8 RR |
1505 | virtual bool GetValueFromEditorCtrl(wxControl* editor, |
1506 | wxVariant& value); | |
23324ae1 FM |
1507 | |
1508 | /** | |
c4e57202 | 1509 | Override this and make it return @true in order to |
5b99d5d8 | 1510 | indicate that this renderer supports in-place editing. |
23324ae1 | 1511 | */ |
220bfe15 | 1512 | virtual bool HasEditorCtrl() const; |
23324ae1 FM |
1513 | |
1514 | /** | |
80093617 | 1515 | Override this to react to a left click. |
c4e57202 | 1516 | This method will only be called in @c wxDATAVIEW_CELL_ACTIVATABLE mode. |
23324ae1 | 1517 | */ |
5b99d5d8 RR |
1518 | virtual bool LeftClick( wxPoint cursor, |
1519 | wxRect cell, | |
1520 | wxDataViewModel * model, | |
1521 | const wxDataViewItem & item, | |
1522 | unsigned int col ); | |
23324ae1 FM |
1523 | |
1524 | /** | |
c4e57202 FM |
1525 | Override this to render the cell. |
1526 | Before this is called, wxDataViewRenderer::SetValue was called | |
5b99d5d8 | 1527 | so that this instance knows what to render. |
23324ae1 | 1528 | */ |
b91c4601 | 1529 | virtual bool Render(wxRect cell, wxDC* dc, int state) = 0; |
23324ae1 FM |
1530 | |
1531 | /** | |
c4e57202 FM |
1532 | This method should be called from within Render() whenever you need to |
1533 | render simple text. | |
1534 | This will ensure that the correct colour, font and vertical alignment will | |
1535 | be chosen so the text will look the same as text drawn by native renderers. | |
23324ae1 | 1536 | */ |
50ec54b6 | 1537 | void RenderText(const wxString& text, int xoffset, wxRect cell, |
5b99d5d8 | 1538 | wxDC* dc, int state); |
23324ae1 FM |
1539 | |
1540 | /** | |
80093617 | 1541 | Override this to start a drag operation. Not yet supported. |
23324ae1 | 1542 | */ |
5b99d5d8 RR |
1543 | virtual bool StartDrag(wxPoint cursor, wxRect cell, |
1544 | wxDataViewModel* model, | |
1545 | const wxDataViewItem & item, | |
1546 | unsigned int col); | |
23324ae1 FM |
1547 | }; |
1548 | ||
1549 | ||
e54c96f1 | 1550 | |
23324ae1 | 1551 | /** |
5b99d5d8 | 1552 | @class wxDataViewBitmapRenderer |
7c913512 | 1553 | |
c4e57202 | 1554 | This class is used by wxDataViewCtrl to render bitmap controls. |
7c913512 | 1555 | |
23324ae1 | 1556 | @library{wxadv} |
b321b61c | 1557 | @category{dvc} |
23324ae1 | 1558 | */ |
5b99d5d8 | 1559 | class wxDataViewBitmapRenderer : public wxDataViewRenderer |
23324ae1 FM |
1560 | { |
1561 | public: | |
1562 | /** | |
c4e57202 | 1563 | The ctor. |
23324ae1 | 1564 | */ |
5b99d5d8 RR |
1565 | wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap", |
1566 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
14d922d1 | 1567 | int align = wxDVR_DEFAULT_ALIGNMENT); |
5b99d5d8 RR |
1568 | }; |
1569 | ||
23324ae1 | 1570 | |
c4e57202 FM |
1571 | /** |
1572 | The flags used by wxDataViewColumn. | |
02b51ae5 | 1573 | Can be combined together. |
c4e57202 FM |
1574 | */ |
1575 | enum wxDataViewColumnFlags | |
1576 | { | |
1577 | wxDATAVIEW_COL_RESIZABLE = 1, | |
1578 | wxDATAVIEW_COL_SORTABLE = 2, | |
1579 | wxDATAVIEW_COL_REORDERABLE = 4, | |
1580 | wxDATAVIEW_COL_HIDDEN = 8 | |
1581 | }; | |
23324ae1 | 1582 | |
5b99d5d8 RR |
1583 | /** |
1584 | @class wxDataViewColumn | |
5b99d5d8 RR |
1585 | |
1586 | This class represents a column in a wxDataViewCtrl. | |
739a8399 | 1587 | One wxDataViewColumn is bound to one column in the data model to which the |
c4e57202 | 1588 | wxDataViewCtrl has been associated. |
5b99d5d8 | 1589 | |
c4e57202 | 1590 | An instance of wxDataViewRenderer is used by this class to render its data. |
5b99d5d8 RR |
1591 | |
1592 | @library{wxadv} | |
b321b61c | 1593 | @category{dvc} |
5b99d5d8 | 1594 | */ |
c9c59db7 | 1595 | class wxDataViewColumn : public wxSettableHeaderColumn |
5b99d5d8 RR |
1596 | { |
1597 | public: | |
23324ae1 | 1598 | /** |
02b51ae5 FM |
1599 | Constructs a text column. |
1600 | ||
1601 | @param title | |
1602 | The title of the column. | |
1603 | @param renderer | |
1604 | The class which will render the contents of this column. | |
1605 | @param model_column | |
1606 | The index of the model's column which is associated with this object. | |
1607 | @param width | |
1608 | The width of the column. | |
1609 | The @c wxDVC_DEFAULT_WIDTH value is the fixed default value. | |
1610 | @param align | |
1611 | The alignment of the column title. | |
1612 | @param flags | |
1613 | One or more flags of the ::wxDataViewColumnFlags enumeration. | |
23324ae1 | 1614 | */ |
5b99d5d8 RR |
1615 | wxDataViewColumn(const wxString& title, |
1616 | wxDataViewRenderer* renderer, | |
1617 | unsigned int model_column, | |
1618 | int width = wxDVC_DEFAULT_WIDTH, | |
882678eb | 1619 | wxAlignment align = wxALIGN_CENTER, |
5b99d5d8 | 1620 | int flags = wxDATAVIEW_COL_RESIZABLE); |
02b51ae5 FM |
1621 | |
1622 | /** | |
1623 | Constructs a bitmap column. | |
1624 | ||
1625 | @param bitmap | |
1626 | The bitmap of the column. | |
1627 | @param renderer | |
1628 | The class which will render the contents of this column. | |
1629 | @param model_column | |
1630 | The index of the model's column which is associated with this object. | |
1631 | @param width | |
1632 | The width of the column. | |
1633 | The @c wxDVC_DEFAULT_WIDTH value is the fixed default value. | |
1634 | @param align | |
1635 | The alignment of the column title. | |
1636 | @param flags | |
1637 | One or more flags of the ::wxDataViewColumnFlags enumeration. | |
1638 | */ | |
5b99d5d8 RR |
1639 | wxDataViewColumn(const wxBitmap& bitmap, |
1640 | wxDataViewRenderer* renderer, | |
1641 | unsigned int model_column, | |
1642 | int width = wxDVC_DEFAULT_WIDTH, | |
882678eb | 1643 | wxAlignment align = wxALIGN_CENTER, |
5b99d5d8 | 1644 | int flags = wxDATAVIEW_COL_RESIZABLE); |
23324ae1 | 1645 | |
23324ae1 | 1646 | /** |
5b99d5d8 RR |
1647 | Returns the index of the column of the model, which this |
1648 | wxDataViewColumn is displaying. | |
23324ae1 | 1649 | */ |
adaaa686 | 1650 | unsigned int GetModelColumn() const; |
23324ae1 FM |
1651 | |
1652 | /** | |
5b99d5d8 | 1653 | Returns the owning wxDataViewCtrl. |
23324ae1 | 1654 | */ |
e51bf699 | 1655 | wxDataViewCtrl* GetOwner() const; |
23324ae1 FM |
1656 | |
1657 | /** | |
5b99d5d8 | 1658 | Returns the renderer of this wxDataViewColumn. |
c4e57202 FM |
1659 | |
1660 | @see wxDataViewRenderer. | |
23324ae1 | 1661 | */ |
adaaa686 | 1662 | wxDataViewRenderer* GetRenderer() const; |
23324ae1 FM |
1663 | }; |
1664 | ||
1665 | ||
e54c96f1 | 1666 | |
832df171 RR |
1667 | /** |
1668 | @class wxDataViewListCtrl | |
1669 | ||
1670 | This class is a wxDataViewCtrl which internally uses a wxDataViewListStore | |
1671 | and forwards most of its API to that class. | |
1672 | ||
1673 | The purpose of this class is to offer a simple way to display and | |
1674 | edit a small table of data without having to write your own wxDataViewModel. | |
1675 | ||
23efa4bf | 1676 | @code |
14f73cf1 | 1677 | wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, wxID_ANY ); |
02b51ae5 | 1678 | |
95b20f41 RR |
1679 | listctrl->AppendToggleColumn( "Toggle" ); |
1680 | listctrl->AppendTextColumn( "Text" ); | |
02b51ae5 | 1681 | |
23efa4bf | 1682 | wxVector<wxVariant> data; |
14f73cf1 FM |
1683 | data.push_back( wxVariant(true) ); |
1684 | data.push_back( wxVariant("row 1") ); | |
23efa4bf | 1685 | listctrl->AppendItem( data ); |
02b51ae5 | 1686 | |
23efa4bf | 1687 | data.clear(); |
14f73cf1 FM |
1688 | data.push_back( wxVariant(false) ); |
1689 | data.push_back( wxVariant("row 3") ); | |
23efa4bf RR |
1690 | listctrl->AppendItem( data ); |
1691 | @endcode | |
43c64cc6 | 1692 | |
14f73cf1 FM |
1693 | @beginStyleTable |
1694 | See wxDataViewCtrl for the list of supported styles. | |
1695 | @endStyleTable | |
43c64cc6 | 1696 | |
14f73cf1 FM |
1697 | @beginEventEmissionTable |
1698 | See wxDataViewCtrl for the list of events emitted by this class. | |
1699 | @endEventTable | |
23efa4bf | 1700 | |
832df171 RR |
1701 | @library{wxadv} |
1702 | @category{ctrl,dvc} | |
1703 | */ | |
832df171 RR |
1704 | class wxDataViewListCtrl: public wxDataViewCtrl |
1705 | { | |
b75b04d4 | 1706 | public: |
832df171 RR |
1707 | /** |
1708 | Default ctor. | |
1709 | */ | |
1710 | wxDataViewListCtrl(); | |
02b51ae5 | 1711 | |
832df171 RR |
1712 | /** |
1713 | Constructor. Calls Create(). | |
1714 | */ | |
1715 | wxDataViewListCtrl( wxWindow *parent, wxWindowID id, | |
1716 | const wxPoint& pos = wxDefaultPosition, | |
1717 | const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES, | |
1718 | const wxValidator& validator = wxDefaultValidator ); | |
02b51ae5 | 1719 | |
832df171 RR |
1720 | /** |
1721 | Destructor. Deletes the image list if any. | |
1722 | */ | |
1723 | ~wxDataViewListCtrl(); | |
1724 | ||
1725 | /** | |
1726 | Creates the control and a wxDataViewListStore as its internal model. | |
1727 | */ | |
1728 | bool Create( wxWindow *parent, wxWindowID id, | |
1729 | const wxPoint& pos = wxDefaultPosition, | |
1730 | const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES, | |
1731 | const wxValidator& validator = wxDefaultValidator ); | |
1732 | ||
1733 | //@{ | |
1734 | /** | |
1735 | Returns the store. | |
1736 | */ | |
1737 | wxDataViewListStore *GetStore(); | |
1738 | const wxDataViewListStore *GetStore() const; | |
1739 | //@} | |
1740 | ||
1741 | /** | |
14f73cf1 FM |
1742 | @name Column management functions |
1743 | */ | |
1744 | //@{ | |
43c64cc6 | 1745 | |
14f73cf1 FM |
1746 | /** |
1747 | Appends a column to the control and additionally appends a | |
1748 | column to the store with the type string. | |
1749 | */ | |
1750 | virtual void AppendColumn( wxDataViewColumn *column ); | |
1751 | ||
1752 | /** | |
1753 | Appends a column to the control and additionally appends a | |
1754 | column to the list store with the type @a varianttype. | |
832df171 | 1755 | */ |
95b20f41 | 1756 | void AppendColumn( wxDataViewColumn *column, const wxString &varianttype ); |
02b51ae5 | 1757 | |
832df171 | 1758 | /** |
14f73cf1 | 1759 | Appends a text column to the control and the store. |
43c64cc6 | 1760 | |
14f73cf1 FM |
1761 | See wxDataViewColumn::wxDataViewColumn for more info about |
1762 | the parameters. | |
832df171 | 1763 | */ |
14f73cf1 FM |
1764 | wxDataViewColumn *AppendTextColumn( const wxString &label, |
1765 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
43c64cc6 | 1766 | int width = -1, wxAlignment align = wxALIGN_LEFT, |
14f73cf1 | 1767 | int flags = wxDATAVIEW_COL_RESIZABLE ); |
02b51ae5 | 1768 | |
832df171 | 1769 | /** |
14f73cf1 | 1770 | Appends a toggle column to the control and the store. |
43c64cc6 | 1771 | |
14f73cf1 FM |
1772 | See wxDataViewColumn::wxDataViewColumn for more info about |
1773 | the parameters. | |
832df171 | 1774 | */ |
14f73cf1 FM |
1775 | wxDataViewColumn *AppendToggleColumn( const wxString &label, |
1776 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
43c64cc6 | 1777 | int width = -1, wxAlignment align = wxALIGN_LEFT, |
14f73cf1 | 1778 | int flags = wxDATAVIEW_COL_RESIZABLE ); |
02b51ae5 | 1779 | |
95b20f41 | 1780 | /** |
14f73cf1 | 1781 | Appends a progress column to the control and the store. |
02b51ae5 | 1782 | |
14f73cf1 FM |
1783 | See wxDataViewColumn::wxDataViewColumn for more info about |
1784 | the parameters. | |
95b20f41 | 1785 | */ |
14f73cf1 FM |
1786 | wxDataViewColumn *AppendProgressColumn( const wxString &label, |
1787 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
43c64cc6 | 1788 | int width = -1, wxAlignment align = wxALIGN_LEFT, |
14f73cf1 | 1789 | int flags = wxDATAVIEW_COL_RESIZABLE ); |
02b51ae5 | 1790 | |
95b20f41 | 1791 | /** |
14f73cf1 | 1792 | Appends an icon-and-text column to the control and the store. |
02b51ae5 | 1793 | |
14f73cf1 FM |
1794 | See wxDataViewColumn::wxDataViewColumn for more info about |
1795 | the parameters. | |
95b20f41 | 1796 | */ |
14f73cf1 FM |
1797 | wxDataViewColumn *AppendIconTextColumn( const wxString &label, |
1798 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
43c64cc6 | 1799 | int width = -1, wxAlignment align = wxALIGN_LEFT, |
14f73cf1 | 1800 | int flags = wxDATAVIEW_COL_RESIZABLE ); |
02b51ae5 | 1801 | |
95b20f41 | 1802 | /** |
14f73cf1 | 1803 | Inserts a column to the control and additionally inserts a |
95b20f41 RR |
1804 | column to the store with the type string. |
1805 | */ | |
1806 | virtual void InsertColumn( unsigned int pos, wxDataViewColumn *column ); | |
02b51ae5 | 1807 | |
832df171 | 1808 | /** |
14f73cf1 FM |
1809 | Inserts a column to the control and additionally inserts a |
1810 | column to the list store with the type @a varianttype. | |
832df171 | 1811 | */ |
43c64cc6 | 1812 | void InsertColumn( unsigned int pos, wxDataViewColumn *column, |
14f73cf1 | 1813 | const wxString &varianttype ); |
02b51ae5 | 1814 | |
832df171 | 1815 | /** |
14f73cf1 FM |
1816 | Prepends a column to the control and additionally prepends a |
1817 | column to the store with the type string. | |
832df171 | 1818 | */ |
14f73cf1 | 1819 | virtual void PrependColumn( wxDataViewColumn *column ); |
02b51ae5 | 1820 | |
832df171 | 1821 | /** |
14f73cf1 FM |
1822 | Prepends a column to the control and additionally prepends a |
1823 | column to the list store with the type @a varianttype. | |
832df171 | 1824 | */ |
14f73cf1 | 1825 | void PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); |
02b51ae5 | 1826 | |
14f73cf1 | 1827 | //@} |
43c64cc6 VZ |
1828 | |
1829 | ||
832df171 | 1830 | /** |
14f73cf1 | 1831 | @name Item management functions |
832df171 | 1832 | */ |
14f73cf1 | 1833 | //@{ |
43c64cc6 | 1834 | |
832df171 RR |
1835 | /** |
1836 | Appends an item (=row) to the control and store. | |
1837 | */ | |
1838 | void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
1839 | ||
1840 | /** | |
1841 | Prepends an item (=row) to the control and store. | |
1842 | */ | |
1843 | void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
1844 | ||
1845 | /** | |
1846 | Inserts an item (=row) to the control and store. | |
1847 | */ | |
14f73cf1 | 1848 | void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL ); |
02b51ae5 | 1849 | |
832df171 RR |
1850 | /** |
1851 | Delete the row at position @a row. | |
1852 | */ | |
1853 | void DeleteItem( unsigned row ); | |
02b51ae5 | 1854 | |
832df171 RR |
1855 | /** |
1856 | Delete all items (= all rows). | |
1857 | */ | |
1858 | void DeleteAllItems(); | |
02b51ae5 | 1859 | |
832df171 RR |
1860 | /** |
1861 | Sets the value in the store and update the control. | |
1862 | */ | |
1863 | void SetValue( const wxVariant &value, unsigned int row, unsigned int col ); | |
02b51ae5 | 1864 | |
832df171 RR |
1865 | /** |
1866 | Returns the value from the store. | |
1867 | */ | |
1868 | void GetValue( wxVariant &value, unsigned int row, unsigned int col ); | |
02b51ae5 | 1869 | |
832df171 | 1870 | /** |
02b51ae5 FM |
1871 | Sets the value in the store and update the control. |
1872 | ||
832df171 RR |
1873 | This method assumes that the a string is stored in respective |
1874 | column. | |
1875 | */ | |
1876 | void SetTextValue( const wxString &value, unsigned int row, unsigned int col ); | |
02b51ae5 | 1877 | |
832df171 RR |
1878 | /** |
1879 | Returns the value from the store. | |
02b51ae5 | 1880 | |
832df171 RR |
1881 | This method assumes that the a string is stored in respective |
1882 | column. | |
1883 | */ | |
1884 | wxString GetTextValue( unsigned int row, unsigned int col ) const; | |
02b51ae5 | 1885 | |
832df171 | 1886 | /** |
02b51ae5 FM |
1887 | Sets the value in the store and update the control. |
1888 | ||
832df171 RR |
1889 | This method assumes that the a boolean value is stored in |
1890 | respective column. | |
1891 | */ | |
1892 | void SetToggleValue( bool value, unsigned int row, unsigned int col ); | |
02b51ae5 | 1893 | |
832df171 RR |
1894 | /** |
1895 | Returns the value from the store. | |
02b51ae5 | 1896 | |
832df171 RR |
1897 | This method assumes that the a boolean value is stored in |
1898 | respective column. | |
1899 | */ | |
1900 | bool GetToggleValue( unsigned int row, unsigned int col ) const; | |
43c64cc6 | 1901 | |
14f73cf1 | 1902 | //@} |
832df171 RR |
1903 | }; |
1904 | ||
1905 | ||
23324ae1 | 1906 | /** |
5b99d5d8 | 1907 | @class wxDataViewTreeCtrl |
7c913512 | 1908 | |
c4e57202 FM |
1909 | This class is a wxDataViewCtrl which internally uses a wxDataViewTreeStore |
1910 | and forwards most of its API to that class. | |
1911 | Additionally, it uses a wxImageList to store a list of icons. | |
1912 | ||
43c64cc6 VZ |
1913 | The main purpose of this class is to provide a simple upgrade path for code |
1914 | using wxTreeCtrl. | |
14f73cf1 FM |
1915 | |
1916 | @beginStyleTable | |
1917 | See wxDataViewCtrl for the list of supported styles. | |
1918 | @endStyleTable | |
43c64cc6 | 1919 | |
14f73cf1 FM |
1920 | @beginEventEmissionTable |
1921 | See wxDataViewCtrl for the list of events emitted by this class. | |
1922 | @endEventTable | |
7c913512 | 1923 | |
8ed522d9 | 1924 | @library{wxadv} |
b321b61c | 1925 | @category{ctrl,dvc} |
7e59b885 | 1926 | @appearance{dataviewtreectrl.png} |
23324ae1 | 1927 | */ |
5b99d5d8 | 1928 | class wxDataViewTreeCtrl : public wxDataViewCtrl |
23324ae1 FM |
1929 | { |
1930 | public: | |
1931 | /** | |
c4e57202 | 1932 | Default ctor. |
5b99d5d8 RR |
1933 | */ |
1934 | wxDataViewTreeCtrl(); | |
c4e57202 FM |
1935 | |
1936 | /** | |
43c64cc6 VZ |
1937 | Constructor. |
1938 | ||
1939 | Calls Create(). | |
c4e57202 | 1940 | */ |
5b99d5d8 RR |
1941 | wxDataViewTreeCtrl(wxWindow* parent, wxWindowID id, |
1942 | const wxPoint& pos = wxDefaultPosition, | |
1943 | const wxSize& size = wxDefaultSize, | |
43c64cc6 | 1944 | long style = wxDV_NO_HEADER | wxDV_ROW_LINES, |
5b99d5d8 | 1945 | const wxValidator& validator = wxDefaultValidator); |
3c4f71cc | 1946 | |
5b99d5d8 RR |
1947 | /** |
1948 | Destructor. Deletes the image list if any. | |
23324ae1 | 1949 | */ |
adaaa686 | 1950 | virtual ~wxDataViewTreeCtrl(); |
23324ae1 | 1951 | |
5b99d5d8 | 1952 | /** |
b75b04d4 | 1953 | Appends a container to the given @a parent. |
5b99d5d8 RR |
1954 | */ |
1955 | wxDataViewItem AppendContainer(const wxDataViewItem& parent, | |
1956 | const wxString& text, | |
1957 | int icon = -1, | |
1958 | int expanded = -1, | |
1959 | wxClientData* data = NULL); | |
e54c96f1 | 1960 | |
5b99d5d8 | 1961 | /** |
b75b04d4 | 1962 | Appends an item to the given @a parent. |
5b99d5d8 RR |
1963 | */ |
1964 | wxDataViewItem AppendItem(const wxDataViewItem& parent, | |
1965 | const wxString& text, | |
1966 | int icon = -1, | |
1967 | wxClientData* data = NULL); | |
7c913512 | 1968 | |
5b99d5d8 | 1969 | /** |
c4e57202 | 1970 | Creates the control and a wxDataViewTreeStore as its internal model. |
43c64cc6 VZ |
1971 | |
1972 | The default tree column created by this method is an editable column | |
1973 | using wxDataViewIconTextRenderer as its renderer. | |
5b99d5d8 RR |
1974 | */ |
1975 | bool Create(wxWindow* parent, wxWindowID id, | |
1976 | const wxPoint& pos = wxDefaultPosition, | |
1977 | const wxSize& size = wxDefaultSize, | |
43c64cc6 | 1978 | long style = wxDV_NO_HEADER | wxDV_ROW_LINES, |
5b99d5d8 RR |
1979 | const wxValidator& validator = wxDefaultValidator); |
1980 | ||
1981 | /** | |
1982 | Calls the identical method from wxDataViewTreeStore. | |
1983 | */ | |
1984 | void DeleteAllItems(); | |
7c913512 | 1985 | |
23324ae1 | 1986 | /** |
5b99d5d8 RR |
1987 | Calls the identical method from wxDataViewTreeStore. |
1988 | */ | |
1989 | void DeleteChildren(const wxDataViewItem& item); | |
3c4f71cc | 1990 | |
5b99d5d8 RR |
1991 | /** |
1992 | Calls the identical method from wxDataViewTreeStore. | |
23324ae1 | 1993 | */ |
5b99d5d8 | 1994 | void DeleteItem(const wxDataViewItem& item); |
23324ae1 | 1995 | |
5b99d5d8 RR |
1996 | /** |
1997 | Calls the identical method from wxDataViewTreeStore. | |
1998 | */ | |
1999 | int GetChildCount(const wxDataViewItem& parent) const; | |
23324ae1 | 2000 | |
5b99d5d8 RR |
2001 | /** |
2002 | Returns the image list. | |
2003 | */ | |
2004 | wxImageList* GetImageList(); | |
05303ccd | 2005 | |
5b99d5d8 RR |
2006 | /** |
2007 | Calls the identical method from wxDataViewTreeStore. | |
2008 | */ | |
2009 | wxClientData* GetItemData(const wxDataViewItem& item) const; | |
05303ccd | 2010 | |
5b99d5d8 RR |
2011 | /** |
2012 | Calls the identical method from wxDataViewTreeStore. | |
2013 | */ | |
b91c4601 | 2014 | const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const; |
05303ccd | 2015 | |
05303ccd | 2016 | /** |
5b99d5d8 | 2017 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2018 | */ |
b91c4601 | 2019 | const wxIcon& GetItemIcon(const wxDataViewItem& item) const; |
05303ccd RR |
2020 | |
2021 | /** | |
5b99d5d8 | 2022 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2023 | */ |
5b99d5d8 RR |
2024 | wxString GetItemText(const wxDataViewItem& item) const; |
2025 | ||
2026 | /** | |
2027 | Calls the identical method from wxDataViewTreeStore. | |
2028 | */ | |
2029 | wxDataViewItem GetNthChild(const wxDataViewItem& parent, | |
2030 | unsigned int pos) const; | |
05303ccd | 2031 | |
5b99d5d8 | 2032 | //@{ |
05303ccd | 2033 | /** |
5b99d5d8 | 2034 | Returns the store. |
05303ccd | 2035 | */ |
882678eb | 2036 | wxDataViewTreeStore* GetStore(); |
5b99d5d8 RR |
2037 | const wxDataViewTreeStore* GetStore() const; |
2038 | //@} | |
05303ccd RR |
2039 | |
2040 | /** | |
c4e57202 FM |
2041 | Calls the same method from wxDataViewTreeStore but uses |
2042 | an index position in the image list instead of a wxIcon. | |
05303ccd | 2043 | */ |
5b99d5d8 RR |
2044 | wxDataViewItem InsertContainer(const wxDataViewItem& parent, |
2045 | const wxDataViewItem& previous, | |
2046 | const wxString& text, | |
2047 | int icon = -1, | |
2048 | int expanded = -1, | |
2049 | wxClientData* data = NULL); | |
05303ccd RR |
2050 | |
2051 | /** | |
c4e57202 FM |
2052 | Calls the same method from wxDataViewTreeStore but uses |
2053 | an index position in the image list instead of a wxIcon. | |
05303ccd | 2054 | */ |
5b99d5d8 RR |
2055 | wxDataViewItem InsertItem(const wxDataViewItem& parent, |
2056 | const wxDataViewItem& previous, | |
2057 | const wxString& text, | |
2058 | int icon = -1, | |
2059 | wxClientData* data = NULL); | |
05303ccd | 2060 | |
8ddda15b RR |
2061 | /** |
2062 | Returns true if item is a container. | |
2063 | */ | |
2064 | bool IsContainer( const wxDataViewItem& item ); | |
2065 | ||
05303ccd | 2066 | /** |
c4e57202 FM |
2067 | Calls the same method from wxDataViewTreeStore but uses |
2068 | an index position in the image list instead of a wxIcon. | |
05303ccd | 2069 | */ |
5b99d5d8 RR |
2070 | wxDataViewItem PrependContainer(const wxDataViewItem& parent, |
2071 | const wxString& text, | |
2072 | int icon = -1, | |
2073 | int expanded = -1, | |
2074 | wxClientData* data = NULL); | |
05303ccd RR |
2075 | |
2076 | /** | |
c4e57202 FM |
2077 | Calls the same method from wxDataViewTreeStore but uses |
2078 | an index position in the image list instead of a wxIcon. | |
05303ccd | 2079 | */ |
5b99d5d8 RR |
2080 | wxDataViewItem PrependItem(const wxDataViewItem& parent, |
2081 | const wxString& text, | |
2082 | int icon = -1, | |
2083 | wxClientData* data = NULL); | |
05303ccd RR |
2084 | |
2085 | /** | |
5b99d5d8 | 2086 | Sets the image list. |
05303ccd | 2087 | */ |
5b99d5d8 | 2088 | void SetImageList(wxImageList* imagelist); |
05303ccd RR |
2089 | |
2090 | /** | |
5b99d5d8 | 2091 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2092 | */ |
5b99d5d8 | 2093 | void SetItemData(const wxDataViewItem& item, wxClientData* data); |
05303ccd RR |
2094 | |
2095 | /** | |
5b99d5d8 | 2096 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2097 | */ |
5b99d5d8 RR |
2098 | void SetItemExpandedIcon(const wxDataViewItem& item, |
2099 | const wxIcon& icon); | |
05303ccd RR |
2100 | |
2101 | /** | |
5b99d5d8 | 2102 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2103 | */ |
5b99d5d8 | 2104 | void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon); |
05303ccd RR |
2105 | |
2106 | /** | |
5b99d5d8 | 2107 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2108 | */ |
5b99d5d8 RR |
2109 | void SetItemText(const wxDataViewItem& item, |
2110 | const wxString& text); | |
05303ccd RR |
2111 | }; |
2112 | ||
2113 | ||
bda698ed RR |
2114 | /** |
2115 | @class wxDataViewListStore | |
2116 | ||
2117 | wxDataViewListStore is a specialised wxDataViewModel for storing | |
2118 | a simple table of data. Since it derives from wxDataViewIndexListModel | |
2119 | its data is be accessed by row (i.e. by index) instead of only | |
2120 | by wxDataViewItem. | |
2121 | ||
02b51ae5 | 2122 | This class actually stores the values (therefore its name) |
bda698ed | 2123 | and implements all virtual methods from the base classes so it can be |
02b51ae5 | 2124 | used directly without having to derive any class from it, but it is |
bda698ed RR |
2125 | mostly used from within wxDataViewListCtrl. |
2126 | ||
2127 | @library{wxadv} | |
2128 | @category{dvc} | |
2129 | */ | |
2130 | ||
2131 | class wxDataViewListStore: public wxDataViewIndexListModel | |
2132 | { | |
2133 | public: | |
2134 | /** | |
02b51ae5 | 2135 | Constructor |
bda698ed RR |
2136 | */ |
2137 | wxDataViewListStore(); | |
02b51ae5 | 2138 | |
bda698ed | 2139 | /** |
02b51ae5 | 2140 | Destructor |
bda698ed RR |
2141 | */ |
2142 | ~wxDataViewListStore(); | |
2143 | ||
2144 | /** | |
02b51ae5 FM |
2145 | Prepends a data column. |
2146 | ||
2147 | @a variantype indicates the type of values store in the column. | |
2148 | ||
2149 | This does not automatically fill in any (default) values in | |
2150 | rows which exist in the store already. | |
bda698ed RR |
2151 | */ |
2152 | void PrependColumn( const wxString &varianttype ); | |
2153 | ||
2154 | /** | |
02b51ae5 FM |
2155 | Inserts a data column before @a pos. |
2156 | ||
2157 | @a variantype indicates the type of values store in the column. | |
2158 | ||
2159 | This does not automatically fill in any (default) values in | |
2160 | rows which exist in the store already. | |
bda698ed RR |
2161 | */ |
2162 | void InsertColumn( unsigned int pos, const wxString &varianttype ); | |
2163 | ||
2164 | /** | |
02b51ae5 FM |
2165 | Appends a data column. |
2166 | ||
2167 | @a variantype indicates the type of values store in the column. | |
2168 | ||
2169 | This does not automatically fill in any (default) values in | |
2170 | rows which exist in the store already. | |
bda698ed RR |
2171 | */ |
2172 | void AppendColumn( const wxString &varianttype ); | |
02b51ae5 | 2173 | |
bda698ed RR |
2174 | /** |
2175 | Appends an item (=row) and fills it with @a values. | |
02b51ae5 | 2176 | |
bda698ed RR |
2177 | The values must match the values specifies in the column |
2178 | in number and type. No (default) values are filled in | |
2179 | automatically. | |
2180 | */ | |
2181 | void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
02b51ae5 | 2182 | |
bda698ed RR |
2183 | /** |
2184 | Prepends an item (=row) and fills it with @a values. | |
02b51ae5 | 2185 | |
bda698ed RR |
2186 | The values must match the values specifies in the column |
2187 | in number and type. No (default) values are filled in | |
2188 | automatically. | |
2189 | */ | |
2190 | void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
02b51ae5 | 2191 | |
bda698ed RR |
2192 | /** |
2193 | Inserts an item (=row) and fills it with @a values. | |
02b51ae5 | 2194 | |
bda698ed RR |
2195 | The values must match the values specifies in the column |
2196 | in number and type. No (default) values are filled in | |
2197 | automatically. | |
2198 | */ | |
2199 | void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
02b51ae5 | 2200 | |
bda698ed RR |
2201 | /** |
2202 | Delete the item (=row) at position @a pos. | |
2203 | */ | |
2204 | void DeleteItem( unsigned pos ); | |
02b51ae5 | 2205 | |
bda698ed RR |
2206 | /** |
2207 | Delete all item (=all rows) in the store. | |
2208 | */ | |
2209 | void DeleteAllItems(); | |
2210 | ||
2211 | /** | |
2212 | Overriden from wxDataViewModel | |
2213 | */ | |
2214 | virtual unsigned int GetColumnCount() const; | |
2215 | ||
2216 | /** | |
2217 | Overriden from wxDataViewModel | |
2218 | */ | |
2219 | virtual wxString GetColumnType( unsigned int col ) const; | |
2220 | ||
2221 | /** | |
2222 | Overriden from wxDataViewIndexListModel | |
2223 | */ | |
2224 | virtual void GetValueByRow( wxVariant &value, | |
2225 | unsigned int row, unsigned int col ) const; | |
2226 | ||
2227 | /** | |
2228 | Overriden from wxDataViewIndexListModel | |
2229 | */ | |
2230 | virtual bool SetValueByRow( const wxVariant &value, | |
2231 | unsigned int row, unsigned int col ); | |
2232 | }; | |
2233 | ||
05303ccd RR |
2234 | |
2235 | /** | |
5b99d5d8 | 2236 | @class wxDataViewTreeStore |
05303ccd | 2237 | |
bda698ed | 2238 | wxDataViewTreeStore is a specialised wxDataViewModel for stroing simple |
c4e57202 FM |
2239 | trees very much like wxTreeCtrl does and it offers a similar API. |
2240 | ||
02b51ae5 | 2241 | This class actually stores the entire tree and the values (therefore its name) |
8eff6c56 | 2242 | and implements all virtual methods from the base class so it can be used directly |
bda698ed RR |
2243 | without having to derive any class from it, but it is mostly used from within |
2244 | wxDataViewTreeCtrl. | |
05303ccd RR |
2245 | |
2246 | @library{wxadv} | |
b321b61c | 2247 | @category{dvc} |
05303ccd | 2248 | */ |
5b99d5d8 | 2249 | class wxDataViewTreeStore : public wxDataViewModel |
05303ccd RR |
2250 | { |
2251 | public: | |
2252 | /** | |
5b99d5d8 | 2253 | Constructor. Creates the invisible root node internally. |
05303ccd | 2254 | */ |
5b99d5d8 | 2255 | wxDataViewTreeStore(); |
e54c96f1 | 2256 | |
5b99d5d8 RR |
2257 | /** |
2258 | Destructor. | |
2259 | */ | |
adaaa686 | 2260 | virtual ~wxDataViewTreeStore(); |
7c913512 | 2261 | |
5b99d5d8 RR |
2262 | /** |
2263 | Append a container. | |
2264 | */ | |
2265 | wxDataViewItem AppendContainer(const wxDataViewItem& parent, | |
2266 | const wxString& text, | |
2267 | const wxIcon& icon = wxNullIcon, | |
2268 | const wxIcon& expanded = wxNullIcon, | |
2269 | wxClientData* data = NULL); | |
7c913512 | 2270 | |
5b99d5d8 RR |
2271 | /** |
2272 | Append an item. | |
2273 | */ | |
2274 | wxDataViewItem AppendItem(const wxDataViewItem& parent, | |
2275 | const wxString& text, | |
2276 | const wxIcon& icon = wxNullIcon, | |
2277 | wxClientData* data = NULL); | |
7c913512 | 2278 | |
23324ae1 | 2279 | /** |
5b99d5d8 | 2280 | Delete all item in the model. |
23324ae1 | 2281 | */ |
5b99d5d8 | 2282 | void DeleteAllItems(); |
23324ae1 FM |
2283 | |
2284 | /** | |
5b99d5d8 | 2285 | Delete all children of the item, but not the item itself. |
23324ae1 | 2286 | */ |
5b99d5d8 | 2287 | void DeleteChildren(const wxDataViewItem& item); |
23324ae1 FM |
2288 | |
2289 | /** | |
5b99d5d8 | 2290 | Delete this item. |
23324ae1 | 2291 | */ |
5b99d5d8 | 2292 | void DeleteItem(const wxDataViewItem& item); |
23324ae1 FM |
2293 | |
2294 | /** | |
5b99d5d8 | 2295 | Return the number of children of item. |
23324ae1 | 2296 | */ |
5b99d5d8 | 2297 | int GetChildCount(const wxDataViewItem& parent) const; |
23324ae1 FM |
2298 | |
2299 | /** | |
5b99d5d8 | 2300 | Returns the client data asoociated with the item. |
23324ae1 | 2301 | */ |
5b99d5d8 | 2302 | wxClientData* GetItemData(const wxDataViewItem& item) const; |
23324ae1 FM |
2303 | |
2304 | /** | |
5b99d5d8 | 2305 | Returns the icon to display in expanded containers. |
23324ae1 | 2306 | */ |
b91c4601 | 2307 | const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const; |
23324ae1 FM |
2308 | |
2309 | /** | |
5b99d5d8 | 2310 | Returns the icon of the item. |
23324ae1 | 2311 | */ |
b91c4601 | 2312 | const wxIcon& GetItemIcon(const wxDataViewItem& item) const; |
23324ae1 FM |
2313 | |
2314 | /** | |
5b99d5d8 | 2315 | Returns the text of the item. |
23324ae1 | 2316 | */ |
5b99d5d8 | 2317 | wxString GetItemText(const wxDataViewItem& item) const; |
23324ae1 FM |
2318 | |
2319 | /** | |
5b99d5d8 | 2320 | Returns the nth child item of item. |
23324ae1 | 2321 | */ |
5b99d5d8 RR |
2322 | wxDataViewItem GetNthChild(const wxDataViewItem& parent, |
2323 | unsigned int pos) const; | |
23324ae1 FM |
2324 | |
2325 | /** | |
c4e57202 | 2326 | Inserts a container after @a previous. |
23324ae1 | 2327 | */ |
5b99d5d8 RR |
2328 | wxDataViewItem InsertContainer(const wxDataViewItem& parent, |
2329 | const wxDataViewItem& previous, | |
2330 | const wxString& text, | |
2331 | const wxIcon& icon = wxNullIcon, | |
2332 | const wxIcon& expanded = wxNullIcon, | |
2333 | wxClientData* data = NULL); | |
23324ae1 FM |
2334 | |
2335 | /** | |
c4e57202 | 2336 | Inserts an item after @a previous. |
23324ae1 | 2337 | */ |
5b99d5d8 RR |
2338 | wxDataViewItem InsertItem(const wxDataViewItem& parent, |
2339 | const wxDataViewItem& previous, | |
2340 | const wxString& text, | |
2341 | const wxIcon& icon = wxNullIcon, | |
2342 | wxClientData* data = NULL); | |
23324ae1 FM |
2343 | |
2344 | /** | |
c4e57202 | 2345 | Inserts a container before the first child item or @a parent. |
23324ae1 | 2346 | */ |
5b99d5d8 RR |
2347 | wxDataViewItem PrependContainer(const wxDataViewItem& parent, |
2348 | const wxString& text, | |
2349 | const wxIcon& icon = wxNullIcon, | |
2350 | const wxIcon& expanded = wxNullIcon, | |
2351 | wxClientData* data = NULL); | |
23324ae1 FM |
2352 | |
2353 | /** | |
c4e57202 | 2354 | Inserts an item before the first child item or @a parent. |
23324ae1 | 2355 | */ |
5b99d5d8 RR |
2356 | wxDataViewItem PrependItem(const wxDataViewItem& parent, |
2357 | const wxString& text, | |
2358 | const wxIcon& icon = wxNullIcon, | |
2359 | wxClientData* data = NULL); | |
23324ae1 FM |
2360 | |
2361 | /** | |
5b99d5d8 | 2362 | Sets the client data associated with the item. |
23324ae1 | 2363 | */ |
5b99d5d8 | 2364 | void SetItemData(const wxDataViewItem& item, wxClientData* data); |
23324ae1 FM |
2365 | |
2366 | /** | |
5b99d5d8 | 2367 | Sets the expanded icon for the item. |
23324ae1 | 2368 | */ |
5b99d5d8 RR |
2369 | void SetItemExpandedIcon(const wxDataViewItem& item, |
2370 | const wxIcon& icon); | |
23324ae1 FM |
2371 | |
2372 | /** | |
5b99d5d8 | 2373 | Sets the icon for the item. |
23324ae1 | 2374 | */ |
5b99d5d8 | 2375 | void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon); |
23324ae1 | 2376 | }; |
e54c96f1 | 2377 | |
80932a3e FM |
2378 | |
2379 | /** | |
2380 | @class wxDataViewIconText | |
2381 | ||
2382 | wxDataViewIconText is used by wxDataViewIconTextRenderer for data transfer. | |
2383 | This class can be converted to and from a wxVariant. | |
2384 | ||
2385 | @library{wxadv} | |
2386 | @category{dvc} | |
2387 | */ | |
2388 | class wxDataViewIconText : public wxObject | |
2389 | { | |
2390 | public: | |
2391 | //@{ | |
2392 | /** | |
2393 | Constructor. | |
2394 | */ | |
2395 | wxDataViewIconText(const wxString& text = wxEmptyString, | |
2396 | const wxIcon& icon = wxNullIcon); | |
2397 | wxDataViewIconText(const wxDataViewIconText& other); | |
2398 | //@} | |
2399 | ||
2400 | /** | |
2401 | Gets the icon. | |
2402 | */ | |
2403 | const wxIcon& GetIcon() const; | |
2404 | ||
2405 | /** | |
2406 | Gets the text. | |
2407 | */ | |
2408 | wxString GetText() const; | |
2409 | ||
2410 | /** | |
2411 | Set the icon. | |
2412 | */ | |
2413 | void SetIcon(const wxIcon& icon); | |
2414 | ||
2415 | /** | |
2416 | Set the text. | |
2417 | */ | |
2418 | void SetText(const wxString& text); | |
2419 | }; | |
2420 | ||
2421 | ||
2422 | ||
2423 | /** | |
2424 | @class wxDataViewEvent | |
2425 | ||
2426 | This is the event class for the wxDataViewCtrl notifications. | |
2427 | ||
14f73cf1 FM |
2428 | @beginEventTable{wxDataViewEvent} |
2429 | @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)} | |
2430 | Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event. | |
2431 | @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)} | |
2432 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. | |
2433 | @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)} | |
2434 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. | |
2435 | @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)} | |
2436 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event. | |
2437 | @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)} | |
2438 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event. | |
2439 | @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)} | |
2440 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event. | |
2441 | @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)} | |
2442 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event. | |
2443 | @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)} | |
2444 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event. | |
2445 | @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)} | |
2446 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event. | |
2447 | @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)} | |
2448 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event. | |
2449 | @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)} | |
2450 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event. | |
2451 | @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)} | |
2452 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event. | |
2453 | @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)} | |
2454 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event. | |
2455 | @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)} | |
2456 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event. | |
2457 | @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)} | |
2458 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event. | |
2459 | @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)} | |
2460 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event. | |
2461 | @event{EVT_DATAVIEW_ITEM_DROP(id, func)} | |
2462 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event. | |
47a8b1e1 VZ |
2463 | @event{EVT_DATAVIEW_CACHE_HINT(id, func)} |
2464 | Process a @c wxEVT_COMMAND_DATAVIEW_CACHE_HINT event. | |
14f73cf1 | 2465 | @endEventTable |
43c64cc6 | 2466 | |
80932a3e FM |
2467 | @library{wxadv} |
2468 | @category{events,dvc} | |
2469 | */ | |
2470 | class wxDataViewEvent : public wxNotifyEvent | |
2471 | { | |
2472 | public: | |
80932a3e FM |
2473 | /** |
2474 | Constructor. Typically used by wxWidgets internals only. | |
2475 | */ | |
2476 | wxDataViewEvent(wxEventType commandType = wxEVT_NULL, | |
2477 | int winid = 0); | |
80932a3e FM |
2478 | |
2479 | /** | |
2480 | Returns the position of the column in the control or -1 | |
2481 | if no column field was set by the event emitter. | |
2482 | */ | |
2483 | int GetColumn() const; | |
2484 | ||
2485 | /** | |
2486 | Returns a pointer to the wxDataViewColumn from which | |
2487 | the event was emitted or @NULL. | |
2488 | */ | |
2489 | wxDataViewColumn* GetDataViewColumn() const; | |
2490 | ||
2491 | /** | |
2492 | Returns the wxDataViewModel associated with the event. | |
2493 | */ | |
2494 | wxDataViewModel* GetModel() const; | |
2495 | ||
2496 | /** | |
2497 | Returns a the position of a context menu event in screen coordinates. | |
2498 | */ | |
2499 | wxPoint GetPosition() const; | |
2500 | ||
2501 | /** | |
2502 | Returns a reference to a value. | |
2503 | */ | |
2504 | const wxVariant& GetValue() const; | |
2505 | ||
2506 | /** | |
2507 | Sets the column index associated with this event. | |
2508 | */ | |
2509 | void SetColumn(int col); | |
2510 | ||
2511 | /** | |
2512 | For wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only. | |
2513 | */ | |
2514 | void SetDataViewColumn(wxDataViewColumn* col); | |
2515 | ||
2516 | /** | |
2517 | Sets the dataview model associated with this event. | |
2518 | */ | |
2519 | void SetModel(wxDataViewModel* model); | |
2520 | ||
2521 | /** | |
2522 | Sets the value associated with this event. | |
2523 | */ | |
2524 | void SetValue(const wxVariant& value); | |
02b51ae5 | 2525 | |
591cc82d | 2526 | /** |
e4de825e | 2527 | Set wxDataObject for data transfer within a drag operation. |
591cc82d RR |
2528 | */ |
2529 | void SetDataObject( wxDataObject *obj ); | |
02b51ae5 | 2530 | |
591cc82d | 2531 | /** |
e4de825e RR |
2532 | Used internally. Gets associated wxDataObject for data transfer |
2533 | within a drag operation. | |
2534 | */ | |
2535 | wxDataObject *GetDataObject() const; | |
02b51ae5 | 2536 | |
e4de825e RR |
2537 | /** |
2538 | Used internally. Sets the wxDataFormat during a drop operation. | |
2539 | */ | |
2540 | void SetDataFormat( const wxDataFormat &format ); | |
02b51ae5 | 2541 | |
e4de825e RR |
2542 | /** |
2543 | Gets the wxDataFormat during a drop operation. | |
2544 | */ | |
2545 | wxDataFormat GetDataFormat() const; | |
02b51ae5 | 2546 | |
e4de825e RR |
2547 | /** |
2548 | Used internally. Sets the data size for a drop data transfer. | |
2549 | */ | |
2550 | void SetDataSize( size_t size ); | |
02b51ae5 | 2551 | |
e4de825e RR |
2552 | /** |
2553 | Gets the data size for a drop data transfer. | |
2554 | */ | |
2555 | size_t GetDataSize() const; | |
02b51ae5 | 2556 | |
e4de825e RR |
2557 | /** |
2558 | Used internally. Sets the data buffer for a drop data transfer. | |
2559 | */ | |
2560 | void SetDataBuffer( void* buf ); | |
02b51ae5 | 2561 | |
e4de825e RR |
2562 | /** |
2563 | Gets the data buffer for a drop data transfer. | |
591cc82d | 2564 | */ |
e4de825e | 2565 | void *GetDataBuffer() const; |
47a8b1e1 VZ |
2566 | |
2567 | /** | |
2568 | Return the first row that will be displayed. | |
2569 | */ | |
2570 | int GetCacheFrom() const; | |
2571 | ||
2572 | /** | |
2573 | Return the last row that will be displayed. | |
2574 | */ | |
2575 | int GetCacheTo() const; | |
80932a3e FM |
2576 | }; |
2577 |