1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxDataView* classes
4 // Author: wxWidgets team
6 // Licence: wxWindows license
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 Since you will usually also allow the wxDataViewCtrl to change your data
24 through its graphical interface, you will also have to override
25 wxDataViewModel::SetValue which the wxDataViewCtrl will call when a change
26 to some data has been commited.
28 wxDataViewModel (as indeed the entire wxDataViewCtrl code) is using wxVariant
29 to store data and its type in a generic way. wxVariant can be extended to contain
30 almost any data without changes to the original class.
32 The data that is presented through this data model is expected to change at
33 run-time. You need to inform the data model when a change happened.
34 Depending on what happened you need to call one of the following methods:
35 - wxDataViewModel::ValueChanged,
36 - wxDataViewModel::ItemAdded,
37 - wxDataViewModel::ItemDeleted,
38 - wxDataViewModel::ItemChanged,
39 - wxDataViewModel::Cleared.
41 There are plural forms for notification of addition, change or removal of
42 several item at once. See:
43 - wxDataViewModel::ItemsAdded,
44 - wxDataViewModel::ItemsDeleted,
45 - wxDataViewModel::ItemsChanged.
47 Note that wxDataViewModel does not define the position or index of any item
48 in the control because different controls might display the same data differently.
49 wxDataViewModel does provide a wxDataViewModel::Compare method which the
50 wxDataViewCtrl may use to sort the data either in conjunction with a column
51 header or without (see wxDataViewModel::HasDefaultCompare).
53 This class maintains a list of wxDataViewModelNotifier which link this class
54 to the specific implementations on the supported platforms so that e.g. calling
55 wxDataViewModel::ValueChanged on this model will just call
56 wxDataViewModelNotifier::ValueChanged for each notifier that has been added.
57 You can also add your own notifier in order to get informed about any changes
58 to the data in the list model.
60 Currently wxWidgets provides the following models apart from the base model:
61 wxDataViewIndexListModel, wxDataViewVirtualListModel, wxDataViewTreeStore.
63 Note that wxDataViewModel is reference counted, derives from wxObjectRefData
64 and cannot be deleted directly as it can be shared by several wxDataViewCtrls.
65 This implies that you need to decrease the reference count after
66 associating the model with a control like this:
69 wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, ID_MUSIC_CTRL );
70 wxDataViewModel *musicModel = new MyMusicModel;
71 m_musicCtrl-AssociateModel( musicModel );
72 musicModel-DecRef(); // avoid memory leak !!
80 class wxDataViewModel
: public wxObjectRefData
89 Adds a wxDataViewModelNotifier to the model.
91 void AddNotifier(wxDataViewModelNotifier
* notifier
);
94 Called to inform the model that all data has been cleared.
95 The control will reread the data from the model again.
97 virtual bool Cleared();
100 The compare function to be used by control. The default compare function
101 sorts by container and other items separately and in ascending order.
102 Override this for a different sorting behaviour.
104 @see HasDefaultCompare().
106 virtual int Compare(const wxDataViewItem
& item1
,
107 const wxDataViewItem
& item2
,
112 Override this to indicate that the item has special font attributes.
113 This only affects the wxDataViewTextRendererText renderer.
115 @see wxDataViewItemAttr.
117 virtual bool GetAttr(const wxDataViewItem
& item
, unsigned int col
,
118 wxDataViewItemAttr
& attr
);
121 Override this so the control can query the child items of an item.
122 Returns the number of items.
124 virtual unsigned int GetChildren(const wxDataViewItem
& item
,
125 wxDataViewItemArray
& children
) const = 0;
128 Override this to indicate the number of columns in the model.
130 virtual unsigned int GetColumnCount() const = 0;
133 Override this to indicate what type of data is stored in the
134 column specified by @a col.
136 This should return a string indicating the type of data as reported by wxVariant.
138 virtual wxString
GetColumnType(unsigned int col
) const = 0;
141 Override this to indicate which wxDataViewItem representing the parent
142 of @a item or an invalid wxDataViewItem if the the root item is
145 virtual wxDataViewItem
GetParent(const wxDataViewItem
& item
) const = 0;
148 Override this to indicate the value of @a item.
149 A wxVariant is used to store the data.
151 virtual void GetValue(wxVariant
& variant
, const wxDataViewItem
& item
,
152 unsigned int col
) const = 0;
155 Override this method to indicate if a container item merely acts as a
156 headline (or for categorisation) or if it also acts a normal item with
157 entries for futher columns. By default returns @false.
159 virtual bool HasContainerColumns(const wxDataViewItem
& item
) const;
162 Override this to indicate that the model provides a default compare
163 function that the control should use if no wxDataViewColumn has been
164 chosen for sorting. Usually, the user clicks on a column header for
165 sorting, the data will be sorted alphanumerically.
167 If any other order (e.g. by index or order of appearance) is required,
168 then this should be used.
169 See wxDataViewIndexListModel for a model which makes use of this.
171 virtual bool HasDefaultCompare() const;
174 Override this to indicate of @a item is a container, i.e. if
175 it can have child items.
177 virtual bool IsContainer(const wxDataViewItem
& item
) const = 0;
180 Call this to inform the model that an item has been added to the data.
182 virtual bool ItemAdded(const wxDataViewItem
& parent
,
183 const wxDataViewItem
& item
);
186 Call this to inform the model that an item has changed.
188 This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
189 event (in which the column fields will not be set) to the user.
191 virtual bool ItemChanged(const wxDataViewItem
& item
);
194 Call this to inform the model that an item has been deleted from the data.
196 virtual bool ItemDeleted(const wxDataViewItem
& parent
,
197 const wxDataViewItem
& item
);
200 Call this to inform the model that several items have been added to the data.
202 virtual bool ItemsAdded(const wxDataViewItem
& parent
,
203 const wxDataViewItemArray
& items
);
206 Call this to inform the model that several items have changed.
208 This will eventually emit wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
209 events (in which the column fields will not be set) to the user.
211 virtual bool ItemsChanged(const wxDataViewItemArray
& items
);
214 Call this to inform the model that several items have been deleted.
216 virtual bool ItemsDeleted(const wxDataViewItem
& parent
,
217 const wxDataViewItemArray
& items
);
220 Remove the @a notifier from the list of notifiers.
222 void RemoveNotifier(wxDataViewModelNotifier
* notifier
);
225 Call this to initiate a resort after the sort function has been changed.
227 virtual void Resort();
230 This gets called in order to set a value in the data model.
231 The most common scenario is that the wxDataViewCtrl calls this method
232 after the user changed some data in the view.
234 Afterwards ValueChanged() has to be called!
236 virtual bool SetValue(const wxVariant
& variant
, const wxDataViewItem
& item
,
237 unsigned int col
) = 0;
240 Call this to inform this model that a value in the model has been changed.
241 This is also called from wxDataViewCtrl's internal editing code, e.g. when
242 editing a text field in the control.
244 This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
247 virtual bool ValueChanged(const wxDataViewItem
& item
,
253 Destructor. This should not be called directly. Use DecRef() instead.
255 virtual ~wxDataViewModel();
261 @class wxDataViewIndexListModel
263 wxDataViewIndexListModel is a specialized data model which lets you address
264 an item by its position (row) rather than its wxDataViewItem (which you can
265 obtain from this class).
266 This model also provides its own wxDataViewIndexListModel::Compare
267 method which sorts the model's data by the index.
269 This model is not a virtual model since the control stores each wxDataViewItem.
270 Use wxDataViewVirtualListModel if you need to display millions of items or
271 have other reason to use a virtual control.
276 class wxDataViewIndexListModel
: public wxDataViewModel
282 wxDataViewIndexListModel(unsigned int initial_size
= 0);
287 virtual ~wxDataViewIndexListModel();
290 Compare method that sorts the items by their index.
292 int Compare(const wxDataViewItem
& item1
,
293 const wxDataViewItem
& item2
,
294 unsigned int column
, bool ascending
);
297 Override this to indicate that the row has special font attributes.
298 This only affects the wxDataViewTextRendererText() renderer.
300 @see wxDataViewItemAttr.
302 virtual bool GetAttrByRow(unsigned int row
, unsigned int col
,
303 wxDataViewItemAttr
& attr
);
306 Returns the wxDataViewItem at the given @e row.
308 wxDataViewItem
GetItem(unsigned int row
) const;
311 Returns the position of given @e item.
313 unsigned int GetRow(const wxDataViewItem
& item
) const;
316 Override this to allow getting values from the model.
318 virtual void GetValueByRow(wxVariant
& variant
, unsigned int row
,
319 unsigned int col
) const = 0;
322 Call this after if the data has to be read again from the model.
323 This is useful after major changes when calling the methods below
324 (possibly thousands of times) doesn't make sense.
326 void Reset(unsigned int new_size
);
329 Call this after a row has been appended to the model.
334 Call this after a row has been changed.
336 void RowChanged(unsigned int row
);
339 Call this after a row has been deleted.
341 void RowDeleted(unsigned int row
);
344 Call this after a row has been inserted at the given position.
346 void RowInserted(unsigned int before
);
349 Call this after a row has been prepended to the model.
354 Call this after a value has been changed.
356 void RowValueChanged(unsigned int row
, unsigned int col
);
359 Call this after rows have been deleted.
360 The array will internally get copied and sorted in descending order so
361 that the rows with the highest position will be deleted first.
363 void RowsDeleted(const wxArrayInt
& rows
);
366 Called in order to set a value in the model.
368 virtual bool SetValueByRow(const wxVariant
& variant
, unsigned int row
,
369 unsigned int col
) = 0;
375 @class wxDataViewVirtualListModel
377 wxDataViewVirtualListModel is a specialized data model which lets you address
378 an item by its position (row) rather than its wxDataViewItem and as such offers
379 the exact same interface as wxDataViewIndexListModel.
380 The important difference is that under platforms other than OS X, using this
381 model will result in a truly virtual control able to handle millions of items
382 as the control doesn't store any item (a feature not supported by the
383 Carbon API under OS X).
385 @see wxDataViewIndexListModel for the API.
390 class wxDataViewVirtualListModel
: public wxDataViewModel
396 wxDataViewVirtualListModel(unsigned int initial_size
= 0);
402 @class wxDataViewItemAttr
404 This class is used to indicate to a wxDataViewCtrl that a certain item
405 (see wxDataViewItem) has extra font attributes for its renderer.
406 For this, it is required to override wxDataViewModel::GetAttr.
408 Attributes are currently only supported by wxDataViewTextRendererText.
413 class wxDataViewItemAttr
419 wxDataViewItemAttr();
422 Call this to indicate that the item shall be displayed in bold text.
424 void SetBold(bool set
);
427 Call this to indicate that the item shall be displayed with that colour.
429 void SetColour(const wxColour
& colour
);
432 Call this to indicate that the item shall be displayed in italic text.
434 void SetItalic(bool set
);
440 @class wxDataViewItem
442 wxDataViewItem is a small opaque class that represents an item in a wxDataViewCtrl
443 in a persistent way, i.e. indepent of the position of the item in the control
444 or changes to its contents.
446 It must hold a unique ID of type @e void* in its only field and can be converted
449 If the ID is @NULL the wxDataViewItem is invalid and wxDataViewItem::IsOk will
450 return @false which used in many places in the API of wxDataViewCtrl to
451 indicate that e.g. no item was found. An ID of @NULL is also used to indicate
452 the invisible root. Examples for this are wxDataViewModel::GetParent and
453 wxDataViewModel::GetChildren.
465 wxDataViewItem(void* id
= NULL
);
466 wxDataViewItem(const wxDataViewItem
& item
);
475 Returns @true if the ID is not @NULL.
483 @class wxDataViewCtrl
485 wxDataViewCtrl is a control to display data either in a tree like fashion or
486 in a tabular form or both.
487 If you only need to display a simple tree structure with an API more like the
488 older wxTreeCtrl class, then the specialized wxDataViewTreeCtrl can be used.
490 A wxDataViewItem is used to represent a (visible) item in the control.
492 Unlike wxListCtrl, wxDataViewCtrl doesn't get its data from the user through
493 virtual functions or by setting it directly. Instead you need to write your own
494 wxDataViewModel and associate it with this control.
495 Then you need to add a number of wxDataViewColumn to this control to define
496 what each column shall display. Each wxDataViewColumn in turn owns 1 instance
497 of a wxDataViewRenderer to render its cells.
499 A number of standard renderers for rendering text, dates, images, toggle,
500 a progress bar etc. are provided. Additionally, the user can write custom
501 renderers deriving from wxDataViewCustomRenderer for displaying anything.
503 All data transfer from the control to the model and the user code is done
504 through wxVariant which can be extended to support more data formats as necessary.
505 Accordingly, all type information uses the strings returned from wxVariant::GetType.
509 Single selection mode. This is the default.
510 @style{wxDV_MULTIPLE}
511 Multiple selection mode.
512 @style{wxDV_ROW_LINES}
513 Use alternating colours for rows if supported by platform and theme.
514 @style{wxDV_HORIZ_RULES}
515 Display fine rules between row if supported.
516 @style{wxDV_VERT_RULES}
517 Display fine rules between columns is supported.
518 @style{wxDV_VARIABLE_LINE_HEIGHT}
519 Allow variable line heights.
520 This can be inefficient when displaying large number of items.
523 @beginEventTable{wxDataViewEvent}
524 @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)}
525 Process a wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event.
526 @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)}
527 Process a wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.
528 @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)}
529 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event.
530 @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)}
531 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event.
532 @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)}
533 Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event.
534 @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)}
535 Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event.
536 @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)}
537 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event.
538 @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)}
539 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event.
540 @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)}
541 Process a wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event.
542 @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)}
543 Process a wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event.
544 @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)}
545 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event.
546 @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)}
547 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event.
548 @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)}
549 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event.
550 @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
551 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event.
556 @appearance{dataviewctrl.png}
558 class wxDataViewCtrl
: public wxControl
567 Constructor. Calls Create().
569 wxDataViewCtrl(wxWindow
* parent
, wxWindowID id
,
570 const wxPoint
& pos
= wxDefaultPosition
,
571 const wxSize
& size
= wxDefaultSize
,
573 const wxValidator
& validator
= wxDefaultValidator
);
578 virtual ~wxDataViewCtrl();
581 Appends a wxDataViewColumn to the control. Returns @true on success.
583 Note that there is a number of short cut methods which implicitly create
584 a wxDataViewColumn and a wxDataViewRenderer for it (see below).
586 virtual bool AppendColumn(wxDataViewColumn
* col
);
589 Prepends a wxDataViewColumn to the control. Returns @true on success.
591 Note that there is a number of short cut methods which implicitly create
592 a wxDataViewColumn and a wxDataViewRenderer for it.
594 virtual bool PrependColumn(wxDataViewColumn
* col
);
597 Inserts a wxDataViewColumn to the control. Returns @true on success.
599 virtual bool InsertColumn(unsigned int pos
, wxDataViewColumn
* col
);
603 Appends a column for rendering a bitmap. Returns the wxDataViewColumn
604 created in the function or @NULL on failure.
606 wxDataViewColumn
* AppendBitmapColumn(const wxString
& label
,
607 unsigned int model_column
,
608 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
610 wxAlignment align
= wxALIGN_CENTER
,
611 int flags
= wxDATAVIEW_COL_RESIZABLE
);
612 wxDataViewColumn
* AppendBitmapColumn(const wxBitmap
& label
,
613 unsigned int model_column
,
614 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
616 wxAlignment align
= wxALIGN_CENTER
,
617 int flags
= wxDATAVIEW_COL_RESIZABLE
);
622 Appends a column for rendering a date. Returns the wxDataViewColumn
623 created in the function or @NULL on failure.
625 @note The @a align parameter is applied to both the column header and
628 wxDataViewColumn
* AppendDateColumn(const wxString
& label
,
629 unsigned int model_column
,
630 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
632 wxAlignment align
= wxALIGN_NOT
,
633 int flags
= wxDATAVIEW_COL_RESIZABLE
);
634 wxDataViewColumn
* AppendDateColumn(const wxBitmap
& label
,
635 unsigned int model_column
,
636 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
638 wxAlignment align
= wxALIGN_NOT
,
639 int flags
= wxDATAVIEW_COL_RESIZABLE
);
644 Appends a column for rendering text with an icon. Returns the wxDataViewColumn
645 created in the function or @NULL on failure.
646 This method uses the wxDataViewIconTextRenderer class.
648 @note The @a align parameter is applied to both the column header and
651 wxDataViewColumn
* AppendIconTextColumn(const wxString
& label
,
652 unsigned int model_column
,
653 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
655 wxAlignment align
= wxALIGN_NOT
,
656 int flags
= wxDATAVIEW_COL_RESIZABLE
);
657 wxDataViewColumn
* AppendIconTextColumn(const wxBitmap
& label
,
658 unsigned int model_column
,
659 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
661 wxAlignment align
= wxALIGN_NOT
,
662 int flags
= wxDATAVIEW_COL_RESIZABLE
);
667 Appends a column for rendering a progress indicator. Returns the
668 wxDataViewColumn created in the function or @NULL on failure.
670 @note The @a align parameter is applied to both the column header and
673 wxDataViewColumn
* AppendProgressColumn(const wxString
& label
,
674 unsigned int model_column
,
675 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
677 wxAlignment align
= wxALIGN_CENTER
,
678 int flags
= wxDATAVIEW_COL_RESIZABLE
);
679 wxDataViewColumn
* AppendProgressColumn(const wxBitmap
& label
,
680 unsigned int model_column
,
681 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
683 wxAlignment align
= wxALIGN_CENTER
,
684 int flags
= wxDATAVIEW_COL_RESIZABLE
);
689 Appends a column for rendering text. Returns the wxDataViewColumn
690 created in the function or @NULL on failure.
692 @note The @a align parameter is applied to both the column header and
695 wxDataViewColumn
* AppendTextColumn(const wxString
& label
,
696 unsigned int model_column
,
697 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
699 wxAlignment align
= wxALIGN_NOT
,
700 int flags
= wxDATAVIEW_COL_RESIZABLE
);
701 wxDataViewColumn
* AppendTextColumn(const wxBitmap
& label
,
702 unsigned int model_column
,
703 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
705 wxAlignment align
= wxALIGN_NOT
,
706 int flags
= wxDATAVIEW_COL_RESIZABLE
);
711 Appends a column for rendering a toggle. Returns the wxDataViewColumn
712 created in the function or @NULL on failure.
714 @note The @a align parameter is applied to both the column header and
717 wxDataViewColumn
* AppendToggleColumn(const wxString
& label
,
718 unsigned int model_column
,
719 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
721 wxAlignment align
= wxALIGN_CENTER
,
722 int flags
= wxDATAVIEW_COL_RESIZABLE
);
723 wxDataViewColumn
* AppendToggleColumn(const wxBitmap
& label
,
724 unsigned int model_column
,
725 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
727 wxAlignment align
= wxALIGN_CENTER
,
728 int flags
= wxDATAVIEW_COL_RESIZABLE
);
732 Associates a wxDataViewModel with the control.
733 This increases the reference count of the model by 1.
735 virtual bool AssociateModel(wxDataViewModel
* model
);
740 virtual bool ClearColumns();
745 virtual void Collapse(const wxDataViewItem
& item
);
748 Create the control. Useful for two step creation.
750 bool Create(wxWindow
* parent
, wxWindowID id
,
751 const wxPoint
& pos
= wxDefaultPosition
,
752 const wxSize
& size
= wxDefaultSize
,
754 const wxValidator
& validator
= wxDefaultValidator
);
757 Deletes given column.
759 virtual bool DeleteColumn(wxDataViewColumn
* column
);
762 Call this to ensure that the given item is visible.
764 virtual void EnsureVisible(const wxDataViewItem
& item
,
765 const wxDataViewColumn
* column
= NULL
);
770 virtual void Expand(const wxDataViewItem
& item
);
773 Expands all ancestors of the @a item. This method also
774 ensures that the item itself as well as all ancestor
775 items have been read from the model by the control.
777 virtual void ExpandAncestors( const wxDataViewItem
& item
);
780 Returns pointer to the column. @a pos refers to the position in the
781 control which may change after reordering columns by the user.
783 virtual wxDataViewColumn
* GetColumn(unsigned int pos
) const;
786 Returns the number of columns.
788 virtual unsigned int GetColumnCount() const;
791 Returns the position of the column or -1 if not found in the control.
793 virtual int GetColumnPosition(const wxDataViewColumn
* column
) const;
796 Returns column containing the expanders.
798 wxDataViewColumn
* GetExpanderColumn() const;
803 int GetIndent() const;
808 virtual wxRect
GetItemRect(const wxDataViewItem
& item
,
809 const wxDataViewColumn
* col
= NULL
) const;
812 Returns pointer to the data model associated with the control (if any).
814 wxDataViewModel
* GetModel();
817 Returns first selected item or an invalid item if none is selected.
819 virtual wxDataViewItem
GetSelection() const;
822 Fills @a sel with currently selected items and returns their number.
824 virtual int GetSelections(wxDataViewItemArray
& sel
) const;
827 Returns the wxDataViewColumn currently responsible for sorting
828 or @NULL if none has been selected.
830 virtual wxDataViewColumn
* GetSortingColumn() const;
835 virtual void HitTest(const wxPoint
& point
, wxDataViewItem
& item
,
836 wxDataViewColumn
*& col
) const;
839 Return @true if the item is expanded.
841 virtual bool IsExpanded(const wxDataViewItem
& item
) const;
844 Return @true if the item is selected.
846 virtual bool IsSelected(const wxDataViewItem
& item
) const;
849 Select the given item.
851 virtual void Select(const wxDataViewItem
& item
);
856 virtual void SelectAll();
859 Set which column shall contain the tree-like expanders.
861 void SetExpanderColumn(wxDataViewColumn
* col
);
864 Sets the indendation.
866 void SetIndent(int indent
);
869 Sets the selection to the array of wxDataViewItems.
871 virtual void SetSelections(const wxDataViewItemArray
& sel
);
874 Unselect the given item.
876 virtual void Unselect(const wxDataViewItem
& item
);
880 This method only has effect if multiple selections are allowed.
882 virtual void UnselectAll();
888 @class wxDataViewModelNotifier
890 A wxDataViewModelNotifier instance is owned by a wxDataViewModel and mirrors
891 its notification interface.
892 See the documentation of that class for further information.
897 class wxDataViewModelNotifier
903 wxDataViewModelNotifier();
908 virtual ~wxDataViewModelNotifier();
911 Called by owning model.
913 virtual bool Cleared() = 0;
916 Get owning wxDataViewModel.
918 wxDataViewModel
* GetOwner() const;
921 Called by owning model.
923 virtual bool ItemAdded(const wxDataViewItem
& parent
,
924 const wxDataViewItem
& item
) = 0;
927 Called by owning model.
929 virtual bool ItemChanged(const wxDataViewItem
& item
) = 0;
932 Called by owning model.
934 virtual bool ItemDeleted(const wxDataViewItem
& parent
,
935 const wxDataViewItem
& item
) = 0;
938 Called by owning model.
940 virtual bool ItemsAdded(const wxDataViewItem
& parent
,
941 const wxDataViewItemArray
& items
);
944 Called by owning model.
946 virtual bool ItemsChanged(const wxDataViewItemArray
& items
);
949 Called by owning model.
951 virtual bool ItemsDeleted(const wxDataViewItem
& parent
,
952 const wxDataViewItemArray
& items
);
955 Called by owning model.
957 virtual void Resort() = 0;
960 Set owner of this notifier. Used internally.
962 void SetOwner(wxDataViewModel
* owner
);
965 Called by owning model.
967 virtual bool ValueChanged(const wxDataViewItem
& item
, unsigned int col
) = 0;
972 The mode of a data-view cell; see wxDataViewRenderer for more info.
974 enum wxDataViewCellMode
976 wxDATAVIEW_CELL_INERT
,
979 Indicates that the user can double click the cell and something will
980 happen (e.g. a window for editing a date will pop up).
982 wxDATAVIEW_CELL_ACTIVATABLE
,
985 Indicates that the user can edit the data in-place, i.e. an control
986 will show up after a slow click on the cell. This behaviour is best
987 known from changing the filename in most file managers etc.
989 wxDATAVIEW_CELL_EDITABLE
993 The values of this enum controls how a wxDataViewRenderer should display
994 its contents in a cell.
996 enum wxDataViewCellRenderState
998 wxDATAVIEW_CELL_SELECTED
= 1,
999 wxDATAVIEW_CELL_PRELIT
= 2,
1000 wxDATAVIEW_CELL_INSENSITIVE
= 4,
1001 wxDATAVIEW_CELL_FOCUSED
= 8
1005 @class wxDataViewRenderer
1007 This class is used by wxDataViewCtrl to render the individual cells.
1008 One instance of a renderer class is owned by a wxDataViewColumn.
1009 There is a number of ready-to-use renderers provided:
1010 - wxDataViewTextRenderer,
1011 - wxDataViewTextRendererAttr,
1012 - wxDataViewIconTextRenderer,
1013 - wxDataViewToggleRenderer,
1014 - wxDataViewProgressRenderer,
1015 - wxDataViewBitmapRenderer,
1016 - wxDataViewDateRenderer,
1017 - wxDataViewSpinRenderer.
1019 Additionally, the user can write own renderers by deriving from
1020 wxDataViewCustomRenderer.
1022 The ::wxDataViewCellMode and ::wxDataViewCellRenderState flags accepted
1023 by the constructors respectively controls what actions the cell data allows
1024 and how the renderer should display its contents in a cell.
1029 class wxDataViewRenderer
: public wxObject
1035 wxDataViewRenderer(const wxString
& varianttype
,
1036 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1037 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1040 Returns the alignment. See SetAlignment()
1042 virtual int GetAlignment() const;
1045 Returns the cell mode.
1047 virtual wxDataViewCellMode
GetMode() const;
1050 Returns pointer to the owning wxDataViewColumn.
1052 wxDataViewColumn
* GetOwner() const;
1055 This methods retrieves the value from the renderer in order to
1056 transfer the value back to the data model.
1058 Returns @false on failure.
1060 virtual bool GetValue(wxVariant
& value
) const = 0;
1063 Returns a string with the type of the wxVariant supported by this renderer.
1065 wxString
GetVariantType() const;
1068 Sets the alignment of the renderer's content.
1069 The default value of @c wxDVR_DEFAULT_ALIGMENT indicates that the content
1070 should have the same alignment as the column header.
1072 The method is not implemented under OS X and the renderer always aligns
1073 its contents as the column header on that platform. The other platforms
1074 support both vertical and horizontal alignment.
1076 virtual void SetAlignment( int align
);
1078 Sets the owning wxDataViewColumn.
1079 This is usually called from within wxDataViewColumn.
1081 void SetOwner(wxDataViewColumn
* owner
);
1084 Set the value of the renderer (and thus its cell) to @a value.
1085 The internal code will then render this cell with this data.
1087 virtual bool SetValue(const wxVariant
& value
) = 0;
1090 Before data is committed to the data model, it is passed to this
1091 method where it can be checked for validity. This can also be
1092 used for checking a valid range or limiting the user input in
1093 a certain aspect (e.g. max number of characters or only alphanumeric
1094 input, ASCII only etc.). Return @false if the value is not valid.
1096 Please note that due to implementation limitations, this validation
1097 is done after the editing control already is destroyed and the
1098 editing process finished.
1100 virtual bool Validate(wxVariant
& value
);
1106 @class wxDataViewTextRenderer
1108 wxDataViewTextRenderer is used for rendering text.
1109 It supports in-place editing if desired.
1114 class wxDataViewTextRenderer
: public wxDataViewRenderer
1120 wxDataViewTextRenderer(const wxString
& varianttype
= "string",
1121 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1122 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1128 @class wxDataViewIconTextRenderer
1130 The wxDataViewIconTextRenderer class is used to display text with
1131 a small icon next to it as it is typically done in a file manager.
1133 This classes uses the wxDataViewIconText helper class to store its data.
1134 wxDataViewIonText can be converted to and from a wxVariant using the left shift
1140 class wxDataViewIconTextRenderer
: public wxDataViewRenderer
1146 wxDataViewIconTextRenderer(const wxString
& varianttype
= "wxDataViewIconText",
1147 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1148 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1154 @class wxDataViewProgressRenderer
1156 This class is used by wxDataViewCtrl to render progress bars.
1161 class wxDataViewProgressRenderer
: public wxDataViewRenderer
1167 wxDataViewProgressRenderer(const wxString
& label
= wxEmptyString
,
1168 const wxString
& varianttype
= "long",
1169 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1170 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1176 @class wxDataViewSpinRenderer
1178 This is a specialized renderer for rendering integer values.
1179 It supports modifying the values in-place by using a wxSpinCtrl.
1180 The renderer only support variants of type @e long.
1185 class wxDataViewSpinRenderer
: public wxDataViewCustomRenderer
1190 @a min and @a max indicate the minimum and maximum values for the wxSpinCtrl.
1192 wxDataViewSpinRenderer(int min
, int max
,
1193 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
1194 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1200 @class wxDataViewToggleRenderer
1202 This class is used by wxDataViewCtrl to render toggle controls.
1207 class wxDataViewToggleRenderer
: public wxDataViewRenderer
1213 wxDataViewToggleRenderer(const wxString
& varianttype
= "bool",
1214 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1215 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1221 @class wxDataViewDateRenderer
1223 This class is used by wxDataViewCtrl to render calendar controls.
1228 class wxDataViewDateRenderer
: public wxDataViewRenderer
1234 wxDataViewDateRenderer(const wxString
& varianttype
= "datetime",
1235 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
1236 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1242 @class wxDataViewTextRendererAttr
1244 The same as wxDataViewTextRenderer but with support for font attributes.
1245 Font attributes are currently only supported under GTK+ and MSW.
1247 @see wxDataViewModel::GetAttr and wxDataViewItemAttr.
1252 class wxDataViewTextRendererAttr
: public wxDataViewTextRenderer
1258 wxDataViewTextRendererAttr(const wxString
& varianttype
= "string",
1259 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1260 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1266 @class wxDataViewCustomRenderer
1268 You need to derive a new class from wxDataViewCustomRenderer in
1269 order to write a new renderer.
1271 You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue,
1272 wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render.
1274 If you want your renderer to support in-place editing then you also need to override
1275 wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl
1276 and wxDataViewCustomRenderer::GetValueFromEditorCtrl.
1278 Note that a special event handler will be pushed onto that editor control
1279 which handles @e \<ENTER\> and focus out events in order to end the editing.
1284 class wxDataViewCustomRenderer
: public wxDataViewRenderer
1290 wxDataViewCustomRenderer(const wxString
& varianttype
= "string",
1291 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1292 int align
= -1, bool no_init
= false);
1297 virtual ~wxDataViewCustomRenderer();
1300 Override this to react to double clicks or ENTER.
1301 This method will only be called in wxDATAVIEW_CELL_ACTIVATABLE mode.
1303 virtual bool Activate( wxRect cell
,
1304 wxDataViewModel
* model
,
1305 const wxDataViewItem
& item
,
1309 Override this to create the actual editor control once editing
1312 @a parent is the parent of the editor control, @a labelRect indicates the
1313 position and size of the editor control and @a value is its initial value:
1317 return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
1318 labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l );
1322 virtual wxControl
* CreateEditorCtrl(wxWindow
* parent
,
1324 const wxVariant
& value
);
1327 Create DC on request. Internal.
1329 virtual wxDC
* GetDC();
1332 Return size required to show content.
1334 virtual wxSize
GetSize() const = 0;
1337 Overrride this so that the renderer can get the value from the editor
1338 control (pointed to by @a editor):
1341 wxSpinCtrl *sc = (wxSpinCtrl*) editor;
1342 long l = sc->GetValue();
1348 virtual bool GetValueFromEditorCtrl(wxControl
* editor
,
1352 Override this and make it return @true in order to
1353 indicate that this renderer supports in-place editing.
1355 virtual bool HasEditorCtrl();
1358 Overrride this to react to a left click.
1359 This method will only be called in @c wxDATAVIEW_CELL_ACTIVATABLE mode.
1361 virtual bool LeftClick( wxPoint cursor
,
1363 wxDataViewModel
* model
,
1364 const wxDataViewItem
& item
,
1368 Override this to render the cell.
1369 Before this is called, wxDataViewRenderer::SetValue was called
1370 so that this instance knows what to render.
1372 virtual bool Render(wxRect cell
, wxDC
* dc
, int state
) = 0;
1375 This method should be called from within Render() whenever you need to
1377 This will ensure that the correct colour, font and vertical alignment will
1378 be chosen so the text will look the same as text drawn by native renderers.
1380 void RenderText(const wxString
& text
, int xoffset
, wxRect cell
,
1381 wxDC
* dc
, int state
);
1384 Overrride this to start a drag operation. Not yet supported.
1386 virtual bool StartDrag(wxPoint cursor
, wxRect cell
,
1387 wxDataViewModel
* model
,
1388 const wxDataViewItem
& item
,
1395 @class wxDataViewBitmapRenderer
1397 This class is used by wxDataViewCtrl to render bitmap controls.
1402 class wxDataViewBitmapRenderer
: public wxDataViewRenderer
1408 wxDataViewBitmapRenderer(const wxString
& varianttype
= "wxBitmap",
1409 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1410 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1415 The flags used by wxDataViewColumn.
1417 enum wxDataViewColumnFlags
1419 wxDATAVIEW_COL_RESIZABLE
= 1,
1420 wxDATAVIEW_COL_SORTABLE
= 2,
1421 wxDATAVIEW_COL_REORDERABLE
= 4,
1422 wxDATAVIEW_COL_HIDDEN
= 8
1426 @class wxDataViewColumn
1428 This class represents a column in a wxDataViewCtrl.
1429 One wxDataViewColumn is bound to one column in the data model to which the
1430 wxDataViewCtrl has been associated.
1432 An instance of wxDataViewRenderer is used by this class to render its data.
1437 class wxDataViewColumn
: public wxHeaderColumn
1444 wxDataViewColumn(const wxString
& title
,
1445 wxDataViewRenderer
* renderer
,
1446 unsigned int model_column
,
1447 int width
= wxDVC_DEFAULT_WIDTH
,
1448 wxAlignment align
= wxALIGN_CENTER
,
1449 int flags
= wxDATAVIEW_COL_RESIZABLE
);
1450 wxDataViewColumn(const wxBitmap
& bitmap
,
1451 wxDataViewRenderer
* renderer
,
1452 unsigned int model_column
,
1453 int width
= wxDVC_DEFAULT_WIDTH
,
1454 wxAlignment align
= wxALIGN_CENTER
,
1455 int flags
= wxDATAVIEW_COL_RESIZABLE
);
1459 Returns the index of the column of the model, which this
1460 wxDataViewColumn is displaying.
1462 unsigned int GetModelColumn() const;
1465 Returns the owning wxDataViewCtrl.
1467 wxDataViewCtrl
* GetOwner() const;
1470 Returns the renderer of this wxDataViewColumn.
1472 @see wxDataViewRenderer.
1474 wxDataViewRenderer
* GetRenderer() const;
1480 @class wxDataViewTreeCtrl
1482 This class is a wxDataViewCtrl which internally uses a wxDataViewTreeStore
1483 and forwards most of its API to that class.
1484 Additionally, it uses a wxImageList to store a list of icons.
1486 The main purpose of this class is to look like a wxTreeCtrl to make a transition
1487 from it to the wxDataViewCtrl class simpler.
1491 @appearance{dataviewtreectrl.png}
1493 class wxDataViewTreeCtrl
: public wxDataViewCtrl
1499 wxDataViewTreeCtrl();
1502 Constructor. Calls Create().
1504 wxDataViewTreeCtrl(wxWindow
* parent
, wxWindowID id
,
1505 const wxPoint
& pos
= wxDefaultPosition
,
1506 const wxSize
& size
= wxDefaultSize
,
1507 long style
= wxDV_NO_HEADER
,
1508 const wxValidator
& validator
= wxDefaultValidator
);
1511 Destructor. Deletes the image list if any.
1513 virtual ~wxDataViewTreeCtrl();
1518 wxDataViewItem
AppendContainer(const wxDataViewItem
& parent
,
1519 const wxString
& text
,
1522 wxClientData
* data
= NULL
);
1527 wxDataViewItem
AppendItem(const wxDataViewItem
& parent
,
1528 const wxString
& text
,
1530 wxClientData
* data
= NULL
);
1533 Creates the control and a wxDataViewTreeStore as its internal model.
1535 bool Create(wxWindow
* parent
, wxWindowID id
,
1536 const wxPoint
& pos
= wxDefaultPosition
,
1537 const wxSize
& size
= wxDefaultSize
,
1538 long style
= wxDV_NO_HEADER
,
1539 const wxValidator
& validator
= wxDefaultValidator
);
1542 Calls the identical method from wxDataViewTreeStore.
1544 void DeleteAllItems();
1547 Calls the identical method from wxDataViewTreeStore.
1549 void DeleteChildren(const wxDataViewItem
& item
);
1552 Calls the identical method from wxDataViewTreeStore.
1554 void DeleteItem(const wxDataViewItem
& item
);
1557 Calls the identical method from wxDataViewTreeStore.
1559 int GetChildCount(const wxDataViewItem
& parent
) const;
1562 Returns the image list.
1564 wxImageList
* GetImageList();
1567 Calls the identical method from wxDataViewTreeStore.
1569 wxClientData
* GetItemData(const wxDataViewItem
& item
) const;
1572 Calls the identical method from wxDataViewTreeStore.
1574 const wxIcon
& GetItemExpandedIcon(const wxDataViewItem
& item
) const;
1577 Calls the identical method from wxDataViewTreeStore.
1579 const wxIcon
& GetItemIcon(const wxDataViewItem
& item
) const;
1582 Calls the identical method from wxDataViewTreeStore.
1584 wxString
GetItemText(const wxDataViewItem
& item
) const;
1587 Calls the identical method from wxDataViewTreeStore.
1589 wxDataViewItem
GetNthChild(const wxDataViewItem
& parent
,
1590 unsigned int pos
) const;
1596 wxDataViewTreeStore
* GetStore();
1597 const wxDataViewTreeStore
* GetStore() const;
1601 Calls the same method from wxDataViewTreeStore but uses
1602 an index position in the image list instead of a wxIcon.
1604 wxDataViewItem
InsertContainer(const wxDataViewItem
& parent
,
1605 const wxDataViewItem
& previous
,
1606 const wxString
& text
,
1609 wxClientData
* data
= NULL
);
1612 Calls the same method from wxDataViewTreeStore but uses
1613 an index position in the image list instead of a wxIcon.
1615 wxDataViewItem
InsertItem(const wxDataViewItem
& parent
,
1616 const wxDataViewItem
& previous
,
1617 const wxString
& text
,
1619 wxClientData
* data
= NULL
);
1622 Calls the same method from wxDataViewTreeStore but uses
1623 an index position in the image list instead of a wxIcon.
1625 wxDataViewItem
PrependContainer(const wxDataViewItem
& parent
,
1626 const wxString
& text
,
1629 wxClientData
* data
= NULL
);
1632 Calls the same method from wxDataViewTreeStore but uses
1633 an index position in the image list instead of a wxIcon.
1635 wxDataViewItem
PrependItem(const wxDataViewItem
& parent
,
1636 const wxString
& text
,
1638 wxClientData
* data
= NULL
);
1641 Sets the image list.
1643 void SetImageList(wxImageList
* imagelist
);
1646 Calls the identical method from wxDataViewTreeStore.
1648 void SetItemData(const wxDataViewItem
& item
, wxClientData
* data
);
1651 Calls the identical method from wxDataViewTreeStore.
1653 void SetItemExpandedIcon(const wxDataViewItem
& item
,
1654 const wxIcon
& icon
);
1657 Calls the identical method from wxDataViewTreeStore.
1659 void SetItemIcon(const wxDataViewItem
& item
, const wxIcon
& icon
);
1662 Calls the identical method from wxDataViewTreeStore.
1664 void SetItemText(const wxDataViewItem
& item
,
1665 const wxString
& text
);
1671 @class wxDataViewTreeStore
1673 wxDataViewTreeStore is a specialised wxDataViewModel for displaying simple
1674 trees very much like wxTreeCtrl does and it offers a similar API.
1676 This class actually stores the entire tree and the values (therefore its name)
1677 and implements all virtual methods from the base class so it can be used directly
1678 without having to derive any class from it.
1679 This comes at the price of much reduced flexibility.
1684 class wxDataViewTreeStore
: public wxDataViewModel
1688 Constructor. Creates the invisible root node internally.
1690 wxDataViewTreeStore();
1695 virtual ~wxDataViewTreeStore();
1700 wxDataViewItem
AppendContainer(const wxDataViewItem
& parent
,
1701 const wxString
& text
,
1702 const wxIcon
& icon
= wxNullIcon
,
1703 const wxIcon
& expanded
= wxNullIcon
,
1704 wxClientData
* data
= NULL
);
1709 wxDataViewItem
AppendItem(const wxDataViewItem
& parent
,
1710 const wxString
& text
,
1711 const wxIcon
& icon
= wxNullIcon
,
1712 wxClientData
* data
= NULL
);
1715 Delete all item in the model.
1717 void DeleteAllItems();
1720 Delete all children of the item, but not the item itself.
1722 void DeleteChildren(const wxDataViewItem
& item
);
1727 void DeleteItem(const wxDataViewItem
& item
);
1730 Return the number of children of item.
1732 int GetChildCount(const wxDataViewItem
& parent
) const;
1735 Returns the client data asoociated with the item.
1737 wxClientData
* GetItemData(const wxDataViewItem
& item
) const;
1740 Returns the icon to display in expanded containers.
1742 const wxIcon
& GetItemExpandedIcon(const wxDataViewItem
& item
) const;
1745 Returns the icon of the item.
1747 const wxIcon
& GetItemIcon(const wxDataViewItem
& item
) const;
1750 Returns the text of the item.
1752 wxString
GetItemText(const wxDataViewItem
& item
) const;
1755 Returns the nth child item of item.
1757 wxDataViewItem
GetNthChild(const wxDataViewItem
& parent
,
1758 unsigned int pos
) const;
1761 Inserts a container after @a previous.
1763 wxDataViewItem
InsertContainer(const wxDataViewItem
& parent
,
1764 const wxDataViewItem
& previous
,
1765 const wxString
& text
,
1766 const wxIcon
& icon
= wxNullIcon
,
1767 const wxIcon
& expanded
= wxNullIcon
,
1768 wxClientData
* data
= NULL
);
1771 Inserts an item after @a previous.
1773 wxDataViewItem
InsertItem(const wxDataViewItem
& parent
,
1774 const wxDataViewItem
& previous
,
1775 const wxString
& text
,
1776 const wxIcon
& icon
= wxNullIcon
,
1777 wxClientData
* data
= NULL
);
1780 Inserts a container before the first child item or @a parent.
1782 wxDataViewItem
PrependContainer(const wxDataViewItem
& parent
,
1783 const wxString
& text
,
1784 const wxIcon
& icon
= wxNullIcon
,
1785 const wxIcon
& expanded
= wxNullIcon
,
1786 wxClientData
* data
= NULL
);
1789 Inserts an item before the first child item or @a parent.
1791 wxDataViewItem
PrependItem(const wxDataViewItem
& parent
,
1792 const wxString
& text
,
1793 const wxIcon
& icon
= wxNullIcon
,
1794 wxClientData
* data
= NULL
);
1797 Sets the client data associated with the item.
1799 void SetItemData(const wxDataViewItem
& item
, wxClientData
* data
);
1802 Sets the expanded icon for the item.
1804 void SetItemExpandedIcon(const wxDataViewItem
& item
,
1805 const wxIcon
& icon
);
1808 Sets the icon for the item.
1810 void SetItemIcon(const wxDataViewItem
& item
, const wxIcon
& icon
);
1815 @class wxDataViewIconText
1817 wxDataViewIconText is used by wxDataViewIconTextRenderer for data transfer.
1818 This class can be converted to and from a wxVariant.
1823 class wxDataViewIconText
: public wxObject
1830 wxDataViewIconText(const wxString
& text
= wxEmptyString
,
1831 const wxIcon
& icon
= wxNullIcon
);
1832 wxDataViewIconText(const wxDataViewIconText
& other
);
1838 const wxIcon
& GetIcon() const;
1843 wxString
GetText() const;
1848 void SetIcon(const wxIcon
& icon
);
1853 void SetText(const wxString
& text
);
1859 @class wxDataViewEvent
1861 This is the event class for the wxDataViewCtrl notifications.
1864 @category{events,dvc}
1866 class wxDataViewEvent
: public wxNotifyEvent
1871 Constructor. Typically used by wxWidgets internals only.
1873 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
,
1875 wxDataViewEvent(const wxDataViewEvent
& event
);
1879 Returns the position of the column in the control or -1
1880 if no column field was set by the event emitter.
1882 int GetColumn() const;
1885 Returns a pointer to the wxDataViewColumn from which
1886 the event was emitted or @NULL.
1888 wxDataViewColumn
* GetDataViewColumn() const;
1891 Returns the wxDataViewModel associated with the event.
1893 wxDataViewModel
* GetModel() const;
1896 Returns a the position of a context menu event in screen coordinates.
1898 wxPoint
GetPosition() const;
1901 Returns a reference to a value.
1903 const wxVariant
& GetValue() const;
1906 Sets the column index associated with this event.
1908 void SetColumn(int col
);
1911 For wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only.
1913 void SetDataViewColumn(wxDataViewColumn
* col
);
1916 Sets the dataview model associated with this event.
1918 void SetModel(wxDataViewModel
* model
);
1921 Sets the value associated with this event.
1923 void SetValue(const wxVariant
& value
);