1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxDataView* classes
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
11 @class wxDataViewModel
13 wxDataViewModel is the base class for all data model to be displayed by a
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.
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).
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
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.
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.
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.
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.
63 Currently wxWidgets provides the following models apart from the base model:
64 wxDataViewIndexListModel, wxDataViewVirtualListModel, wxDataViewTreeStore,
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:
73 wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, wxID_ANY );
74 wxDataViewModel *musicModel = new MyMusicModel;
75 m_musicCtrl->AssociateModel( musicModel );
76 musicModel->DecRef(); // avoid memory leak !!
81 A potentially better way to avoid memory leaks is to use wxObjectDataPtr
84 wxObjectDataPtr<MyMusicModel> musicModel;
86 wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, wxID_ANY );
87 musicModel = new MyMusicModel;
88 m_musicCtrl->AssociateModel( musicModel.get() );
97 class wxDataViewModel
: public wxRefCounter
106 Adds a wxDataViewModelNotifier to the model.
108 void AddNotifier(wxDataViewModelNotifier
* notifier
);
111 Change the value of the given item and update the control to reflect
114 This function simply calls SetValue() and, if it succeeded,
122 The item (row) to update.
124 The column to update.
126 @true if both SetValue() and ValueChanged() returned @true.
128 bool ChangeValue(const wxVariant
& variant
,
129 const wxDataViewItem
& item
,
133 Called to inform the model that all data has been cleared.
134 The control will reread the data from the model again.
136 virtual bool Cleared();
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.
143 @see HasDefaultCompare().
145 virtual int Compare(const wxDataViewItem
& item1
,
146 const wxDataViewItem
& item2
,
148 bool ascending
) const;
151 Override this to indicate that the item has special font attributes.
152 This only affects the wxDataViewTextRendererText renderer.
154 The base class version always simply returns @false.
156 @see wxDataViewItemAttr.
159 The item for which the attribute is requested.
161 The column of the item for which the attribute is requested.
163 The attribute to be filled in if the function returns @true.
165 @true if this item has an attribute or @false otherwise.
167 virtual bool GetAttr(const wxDataViewItem
& item
, unsigned int col
,
168 wxDataViewItemAttr
& attr
) const;
171 Override this to indicate that the item should be disabled.
173 Disabled items are displayed differently (e.g. grayed out) and cannot
176 The base class version always returns @true, thus making all items
180 The item whose enabled status is requested.
182 The column of the item whose enabled status is requested.
184 @true if this item should be enabled, @false otherwise.
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
194 virtual bool IsEnabled(const wxDataViewItem
&item
,
195 unsigned int col
) const;
198 Override this so the control can query the child items of an item.
199 Returns the number of items.
201 virtual unsigned int GetChildren(const wxDataViewItem
& item
,
202 wxDataViewItemArray
& children
) const = 0;
205 Override this to indicate the number of columns in the model.
207 virtual unsigned int GetColumnCount() const = 0;
210 Override this to indicate what type of data is stored in the
211 column specified by @a col.
213 This should return a string indicating the type of data as reported by wxVariant.
215 virtual wxString
GetColumnType(unsigned int col
) const = 0;
218 Override this to indicate which wxDataViewItem representing the parent
219 of @a item or an invalid wxDataViewItem if the root item is
222 virtual wxDataViewItem
GetParent(const wxDataViewItem
& item
) const = 0;
225 Override this to indicate the value of @a item.
226 A wxVariant is used to store the data.
228 virtual void GetValue(wxVariant
& variant
, const wxDataViewItem
& item
,
229 unsigned int col
) const = 0;
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.
236 virtual bool HasContainerColumns(const wxDataViewItem
& item
) const;
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.
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.
248 virtual bool HasDefaultCompare() const;
251 Return true if there is a value in the given column of this item.
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
262 bool HasValue(const wxDataViewItem
& item
, unsigned col
) const;
265 Override this to indicate of @a item is a container, i.e. if
266 it can have child items.
268 virtual bool IsContainer(const wxDataViewItem
& item
) const = 0;
271 Call this to inform the model that an item has been added to the data.
273 bool ItemAdded(const wxDataViewItem
& parent
,
274 const wxDataViewItem
& item
);
277 Call this to inform the model that an item has changed.
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.
282 bool ItemChanged(const wxDataViewItem
& item
);
285 Call this to inform the model that an item has been deleted from the data.
287 bool ItemDeleted(const wxDataViewItem
& parent
,
288 const wxDataViewItem
& item
);
291 Call this to inform the model that several items have been added to the data.
293 bool ItemsAdded(const wxDataViewItem
& parent
,
294 const wxDataViewItemArray
& items
);
297 Call this to inform the model that several items have changed.
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.
302 bool ItemsChanged(const wxDataViewItemArray
& items
);
305 Call this to inform the model that several items have been deleted.
307 bool ItemsDeleted(const wxDataViewItem
& parent
,
308 const wxDataViewItemArray
& items
);
311 Remove the @a notifier from the list of notifiers.
313 void RemoveNotifier(wxDataViewModelNotifier
* notifier
);
316 Call this to initiate a resort after the sort function has been changed.
318 virtual void Resort();
321 This gets called in order to set a value in the data model.
323 The most common scenario is that the wxDataViewCtrl calls this method
324 after the user changed some data in the view.
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
331 virtual bool SetValue(const wxVariant
& variant
,
332 const wxDataViewItem
& item
,
333 unsigned int col
) = 0;
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.
340 This will eventually emit a @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
343 virtual bool ValueChanged(const wxDataViewItem
& item
,
349 Destructor. This should not be called directly. Use DecRef() instead.
351 virtual ~wxDataViewModel();
357 @class wxDataViewListModel
359 Base class with abstract API for wxDataViewIndexListModel and
360 wxDataViewVirtualListModel.
365 class wxDataViewListModel
: public wxDataViewModel
372 virtual ~wxDataViewIndexListModel();
375 Compare method that sorts the items by their index.
377 int Compare(const wxDataViewItem
& item1
,
378 const wxDataViewItem
& item2
,
379 unsigned int column
, bool ascending
);
382 Override this to indicate that the row has special font attributes.
383 This only affects the wxDataViewTextRendererText() renderer.
385 The base class version always simply returns @false.
387 @see wxDataViewItemAttr.
390 The row for which the attribute is requested.
392 The column for which the attribute is requested.
394 The attribute to be filled in if the function returns @true.
396 @true if this item has an attribute or @false otherwise.
398 virtual bool GetAttrByRow(unsigned int row
, unsigned int col
,
399 wxDataViewItemAttr
& attr
) const;
402 Override this if you want to disable specific items.
404 The base class version always returns @true, thus making all items
408 The row of the item whose enabled status is requested.
410 The column of the item whose enabled status is requested.
412 @true if the item at this row and column should be enabled,
415 @note See wxDataViewModel::IsEnabled() for the current status of
416 support for disabling the items under different platforms.
420 virtual bool IsEnabledByRow(unsigned int row
,
421 unsigned int col
) const;
424 Returns the number of items (or rows) in the list.
426 unsigned int GetCount() const;
429 Returns the wxDataViewItem at the given @e row.
431 wxDataViewItem
GetItem(unsigned int row
) const;
434 Returns the position of given @e item.
436 unsigned int GetRow(const wxDataViewItem
& item
) const;
439 Override this to allow getting values from the model.
441 virtual void GetValueByRow(wxVariant
& variant
, unsigned int row
,
442 unsigned int col
) const = 0;
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.
449 void Reset(unsigned int new_size
);
452 Call this after a row has been appended to the model.
457 Call this after a row has been changed.
459 void RowChanged(unsigned int row
);
462 Call this after a row has been deleted.
464 void RowDeleted(unsigned int row
);
467 Call this after a row has been inserted at the given position.
469 void RowInserted(unsigned int before
);
472 Call this after a row has been prepended to the model.
477 Call this after a value has been changed.
479 void RowValueChanged(unsigned int row
, unsigned int col
);
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.
486 void RowsDeleted(const wxArrayInt
& rows
);
489 Called in order to set a value in the model.
491 virtual bool SetValueByRow(const wxVariant
& variant
, unsigned int row
,
492 unsigned int col
) = 0;
497 @class wxDataViewIndexListModel
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.
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.
509 @see wxDataViewListModel for the API.
515 class wxDataViewIndexListModel
: public wxDataViewListModel
521 wxDataViewIndexListModel(unsigned int initial_size
= 0);
526 @class wxDataViewVirtualListModel
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).
535 @see wxDataViewListModel for the API.
541 class wxDataViewVirtualListModel
: public wxDataViewListModel
547 wxDataViewVirtualListModel(unsigned int initial_size
= 0);
554 @class wxDataViewItemAttr
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.
560 Attributes are currently only supported by wxDataViewTextRendererText.
565 class wxDataViewItemAttr
571 wxDataViewItemAttr();
574 Call this to indicate that the item shall be displayed in bold text.
576 void SetBold(bool set
);
579 Call this to indicate that the item shall be displayed with that colour.
581 void SetColour(const wxColour
& colour
);
584 Call this to indicate that the item shall be displayed in italic text.
586 void SetItalic(bool set
);
592 @class wxDataViewItem
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.
598 It must hold a unique ID of type @e void* in its only field and can be converted
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.
618 wxDataViewItem(const wxDataViewItem
& item
);
619 explicit wxDataViewItem(void* id
);
628 Returns @true if the ID is not @NULL.
634 // ----------------------------------------------------------------------------
635 // wxDataViewCtrl flags
636 // ----------------------------------------------------------------------------
638 // size of a wxDataViewRenderer without contents:
639 #define wxDVC_DEFAULT_RENDERER_SIZE 20
641 // the default width of new (text) columns:
642 #define wxDVC_DEFAULT_WIDTH 80
644 // the default width of new toggle columns:
645 #define wxDVC_TOGGLE_DEFAULT_WIDTH 30
647 // the default minimal width of the columns:
648 #define wxDVC_DEFAULT_MINWIDTH 30
650 // The default alignment of wxDataViewRenderers is to take
651 // the alignment from the column it owns.
652 #define wxDVR_DEFAULT_ALIGNMENT -1
654 #define wxDV_SINGLE 0x0000 // for convenience
655 #define wxDV_MULTIPLE 0x0001 // can select multiple items
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
661 #define wxDV_ROW_LINES 0x0010 // alternating colour in rows
662 #define wxDV_VARIABLE_LINE_HEIGHT 0x0020 // variable line height
666 wxEventType wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED
;
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
;
678 wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU
;
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
;
686 wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG
;
687 wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE
;
688 wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_DROP
;
691 @class wxDataViewCtrl
693 wxDataViewCtrl is a control to display data either in a tree like fashion or
694 in a tabular form or both.
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.
702 A wxDataViewItem is used to represent a (visible) item in the control.
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.
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.
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.
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).
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
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.
786 @appearance{dataviewctrl.png}
788 class wxDataViewCtrl
: public wxControl
797 Constructor. Calls Create().
799 wxDataViewCtrl(wxWindow
* parent
, wxWindowID id
,
800 const wxPoint
& pos
= wxDefaultPosition
,
801 const wxSize
& size
= wxDefaultSize
,
803 const wxValidator
& validator
= wxDefaultValidator
,
804 const wxString
& name
= wxDataViewCtrlNameStr
);
809 virtual ~wxDataViewCtrl();
812 Appends a wxDataViewColumn to the control. Returns @true on success.
814 Note that there is a number of short cut methods which implicitly create
815 a wxDataViewColumn and a wxDataViewRenderer for it (see below).
817 virtual bool AppendColumn(wxDataViewColumn
* col
);
820 Prepends a wxDataViewColumn to the control. Returns @true on success.
822 Note that there is a number of short cut methods which implicitly create
823 a wxDataViewColumn and a wxDataViewRenderer for it.
825 virtual bool PrependColumn(wxDataViewColumn
* col
);
828 Inserts a wxDataViewColumn to the control. Returns @true on success.
830 virtual bool InsertColumn(unsigned int pos
, wxDataViewColumn
* col
);
834 Appends a column for rendering a bitmap. Returns the wxDataViewColumn
835 created in the function or @NULL on failure.
837 wxDataViewColumn
* AppendBitmapColumn(const wxString
& label
,
838 unsigned int model_column
,
839 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
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
,
847 wxAlignment align
= wxALIGN_CENTER
,
848 int flags
= wxDATAVIEW_COL_RESIZABLE
);
853 Appends a column for rendering a date. Returns the wxDataViewColumn
854 created in the function or @NULL on failure.
856 @note The @a align parameter is applied to both the column header and
859 wxDataViewColumn
* AppendDateColumn(const wxString
& label
,
860 unsigned int model_column
,
861 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
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
,
869 wxAlignment align
= wxALIGN_NOT
,
870 int flags
= wxDATAVIEW_COL_RESIZABLE
);
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.
879 @note The @a align parameter is applied to both the column header and
882 wxDataViewColumn
* AppendIconTextColumn(const wxString
& label
,
883 unsigned int model_column
,
884 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
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
,
892 wxAlignment align
= wxALIGN_NOT
,
893 int flags
= wxDATAVIEW_COL_RESIZABLE
);
898 Appends a column for rendering a progress indicator. Returns the
899 wxDataViewColumn created in the function or @NULL on failure.
901 @note The @a align parameter is applied to both the column header and
904 wxDataViewColumn
* AppendProgressColumn(const wxString
& label
,
905 unsigned int model_column
,
906 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
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
,
914 wxAlignment align
= wxALIGN_CENTER
,
915 int flags
= wxDATAVIEW_COL_RESIZABLE
);
920 Appends a column for rendering text. Returns the wxDataViewColumn
921 created in the function or @NULL on failure.
923 @note The @a align parameter is applied to both the column header and
926 wxDataViewColumn
* AppendTextColumn(const wxString
& label
,
927 unsigned int model_column
,
928 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
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
,
936 wxAlignment align
= wxALIGN_NOT
,
937 int flags
= wxDATAVIEW_COL_RESIZABLE
);
942 Appends a column for rendering a toggle. Returns the wxDataViewColumn
943 created in the function or @NULL on failure.
945 @note The @a align parameter is applied to both the column header and
948 wxDataViewColumn
* AppendToggleColumn(const wxString
& label
,
949 unsigned int model_column
,
950 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
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
,
958 wxAlignment align
= wxALIGN_CENTER
,
959 int flags
= wxDATAVIEW_COL_RESIZABLE
);
963 Associates a wxDataViewModel with the control.
964 This increases the reference count of the model by 1.
966 virtual bool AssociateModel(wxDataViewModel
* model
);
971 virtual bool ClearColumns();
976 virtual void Collapse(const wxDataViewItem
& item
);
979 Create the control. Useful for two step creation.
981 bool Create(wxWindow
* parent
, wxWindowID id
,
982 const wxPoint
& pos
= wxDefaultPosition
,
983 const wxSize
& size
= wxDefaultSize
,
985 const wxValidator
& validator
= wxDefaultValidator
,
986 const wxString
& name
= wxDataViewCtrlNameStr
);
989 Deletes given column.
991 virtual bool DeleteColumn(wxDataViewColumn
* column
);
994 Enable drag operations using the given @a format.
996 virtual bool EnableDragSource( const wxDataFormat
&format
);
999 Enable drop operations using the given @a format.
1001 virtual bool EnableDropTarget( const wxDataFormat
&format
);
1004 Call this to ensure that the given item is visible.
1006 virtual void EnsureVisible(const wxDataViewItem
& item
,
1007 const wxDataViewColumn
* column
= NULL
);
1012 virtual void Expand(const wxDataViewItem
& item
);
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.
1019 virtual void ExpandAncestors( const wxDataViewItem
& item
);
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.
1025 virtual wxDataViewColumn
* GetColumn(unsigned int pos
) const;
1028 Returns the number of columns.
1030 virtual unsigned int GetColumnCount() const;
1033 Returns the position of the column or -1 if not found in the control.
1035 virtual int GetColumnPosition(const wxDataViewColumn
* column
) const;
1038 Returns column containing the expanders.
1040 wxDataViewColumn
* GetExpanderColumn() const;
1043 Returns the currently focused item.
1045 This is the item that the keyboard commands apply to. It may be invalid
1046 if there is no focus currently.
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
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
1056 @see SetCurrentItem()
1060 wxDataViewItem
GetCurrentItem() const;
1063 Returns indentation.
1065 int GetIndent() const;
1070 virtual wxRect
GetItemRect(const wxDataViewItem
& item
,
1071 const wxDataViewColumn
* col
= NULL
) const;
1074 Returns pointer to the data model associated with the control (if any).
1076 wxDataViewModel
* GetModel();
1079 Returns the number of currently selected items.
1081 This method may be called for both the controls with single and
1082 multiple selections and returns the number of selected item, possibly
1087 virtual int GetSelectedItemsCount() const;
1090 Returns first selected item or an invalid item if none is selected.
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.
1097 virtual wxDataViewItem
GetSelection() const;
1100 Fills @a sel with currently selected items and returns their number.
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.
1106 @see GetSelectedItemsCount()
1108 virtual int GetSelections(wxDataViewItemArray
& sel
) const;
1111 Returns the wxDataViewColumn currently responsible for sorting
1112 or @NULL if none has been selected.
1114 virtual wxDataViewColumn
* GetSortingColumn() const;
1117 Returns true if any items are currently selected.
1119 This method may be called for both the controls with single and
1120 multiple selections.
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.
1128 bool HasSelection() const;
1133 virtual void HitTest(const wxPoint
& point
, wxDataViewItem
& item
,
1134 wxDataViewColumn
*& col
) const;
1137 Return @true if the item is expanded.
1139 virtual bool IsExpanded(const wxDataViewItem
& item
) const;
1142 Return @true if the item is selected.
1144 virtual bool IsSelected(const wxDataViewItem
& item
) const;
1147 Select the given item.
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.
1153 virtual void Select(const wxDataViewItem
& item
);
1158 virtual void SelectAll();
1161 Set which column shall contain the tree-like expanders.
1163 void SetExpanderColumn(wxDataViewColumn
* col
);
1166 Changes the currently focused item.
1168 The @a item parameter must be valid, there is no way to remove the
1169 current item from the control.
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
1178 @see GetCurrentItem()
1182 void SetCurrentItem(const wxDataViewItem
& item
);
1185 Sets the indentation.
1187 void SetIndent(int indent
);
1190 Sets the selection to the array of wxDataViewItems.
1192 virtual void SetSelections(const wxDataViewItemArray
& sel
);
1195 Programmatically starts editing the given item on the given column.
1196 Currently not implemented on wxOSX Carbon.
1200 virtual void StartEditor(const wxDataViewItem
& item
, unsigned int column
);
1203 Unselect the given item.
1205 virtual void Unselect(const wxDataViewItem
& item
);
1209 This method only has effect if multiple selections are allowed.
1211 virtual void UnselectAll();
1214 Sets the row height.
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.
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.
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.
1227 @return @true if the line height was changed or @false otherwise.
1231 virtual bool SetRowHeight(int rowHeight
);
1237 @class wxDataViewModelNotifier
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.
1246 class wxDataViewModelNotifier
1252 wxDataViewModelNotifier();
1257 virtual ~wxDataViewModelNotifier();
1260 Called by owning model.
1262 virtual bool Cleared() = 0;
1265 Get owning wxDataViewModel.
1267 wxDataViewModel
* GetOwner() const;
1270 Called by owning model.
1272 virtual bool ItemAdded(const wxDataViewItem
& parent
,
1273 const wxDataViewItem
& item
) = 0;
1276 Called by owning model.
1278 virtual bool ItemChanged(const wxDataViewItem
& item
) = 0;
1281 Called by owning model.
1283 virtual bool ItemDeleted(const wxDataViewItem
& parent
,
1284 const wxDataViewItem
& item
) = 0;
1287 Called by owning model.
1289 virtual bool ItemsAdded(const wxDataViewItem
& parent
,
1290 const wxDataViewItemArray
& items
);
1293 Called by owning model.
1295 virtual bool ItemsChanged(const wxDataViewItemArray
& items
);
1298 Called by owning model.
1300 virtual bool ItemsDeleted(const wxDataViewItem
& parent
,
1301 const wxDataViewItemArray
& items
);
1304 Called by owning model.
1306 virtual void Resort() = 0;
1309 Set owner of this notifier. Used internally.
1311 void SetOwner(wxDataViewModel
* owner
);
1314 Called by owning model.
1316 virtual bool ValueChanged(const wxDataViewItem
& item
, unsigned int col
) = 0;
1321 The mode of a data-view cell; see wxDataViewRenderer for more info.
1323 enum wxDataViewCellMode
1325 wxDATAVIEW_CELL_INERT
,
1328 Indicates that the user can double click the cell and something will
1329 happen (e.g. a window for editing a date will pop up).
1331 wxDATAVIEW_CELL_ACTIVATABLE
,
1334 Indicates that the user can edit the data in-place, i.e. an control
1335 will show up after a slow click on the cell. This behaviour is best
1336 known from changing the filename in most file managers etc.
1338 wxDATAVIEW_CELL_EDITABLE
1342 The values of this enum controls how a wxDataViewRenderer should display
1343 its contents in a cell.
1345 enum wxDataViewCellRenderState
1347 wxDATAVIEW_CELL_SELECTED
= 1,
1348 wxDATAVIEW_CELL_PRELIT
= 2,
1349 wxDATAVIEW_CELL_INSENSITIVE
= 4,
1350 wxDATAVIEW_CELL_FOCUSED
= 8
1354 @class wxDataViewRenderer
1356 This class is used by wxDataViewCtrl to render the individual cells.
1357 One instance of a renderer class is owned by a wxDataViewColumn.
1358 There is a number of ready-to-use renderers provided:
1359 - wxDataViewTextRenderer,
1360 - wxDataViewIconTextRenderer,
1361 - wxDataViewToggleRenderer,
1362 - wxDataViewProgressRenderer,
1363 - wxDataViewBitmapRenderer,
1364 - wxDataViewDateRenderer,
1365 - wxDataViewSpinRenderer.
1366 - wxDataViewChoiceRenderer.
1368 Additionally, the user can write own renderers by deriving from
1369 wxDataViewCustomRenderer.
1371 The ::wxDataViewCellMode and ::wxDataViewCellRenderState flags accepted
1372 by the constructors respectively controls what actions the cell data allows
1373 and how the renderer should display its contents in a cell.
1378 class wxDataViewRenderer
: public wxObject
1384 wxDataViewRenderer(const wxString
& varianttype
,
1385 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1386 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1389 Enable or disable replacing parts of the item text with ellipsis to
1390 make it fit the column width.
1392 This method only makes sense for the renderers working with text, such
1393 as wxDataViewTextRenderer or wxDataViewIconTextRenderer.
1395 By default wxELLIPSIZE_MIDDLE is used.
1398 Ellipsization mode, use wxELLIPSIZE_NONE to disable.
1402 void EnableEllipsize(wxEllipsizeMode mode
= wxELLIPSIZE_MIDDLE
);
1405 Disable replacing parts of the item text with ellipsis.
1407 If ellipsizing is disabled, the string will be truncated if it doesn't
1410 This is the same as @code EnableEllipsize(wxELLIPSIZE_NONE) @endcode.
1414 void DisableEllipsize();
1417 Returns the alignment. See SetAlignment()
1419 virtual int GetAlignment() const;
1422 Returns the ellipsize mode used by the renderer.
1424 If the return value is wxELLIPSIZE_NONE, the text is simply truncated
1427 @see EnableEllipsize()
1429 wxEllipsizeMode
GetEllipsizeMode() const;
1432 Returns the cell mode.
1434 virtual wxDataViewCellMode
GetMode() const;
1437 Returns pointer to the owning wxDataViewColumn.
1439 wxDataViewColumn
* GetOwner() const;
1442 This methods retrieves the value from the renderer in order to
1443 transfer the value back to the data model.
1445 Returns @false on failure.
1447 virtual bool GetValue(wxVariant
& value
) const = 0;
1450 Returns a string with the type of the wxVariant supported by this renderer.
1452 wxString
GetVariantType() const;
1455 Sets the alignment of the renderer's content.
1456 The default value of @c wxDVR_DEFAULT_ALIGMENT indicates that the content
1457 should have the same alignment as the column header.
1459 The method is not implemented under OS X and the renderer always aligns
1460 its contents as the column header on that platform. The other platforms
1461 support both vertical and horizontal alignment.
1463 virtual void SetAlignment( int align
);
1465 Sets the owning wxDataViewColumn.
1466 This is usually called from within wxDataViewColumn.
1468 void SetOwner(wxDataViewColumn
* owner
);
1471 Set the value of the renderer (and thus its cell) to @a value.
1472 The internal code will then render this cell with this data.
1474 virtual bool SetValue(const wxVariant
& value
) = 0;
1477 Before data is committed to the data model, it is passed to this
1478 method where it can be checked for validity. This can also be
1479 used for checking a valid range or limiting the user input in
1480 a certain aspect (e.g. max number of characters or only alphanumeric
1481 input, ASCII only etc.). Return @false if the value is not valid.
1483 Please note that due to implementation limitations, this validation
1484 is done after the editing control already is destroyed and the
1485 editing process finished.
1487 virtual bool Validate(wxVariant
& value
);
1493 @class wxDataViewTextRenderer
1495 wxDataViewTextRenderer is used for rendering text.
1496 It supports in-place editing if desired.
1501 class wxDataViewTextRenderer
: public wxDataViewRenderer
1507 wxDataViewTextRenderer(const wxString
& varianttype
= "string",
1508 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1509 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1515 @class wxDataViewIconTextRenderer
1517 The wxDataViewIconTextRenderer class is used to display text with
1518 a small icon next to it as it is typically done in a file manager.
1520 This classes uses the wxDataViewIconText helper class to store its data.
1521 wxDataViewIconText can be converted to and from a wxVariant using the left
1527 class wxDataViewIconTextRenderer
: public wxDataViewRenderer
1533 wxDataViewIconTextRenderer(const wxString
& varianttype
= "wxDataViewIconText",
1534 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1535 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1541 @class wxDataViewProgressRenderer
1543 This class is used by wxDataViewCtrl to render progress bars.
1548 class wxDataViewProgressRenderer
: public wxDataViewRenderer
1554 wxDataViewProgressRenderer(const wxString
& label
= wxEmptyString
,
1555 const wxString
& varianttype
= "long",
1556 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1557 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1563 @class wxDataViewSpinRenderer
1565 This is a specialized renderer for rendering integer values.
1566 It supports modifying the values in-place by using a wxSpinCtrl.
1567 The renderer only support variants of type @e long.
1572 class wxDataViewSpinRenderer
: public wxDataViewCustomRenderer
1577 @a min and @a max indicate the minimum and maximum values for the wxSpinCtrl.
1579 wxDataViewSpinRenderer(int min
, int max
,
1580 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
1581 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1587 @class wxDataViewToggleRenderer
1589 This class is used by wxDataViewCtrl to render toggle controls.
1594 class wxDataViewToggleRenderer
: public wxDataViewRenderer
1600 wxDataViewToggleRenderer(const wxString
& varianttype
= "bool",
1601 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1602 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1607 @class wxDataViewChoiceRenderer
1609 This class is used by wxDataViewCtrl to render choice controls.
1610 It stores a string so that SetValue() and GetValue() operate
1611 on a variant holding a string.
1617 class wxDataViewChoiceRenderer
: public wxDataViewRenderer
1623 wxDataViewChoiceRenderer( const wxArrayString
&choices
,
1624 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
1625 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
1628 Returns the choice referred to by index.
1630 wxString
GetChoice(size_t index
) const;
1633 Returns all choices.
1635 const wxArrayString
& GetChoices() const;
1640 @class wxDataViewDateRenderer
1642 This class is used by wxDataViewCtrl to render calendar controls.
1647 class wxDataViewDateRenderer
: public wxDataViewRenderer
1653 wxDataViewDateRenderer(const wxString
& varianttype
= "datetime",
1654 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
1655 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1661 @class wxDataViewCustomRenderer
1663 You need to derive a new class from wxDataViewCustomRenderer in
1664 order to write a new renderer.
1666 You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue,
1667 wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render.
1669 If you want your renderer to support in-place editing then you also need to override
1670 wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl
1671 and wxDataViewCustomRenderer::GetValueFromEditorCtrl.
1673 Note that a special event handler will be pushed onto that editor control
1674 which handles @e \<ENTER\> and focus out events in order to end the editing.
1679 class wxDataViewCustomRenderer
: public wxDataViewRenderer
1685 wxDataViewCustomRenderer(const wxString
& varianttype
= "string",
1686 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1687 int align
= -1, bool no_init
= false);
1692 virtual ~wxDataViewCustomRenderer();
1695 Override this to react to double clicks or ENTER.
1696 This method will only be called in wxDATAVIEW_CELL_ACTIVATABLE mode.
1698 virtual bool Activate( const wxRect
& cell
,
1699 wxDataViewModel
* model
,
1700 const wxDataViewItem
& item
,
1704 Override this to create the actual editor control once editing
1707 @a parent is the parent of the editor control, @a labelRect indicates the
1708 position and size of the editor control and @a value is its initial value:
1712 return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
1713 labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l );
1717 virtual wxWindow
* CreateEditorCtrl(wxWindow
* parent
,
1719 const wxVariant
& value
);
1722 Return the attribute to be used for rendering.
1724 This function may be called from Render() implementation to use the
1725 attributes defined for the item if the renderer supports them.
1727 Notice that when Render() is called, the wxDC object passed to it is
1728 already set up to use the correct attributes (e.g. its font is set to
1729 bold or italic version if wxDataViewItemAttr::GetBold() or GetItalic()
1730 returns true) so it may not be necessary to call it explicitly if you
1731 only want to render text using the items attributes.
1735 const wxDataViewItemAttr
& GetAttr() const;
1738 Return size required to show content.
1740 virtual wxSize
GetSize() const = 0;
1743 Override this so that the renderer can get the value from the editor
1744 control (pointed to by @a editor):
1747 wxSpinCtrl *sc = (wxSpinCtrl*) editor;
1748 long l = sc->GetValue();
1754 virtual bool GetValueFromEditorCtrl(wxWindow
* editor
,
1758 Override this and make it return @true in order to
1759 indicate that this renderer supports in-place editing.
1761 virtual bool HasEditorCtrl() const;
1764 Override this to react to a left click.
1765 This method will only be called in @c wxDATAVIEW_CELL_ACTIVATABLE mode.
1767 virtual bool LeftClick( const wxPoint
& cursor
,
1769 wxDataViewModel
* model
,
1770 const wxDataViewItem
& item
,
1774 Override this to render the cell.
1775 Before this is called, wxDataViewRenderer::SetValue was called
1776 so that this instance knows what to render.
1778 virtual bool Render(wxRect cell
, wxDC
* dc
, int state
) = 0;
1781 This method should be called from within Render() whenever you need to
1783 This will ensure that the correct colour, font and vertical alignment will
1784 be chosen so the text will look the same as text drawn by native renderers.
1786 void RenderText(const wxString
& text
, int xoffset
, wxRect cell
,
1787 wxDC
* dc
, int state
);
1790 Override this to start a drag operation. Not yet supported.
1792 virtual bool StartDrag(const wxPoint
& cursor
,
1794 wxDataViewModel
* model
,
1795 const wxDataViewItem
& item
,
1802 @class wxDataViewBitmapRenderer
1804 This class is used by wxDataViewCtrl to render bitmap controls.
1809 class wxDataViewBitmapRenderer
: public wxDataViewRenderer
1815 wxDataViewBitmapRenderer(const wxString
& varianttype
= "wxBitmap",
1816 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1817 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1822 The flags used by wxDataViewColumn.
1823 Can be combined together.
1825 enum wxDataViewColumnFlags
1827 wxDATAVIEW_COL_RESIZABLE
= 1,
1828 wxDATAVIEW_COL_SORTABLE
= 2,
1829 wxDATAVIEW_COL_REORDERABLE
= 4,
1830 wxDATAVIEW_COL_HIDDEN
= 8
1834 @class wxDataViewColumn
1836 This class represents a column in a wxDataViewCtrl.
1837 One wxDataViewColumn is bound to one column in the data model to which the
1838 wxDataViewCtrl has been associated.
1840 An instance of wxDataViewRenderer is used by this class to render its data.
1845 class wxDataViewColumn
: public wxSettableHeaderColumn
1849 Constructs a text column.
1852 The title of the column.
1854 The class which will render the contents of this column.
1856 The index of the model's column which is associated with this object.
1858 The width of the column.
1859 The @c wxDVC_DEFAULT_WIDTH value is the fixed default value.
1861 The alignment of the column title.
1863 One or more flags of the ::wxDataViewColumnFlags enumeration.
1865 wxDataViewColumn(const wxString
& title
,
1866 wxDataViewRenderer
* renderer
,
1867 unsigned int model_column
,
1868 int width
= wxDVC_DEFAULT_WIDTH
,
1869 wxAlignment align
= wxALIGN_CENTER
,
1870 int flags
= wxDATAVIEW_COL_RESIZABLE
);
1873 Constructs a bitmap column.
1876 The bitmap of the column.
1878 The class which will render the contents of this column.
1880 The index of the model's column which is associated with this object.
1882 The width of the column.
1883 The @c wxDVC_DEFAULT_WIDTH value is the fixed default value.
1885 The alignment of the column title.
1887 One or more flags of the ::wxDataViewColumnFlags enumeration.
1889 wxDataViewColumn(const wxBitmap
& bitmap
,
1890 wxDataViewRenderer
* renderer
,
1891 unsigned int model_column
,
1892 int width
= wxDVC_DEFAULT_WIDTH
,
1893 wxAlignment align
= wxALIGN_CENTER
,
1894 int flags
= wxDATAVIEW_COL_RESIZABLE
);
1897 Returns the index of the column of the model, which this
1898 wxDataViewColumn is displaying.
1900 unsigned int GetModelColumn() const;
1903 Returns the owning wxDataViewCtrl.
1905 wxDataViewCtrl
* GetOwner() const;
1908 Returns the renderer of this wxDataViewColumn.
1910 @see wxDataViewRenderer.
1912 wxDataViewRenderer
* GetRenderer() const;
1918 @class wxDataViewListCtrl
1920 This class is a wxDataViewCtrl which internally uses a wxDataViewListStore
1921 and forwards most of its API to that class.
1923 The purpose of this class is to offer a simple way to display and
1924 edit a small table of data without having to write your own wxDataViewModel.
1927 wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, wxID_ANY );
1929 listctrl->AppendToggleColumn( "Toggle" );
1930 listctrl->AppendTextColumn( "Text" );
1932 wxVector<wxVariant> data;
1933 data.push_back( wxVariant(true) );
1934 data.push_back( wxVariant("row 1") );
1935 listctrl->AppendItem( data );
1938 data.push_back( wxVariant(false) );
1939 data.push_back( wxVariant("row 3") );
1940 listctrl->AppendItem( data );
1944 See wxDataViewCtrl for the list of supported styles.
1947 @beginEventEmissionTable
1948 See wxDataViewCtrl for the list of events emitted by this class.
1954 class wxDataViewListCtrl
: public wxDataViewCtrl
1960 wxDataViewListCtrl();
1963 Constructor. Calls Create().
1965 wxDataViewListCtrl( wxWindow
*parent
, wxWindowID id
,
1966 const wxPoint
& pos
= wxDefaultPosition
,
1967 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_ROW_LINES
,
1968 const wxValidator
& validator
= wxDefaultValidator
);
1971 Destructor. Deletes the image list if any.
1973 ~wxDataViewListCtrl();
1976 Creates the control and a wxDataViewListStore as its internal model.
1978 bool Create( wxWindow
*parent
, wxWindowID id
,
1979 const wxPoint
& pos
= wxDefaultPosition
,
1980 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_ROW_LINES
,
1981 const wxValidator
& validator
= wxDefaultValidator
);
1987 wxDataViewListStore
*GetStore();
1988 const wxDataViewListStore
*GetStore() const;
1992 Returns the position of given @e item or wxNOT_FOUND if it's
1997 int ItemToRow(const wxDataViewItem
&item
) const;
2000 Returns the wxDataViewItem at the given @e row.
2004 wxDataViewItem
RowToItem(int row
) const;
2008 @name Selection handling functions
2012 Returns index of the selected row or wxNOT_FOUND.
2014 @see wxDataViewCtrl::GetSelection()
2018 int GetSelectedRow() const;
2023 @see wxDataViewCtrl::Select()
2027 void SelectRow(unsigned row
);
2030 Unselects given row.
2032 @see wxDataViewCtrl::Unselect()
2036 void UnselectRow(unsigned row
);
2039 Returns true if @a row is selected.
2041 @see wxDataViewCtrl::IsSelected()
2045 bool IsRowSelected(unsigned row
) const;
2050 @name Column management functions
2055 Appends a column to the control and additionally appends a
2056 column to the store with the type string.
2058 virtual void AppendColumn( wxDataViewColumn
*column
);
2061 Appends a column to the control and additionally appends a
2062 column to the list store with the type @a varianttype.
2064 void AppendColumn( wxDataViewColumn
*column
, const wxString
&varianttype
);
2067 Appends a text column to the control and the store.
2069 See wxDataViewColumn::wxDataViewColumn for more info about
2072 wxDataViewColumn
*AppendTextColumn( const wxString
&label
,
2073 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
2074 int width
= -1, wxAlignment align
= wxALIGN_LEFT
,
2075 int flags
= wxDATAVIEW_COL_RESIZABLE
);
2078 Appends a toggle column to the control and the store.
2080 See wxDataViewColumn::wxDataViewColumn for more info about
2083 wxDataViewColumn
*AppendToggleColumn( const wxString
&label
,
2084 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
2085 int width
= -1, wxAlignment align
= wxALIGN_LEFT
,
2086 int flags
= wxDATAVIEW_COL_RESIZABLE
);
2089 Appends a progress column to the control and the store.
2091 See wxDataViewColumn::wxDataViewColumn for more info about
2094 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
,
2095 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
2096 int width
= -1, wxAlignment align
= wxALIGN_LEFT
,
2097 int flags
= wxDATAVIEW_COL_RESIZABLE
);
2100 Appends an icon-and-text column to the control and the store.
2102 See wxDataViewColumn::wxDataViewColumn for more info about
2105 wxDataViewColumn
*AppendIconTextColumn( const wxString
&label
,
2106 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
2107 int width
= -1, wxAlignment align
= wxALIGN_LEFT
,
2108 int flags
= wxDATAVIEW_COL_RESIZABLE
);
2111 Inserts a column to the control and additionally inserts a
2112 column to the store with the type string.
2114 virtual void InsertColumn( unsigned int pos
, wxDataViewColumn
*column
);
2117 Inserts a column to the control and additionally inserts a
2118 column to the list store with the type @a varianttype.
2120 void InsertColumn( unsigned int pos
, wxDataViewColumn
*column
,
2121 const wxString
&varianttype
);
2124 Prepends a column to the control and additionally prepends a
2125 column to the store with the type string.
2127 virtual void PrependColumn( wxDataViewColumn
*column
);
2130 Prepends a column to the control and additionally prepends a
2131 column to the list store with the type @a varianttype.
2133 void PrependColumn( wxDataViewColumn
*column
, const wxString
&varianttype
);
2139 @name Item management functions
2144 Appends an item (=row) to the control and store.
2146 void AppendItem( const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2149 Prepends an item (=row) to the control and store.
2151 void PrependItem( const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2154 Inserts an item (=row) to the control and store.
2156 void InsertItem( unsigned int row
, const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2159 Delete the row at position @a row.
2161 void DeleteItem( unsigned row
);
2164 Delete all items (= all rows).
2166 void DeleteAllItems();
2169 Sets the value in the store and update the control.
2171 void SetValue( const wxVariant
&value
, unsigned int row
, unsigned int col
);
2174 Returns the value from the store.
2176 void GetValue( wxVariant
&value
, unsigned int row
, unsigned int col
);
2179 Sets the value in the store and update the control.
2181 This method assumes that the string is stored in respective
2184 void SetTextValue( const wxString
&value
, unsigned int row
, unsigned int col
);
2187 Returns the value from the store.
2189 This method assumes that the string is stored in respective
2192 wxString
GetTextValue( unsigned int row
, unsigned int col
) const;
2195 Sets the value in the store and update the control.
2197 This method assumes that the boolean value is stored in
2200 void SetToggleValue( bool value
, unsigned int row
, unsigned int col
);
2203 Returns the value from the store.
2205 This method assumes that the boolean value is stored in
2208 bool GetToggleValue( unsigned int row
, unsigned int col
) const;
2215 @class wxDataViewTreeCtrl
2217 This class is a wxDataViewCtrl which internally uses a wxDataViewTreeStore
2218 and forwards most of its API to that class.
2219 Additionally, it uses a wxImageList to store a list of icons.
2221 The main purpose of this class is to provide a simple upgrade path for code
2225 See wxDataViewCtrl for the list of supported styles.
2228 @beginEventEmissionTable
2229 See wxDataViewCtrl for the list of events emitted by this class.
2234 @appearance{dataviewtreectrl.png}
2236 class wxDataViewTreeCtrl
: public wxDataViewCtrl
2242 wxDataViewTreeCtrl();
2249 wxDataViewTreeCtrl(wxWindow
* parent
, wxWindowID id
,
2250 const wxPoint
& pos
= wxDefaultPosition
,
2251 const wxSize
& size
= wxDefaultSize
,
2252 long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
2253 const wxValidator
& validator
= wxDefaultValidator
);
2256 Destructor. Deletes the image list if any.
2258 virtual ~wxDataViewTreeCtrl();
2261 Appends a container to the given @a parent.
2263 wxDataViewItem
AppendContainer(const wxDataViewItem
& parent
,
2264 const wxString
& text
,
2267 wxClientData
* data
= NULL
);
2270 Appends an item to the given @a parent.
2272 wxDataViewItem
AppendItem(const wxDataViewItem
& parent
,
2273 const wxString
& text
,
2275 wxClientData
* data
= NULL
);
2278 Creates the control and a wxDataViewTreeStore as its internal model.
2280 The default tree column created by this method is an editable column
2281 using wxDataViewIconTextRenderer as its renderer.
2283 bool Create(wxWindow
* parent
, wxWindowID id
,
2284 const wxPoint
& pos
= wxDefaultPosition
,
2285 const wxSize
& size
= wxDefaultSize
,
2286 long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
2287 const wxValidator
& validator
= wxDefaultValidator
);
2290 Calls the identical method from wxDataViewTreeStore.
2292 void DeleteAllItems();
2295 Calls the identical method from wxDataViewTreeStore.
2297 void DeleteChildren(const wxDataViewItem
& item
);
2300 Calls the identical method from wxDataViewTreeStore.
2302 void DeleteItem(const wxDataViewItem
& item
);
2305 Calls the identical method from wxDataViewTreeStore.
2307 int GetChildCount(const wxDataViewItem
& parent
) const;
2310 Returns the image list.
2312 wxImageList
* GetImageList();
2315 Calls the identical method from wxDataViewTreeStore.
2317 wxClientData
* GetItemData(const wxDataViewItem
& item
) const;
2320 Calls the identical method from wxDataViewTreeStore.
2322 const wxIcon
& GetItemExpandedIcon(const wxDataViewItem
& item
) const;
2325 Calls the identical method from wxDataViewTreeStore.
2327 const wxIcon
& GetItemIcon(const wxDataViewItem
& item
) const;
2330 Calls the identical method from wxDataViewTreeStore.
2332 wxString
GetItemText(const wxDataViewItem
& item
) const;
2335 Calls the identical method from wxDataViewTreeStore.
2337 wxDataViewItem
GetNthChild(const wxDataViewItem
& parent
,
2338 unsigned int pos
) const;
2344 wxDataViewTreeStore
* GetStore();
2345 const wxDataViewTreeStore
* GetStore() const;
2349 Calls the same method from wxDataViewTreeStore but uses
2350 an index position in the image list instead of a wxIcon.
2352 wxDataViewItem
InsertContainer(const wxDataViewItem
& parent
,
2353 const wxDataViewItem
& previous
,
2354 const wxString
& text
,
2357 wxClientData
* data
= NULL
);
2360 Calls the same method from wxDataViewTreeStore but uses
2361 an index position in the image list instead of a wxIcon.
2363 wxDataViewItem
InsertItem(const wxDataViewItem
& parent
,
2364 const wxDataViewItem
& previous
,
2365 const wxString
& text
,
2367 wxClientData
* data
= NULL
);
2370 Returns true if item is a container.
2372 bool IsContainer( const wxDataViewItem
& item
);
2375 Calls the same method from wxDataViewTreeStore but uses
2376 an index position in the image list instead of a wxIcon.
2378 wxDataViewItem
PrependContainer(const wxDataViewItem
& parent
,
2379 const wxString
& text
,
2382 wxClientData
* data
= NULL
);
2385 Calls the same method from wxDataViewTreeStore but uses
2386 an index position in the image list instead of a wxIcon.
2388 wxDataViewItem
PrependItem(const wxDataViewItem
& parent
,
2389 const wxString
& text
,
2391 wxClientData
* data
= NULL
);
2394 Sets the image list.
2396 void SetImageList(wxImageList
* imagelist
);
2399 Calls the identical method from wxDataViewTreeStore.
2401 void SetItemData(const wxDataViewItem
& item
, wxClientData
* data
);
2404 Calls the identical method from wxDataViewTreeStore.
2406 void SetItemExpandedIcon(const wxDataViewItem
& item
,
2407 const wxIcon
& icon
);
2410 Calls the identical method from wxDataViewTreeStore.
2412 void SetItemIcon(const wxDataViewItem
& item
, const wxIcon
& icon
);
2415 Calls the identical method from wxDataViewTreeStore.
2417 void SetItemText(const wxDataViewItem
& item
,
2418 const wxString
& text
);
2423 @class wxDataViewListStore
2425 wxDataViewListStore is a specialised wxDataViewModel for storing
2426 a simple table of data. Since it derives from wxDataViewIndexListModel
2427 its data is be accessed by row (i.e. by index) instead of only
2430 This class actually stores the values (therefore its name)
2431 and implements all virtual methods from the base classes so it can be
2432 used directly without having to derive any class from it, but it is
2433 mostly used from within wxDataViewListCtrl.
2439 class wxDataViewListStore
: public wxDataViewIndexListModel
2445 wxDataViewListStore();
2450 ~wxDataViewListStore();
2453 Prepends a data column.
2455 @a variantype indicates the type of values store in the column.
2457 This does not automatically fill in any (default) values in
2458 rows which exist in the store already.
2460 void PrependColumn( const wxString
&varianttype
);
2463 Inserts a data column before @a pos.
2465 @a variantype indicates the type of values store in the column.
2467 This does not automatically fill in any (default) values in
2468 rows which exist in the store already.
2470 void InsertColumn( unsigned int pos
, const wxString
&varianttype
);
2473 Appends a data column.
2475 @a variantype indicates the type of values store in the column.
2477 This does not automatically fill in any (default) values in
2478 rows which exist in the store already.
2480 void AppendColumn( const wxString
&varianttype
);
2483 Appends an item (=row) and fills it with @a values.
2485 The values must match the values specifies in the column
2486 in number and type. No (default) values are filled in
2489 void AppendItem( const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2492 Prepends an item (=row) and fills it with @a values.
2494 The values must match the values specifies in the column
2495 in number and type. No (default) values are filled in
2498 void PrependItem( const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2501 Inserts an item (=row) and fills it with @a values.
2503 The values must match the values specifies in the column
2504 in number and type. No (default) values are filled in
2507 void InsertItem( unsigned int row
, const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2510 Delete the item (=row) at position @a pos.
2512 void DeleteItem( unsigned pos
);
2515 Delete all item (=all rows) in the store.
2517 void DeleteAllItems();
2520 Overridden from wxDataViewModel
2522 virtual unsigned int GetColumnCount() const;
2525 Overridden from wxDataViewModel
2527 virtual wxString
GetColumnType( unsigned int col
) const;
2530 Overridden from wxDataViewIndexListModel
2532 virtual void GetValueByRow( wxVariant
&value
,
2533 unsigned int row
, unsigned int col
) const;
2536 Overridden from wxDataViewIndexListModel
2538 virtual bool SetValueByRow( const wxVariant
&value
,
2539 unsigned int row
, unsigned int col
);
2544 @class wxDataViewTreeStore
2546 wxDataViewTreeStore is a specialised wxDataViewModel for storing simple
2547 trees very much like wxTreeCtrl does and it offers a similar API.
2549 This class actually stores the entire tree and the values (therefore its name)
2550 and implements all virtual methods from the base class so it can be used directly
2551 without having to derive any class from it, but it is mostly used from within
2557 class wxDataViewTreeStore
: public wxDataViewModel
2561 Constructor. Creates the invisible root node internally.
2563 wxDataViewTreeStore();
2568 virtual ~wxDataViewTreeStore();
2573 wxDataViewItem
AppendContainer(const wxDataViewItem
& parent
,
2574 const wxString
& text
,
2575 const wxIcon
& icon
= wxNullIcon
,
2576 const wxIcon
& expanded
= wxNullIcon
,
2577 wxClientData
* data
= NULL
);
2582 wxDataViewItem
AppendItem(const wxDataViewItem
& parent
,
2583 const wxString
& text
,
2584 const wxIcon
& icon
= wxNullIcon
,
2585 wxClientData
* data
= NULL
);
2588 Delete all item in the model.
2590 void DeleteAllItems();
2593 Delete all children of the item, but not the item itself.
2595 void DeleteChildren(const wxDataViewItem
& item
);
2600 void DeleteItem(const wxDataViewItem
& item
);
2603 Return the number of children of item.
2605 int GetChildCount(const wxDataViewItem
& parent
) const;
2608 Returns the client data associated with the item.
2610 wxClientData
* GetItemData(const wxDataViewItem
& item
) const;
2613 Returns the icon to display in expanded containers.
2615 const wxIcon
& GetItemExpandedIcon(const wxDataViewItem
& item
) const;
2618 Returns the icon of the item.
2620 const wxIcon
& GetItemIcon(const wxDataViewItem
& item
) const;
2623 Returns the text of the item.
2625 wxString
GetItemText(const wxDataViewItem
& item
) const;
2628 Returns the nth child item of item.
2630 wxDataViewItem
GetNthChild(const wxDataViewItem
& parent
,
2631 unsigned int pos
) const;
2634 Inserts a container after @a previous.
2636 wxDataViewItem
InsertContainer(const wxDataViewItem
& parent
,
2637 const wxDataViewItem
& previous
,
2638 const wxString
& text
,
2639 const wxIcon
& icon
= wxNullIcon
,
2640 const wxIcon
& expanded
= wxNullIcon
,
2641 wxClientData
* data
= NULL
);
2644 Inserts an item after @a previous.
2646 wxDataViewItem
InsertItem(const wxDataViewItem
& parent
,
2647 const wxDataViewItem
& previous
,
2648 const wxString
& text
,
2649 const wxIcon
& icon
= wxNullIcon
,
2650 wxClientData
* data
= NULL
);
2653 Inserts a container before the first child item or @a parent.
2655 wxDataViewItem
PrependContainer(const wxDataViewItem
& parent
,
2656 const wxString
& text
,
2657 const wxIcon
& icon
= wxNullIcon
,
2658 const wxIcon
& expanded
= wxNullIcon
,
2659 wxClientData
* data
= NULL
);
2662 Inserts an item before the first child item or @a parent.
2664 wxDataViewItem
PrependItem(const wxDataViewItem
& parent
,
2665 const wxString
& text
,
2666 const wxIcon
& icon
= wxNullIcon
,
2667 wxClientData
* data
= NULL
);
2670 Sets the client data associated with the item.
2672 void SetItemData(const wxDataViewItem
& item
, wxClientData
* data
);
2675 Sets the expanded icon for the item.
2677 void SetItemExpandedIcon(const wxDataViewItem
& item
,
2678 const wxIcon
& icon
);
2681 Sets the icon for the item.
2683 void SetItemIcon(const wxDataViewItem
& item
, const wxIcon
& icon
);
2688 @class wxDataViewIconText
2690 wxDataViewIconText is used by wxDataViewIconTextRenderer for data transfer.
2691 This class can be converted to and from a wxVariant.
2696 class wxDataViewIconText
: public wxObject
2703 wxDataViewIconText(const wxString
& text
= wxEmptyString
,
2704 const wxIcon
& icon
= wxNullIcon
);
2705 wxDataViewIconText(const wxDataViewIconText
& other
);
2711 const wxIcon
& GetIcon() const;
2716 wxString
GetText() const;
2721 void SetIcon(const wxIcon
& icon
);
2726 void SetText(const wxString
& text
);
2732 @class wxDataViewEvent
2734 This is the event class for the wxDataViewCtrl notifications.
2736 @beginEventTable{wxDataViewEvent}
2737 @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)}
2738 Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event.
2739 @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)}
2740 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.
2741 @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)}
2742 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event.
2743 @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)}
2744 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event.
2745 @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)}
2746 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event.
2747 @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)}
2748 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event.
2749 @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)}
2750 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event.
2751 @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)}
2752 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event.
2753 @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)}
2754 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event.
2755 @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)}
2756 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event.
2757 @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)}
2758 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event.
2759 @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)}
2760 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event.
2761 @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)}
2762 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event.
2763 @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
2764 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event.
2765 @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)}
2766 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event.
2767 @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)}
2768 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event.
2769 @event{EVT_DATAVIEW_ITEM_DROP(id, func)}
2770 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event.
2771 @event{EVT_DATAVIEW_CACHE_HINT(id, func)}
2772 Process a @c wxEVT_COMMAND_DATAVIEW_CACHE_HINT event.
2776 @category{events,dvc}
2778 class wxDataViewEvent
: public wxNotifyEvent
2782 Constructor. Typically used by wxWidgets internals only.
2784 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
,
2788 Returns the position of the column in the control or -1
2789 if no column field was set by the event emitter.
2791 int GetColumn() const;
2794 Returns a pointer to the wxDataViewColumn from which
2795 the event was emitted or @NULL.
2797 wxDataViewColumn
* GetDataViewColumn() const;
2800 Returns the wxDataViewModel associated with the event.
2802 wxDataViewModel
* GetModel() const;
2805 Returns the position of a context menu event in screen coordinates.
2807 wxPoint
GetPosition() const;
2810 Returns a reference to a value.
2812 const wxVariant
& GetValue() const;
2815 Can be used to determine whether the new value is going to be accepted
2816 in wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE handler.
2818 Returns @true if editing the item was cancelled or if the user tried to
2819 enter an invalid value (refused by wxDataViewRenderer::Validate()). If
2820 this method returns @false, it means that the value in the model is
2821 about to be changed to the new one.
2823 Notice that wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event handler can
2824 call wxNotifyEvent::Veto() to prevent this from happening.
2826 Currently support for setting this field and for vetoing the change is
2827 only available in the generic version of wxDataViewCtrl, i.e. under MSW
2828 but not GTK nor OS X.
2832 bool IsEditCancelled() const;
2835 Sets the column index associated with this event.
2837 void SetColumn(int col
);
2840 For @c wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only.
2842 void SetDataViewColumn(wxDataViewColumn
* col
);
2845 Sets the dataview model associated with this event.
2847 void SetModel(wxDataViewModel
* model
);
2850 Sets the value associated with this event.
2852 void SetValue(const wxVariant
& value
);
2855 Set wxDataObject for data transfer within a drag operation.
2857 void SetDataObject( wxDataObject
*obj
);
2860 Used internally. Gets associated wxDataObject for data transfer
2861 within a drag operation.
2863 wxDataObject
*GetDataObject() const;
2866 Used internally. Sets the wxDataFormat during a drop operation.
2868 void SetDataFormat( const wxDataFormat
&format
);
2871 Gets the wxDataFormat during a drop operation.
2873 wxDataFormat
GetDataFormat() const;
2876 Used internally. Sets the data size for a drop data transfer.
2878 void SetDataSize( size_t size
);
2881 Gets the data size for a drop data transfer.
2883 size_t GetDataSize() const;
2886 Used internally. Sets the data buffer for a drop data transfer.
2888 void SetDataBuffer( void* buf
);
2891 Gets the data buffer for a drop data transfer.
2893 void *GetDataBuffer() const;
2896 Return the first row that will be displayed.
2898 int GetCacheFrom() const;
2901 Return the last row that will be displayed.
2903 int GetCacheTo() const;