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.
636 @class wxDataViewCtrl
638 wxDataViewCtrl is a control to display data either in a tree like fashion or
639 in a tabular form or both.
641 If you only need to display a simple tree structure with an API more like the
642 older wxTreeCtrl class, then the specialized wxDataViewTreeCtrl can be used.
643 Likewise, if you only want to display simple table structure you can use
644 the specialized wxDataViewListCtrl class. Both wxDataViewTreeCtrl and
645 wxDataViewListCtrl can be used without defining your own wxDataViewModel.
647 A wxDataViewItem is used to represent a (visible) item in the control.
649 Unlike wxListCtrl, wxDataViewCtrl doesn't get its data from the user through
650 virtual functions or by setting it directly. Instead you need to write your own
651 wxDataViewModel and associate it with this control.
652 Then you need to add a number of wxDataViewColumn to this control to define
653 what each column shall display. Each wxDataViewColumn in turn owns 1 instance
654 of a wxDataViewRenderer to render its cells.
656 A number of standard renderers for rendering text, dates, images, toggle,
657 a progress bar etc. are provided. Additionally, the user can write custom
658 renderers deriving from wxDataViewCustomRenderer for displaying anything.
660 All data transfer from the control to the model and the user code is done
661 through wxVariant which can be extended to support more data formats as necessary.
662 Accordingly, all type information uses the strings returned from wxVariant::GetType.
666 Single selection mode. This is the default.
667 @style{wxDV_MULTIPLE}
668 Multiple selection mode.
669 @style{wxDV_ROW_LINES}
670 Use alternating colours for rows if supported by platform and theme.
671 Currently only supported by the native GTK and OS X implementations
672 but not by the generic one.
673 @style{wxDV_HORIZ_RULES}
674 Display fine rules between row if supported.
675 @style{wxDV_VERT_RULES}
676 Display fine rules between columns is supported.
677 @style{wxDV_VARIABLE_LINE_HEIGHT}
678 Allow variable line heights.
679 This can be inefficient when displaying large number of items.
680 @style{wxDV_NO_HEADER}
681 Do not show column headers (which are shown by default).
684 @beginEventEmissionTable{wxDataViewEvent}
685 @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)}
686 Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event.
687 @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)}
688 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.
689 @event{EVT_DATAVIEW_ITEM_START_EDITING(id, func)}
690 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. This
691 event can be vetoed in order to prevent editing on an item by item
692 basis. Still experimental.
693 @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)}
694 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event.
695 @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)}
696 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event.
697 @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)}
698 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event.
699 @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)}
700 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event.
701 @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)}
702 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event.
703 @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)}
704 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event.
705 @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)}
706 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event.
707 @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)}
708 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event.
709 @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)}
710 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event.
711 @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)}
712 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event.
713 @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)}
714 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event.
715 @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
716 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event.
717 @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)}
718 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event.
719 @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)}
720 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event.
721 @event{EVT_DATAVIEW_ITEM_DROP(id, func)}
722 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event.
727 @appearance{dataviewctrl.png}
729 class wxDataViewCtrl
: public wxControl
738 Constructor. Calls Create().
740 wxDataViewCtrl(wxWindow
* parent
, wxWindowID id
,
741 const wxPoint
& pos
= wxDefaultPosition
,
742 const wxSize
& size
= wxDefaultSize
,
744 const wxValidator
& validator
= wxDefaultValidator
,
745 const wxString
& name
= wxDataViewCtrlNameStr
);
750 virtual ~wxDataViewCtrl();
753 Appends a wxDataViewColumn to the control. Returns @true on success.
755 Note that there is a number of short cut methods which implicitly create
756 a wxDataViewColumn and a wxDataViewRenderer for it (see below).
758 virtual bool AppendColumn(wxDataViewColumn
* col
);
761 Prepends a wxDataViewColumn to the control. Returns @true on success.
763 Note that there is a number of short cut methods which implicitly create
764 a wxDataViewColumn and a wxDataViewRenderer for it.
766 virtual bool PrependColumn(wxDataViewColumn
* col
);
769 Inserts a wxDataViewColumn to the control. Returns @true on success.
771 virtual bool InsertColumn(unsigned int pos
, wxDataViewColumn
* col
);
775 Appends a column for rendering a bitmap. Returns the wxDataViewColumn
776 created in the function or @NULL on failure.
778 wxDataViewColumn
* AppendBitmapColumn(const wxString
& label
,
779 unsigned int model_column
,
780 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
782 wxAlignment align
= wxALIGN_CENTER
,
783 int flags
= wxDATAVIEW_COL_RESIZABLE
);
784 wxDataViewColumn
* AppendBitmapColumn(const wxBitmap
& label
,
785 unsigned int model_column
,
786 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
788 wxAlignment align
= wxALIGN_CENTER
,
789 int flags
= wxDATAVIEW_COL_RESIZABLE
);
794 Appends a column for rendering a date. Returns the wxDataViewColumn
795 created in the function or @NULL on failure.
797 @note The @a align parameter is applied to both the column header and
800 wxDataViewColumn
* AppendDateColumn(const wxString
& label
,
801 unsigned int model_column
,
802 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
804 wxAlignment align
= wxALIGN_NOT
,
805 int flags
= wxDATAVIEW_COL_RESIZABLE
);
806 wxDataViewColumn
* AppendDateColumn(const wxBitmap
& label
,
807 unsigned int model_column
,
808 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
810 wxAlignment align
= wxALIGN_NOT
,
811 int flags
= wxDATAVIEW_COL_RESIZABLE
);
816 Appends a column for rendering text with an icon. Returns the wxDataViewColumn
817 created in the function or @NULL on failure.
818 This method uses the wxDataViewIconTextRenderer class.
820 @note The @a align parameter is applied to both the column header and
823 wxDataViewColumn
* AppendIconTextColumn(const wxString
& label
,
824 unsigned int model_column
,
825 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
827 wxAlignment align
= wxALIGN_NOT
,
828 int flags
= wxDATAVIEW_COL_RESIZABLE
);
829 wxDataViewColumn
* AppendIconTextColumn(const wxBitmap
& label
,
830 unsigned int model_column
,
831 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
833 wxAlignment align
= wxALIGN_NOT
,
834 int flags
= wxDATAVIEW_COL_RESIZABLE
);
839 Appends a column for rendering a progress indicator. Returns the
840 wxDataViewColumn created in the function or @NULL on failure.
842 @note The @a align parameter is applied to both the column header and
845 wxDataViewColumn
* AppendProgressColumn(const wxString
& label
,
846 unsigned int model_column
,
847 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
849 wxAlignment align
= wxALIGN_CENTER
,
850 int flags
= wxDATAVIEW_COL_RESIZABLE
);
851 wxDataViewColumn
* AppendProgressColumn(const wxBitmap
& label
,
852 unsigned int model_column
,
853 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
855 wxAlignment align
= wxALIGN_CENTER
,
856 int flags
= wxDATAVIEW_COL_RESIZABLE
);
861 Appends a column for rendering text. Returns the wxDataViewColumn
862 created in the function or @NULL on failure.
864 @note The @a align parameter is applied to both the column header and
867 wxDataViewColumn
* AppendTextColumn(const wxString
& label
,
868 unsigned int model_column
,
869 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
871 wxAlignment align
= wxALIGN_NOT
,
872 int flags
= wxDATAVIEW_COL_RESIZABLE
);
873 wxDataViewColumn
* AppendTextColumn(const wxBitmap
& label
,
874 unsigned int model_column
,
875 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
877 wxAlignment align
= wxALIGN_NOT
,
878 int flags
= wxDATAVIEW_COL_RESIZABLE
);
883 Appends a column for rendering a toggle. Returns the wxDataViewColumn
884 created in the function or @NULL on failure.
886 @note The @a align parameter is applied to both the column header and
889 wxDataViewColumn
* AppendToggleColumn(const wxString
& label
,
890 unsigned int model_column
,
891 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
893 wxAlignment align
= wxALIGN_CENTER
,
894 int flags
= wxDATAVIEW_COL_RESIZABLE
);
895 wxDataViewColumn
* AppendToggleColumn(const wxBitmap
& label
,
896 unsigned int model_column
,
897 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
899 wxAlignment align
= wxALIGN_CENTER
,
900 int flags
= wxDATAVIEW_COL_RESIZABLE
);
904 Associates a wxDataViewModel with the control.
905 This increases the reference count of the model by 1.
907 virtual bool AssociateModel(wxDataViewModel
* model
);
912 virtual bool ClearColumns();
917 virtual void Collapse(const wxDataViewItem
& item
);
920 Create the control. Useful for two step creation.
922 bool Create(wxWindow
* parent
, wxWindowID id
,
923 const wxPoint
& pos
= wxDefaultPosition
,
924 const wxSize
& size
= wxDefaultSize
,
926 const wxValidator
& validator
= wxDefaultValidator
,
927 const wxString
& name
= wxDataViewCtrlNameStr
);
930 Deletes given column.
932 virtual bool DeleteColumn(wxDataViewColumn
* column
);
935 Enable drag operations using the given @a format.
937 virtual bool EnableDragSource( const wxDataFormat
&format
);
940 Enable drop operations using the given @a format.
942 virtual bool EnableDropTarget( const wxDataFormat
&format
);
945 Call this to ensure that the given item is visible.
947 virtual void EnsureVisible(const wxDataViewItem
& item
,
948 const wxDataViewColumn
* column
= NULL
);
953 virtual void Expand(const wxDataViewItem
& item
);
956 Expands all ancestors of the @a item. This method also
957 ensures that the item itself as well as all ancestor
958 items have been read from the model by the control.
960 virtual void ExpandAncestors( const wxDataViewItem
& item
);
963 Returns pointer to the column. @a pos refers to the position in the
964 control which may change after reordering columns by the user.
966 virtual wxDataViewColumn
* GetColumn(unsigned int pos
) const;
969 Returns the number of columns.
971 virtual unsigned int GetColumnCount() const;
974 Returns the position of the column or -1 if not found in the control.
976 virtual int GetColumnPosition(const wxDataViewColumn
* column
) const;
979 Returns column containing the expanders.
981 wxDataViewColumn
* GetExpanderColumn() const;
984 Returns the currently focused item.
986 This is the item that the keyboard commands apply to. It may be invalid
987 if there is no focus currently.
989 This method is mostly useful for the controls with @c wxDV_MULTIPLE
990 style as in the case of single selection it returns the same thing as
993 Notice that under all platforms except Mac OS X the currently focused
994 item may be selected or not but under OS X the current item is always
997 @see SetCurrentItem()
1001 wxDataViewItem
GetCurrentItem() const;
1004 Returns indentation.
1006 int GetIndent() const;
1011 virtual wxRect
GetItemRect(const wxDataViewItem
& item
,
1012 const wxDataViewColumn
* col
= NULL
) const;
1015 Returns pointer to the data model associated with the control (if any).
1017 wxDataViewModel
* GetModel();
1020 Returns the number of currently selected items.
1022 This method may be called for both the controls with single and
1023 multiple selections and returns the number of selected item, possibly
1028 virtual int GetSelectedItemsCount() const;
1031 Returns first selected item or an invalid item if none is selected.
1033 This method may be called for both the controls with single and
1034 multiple selections but returns an invalid item if more than one item
1035 is selected in the latter case, use HasSelection() to determine if
1036 there are any selected items when using multiple selection.
1038 virtual wxDataViewItem
GetSelection() const;
1041 Fills @a sel with currently selected items and returns their number.
1043 This method may be called for both the controls with single and
1044 multiple selections. In the single selection case it returns the array
1045 with at most one element in it.
1047 @see GetSelectedItemsCount()
1049 virtual int GetSelections(wxDataViewItemArray
& sel
) const;
1052 Returns the wxDataViewColumn currently responsible for sorting
1053 or @NULL if none has been selected.
1055 virtual wxDataViewColumn
* GetSortingColumn() const;
1058 Returns true if any items are currently selected.
1060 This method may be called for both the controls with single and
1061 multiple selections.
1063 Calling this method is equivalent to calling GetSelectedItemsCount()
1064 and comparing its result with 0 but is more clear and might also be
1065 implemented more efficiently in the future.
1069 bool HasSelection() const;
1074 virtual void HitTest(const wxPoint
& point
, wxDataViewItem
& item
,
1075 wxDataViewColumn
*& col
) const;
1078 Return @true if the item is expanded.
1080 virtual bool IsExpanded(const wxDataViewItem
& item
) const;
1083 Return @true if the item is selected.
1085 virtual bool IsSelected(const wxDataViewItem
& item
) const;
1088 Select the given item.
1090 In single selection mode this changes the (unique) currently selected
1091 item. In multi selection mode, the @a item is selected and the
1092 previously selected items remain selected.
1094 virtual void Select(const wxDataViewItem
& item
);
1099 virtual void SelectAll();
1102 Set which column shall contain the tree-like expanders.
1104 void SetExpanderColumn(wxDataViewColumn
* col
);
1107 Changes the currently focused item.
1109 The @a item parameter must be valid, there is no way to remove the
1110 current item from the control.
1112 In single selection mode, calling this method is the same as calling
1113 Select() and is thus not very useful. In multiple selection mode this
1114 method only moves the current item however without changing the
1115 selection except under OS X where the current item is always selected,
1116 so calling SetCurrentItem() selects @a item if it hadn't been selected
1119 @see GetCurrentItem()
1123 void SetCurrentItem(const wxDataViewItem
& item
);
1126 Sets the indentation.
1128 void SetIndent(int indent
);
1131 Sets the selection to the array of wxDataViewItems.
1133 virtual void SetSelections(const wxDataViewItemArray
& sel
);
1136 Programmatically starts editing the given item on the given column.
1137 Currently not implemented on wxOSX Carbon.
1141 virtual void StartEditor(const wxDataViewItem
& item
, unsigned int column
);
1144 Unselect the given item.
1146 virtual void Unselect(const wxDataViewItem
& item
);
1150 This method only has effect if multiple selections are allowed.
1152 virtual void UnselectAll();
1155 Sets the row height.
1157 This function can only be used when all rows have the same height, i.e.
1158 when wxDV_VARIABLE_LINE_HEIGHT flag is not used.
1160 Currently this is implemented in the generic and native GTK versions
1161 only and nothing is done (and @false returned) when using OS X port.
1163 Also notice that this method can only be used to increase the row
1164 height compared with the default one (as determined by the return value
1165 of wxDataViewRenderer::GetSize()), if it is set to a too small value
1166 then the minimum required by the renderers will be used.
1168 @return @true if the line height was changed or @false otherwise.
1172 virtual bool SetRowHeight(int rowHeight
);
1178 @class wxDataViewModelNotifier
1180 A wxDataViewModelNotifier instance is owned by a wxDataViewModel and mirrors
1181 its notification interface.
1182 See the documentation of that class for further information.
1187 class wxDataViewModelNotifier
1193 wxDataViewModelNotifier();
1198 virtual ~wxDataViewModelNotifier();
1201 Called by owning model.
1203 virtual bool Cleared() = 0;
1206 Get owning wxDataViewModel.
1208 wxDataViewModel
* GetOwner() const;
1211 Called by owning model.
1213 virtual bool ItemAdded(const wxDataViewItem
& parent
,
1214 const wxDataViewItem
& item
) = 0;
1217 Called by owning model.
1219 virtual bool ItemChanged(const wxDataViewItem
& item
) = 0;
1222 Called by owning model.
1224 virtual bool ItemDeleted(const wxDataViewItem
& parent
,
1225 const wxDataViewItem
& item
) = 0;
1228 Called by owning model.
1230 virtual bool ItemsAdded(const wxDataViewItem
& parent
,
1231 const wxDataViewItemArray
& items
);
1234 Called by owning model.
1236 virtual bool ItemsChanged(const wxDataViewItemArray
& items
);
1239 Called by owning model.
1241 virtual bool ItemsDeleted(const wxDataViewItem
& parent
,
1242 const wxDataViewItemArray
& items
);
1245 Called by owning model.
1247 virtual void Resort() = 0;
1250 Set owner of this notifier. Used internally.
1252 void SetOwner(wxDataViewModel
* owner
);
1255 Called by owning model.
1257 virtual bool ValueChanged(const wxDataViewItem
& item
, unsigned int col
) = 0;
1262 The mode of a data-view cell; see wxDataViewRenderer for more info.
1264 enum wxDataViewCellMode
1266 wxDATAVIEW_CELL_INERT
,
1269 Indicates that the user can double click the cell and something will
1270 happen (e.g. a window for editing a date will pop up).
1272 wxDATAVIEW_CELL_ACTIVATABLE
,
1275 Indicates that the user can edit the data in-place, i.e. an control
1276 will show up after a slow click on the cell. This behaviour is best
1277 known from changing the filename in most file managers etc.
1279 wxDATAVIEW_CELL_EDITABLE
1283 The values of this enum controls how a wxDataViewRenderer should display
1284 its contents in a cell.
1286 enum wxDataViewCellRenderState
1288 wxDATAVIEW_CELL_SELECTED
= 1,
1289 wxDATAVIEW_CELL_PRELIT
= 2,
1290 wxDATAVIEW_CELL_INSENSITIVE
= 4,
1291 wxDATAVIEW_CELL_FOCUSED
= 8
1295 @class wxDataViewRenderer
1297 This class is used by wxDataViewCtrl to render the individual cells.
1298 One instance of a renderer class is owned by a wxDataViewColumn.
1299 There is a number of ready-to-use renderers provided:
1300 - wxDataViewTextRenderer,
1301 - wxDataViewIconTextRenderer,
1302 - wxDataViewToggleRenderer,
1303 - wxDataViewProgressRenderer,
1304 - wxDataViewBitmapRenderer,
1305 - wxDataViewDateRenderer,
1306 - wxDataViewSpinRenderer.
1307 - wxDataViewChoiceRenderer.
1309 Additionally, the user can write own renderers by deriving from
1310 wxDataViewCustomRenderer.
1312 The ::wxDataViewCellMode and ::wxDataViewCellRenderState flags accepted
1313 by the constructors respectively controls what actions the cell data allows
1314 and how the renderer should display its contents in a cell.
1319 class wxDataViewRenderer
: public wxObject
1325 wxDataViewRenderer(const wxString
& varianttype
,
1326 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1327 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1330 Enable or disable replacing parts of the item text with ellipsis to
1331 make it fit the column width.
1333 This method only makes sense for the renderers working with text, such
1334 as wxDataViewTextRenderer or wxDataViewIconTextRenderer.
1336 By default wxELLIPSIZE_MIDDLE is used.
1339 Ellipsization mode, use wxELLIPSIZE_NONE to disable.
1343 void EnableEllipsize(wxEllipsizeMode mode
= wxELLIPSIZE_MIDDLE
);
1346 Disable replacing parts of the item text with ellipsis.
1348 If ellipsizing is disabled, the string will be truncated if it doesn't
1351 This is the same as @code EnableEllipsize(wxELLIPSIZE_NONE) @endcode.
1355 void DisableEllipsize();
1358 Returns the alignment. See SetAlignment()
1360 virtual int GetAlignment() const;
1363 Returns the ellipsize mode used by the renderer.
1365 If the return value is wxELLIPSIZE_NONE, the text is simply truncated
1368 @see EnableEllipsize()
1370 wxEllipsizeMode
GetEllipsizeMode() const;
1373 Returns the cell mode.
1375 virtual wxDataViewCellMode
GetMode() const;
1378 Returns pointer to the owning wxDataViewColumn.
1380 wxDataViewColumn
* GetOwner() const;
1383 This methods retrieves the value from the renderer in order to
1384 transfer the value back to the data model.
1386 Returns @false on failure.
1388 virtual bool GetValue(wxVariant
& value
) const = 0;
1391 Returns a string with the type of the wxVariant supported by this renderer.
1393 wxString
GetVariantType() const;
1396 Sets the alignment of the renderer's content.
1397 The default value of @c wxDVR_DEFAULT_ALIGMENT indicates that the content
1398 should have the same alignment as the column header.
1400 The method is not implemented under OS X and the renderer always aligns
1401 its contents as the column header on that platform. The other platforms
1402 support both vertical and horizontal alignment.
1404 virtual void SetAlignment( int align
);
1406 Sets the owning wxDataViewColumn.
1407 This is usually called from within wxDataViewColumn.
1409 void SetOwner(wxDataViewColumn
* owner
);
1412 Set the value of the renderer (and thus its cell) to @a value.
1413 The internal code will then render this cell with this data.
1415 virtual bool SetValue(const wxVariant
& value
) = 0;
1418 Before data is committed to the data model, it is passed to this
1419 method where it can be checked for validity. This can also be
1420 used for checking a valid range or limiting the user input in
1421 a certain aspect (e.g. max number of characters or only alphanumeric
1422 input, ASCII only etc.). Return @false if the value is not valid.
1424 Please note that due to implementation limitations, this validation
1425 is done after the editing control already is destroyed and the
1426 editing process finished.
1428 virtual bool Validate(wxVariant
& value
);
1434 @class wxDataViewTextRenderer
1436 wxDataViewTextRenderer is used for rendering text.
1437 It supports in-place editing if desired.
1442 class wxDataViewTextRenderer
: public wxDataViewRenderer
1448 wxDataViewTextRenderer(const wxString
& varianttype
= "string",
1449 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1450 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1456 @class wxDataViewIconTextRenderer
1458 The wxDataViewIconTextRenderer class is used to display text with
1459 a small icon next to it as it is typically done in a file manager.
1461 This classes uses the wxDataViewIconText helper class to store its data.
1462 wxDataViewIconText can be converted to and from a wxVariant using the left
1468 class wxDataViewIconTextRenderer
: public wxDataViewRenderer
1474 wxDataViewIconTextRenderer(const wxString
& varianttype
= "wxDataViewIconText",
1475 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1476 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1482 @class wxDataViewProgressRenderer
1484 This class is used by wxDataViewCtrl to render progress bars.
1489 class wxDataViewProgressRenderer
: public wxDataViewRenderer
1495 wxDataViewProgressRenderer(const wxString
& label
= wxEmptyString
,
1496 const wxString
& varianttype
= "long",
1497 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1498 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1504 @class wxDataViewSpinRenderer
1506 This is a specialized renderer for rendering integer values.
1507 It supports modifying the values in-place by using a wxSpinCtrl.
1508 The renderer only support variants of type @e long.
1513 class wxDataViewSpinRenderer
: public wxDataViewCustomRenderer
1518 @a min and @a max indicate the minimum and maximum values for the wxSpinCtrl.
1520 wxDataViewSpinRenderer(int min
, int max
,
1521 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
1522 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1528 @class wxDataViewToggleRenderer
1530 This class is used by wxDataViewCtrl to render toggle controls.
1535 class wxDataViewToggleRenderer
: public wxDataViewRenderer
1541 wxDataViewToggleRenderer(const wxString
& varianttype
= "bool",
1542 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1543 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1548 @class wxDataViewChoiceRenderer
1550 This class is used by wxDataViewCtrl to render choice controls.
1551 It stores a string so that SetValue() and GetValue() operate
1552 on a variant holding a string.
1558 class wxDataViewChoiceRenderer
: public wxDataViewRenderer
1564 wxDataViewChoiceRenderer( const wxArrayString
&choices
,
1565 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
1566 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
1569 Returns the choice referred to by index.
1571 wxString
GetChoice(size_t index
) const;
1574 Returns all choices.
1576 const wxArrayString
& GetChoices() const;
1581 @class wxDataViewDateRenderer
1583 This class is used by wxDataViewCtrl to render calendar controls.
1588 class wxDataViewDateRenderer
: public wxDataViewRenderer
1594 wxDataViewDateRenderer(const wxString
& varianttype
= "datetime",
1595 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
1596 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1602 @class wxDataViewCustomRenderer
1604 You need to derive a new class from wxDataViewCustomRenderer in
1605 order to write a new renderer.
1607 You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue,
1608 wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render.
1610 If you want your renderer to support in-place editing then you also need to override
1611 wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl
1612 and wxDataViewCustomRenderer::GetValueFromEditorCtrl.
1614 Note that a special event handler will be pushed onto that editor control
1615 which handles @e \<ENTER\> and focus out events in order to end the editing.
1620 class wxDataViewCustomRenderer
: public wxDataViewRenderer
1626 wxDataViewCustomRenderer(const wxString
& varianttype
= "string",
1627 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1628 int align
= -1, bool no_init
= false);
1633 virtual ~wxDataViewCustomRenderer();
1636 Override this to react to double clicks or ENTER.
1637 This method will only be called in wxDATAVIEW_CELL_ACTIVATABLE mode.
1639 virtual bool Activate( const wxRect
& cell
,
1640 wxDataViewModel
* model
,
1641 const wxDataViewItem
& item
,
1645 Override this to create the actual editor control once editing
1648 @a parent is the parent of the editor control, @a labelRect indicates the
1649 position and size of the editor control and @a value is its initial value:
1653 return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
1654 labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l );
1658 virtual wxWindow
* CreateEditorCtrl(wxWindow
* parent
,
1660 const wxVariant
& value
);
1663 Return the attribute to be used for rendering.
1665 This function may be called from Render() implementation to use the
1666 attributes defined for the item if the renderer supports them.
1668 Notice that when Render() is called, the wxDC object passed to it is
1669 already set up to use the correct attributes (e.g. its font is set to
1670 bold or italic version if wxDataViewItemAttr::GetBold() or GetItalic()
1671 returns true) so it may not be necessary to call it explicitly if you
1672 only want to render text using the items attributes.
1676 const wxDataViewItemAttr
& GetAttr() const;
1679 Return size required to show content.
1681 virtual wxSize
GetSize() const = 0;
1684 Override this so that the renderer can get the value from the editor
1685 control (pointed to by @a editor):
1688 wxSpinCtrl *sc = (wxSpinCtrl*) editor;
1689 long l = sc->GetValue();
1695 virtual bool GetValueFromEditorCtrl(wxWindow
* editor
,
1699 Override this and make it return @true in order to
1700 indicate that this renderer supports in-place editing.
1702 virtual bool HasEditorCtrl() const;
1705 Override this to react to a left click.
1706 This method will only be called in @c wxDATAVIEW_CELL_ACTIVATABLE mode.
1708 virtual bool LeftClick( const wxPoint
& cursor
,
1710 wxDataViewModel
* model
,
1711 const wxDataViewItem
& item
,
1715 Override this to render the cell.
1716 Before this is called, wxDataViewRenderer::SetValue was called
1717 so that this instance knows what to render.
1719 virtual bool Render(wxRect cell
, wxDC
* dc
, int state
) = 0;
1722 This method should be called from within Render() whenever you need to
1724 This will ensure that the correct colour, font and vertical alignment will
1725 be chosen so the text will look the same as text drawn by native renderers.
1727 void RenderText(const wxString
& text
, int xoffset
, wxRect cell
,
1728 wxDC
* dc
, int state
);
1731 Override this to start a drag operation. Not yet supported.
1733 virtual bool StartDrag(const wxPoint
& cursor
,
1735 wxDataViewModel
* model
,
1736 const wxDataViewItem
& item
,
1743 @class wxDataViewBitmapRenderer
1745 This class is used by wxDataViewCtrl to render bitmap controls.
1750 class wxDataViewBitmapRenderer
: public wxDataViewRenderer
1756 wxDataViewBitmapRenderer(const wxString
& varianttype
= "wxBitmap",
1757 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1758 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1763 The flags used by wxDataViewColumn.
1764 Can be combined together.
1766 enum wxDataViewColumnFlags
1768 wxDATAVIEW_COL_RESIZABLE
= 1,
1769 wxDATAVIEW_COL_SORTABLE
= 2,
1770 wxDATAVIEW_COL_REORDERABLE
= 4,
1771 wxDATAVIEW_COL_HIDDEN
= 8
1775 @class wxDataViewColumn
1777 This class represents a column in a wxDataViewCtrl.
1778 One wxDataViewColumn is bound to one column in the data model to which the
1779 wxDataViewCtrl has been associated.
1781 An instance of wxDataViewRenderer is used by this class to render its data.
1786 class wxDataViewColumn
: public wxSettableHeaderColumn
1790 Constructs a text column.
1793 The title of the column.
1795 The class which will render the contents of this column.
1797 The index of the model's column which is associated with this object.
1799 The width of the column.
1800 The @c wxDVC_DEFAULT_WIDTH value is the fixed default value.
1802 The alignment of the column title.
1804 One or more flags of the ::wxDataViewColumnFlags enumeration.
1806 wxDataViewColumn(const wxString
& title
,
1807 wxDataViewRenderer
* renderer
,
1808 unsigned int model_column
,
1809 int width
= wxDVC_DEFAULT_WIDTH
,
1810 wxAlignment align
= wxALIGN_CENTER
,
1811 int flags
= wxDATAVIEW_COL_RESIZABLE
);
1814 Constructs a bitmap column.
1817 The bitmap of the column.
1819 The class which will render the contents of this column.
1821 The index of the model's column which is associated with this object.
1823 The width of the column.
1824 The @c wxDVC_DEFAULT_WIDTH value is the fixed default value.
1826 The alignment of the column title.
1828 One or more flags of the ::wxDataViewColumnFlags enumeration.
1830 wxDataViewColumn(const wxBitmap
& bitmap
,
1831 wxDataViewRenderer
* renderer
,
1832 unsigned int model_column
,
1833 int width
= wxDVC_DEFAULT_WIDTH
,
1834 wxAlignment align
= wxALIGN_CENTER
,
1835 int flags
= wxDATAVIEW_COL_RESIZABLE
);
1838 Returns the index of the column of the model, which this
1839 wxDataViewColumn is displaying.
1841 unsigned int GetModelColumn() const;
1844 Returns the owning wxDataViewCtrl.
1846 wxDataViewCtrl
* GetOwner() const;
1849 Returns the renderer of this wxDataViewColumn.
1851 @see wxDataViewRenderer.
1853 wxDataViewRenderer
* GetRenderer() const;
1859 @class wxDataViewListCtrl
1861 This class is a wxDataViewCtrl which internally uses a wxDataViewListStore
1862 and forwards most of its API to that class.
1864 The purpose of this class is to offer a simple way to display and
1865 edit a small table of data without having to write your own wxDataViewModel.
1868 wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, wxID_ANY );
1870 listctrl->AppendToggleColumn( "Toggle" );
1871 listctrl->AppendTextColumn( "Text" );
1873 wxVector<wxVariant> data;
1874 data.push_back( wxVariant(true) );
1875 data.push_back( wxVariant("row 1") );
1876 listctrl->AppendItem( data );
1879 data.push_back( wxVariant(false) );
1880 data.push_back( wxVariant("row 3") );
1881 listctrl->AppendItem( data );
1885 See wxDataViewCtrl for the list of supported styles.
1888 @beginEventEmissionTable
1889 See wxDataViewCtrl for the list of events emitted by this class.
1895 class wxDataViewListCtrl
: public wxDataViewCtrl
1901 wxDataViewListCtrl();
1904 Constructor. Calls Create().
1906 wxDataViewListCtrl( wxWindow
*parent
, wxWindowID id
,
1907 const wxPoint
& pos
= wxDefaultPosition
,
1908 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_ROW_LINES
,
1909 const wxValidator
& validator
= wxDefaultValidator
);
1912 Destructor. Deletes the image list if any.
1914 ~wxDataViewListCtrl();
1917 Creates the control and a wxDataViewListStore as its internal model.
1919 bool Create( wxWindow
*parent
, wxWindowID id
,
1920 const wxPoint
& pos
= wxDefaultPosition
,
1921 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_ROW_LINES
,
1922 const wxValidator
& validator
= wxDefaultValidator
);
1928 wxDataViewListStore
*GetStore();
1929 const wxDataViewListStore
*GetStore() const;
1933 Returns the position of given @e item or wxNOT_FOUND if it's
1938 int ItemToRow(const wxDataViewItem
&item
) const;
1941 Returns the wxDataViewItem at the given @e row.
1945 wxDataViewItem
RowToItem(int row
) const;
1949 @name Selection handling functions
1953 Returns index of the selected row or wxNOT_FOUND.
1955 @see wxDataViewCtrl::GetSelection()
1959 int GetSelectedRow() const;
1964 @see wxDataViewCtrl::Select()
1968 void SelectRow(unsigned row
);
1971 Unselects given row.
1973 @see wxDataViewCtrl::Unselect()
1977 void UnselectRow(unsigned row
);
1980 Returns true if @a row is selected.
1982 @see wxDataViewCtrl::IsSelected()
1986 bool IsRowSelected(unsigned row
) const;
1991 @name Column management functions
1996 Appends a column to the control and additionally appends a
1997 column to the store with the type string.
1999 virtual void AppendColumn( wxDataViewColumn
*column
);
2002 Appends a column to the control and additionally appends a
2003 column to the list store with the type @a varianttype.
2005 void AppendColumn( wxDataViewColumn
*column
, const wxString
&varianttype
);
2008 Appends a text column to the control and the store.
2010 See wxDataViewColumn::wxDataViewColumn for more info about
2013 wxDataViewColumn
*AppendTextColumn( const wxString
&label
,
2014 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
2015 int width
= -1, wxAlignment align
= wxALIGN_LEFT
,
2016 int flags
= wxDATAVIEW_COL_RESIZABLE
);
2019 Appends a toggle column to the control and the store.
2021 See wxDataViewColumn::wxDataViewColumn for more info about
2024 wxDataViewColumn
*AppendToggleColumn( const wxString
&label
,
2025 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
2026 int width
= -1, wxAlignment align
= wxALIGN_LEFT
,
2027 int flags
= wxDATAVIEW_COL_RESIZABLE
);
2030 Appends a progress column to the control and the store.
2032 See wxDataViewColumn::wxDataViewColumn for more info about
2035 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
,
2036 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
2037 int width
= -1, wxAlignment align
= wxALIGN_LEFT
,
2038 int flags
= wxDATAVIEW_COL_RESIZABLE
);
2041 Appends an icon-and-text column to the control and the store.
2043 See wxDataViewColumn::wxDataViewColumn for more info about
2046 wxDataViewColumn
*AppendIconTextColumn( const wxString
&label
,
2047 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
2048 int width
= -1, wxAlignment align
= wxALIGN_LEFT
,
2049 int flags
= wxDATAVIEW_COL_RESIZABLE
);
2052 Inserts a column to the control and additionally inserts a
2053 column to the store with the type string.
2055 virtual void InsertColumn( unsigned int pos
, wxDataViewColumn
*column
);
2058 Inserts a column to the control and additionally inserts a
2059 column to the list store with the type @a varianttype.
2061 void InsertColumn( unsigned int pos
, wxDataViewColumn
*column
,
2062 const wxString
&varianttype
);
2065 Prepends a column to the control and additionally prepends a
2066 column to the store with the type string.
2068 virtual void PrependColumn( wxDataViewColumn
*column
);
2071 Prepends a column to the control and additionally prepends a
2072 column to the list store with the type @a varianttype.
2074 void PrependColumn( wxDataViewColumn
*column
, const wxString
&varianttype
);
2080 @name Item management functions
2085 Appends an item (=row) to the control and store.
2087 void AppendItem( const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2090 Prepends an item (=row) to the control and store.
2092 void PrependItem( const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2095 Inserts an item (=row) to the control and store.
2097 void InsertItem( unsigned int row
, const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2100 Delete the row at position @a row.
2102 void DeleteItem( unsigned row
);
2105 Delete all items (= all rows).
2107 void DeleteAllItems();
2110 Sets the value in the store and update the control.
2112 void SetValue( const wxVariant
&value
, unsigned int row
, unsigned int col
);
2115 Returns the value from the store.
2117 void GetValue( wxVariant
&value
, unsigned int row
, unsigned int col
);
2120 Sets the value in the store and update the control.
2122 This method assumes that the string is stored in respective
2125 void SetTextValue( const wxString
&value
, unsigned int row
, unsigned int col
);
2128 Returns the value from the store.
2130 This method assumes that the string is stored in respective
2133 wxString
GetTextValue( unsigned int row
, unsigned int col
) const;
2136 Sets the value in the store and update the control.
2138 This method assumes that the boolean value is stored in
2141 void SetToggleValue( bool value
, unsigned int row
, unsigned int col
);
2144 Returns the value from the store.
2146 This method assumes that the boolean value is stored in
2149 bool GetToggleValue( unsigned int row
, unsigned int col
) const;
2156 @class wxDataViewTreeCtrl
2158 This class is a wxDataViewCtrl which internally uses a wxDataViewTreeStore
2159 and forwards most of its API to that class.
2160 Additionally, it uses a wxImageList to store a list of icons.
2162 The main purpose of this class is to provide a simple upgrade path for code
2166 See wxDataViewCtrl for the list of supported styles.
2169 @beginEventEmissionTable
2170 See wxDataViewCtrl for the list of events emitted by this class.
2175 @appearance{dataviewtreectrl.png}
2177 class wxDataViewTreeCtrl
: public wxDataViewCtrl
2183 wxDataViewTreeCtrl();
2190 wxDataViewTreeCtrl(wxWindow
* parent
, wxWindowID id
,
2191 const wxPoint
& pos
= wxDefaultPosition
,
2192 const wxSize
& size
= wxDefaultSize
,
2193 long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
2194 const wxValidator
& validator
= wxDefaultValidator
);
2197 Destructor. Deletes the image list if any.
2199 virtual ~wxDataViewTreeCtrl();
2202 Appends a container to the given @a parent.
2204 wxDataViewItem
AppendContainer(const wxDataViewItem
& parent
,
2205 const wxString
& text
,
2208 wxClientData
* data
= NULL
);
2211 Appends an item to the given @a parent.
2213 wxDataViewItem
AppendItem(const wxDataViewItem
& parent
,
2214 const wxString
& text
,
2216 wxClientData
* data
= NULL
);
2219 Creates the control and a wxDataViewTreeStore as its internal model.
2221 The default tree column created by this method is an editable column
2222 using wxDataViewIconTextRenderer as its renderer.
2224 bool Create(wxWindow
* parent
, wxWindowID id
,
2225 const wxPoint
& pos
= wxDefaultPosition
,
2226 const wxSize
& size
= wxDefaultSize
,
2227 long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
2228 const wxValidator
& validator
= wxDefaultValidator
);
2231 Calls the identical method from wxDataViewTreeStore.
2233 void DeleteAllItems();
2236 Calls the identical method from wxDataViewTreeStore.
2238 void DeleteChildren(const wxDataViewItem
& item
);
2241 Calls the identical method from wxDataViewTreeStore.
2243 void DeleteItem(const wxDataViewItem
& item
);
2246 Calls the identical method from wxDataViewTreeStore.
2248 int GetChildCount(const wxDataViewItem
& parent
) const;
2251 Returns the image list.
2253 wxImageList
* GetImageList();
2256 Calls the identical method from wxDataViewTreeStore.
2258 wxClientData
* GetItemData(const wxDataViewItem
& item
) const;
2261 Calls the identical method from wxDataViewTreeStore.
2263 const wxIcon
& GetItemExpandedIcon(const wxDataViewItem
& item
) const;
2266 Calls the identical method from wxDataViewTreeStore.
2268 const wxIcon
& GetItemIcon(const wxDataViewItem
& item
) const;
2271 Calls the identical method from wxDataViewTreeStore.
2273 wxString
GetItemText(const wxDataViewItem
& item
) const;
2276 Calls the identical method from wxDataViewTreeStore.
2278 wxDataViewItem
GetNthChild(const wxDataViewItem
& parent
,
2279 unsigned int pos
) const;
2285 wxDataViewTreeStore
* GetStore();
2286 const wxDataViewTreeStore
* GetStore() const;
2290 Calls the same method from wxDataViewTreeStore but uses
2291 an index position in the image list instead of a wxIcon.
2293 wxDataViewItem
InsertContainer(const wxDataViewItem
& parent
,
2294 const wxDataViewItem
& previous
,
2295 const wxString
& text
,
2298 wxClientData
* data
= NULL
);
2301 Calls the same method from wxDataViewTreeStore but uses
2302 an index position in the image list instead of a wxIcon.
2304 wxDataViewItem
InsertItem(const wxDataViewItem
& parent
,
2305 const wxDataViewItem
& previous
,
2306 const wxString
& text
,
2308 wxClientData
* data
= NULL
);
2311 Returns true if item is a container.
2313 bool IsContainer( const wxDataViewItem
& item
);
2316 Calls the same method from wxDataViewTreeStore but uses
2317 an index position in the image list instead of a wxIcon.
2319 wxDataViewItem
PrependContainer(const wxDataViewItem
& parent
,
2320 const wxString
& text
,
2323 wxClientData
* data
= NULL
);
2326 Calls the same method from wxDataViewTreeStore but uses
2327 an index position in the image list instead of a wxIcon.
2329 wxDataViewItem
PrependItem(const wxDataViewItem
& parent
,
2330 const wxString
& text
,
2332 wxClientData
* data
= NULL
);
2335 Sets the image list.
2337 void SetImageList(wxImageList
* imagelist
);
2340 Calls the identical method from wxDataViewTreeStore.
2342 void SetItemData(const wxDataViewItem
& item
, wxClientData
* data
);
2345 Calls the identical method from wxDataViewTreeStore.
2347 void SetItemExpandedIcon(const wxDataViewItem
& item
,
2348 const wxIcon
& icon
);
2351 Calls the identical method from wxDataViewTreeStore.
2353 void SetItemIcon(const wxDataViewItem
& item
, const wxIcon
& icon
);
2356 Calls the identical method from wxDataViewTreeStore.
2358 void SetItemText(const wxDataViewItem
& item
,
2359 const wxString
& text
);
2364 @class wxDataViewListStore
2366 wxDataViewListStore is a specialised wxDataViewModel for storing
2367 a simple table of data. Since it derives from wxDataViewIndexListModel
2368 its data is be accessed by row (i.e. by index) instead of only
2371 This class actually stores the values (therefore its name)
2372 and implements all virtual methods from the base classes so it can be
2373 used directly without having to derive any class from it, but it is
2374 mostly used from within wxDataViewListCtrl.
2380 class wxDataViewListStore
: public wxDataViewIndexListModel
2386 wxDataViewListStore();
2391 ~wxDataViewListStore();
2394 Prepends a data column.
2396 @a variantype indicates the type of values store in the column.
2398 This does not automatically fill in any (default) values in
2399 rows which exist in the store already.
2401 void PrependColumn( const wxString
&varianttype
);
2404 Inserts a data column before @a pos.
2406 @a variantype indicates the type of values store in the column.
2408 This does not automatically fill in any (default) values in
2409 rows which exist in the store already.
2411 void InsertColumn( unsigned int pos
, const wxString
&varianttype
);
2414 Appends a data column.
2416 @a variantype indicates the type of values store in the column.
2418 This does not automatically fill in any (default) values in
2419 rows which exist in the store already.
2421 void AppendColumn( const wxString
&varianttype
);
2424 Appends an item (=row) and fills it with @a values.
2426 The values must match the values specifies in the column
2427 in number and type. No (default) values are filled in
2430 void AppendItem( const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2433 Prepends an item (=row) and fills it with @a values.
2435 The values must match the values specifies in the column
2436 in number and type. No (default) values are filled in
2439 void PrependItem( const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2442 Inserts an item (=row) and fills it with @a values.
2444 The values must match the values specifies in the column
2445 in number and type. No (default) values are filled in
2448 void InsertItem( unsigned int row
, const wxVector
<wxVariant
> &values
, wxClientData
*data
= NULL
);
2451 Delete the item (=row) at position @a pos.
2453 void DeleteItem( unsigned pos
);
2456 Delete all item (=all rows) in the store.
2458 void DeleteAllItems();
2461 Overridden from wxDataViewModel
2463 virtual unsigned int GetColumnCount() const;
2466 Overridden from wxDataViewModel
2468 virtual wxString
GetColumnType( unsigned int col
) const;
2471 Overridden from wxDataViewIndexListModel
2473 virtual void GetValueByRow( wxVariant
&value
,
2474 unsigned int row
, unsigned int col
) const;
2477 Overridden from wxDataViewIndexListModel
2479 virtual bool SetValueByRow( const wxVariant
&value
,
2480 unsigned int row
, unsigned int col
);
2485 @class wxDataViewTreeStore
2487 wxDataViewTreeStore is a specialised wxDataViewModel for storing simple
2488 trees very much like wxTreeCtrl does and it offers a similar API.
2490 This class actually stores the entire tree and the values (therefore its name)
2491 and implements all virtual methods from the base class so it can be used directly
2492 without having to derive any class from it, but it is mostly used from within
2498 class wxDataViewTreeStore
: public wxDataViewModel
2502 Constructor. Creates the invisible root node internally.
2504 wxDataViewTreeStore();
2509 virtual ~wxDataViewTreeStore();
2514 wxDataViewItem
AppendContainer(const wxDataViewItem
& parent
,
2515 const wxString
& text
,
2516 const wxIcon
& icon
= wxNullIcon
,
2517 const wxIcon
& expanded
= wxNullIcon
,
2518 wxClientData
* data
= NULL
);
2523 wxDataViewItem
AppendItem(const wxDataViewItem
& parent
,
2524 const wxString
& text
,
2525 const wxIcon
& icon
= wxNullIcon
,
2526 wxClientData
* data
= NULL
);
2529 Delete all item in the model.
2531 void DeleteAllItems();
2534 Delete all children of the item, but not the item itself.
2536 void DeleteChildren(const wxDataViewItem
& item
);
2541 void DeleteItem(const wxDataViewItem
& item
);
2544 Return the number of children of item.
2546 int GetChildCount(const wxDataViewItem
& parent
) const;
2549 Returns the client data associated with the item.
2551 wxClientData
* GetItemData(const wxDataViewItem
& item
) const;
2554 Returns the icon to display in expanded containers.
2556 const wxIcon
& GetItemExpandedIcon(const wxDataViewItem
& item
) const;
2559 Returns the icon of the item.
2561 const wxIcon
& GetItemIcon(const wxDataViewItem
& item
) const;
2564 Returns the text of the item.
2566 wxString
GetItemText(const wxDataViewItem
& item
) const;
2569 Returns the nth child item of item.
2571 wxDataViewItem
GetNthChild(const wxDataViewItem
& parent
,
2572 unsigned int pos
) const;
2575 Inserts a container after @a previous.
2577 wxDataViewItem
InsertContainer(const wxDataViewItem
& parent
,
2578 const wxDataViewItem
& previous
,
2579 const wxString
& text
,
2580 const wxIcon
& icon
= wxNullIcon
,
2581 const wxIcon
& expanded
= wxNullIcon
,
2582 wxClientData
* data
= NULL
);
2585 Inserts an item after @a previous.
2587 wxDataViewItem
InsertItem(const wxDataViewItem
& parent
,
2588 const wxDataViewItem
& previous
,
2589 const wxString
& text
,
2590 const wxIcon
& icon
= wxNullIcon
,
2591 wxClientData
* data
= NULL
);
2594 Inserts a container before the first child item or @a parent.
2596 wxDataViewItem
PrependContainer(const wxDataViewItem
& parent
,
2597 const wxString
& text
,
2598 const wxIcon
& icon
= wxNullIcon
,
2599 const wxIcon
& expanded
= wxNullIcon
,
2600 wxClientData
* data
= NULL
);
2603 Inserts an item before the first child item or @a parent.
2605 wxDataViewItem
PrependItem(const wxDataViewItem
& parent
,
2606 const wxString
& text
,
2607 const wxIcon
& icon
= wxNullIcon
,
2608 wxClientData
* data
= NULL
);
2611 Sets the client data associated with the item.
2613 void SetItemData(const wxDataViewItem
& item
, wxClientData
* data
);
2616 Sets the expanded icon for the item.
2618 void SetItemExpandedIcon(const wxDataViewItem
& item
,
2619 const wxIcon
& icon
);
2622 Sets the icon for the item.
2624 void SetItemIcon(const wxDataViewItem
& item
, const wxIcon
& icon
);
2629 @class wxDataViewIconText
2631 wxDataViewIconText is used by wxDataViewIconTextRenderer for data transfer.
2632 This class can be converted to and from a wxVariant.
2637 class wxDataViewIconText
: public wxObject
2644 wxDataViewIconText(const wxString
& text
= wxEmptyString
,
2645 const wxIcon
& icon
= wxNullIcon
);
2646 wxDataViewIconText(const wxDataViewIconText
& other
);
2652 const wxIcon
& GetIcon() const;
2657 wxString
GetText() const;
2662 void SetIcon(const wxIcon
& icon
);
2667 void SetText(const wxString
& text
);
2673 @class wxDataViewEvent
2675 This is the event class for the wxDataViewCtrl notifications.
2677 @beginEventTable{wxDataViewEvent}
2678 @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)}
2679 Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event.
2680 @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)}
2681 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.
2682 @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)}
2683 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event.
2684 @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)}
2685 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event.
2686 @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)}
2687 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event.
2688 @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)}
2689 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event.
2690 @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)}
2691 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event.
2692 @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)}
2693 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event.
2694 @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)}
2695 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event.
2696 @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)}
2697 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event.
2698 @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)}
2699 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event.
2700 @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)}
2701 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event.
2702 @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)}
2703 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event.
2704 @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
2705 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event.
2706 @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)}
2707 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event.
2708 @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)}
2709 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event.
2710 @event{EVT_DATAVIEW_ITEM_DROP(id, func)}
2711 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event.
2712 @event{EVT_DATAVIEW_CACHE_HINT(id, func)}
2713 Process a @c wxEVT_COMMAND_DATAVIEW_CACHE_HINT event.
2717 @category{events,dvc}
2719 class wxDataViewEvent
: public wxNotifyEvent
2723 Constructor. Typically used by wxWidgets internals only.
2725 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
,
2729 Returns the position of the column in the control or -1
2730 if no column field was set by the event emitter.
2732 int GetColumn() const;
2735 Returns a pointer to the wxDataViewColumn from which
2736 the event was emitted or @NULL.
2738 wxDataViewColumn
* GetDataViewColumn() const;
2741 Returns the wxDataViewModel associated with the event.
2743 wxDataViewModel
* GetModel() const;
2746 Returns the position of a context menu event in screen coordinates.
2748 wxPoint
GetPosition() const;
2751 Returns a reference to a value.
2753 const wxVariant
& GetValue() const;
2756 Can be used to determine whether the new value is going to be accepted
2757 in wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE handler.
2759 Returns @true if editing the item was cancelled or if the user tried to
2760 enter an invalid value (refused by wxDataViewRenderer::Validate()). If
2761 this method returns @false, it means that the value in the model is
2762 about to be changed to the new one.
2764 Notice that wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event handler can
2765 call wxNotifyEvent::Veto() to prevent this from happening.
2767 Currently support for setting this field and for vetoing the change is
2768 only available in the generic version of wxDataViewCtrl, i.e. under MSW
2769 but not GTK nor OS X.
2773 bool IsEditCancelled() const;
2776 Sets the column index associated with this event.
2778 void SetColumn(int col
);
2781 For @c wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only.
2783 void SetDataViewColumn(wxDataViewColumn
* col
);
2786 Sets the dataview model associated with this event.
2788 void SetModel(wxDataViewModel
* model
);
2791 Sets the value associated with this event.
2793 void SetValue(const wxVariant
& value
);
2796 Set wxDataObject for data transfer within a drag operation.
2798 void SetDataObject( wxDataObject
*obj
);
2801 Used internally. Gets associated wxDataObject for data transfer
2802 within a drag operation.
2804 wxDataObject
*GetDataObject() const;
2807 Used internally. Sets the wxDataFormat during a drop operation.
2809 void SetDataFormat( const wxDataFormat
&format
);
2812 Gets the wxDataFormat during a drop operation.
2814 wxDataFormat
GetDataFormat() const;
2817 Used internally. Sets the data size for a drop data transfer.
2819 void SetDataSize( size_t size
);
2822 Gets the data size for a drop data transfer.
2824 size_t GetDataSize() const;
2827 Used internally. Sets the data buffer for a drop data transfer.
2829 void SetDataBuffer( void* buf
);
2832 Gets the data buffer for a drop data transfer.
2834 void *GetDataBuffer() const;
2837 Return the first row that will be displayed.
2839 int GetCacheFrom() const;
2842 Return the last row that will be displayed.
2844 int GetCacheTo() const;