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