1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxDataViewIconText
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxDataViewIconText
12 wxDataViewIconText is used by wxDataViewIconTextRenderer for data transfer.
13 This class can be converted to and from a wxVariant.
18 class wxDataViewIconText
: public wxObject
25 wxDataViewIconText(const wxString
& text
= wxEmptyString
,
26 const wxIcon
& icon
= wxNullIcon
);
27 wxDataViewIconText(const wxDataViewIconText
& other
);
33 const wxIcon
& GetIcon() const;
38 wxString
GetText() const;
43 void SetIcon(const wxIcon
& icon
);
48 void SetText(const wxString
& text
);
54 @class wxDataViewEvent
56 This is the event class for the wxDataViewCtrl notifications.
61 class wxDataViewEvent
: public wxNotifyEvent
66 Constructor. Typically used by wxWidgets internals only.
68 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
,
70 wxDataViewEvent(const wxDataViewEvent
& event
);
74 Used to clone the event.
76 wxEvent
* Clone() const;
79 Returns the position of the column in the control or -1
80 if no column field was set by the event emitter.
82 int GetColumn() const;
85 Returns a pointer to the wxDataViewColumn from which
86 the event was emitted or @NULL.
88 wxDataViewColumn
* GetDataViewColumn() const;
91 Returns the wxDataViewModel associated with the event.
93 wxDataViewModel
* GetModel() const;
96 Returns a the position of a context menu event in screen coordinates.
98 wxPoint
GetPosition() const;
101 Returns a reference to a value.
103 const wxVariant
& GetValue() const;
106 Sets the column index associated with this event.
108 void SetColumn(int col
);
111 For wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only.
113 void SetDataViewColumn(wxDataViewColumn
* col
);
116 Sets the dataview model associated with this event.
118 void SetModel(wxDataViewModel
* model
);
121 Sets the value associated with this event.
123 void SetValue(const wxVariant
& value
);
129 @class wxDataViewModel
131 wxDataViewModel is the base class for all data model to be displayed by a
134 All other models derive from it and must implement its pure virtual functions
135 in order to define a complete data model. In detail, you need to override
136 wxDataViewModel::IsContainer, wxDataViewModel::GetParent, wxDataViewModel::GetChildren,
137 wxDataViewModel::GetColumnCount, wxDataViewModel::GetColumnType and
138 wxDataViewModel::GetValue in order to define the data model which acts as an
139 interface between your actual data and the wxDataViewCtrl.
141 Since you will usually also allow the wxDataViewCtrl to change your data
142 through its graphical interface, you will also have to override
143 wxDataViewModel::SetValue which the wxDataViewCtrl will call when a change
144 to some data has been commited.
146 wxDataViewModel (as indeed the entire wxDataViewCtrl code) is using wxVariant
147 to store data and its type in a generic way. wxVariant can be extended to contain
148 almost any data without changes to the original class.
150 The data that is presented through this data model is expected to change at
151 run-time. You need to inform the data model when a change happened.
152 Depending on what happened you need to call one of the following methods:
153 - wxDataViewModel::ValueChanged,
154 - wxDataViewModel::ItemAdded,
155 - wxDataViewModel::ItemDeleted,
156 - wxDataViewModel::ItemChanged,
157 - wxDataViewModel::Cleared.
159 There are plural forms for notification of addition, change or removal of
160 several item at once. See:
161 - wxDataViewModel::ItemsAdded,
162 - wxDataViewModel::ItemsDeleted,
163 - wxDataViewModel::ItemsChanged.
165 Note that wxDataViewModel does not define the position or index of any item
166 in the control because different controls might display the same data differently.
167 wxDataViewModel does provide a wxDataViewModel::Compare method which the
168 wxDataViewCtrl may use to sort the data either in conjunction with a column
169 header or without (see wxDataViewModel::HasDefaultCompare).
171 This class maintains a list of wxDataViewModelNotifier which link this class
172 to the specific implementations on the supported platforms so that e.g. calling
173 wxDataViewModel::ValueChanged on this model will just call
174 wxDataViewModelNotifier::ValueChanged for each notifier that has been added.
175 You can also add your own notifier in order to get informed about any changes
176 to the data in the list model.
178 Currently wxWidgets provides the following models apart from the base model:
179 wxDataViewIndexListModel, wxDataViewVirtualListModel, wxDataViewTreeStore.
181 Note that wxDataViewModel is reference counted, derives from wxObjectRefData
182 and cannot be deleted directly as it can be shared by several wxDataViewCtrls.
183 This implies that you need to decrease the reference count after
184 associating the model with a control like this:
187 wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, ID_MUSIC_CTRL );
188 wxDataViewModel *musicModel = new MyMusicModel;
189 m_musicCtrl-AssociateModel( musicModel );
190 musicModel-DecRef(); // avoid memory leak !!
198 class wxDataViewModel
: public wxObjectRefData
207 Adds a wxDataViewModelNotifier to the model.
209 void AddNotifier(wxDataViewModelNotifier
* notifier
);
212 Called to inform the model that all data has been cleared.
213 The control will reread the data from the model again.
215 virtual bool Cleared();
218 The compare function to be used by control. The default compare function
219 sorts by container and other items separately and in ascending order.
220 Override this for a different sorting behaviour.
222 @see HasDefaultCompare().
224 virtual int Compare(const wxDataViewItem
& item1
,
225 const wxDataViewItem
& item2
,
230 Oberride this to indicate that the item has special font attributes.
231 This only affects the wxDataViewTextRendererText renderer.
233 @see wxDataViewItemAttr.
235 virtual bool GetAttr(const wxDataViewItem
& item
, unsigned int col
,
236 wxDataViewItemAttr
& attr
);
239 Override this so the control can query the child items of an item.
240 Returns the number of items.
242 virtual unsigned int GetChildren(const wxDataViewItem
& item
,
243 wxDataViewItemArray
& children
) const = 0;
246 Override this to indicate the number of columns in the model.
248 virtual unsigned int GetColumnCount() const = 0;
251 Override this to indicate what type of data is stored in the
252 column specified by @a col.
254 This should return a string indicating the type of data as reported by wxVariant.
256 virtual wxString
GetColumnType(unsigned int col
) const = 0;
259 Override this to indicate which wxDataViewItem representing the parent
260 of @a item or an invalid wxDataViewItem if the the root item is
263 virtual wxDataViewItem
GetParent(const wxDataViewItem
& item
) const = 0;
266 Override this to indicate the value of @a item.
267 A wxVariant is used to store the data.
269 virtual void GetValue(wxVariant
& variant
, const wxDataViewItem
& item
,
270 unsigned int col
) const = 0;
273 Override this method to indicate if a container item merely acts as a
274 headline (or for categorisation) or if it also acts a normal item with
275 entries for futher columns. By default returns @false.
277 virtual bool HasContainerColumns(const wxDataViewItem
& item
) const;
280 Override this to indicate that the model provides a default compare
281 function that the control should use if no wxDataViewColumn has been
282 chosen for sorting. Usually, the user clicks on a column header for
283 sorting, the data will be sorted alphanumerically.
285 If any other order (e.g. by index or order of appearance) is required,
286 then this should be used.
287 See wxDataViewIndexListModel for a model which makes use of this.
289 virtual bool HasDefaultCompare() const;
292 Override this to indicate of @a item is a container, i.e. if
293 it can have child items.
295 virtual bool IsContainer(const wxDataViewItem
& item
) const = 0;
298 Call this to inform the model that an item has been added to the data.
300 virtual bool ItemAdded(const wxDataViewItem
& parent
,
301 const wxDataViewItem
& item
);
304 Call this to inform the model that an item has changed.
306 This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
307 event (in which the column fields will not be set) to the user.
309 virtual bool ItemChanged(const wxDataViewItem
& item
);
312 Call this to inform the model that an item has been deleted from the data.
314 virtual bool ItemDeleted(const wxDataViewItem
& parent
,
315 const wxDataViewItem
& item
);
318 Call this to inform the model that several items have been added to the data.
320 virtual bool ItemsAdded(const wxDataViewItem
& parent
,
321 const wxDataViewItemArray
& items
);
324 Call this to inform the model that several items have changed.
326 This will eventually emit wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
327 events (in which the column fields will not be set) to the user.
329 virtual bool ItemsChanged(const wxDataViewItemArray
& items
);
332 Call this to inform the model that several items have been deleted.
334 virtual bool ItemsDeleted(const wxDataViewItem
& parent
,
335 const wxDataViewItemArray
& items
);
338 Remove the @a notifier from the list of notifiers.
340 void RemoveNotifier(wxDataViewModelNotifier
* notifier
);
343 Call this to initiate a resort after the sort function has been changed.
345 virtual void Resort();
348 This gets called in order to set a value in the data model.
349 The most common scenario is that the wxDataViewCtrl calls this method
350 after the user changed some data in the view.
352 Afterwards ValueChanged() has to be called!
354 virtual bool SetValue(const wxVariant
& variant
, const wxDataViewItem
& item
,
355 unsigned int col
) = 0;
358 Call this to inform this model that a value in the model has been changed.
359 This is also called from wxDataViewCtrl's internal editing code, e.g. when
360 editing a text field in the control.
362 This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
365 virtual bool ValueChanged(const wxDataViewItem
& item
,
371 Destructor. This should not be called directly. Use DecRef() instead.
373 virtual ~wxDataViewModel();
379 @class wxDataViewIndexListModel
381 wxDataViewIndexListModel is a specialized data model which lets you address
382 an item by its position (row) rather than its wxDataViewItem (which you can
383 obtain from this class).
384 This model also provides its own wxDataViewIndexListModel::Compare
385 method which sorts the model's data by the index.
387 This model is not a virtual model since the control stores each wxDataViewItem.
388 Use wxDataViewVirtualListModel if you need to display millions of items or
389 have other reason to use a virtual control.
394 class wxDataViewIndexListModel
: public wxDataViewModel
400 wxDataViewIndexListModel(unsigned int initial_size
= 0);
405 virtual ~wxDataViewIndexListModel();
408 Compare method that sorts the items by their index.
410 int Compare(const wxDataViewItem
& item1
,
411 const wxDataViewItem
& item2
,
412 unsigned int column
, bool ascending
);
415 Oberride this to indicate that the row has special font attributes.
416 This only affects the wxDataViewTextRendererText() renderer.
418 @see wxDataViewItemAttr.
420 virtual bool GetAttr(unsigned int row
, unsigned int col
,
421 wxDataViewItemAttr
& attr
);
424 Returns the wxDataViewItem at the given @e row.
426 wxDataViewItem
GetItem(unsigned int row
) const;
429 Returns the position of given @e item.
431 unsigned int GetRow(const wxDataViewItem
& item
) const;
434 Override this to allow getting values from the model.
436 virtual void GetValue(wxVariant
& variant
, unsigned int row
,
437 unsigned int col
) const = 0;
440 Call this after if the data has to be read again from the model.
441 This is useful after major changes when calling the methods below
442 (possibly thousands of times) doesn't make sense.
444 void Reset(unsigned int new_size
);
447 Call this after a row has been appended to the model.
452 Call this after a row has been changed.
454 void RowChanged(unsigned int row
);
457 Call this after a row has been deleted.
459 void RowDeleted(unsigned int row
);
462 Call this after a row has been inserted at the given position.
464 void RowInserted(unsigned int before
);
467 Call this after a row has been prepended to the model.
472 Call this after a value has been changed.
474 void RowValueChanged(unsigned int row
, unsigned int col
);
477 Call this after rows have been deleted.
478 The array will internally get copied and sorted in descending order so
479 that the rows with the highest position will be deleted first.
481 void RowsDeleted(const wxArrayInt
& rows
);
484 Called in order to set a value in the model.
486 virtual bool SetValue(const wxVariant
& variant
, unsigned int row
,
487 unsigned int col
) = 0;
493 @class wxDataViewVirtualListModel
495 wxDataViewVirtualListModel is a specialized data model which lets you address
496 an item by its position (row) rather than its wxDataViewItem and as such offers
497 the exact same interface as wxDataViewIndexListModel.
498 The important difference is that under platforms other than OS X, using this
499 model will result in a truly virtual control able to handle millions of items
500 as the control doesn't store any item (a feature not supported by the
501 Carbon API under OS X).
503 @see wxDataViewIndexListModel for the API.
508 class wxDataViewVirtualListModel
: public wxDataViewModel
514 wxDataViewVirtualListModel(unsigned int initial_size
= 0);
520 @class wxDataViewItemAttr
522 This class is used to indicate to a wxDataViewCtrl that a certain item
523 (see wxDataViewItem) has extra font attributes for its renderer.
524 For this, it is required to override wxDataViewModel::GetAttr.
526 Attributes are currently only supported by wxDataViewTextRendererText.
531 class wxDataViewItemAttr
537 wxDataViewItemAttr();
540 Call this to indicate that the item shall be displayed in bold text.
542 void SetBold(bool set
);
545 Call this to indicate that the item shall be displayed with that colour.
547 void SetColour(const wxColour
& colour
);
550 Call this to indicate that the item shall be displayed in italic text.
552 void SetItalic(bool set
);
558 @class wxDataViewItem
560 wxDataViewItem is a small opaque class that represents an item in a wxDataViewCtrl
561 in a persistent way, i.e. indepent of the position of the item in the control
562 or changes to its contents.
564 It must hold a unique ID of type @e void* in its only field and can be converted
567 If the ID is @NULL the wxDataViewItem is invalid and wxDataViewItem::IsOk will
568 return @false which used in many places in the API of wxDataViewCtrl to
569 indicate that e.g. no item was found. An ID of @NULL is also used to indicate
570 the invisible root. Examples for this are wxDataViewModel::GetParent and
571 wxDataViewModel::GetChildren.
583 wxDataViewItem(void* id
= NULL
);
584 wxDataViewItem(const wxDataViewItem
& item
);
593 Returns @true if the ID is not @NULL.
601 @class wxDataViewCtrl
603 wxDataViewCtrl is a control to display data either in a tree like fashion or
604 in a tabular form or both.
605 If you only need to display a simple tree structure with an API more like the
606 older wxTreeCtrl class, then the specialized wxDataViewTreeCtrl can be used.
608 A wxDataViewItem is used to represent a (visible) item in the control.
610 Unlike wxListCtrl wxDataViewCtrl doesn't get its data from the user through
611 virtual functions or by setting it directly. Instead you need to write your own
612 wxDataViewModel and associate it with this control.
613 Then you need to add a number of wxDataViewColumn to this control to define
614 what each column shall display. Each wxDataViewColumn in turn owns 1 instance
615 of a wxDataViewRenderer to render its cells.
617 A number of standard renderers for rendering text, dates, images, toggle,
618 a progress bar etc. are provided. Additionally, the user can write custom
619 renderes deriving from wxDataViewCustomRenderer for displaying anything.
621 All data transfer from the control to the model and the user code is done
622 through wxVariant which can be extended to support more data formats as necessary.
623 Accordingly, all type information uses the strings returned from wxVariant::GetType.
627 Single selection mode. This is the default.
628 @style{wxDV_MULTIPLE}
629 Multiple selection mode.
630 @style{wxDV_ROW_LINES}
631 Use alternating colours for rows if supported by platform and theme.
632 @style{wxDV_HORIZ_RULES}
633 Display fine rules between row if supported.
634 @style{wxDV_VERT_RULES}
635 Display fine rules between columns is supported.
636 @style{wxDV_VARIABLE_LINE_HEIGHT}
637 Allow variable line heights.
638 This can be inefficient when displaying large number of items.
641 @beginEventTable{wxDataViewEvent}
642 @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)}
643 Process a wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event.
644 @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)}
645 Process a wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.
646 @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)}
647 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event.
648 @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)}
649 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event.
650 @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)}
651 Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event.
652 @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)}
653 Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event.
654 @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)}
655 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event.
656 @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)}
657 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event.
658 @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)}
659 Process a wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event.
660 @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)}
661 Process a wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event.
662 @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)}
663 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event.
664 @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)}
665 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event.
666 @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)}
667 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event.
668 @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
669 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event.
674 @appearance{dataviewctrl.png}
676 class wxDataViewCtrl
: public wxControl
685 Constructor. Calls Create().
687 wxDataViewCtrl(wxWindow
* parent
, wxWindowID id
,
688 const wxPoint
& pos
= wxDefaultPosition
,
689 const wxSize
& size
= wxDefaultSize
,
691 const wxValidator
& validator
= wxDefaultValidator
);
696 virtual ~wxDataViewCtrl();
699 Appends a wxDataViewColumn to the control. Returns @true on success.
701 Note that there is a number of short cut methods which implicitly create
702 a wxDataViewColumn and a wxDataViewRenderer for it (see below).
704 virtual bool AppendColumn(wxDataViewColumn
* col
);
707 Prepends a wxDataViewColumn to the control. Returns @true on success.
709 Note that there is a number of short cut methods which implicitly create
710 a wxDataViewColumn and a wxDataViewRenderer for it.
712 virtual bool PrependColumn(wxDataViewColumn
* col
);
715 Inserts a wxDataViewColumn to the control. Returns @true on success.
717 virtual bool InsertColumn(unsigned int pos
, wxDataViewColumn
* col
);
721 Appends a column for rendering a bitmap. Returns the wxDataViewColumn
722 created in the function or @NULL on failure.
724 wxDataViewColumn
* AppendBitmapColumn(const wxString
& label
,
725 unsigned int model_column
,
726 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
728 wxAlignment align
= wxALIGN_CENTER
,
729 int flags
= wxDATAVIEW_COL_RESIZABLE
);
730 wxDataViewColumn
* AppendBitmapColumn(const wxBitmap
& label
,
731 unsigned int model_column
,
732 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
734 wxAlignment align
= wxALIGN_CENTER
,
735 int flags
= wxDATAVIEW_COL_RESIZABLE
);
740 Appends a column for rendering a date. Returns the wxDataViewColumn
741 created in the function or @NULL on failure.
743 @note The @a align parameter is applied to both the column header and
746 wxDataViewColumn
* AppendDateColumn(const wxString
& label
,
747 unsigned int model_column
,
748 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
750 wxAlignment align
= wxALIGN_CENTER
,
751 int flags
= wxDATAVIEW_COL_RESIZABLE
);
752 wxDataViewColumn
* AppendDateColumn(const wxBitmap
& label
,
753 unsigned int model_column
,
754 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
756 wxAlignment align
= wxALIGN_CENTER
,
757 int flags
= wxDATAVIEW_COL_RESIZABLE
);
762 Appends a column for rendering text with an icon. Returns the wxDataViewColumn
763 created in the function or @NULL on failure.
764 This method uses the wxDataViewIconTextRenderer class.
766 @note The @a align parameter is applied to both the column header and
769 wxDataViewColumn
* AppendIconTextColumn(const wxString
& label
,
770 unsigned int model_column
,
771 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
773 wxAlignment align
= wxALIGN_LEFT
,
774 int flags
= wxDATAVIEW_COL_RESIZABLE
);
775 wxDataViewColumn
* AppendIconTextColumn(const wxBitmap
& label
,
776 unsigned int model_column
,
777 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
779 wxAlignment align
= wxALIGN_LEFT
,
780 int flags
= wxDATAVIEW_COL_RESIZABLE
);
785 Appends a column for rendering a progress indicator. Returns the
786 wxDataViewColumn created in the function or @NULL on failure.
788 @note The @a align parameter is applied to both the column header and
791 wxDataViewColumn
* AppendProgressColumn(const wxString
& label
,
792 unsigned int model_column
,
793 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
795 wxAlignment align
= wxALIGN_CENTER
,
796 int flags
= wxDATAVIEW_COL_RESIZABLE
);
797 wxDataViewColumn
* AppendProgressColumn(const wxBitmap
& label
,
798 unsigned int model_column
,
799 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
801 wxAlignment align
= wxALIGN_CENTER
,
802 int flags
= wxDATAVIEW_COL_RESIZABLE
);
807 Appends a column for rendering text. Returns the wxDataViewColumn
808 created in the function or @NULL on failure.
810 @note The @a align parameter is applied to both the column header and
813 wxDataViewColumn
* AppendTextColumn(const wxString
& label
,
814 unsigned int model_column
,
815 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
817 wxAlignment align
= wxALIGN_LEFT
,
818 int flags
= wxDATAVIEW_COL_RESIZABLE
);
819 wxDataViewColumn
* AppendTextColumn(const wxBitmap
& label
,
820 unsigned int model_column
,
821 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
823 wxAlignment align
= wxALIGN_LEFT
,
824 int flags
= wxDATAVIEW_COL_RESIZABLE
);
829 Appends a column for rendering a toggle. Returns the wxDataViewColumn
830 created in the function or @NULL on failure.
832 @note The @a align parameter is applied to both the column header and
835 wxDataViewColumn
* AppendToggleColumn(const wxString
& label
,
836 unsigned int model_column
,
837 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
839 wxAlignment align
= wxALIGN_CENTER
,
840 int flags
= wxDATAVIEW_COL_RESIZABLE
);
841 wxDataViewColumn
* AppendToggleColumn(const wxBitmap
& label
,
842 unsigned int model_column
,
843 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
845 wxAlignment align
= wxALIGN_CENTER
,
846 int flags
= wxDATAVIEW_COL_RESIZABLE
);
850 Associates a wxDataViewModel with the control.
851 This increases the reference count of the model by 1.
853 virtual bool AssociateModel(wxDataViewModel
* model
);
858 virtual bool ClearColumns();
863 void ClearSelection();
868 virtual void Collapse(const wxDataViewItem
& item
);
871 Create the control. Useful for two step creation.
873 bool Create(wxWindow
* parent
, wxWindowID id
,
874 const wxPoint
& pos
= wxDefaultPosition
,
875 const wxSize
& size
= wxDefaultSize
,
877 const wxValidator
& validator
= wxDefaultValidator
);
880 Deletes given column.
882 virtual bool DeleteColumn(wxDataViewColumn
* column
);
885 Call this to ensure that the given item is visible.
887 virtual void EnsureVisible(const wxDataViewItem
& item
,
888 const wxDataViewColumn
* column
= NULL
);
893 virtual void Expand(const wxDataViewItem
& item
);
896 Returns pointer to the column. @a pos refers to the position in the
897 control which may change after reordering columns by the user.
899 virtual wxDataViewColumn
* GetColumn(unsigned int pos
) const;
902 Returns the number of columns.
904 virtual unsigned int GetColumnCount() const;
907 Returns the position of the column or -1 if not found in the control.
909 virtual int GetColumnPosition(const wxDataViewColumn
* column
) const;
912 Returns column containing the expanders.
914 wxDataViewColumn
* GetExpanderColumn() const;
919 int GetIndent() const;
924 virtual wxRect
GetItemRect(const wxDataViewItem
& item
,
925 const wxDataViewColumn
* col
= NULL
) const;
928 Returns pointer to the data model associated with the control (if any).
930 wxDataViewModel
* GetModel();
933 Returns first selected item or an invalid item if none is selected.
935 virtual wxDataViewItem
GetSelection() const;
938 Fills @a sel with currently selected items and returns their number.
940 virtual int GetSelections(wxDataViewItemArray
& sel
) const;
943 Returns the wxDataViewColumn currently responsible for sorting
944 or @NULL if none has been selected.
946 virtual wxDataViewColumn
* GetSortingColumn() const;
951 virtual void HitTest(const wxPoint
& point
, wxDataViewItem
& item
,
952 wxDataViewColumn
*& col
) const;
955 Return @true if the item is selected.
957 virtual bool IsSelected(const wxDataViewItem
& item
) const;
960 Select the given item.
962 virtual void Select(const wxDataViewItem
& item
);
967 virtual void SelectAll();
970 Set which column shall contain the tree-like expanders.
972 void SetExpanderColumn(wxDataViewColumn
* col
);
975 Sets the indendation.
977 void SetIndent(int indent
);
980 Sets the selection to the array of wxDataViewItems.
982 virtual void SetSelections(const wxDataViewItemArray
& sel
);
985 Unselect the given item.
987 virtual void Unselect(const wxDataViewItem
& item
);
991 This method only has effect if multiple selections are allowed.
993 virtual void UnselectAll();
999 @class wxDataViewModelNotifier
1001 A wxDataViewModelNotifier instance is owned by a wxDataViewModel and mirrors
1002 its notification interface.
1003 See the documentation of that class for further information.
1008 class wxDataViewModelNotifier
1014 wxDataViewModelNotifier();
1019 virtual ~wxDataViewModelNotifier();
1022 Called by owning model.
1024 virtual bool Cleared() = 0;
1027 Get owning wxDataViewModel.
1029 wxDataViewModel
* GetOwner() const;
1032 Called by owning model.
1034 virtual bool ItemAdded(const wxDataViewItem
& parent
,
1035 const wxDataViewItem
& item
) = 0;
1038 Called by owning model.
1040 virtual bool ItemChanged(const wxDataViewItem
& item
) = 0;
1043 Called by owning model.
1045 virtual bool ItemDeleted(const wxDataViewItem
& parent
,
1046 const wxDataViewItem
& item
) = 0;
1049 Called by owning model.
1051 virtual bool ItemsAdded(const wxDataViewItem
& parent
,
1052 const wxDataViewItemArray
& items
);
1055 Called by owning model.
1057 virtual bool ItemsChanged(const wxDataViewItemArray
& items
);
1060 Called by owning model.
1062 virtual bool ItemsDeleted(const wxDataViewItem
& parent
,
1063 const wxDataViewItemArray
& items
);
1066 Called by owning model.
1068 virtual void Resort() = 0;
1071 Set owner of this notifier. Used internally.
1073 void SetOwner(wxDataViewModel
* owner
);
1076 Called by owning model.
1078 virtual bool ValueChanged(const wxDataViewItem
& item
, unsigned int col
) = 0;
1083 The mode of a data-view cell; see wxDataViewRenderer for more info.
1085 enum wxDataViewCellMode
1087 wxDATAVIEW_CELL_INERT
,
1090 Indicates that the user can double click the cell and something will
1091 happen (e.g. a window for editing a date will pop up).
1093 wxDATAVIEW_CELL_ACTIVATABLE
,
1096 Indicates that the user can edit the data in-place, i.e. an control
1097 will show up after a slow click on the cell. This behaviour is best
1098 known from changing the filename in most file managers etc.
1100 wxDATAVIEW_CELL_EDITABLE
1104 The values of this enum controls how a wxDataViewRenderer should display
1105 its contents in a cell.
1107 enum wxDataViewCellRenderState
1109 wxDATAVIEW_CELL_SELECTED
= 1,
1110 wxDATAVIEW_CELL_PRELIT
= 2,
1111 wxDATAVIEW_CELL_INSENSITIVE
= 4,
1112 wxDATAVIEW_CELL_FOCUSED
= 8
1116 @class wxDataViewRenderer
1118 This class is used by wxDataViewCtrl to render the individual cells.
1119 One instance of a renderer class is owned by a wxDataViewColumn.
1120 There is a number of ready-to-use renderers provided:
1121 - wxDataViewTextRenderer,
1122 - wxDataViewTextRendererAttr,
1123 - wxDataViewIconTextRenderer,
1124 - wxDataViewToggleRenderer,
1125 - wxDataViewProgressRenderer,
1126 - wxDataViewBitmapRenderer,
1127 - wxDataViewDateRenderer,
1128 - wxDataViewSpinRenderer.
1130 Additionally, the user can write own renderers by deriving from
1131 wxDataViewCustomRenderer.
1133 The ::wxDataViewCellMode and ::wxDataViewCellRenderState flags accepted
1134 by the constructors respectively controls what actions the cell data allows
1135 and how the renderer should display its contents in a cell.
1140 class wxDataViewRenderer
: public wxObject
1146 wxDataViewRenderer(const wxString
& varianttype
,
1147 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1148 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1151 Returns the alignment. See SetAlignment()
1153 virtual int GetAlignment() const;
1156 Returns the cell mode.
1158 virtual wxDataViewCellMode
GetMode() const;
1161 Returns pointer to the owning wxDataViewColumn.
1163 wxDataViewColumn
* GetOwner() const;
1166 This methods retrieves the value from the renderer in order to
1167 transfer the value back to the data model.
1169 Returns @false on failure.
1171 virtual bool GetValue(wxVariant
& value
) const = 0;
1174 Returns a string with the type of the wxVariant supported by this renderer.
1176 wxString
GetVariantType() const;
1179 Sets the alignment of the renderer's content.
1180 The default value of @c wxDVR_DEFAULT_ALIGMENT indicates that the content
1181 should have the same alignment as the column header.
1183 The method is not implemented under OS X and the renderer always aligns
1184 its contents as the column header on that platform. The other platforms
1185 support both vertical and horizontal alignment.
1187 virtual void SetAlignment( int align
);
1189 Sets the owning wxDataViewColumn.
1190 This is usually called from within wxDataViewColumn.
1192 void SetOwner(wxDataViewColumn
* owner
);
1195 Set the value of the renderer (and thus its cell) to @a value.
1196 The internal code will then render this cell with this data.
1198 virtual bool SetValue(const wxVariant
& value
) = 0;
1201 Before data is committed to the data model, it is passed to this
1202 method where it can be checked for validity. This can also be
1203 used for checking a valid range or limiting the user input in
1204 a certain aspect (e.g. max number of characters or only alphanumeric
1205 input, ASCII only etc.). Return @false if the value is not valid.
1207 Please note that due to implementation limitations, this validation
1208 is done after the editing control already is destroyed and the
1209 editing process finished.
1211 virtual bool Validate(wxVariant
& value
);
1217 @class wxDataViewTextRenderer
1219 wxDataViewTextRenderer is used for rendering text.
1220 It supports in-place editing if desired.
1225 class wxDataViewTextRenderer
: public wxDataViewRenderer
1231 wxDataViewTextRenderer(const wxString
& varianttype
= "string",
1232 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1233 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1239 @class wxDataViewIconTextRenderer
1241 The wxDataViewIconTextRenderer class is used to display text with
1242 a small icon next to it as it is typically done in a file manager.
1244 This classes uses the wxDataViewIconText helper class to store its data.
1245 wxDataViewIonText can be converted to and from a wxVariant using the left shift
1251 class wxDataViewIconTextRenderer
: public wxDataViewRenderer
1257 wxDataViewIconTextRenderer(const wxString
& varianttype
= "wxDataViewIconText",
1258 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1259 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1265 @class wxDataViewProgressRenderer
1267 This class is used by wxDataViewCtrl to render progress bars.
1272 class wxDataViewProgressRenderer
: public wxDataViewRenderer
1278 wxDataViewProgressRenderer(const wxString
& label
= wxEmptyString
,
1279 const wxString
& varianttype
= "long",
1280 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1281 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1287 @class wxDataViewSpinRenderer
1289 This is a specialized renderer for rendering integer values.
1290 It supports modifying the values in-place by using a wxSpinCtrl.
1291 The renderer only support variants of type @e long.
1296 class wxDataViewSpinRenderer
: public wxDataViewCustomRenderer
1301 @a min and @a max indicate the minimum and maximum values for the wxSpinCtrl.
1303 wxDataViewSpinRenderer(int min
, int max
,
1304 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
1305 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1311 @class wxDataViewToggleRenderer
1313 This class is used by wxDataViewCtrl to render toggle controls.
1318 class wxDataViewToggleRenderer
: public wxDataViewRenderer
1324 wxDataViewToggleRenderer(const wxString
& varianttype
= "bool",
1325 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1326 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1332 @class wxDataViewDateRenderer
1334 This class is used by wxDataViewCtrl to render calendar controls.
1339 class wxDataViewDateRenderer
: public wxDataViewRenderer
1345 wxDataViewDateRenderer(const wxString
& varianttype
= "datetime",
1346 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
1347 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1353 @class wxDataViewTextRendererAttr
1355 The same as wxDataViewTextRenderer but with support for font attributes.
1356 Font attributes are currently only supported under GTK+ and MSW.
1358 @see wxDataViewModel::GetAttr and wxDataViewItemAttr.
1363 class wxDataViewTextRendererAttr
: public wxDataViewTextRenderer
1369 wxDataViewTextRendererAttr(const wxString
& varianttype
= "string",
1370 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1371 int align
= wxDVR_DEFAULT_ALIGNMENT
);
1377 @class wxDataViewCustomRenderer
1379 You need to derive a new class from wxDataViewCustomRenderer in
1380 order to write a new renderer.
1382 You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue,
1383 wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render.
1385 If you want your renderer to support in-place editing then you also need to override
1386 wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl
1387 and wxDataViewCustomRenderer::GetValueFromEditorCtrl.
1389 Note that a special event handler will be pushed onto that editor control
1390 which handles @e \<ENTER\> and focus out events in order to end the editing.
1395 class wxDataViewCustomRenderer
: public wxDataViewRenderer
1401 wxDataViewCustomRenderer(const wxString
& varianttype
= "string",
1402 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1403 int align
= -1, bool no_init
= false);
1408 virtual ~wxDataViewCustomRenderer();
1411 Override this to react to double clicks or ENTER.
1412 This method will only be called in wxDATAVIEW_CELL_ACTIVATABLE mode.
1414 virtual bool Activate( wxRect cell
,
1415 wxDataViewModel
* model
,
1416 const wxDataViewItem
& item
,
1420 Override this to create the actual editor control once editing
1423 @a parent is the parent of the editor control, @a labelRect indicates the
1424 position and size of the editor control and @a value is its initial value:
1428 return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
1429 labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l );
1433 virtual wxControl
* CreateEditorCtrl(wxWindow
* parent
,
1435 const wxVariant
& value
);
1438 Create DC on request. Internal.
1440 virtual wxDC
* GetDC();
1443 Return size required to show content.
1445 virtual wxSize
GetSize() const = 0;
1448 Overrride this so that the renderer can get the value from the editor
1449 control (pointed to by @a editor):
1452 wxSpinCtrl *sc = (wxSpinCtrl*) editor;
1453 long l = sc->GetValue();
1459 virtual bool GetValueFromEditorCtrl(wxControl
* editor
,
1463 Override this and make it return @true in order to
1464 indicate that this renderer supports in-place editing.
1466 virtual bool HasEditorCtrl();
1469 Overrride this to react to a left click.
1470 This method will only be called in @c wxDATAVIEW_CELL_ACTIVATABLE mode.
1472 virtual bool LeftClick( wxPoint cursor
,
1474 wxDataViewModel
* model
,
1475 const wxDataViewItem
& item
,
1479 Override this to render the cell.
1480 Before this is called, wxDataViewRenderer::SetValue was called
1481 so that this instance knows what to render.
1483 virtual bool Render(wxRect cell
, wxDC
* dc
, int state
) = 0;
1486 This method should be called from within Render() whenever you need to
1488 This will ensure that the correct colour, font and vertical alignment will
1489 be chosen so the text will look the same as text drawn by native renderers.
1491 void RenderText(const wxString
& text
, int xoffset
, wxRect cell
,
1492 wxDC
* dc
, int state
);
1495 Overrride this to start a drag operation. Not yet supported.
1497 virtual bool StartDrag(wxPoint cursor
, wxRect cell
,
1498 wxDataViewModel
* model
,
1499 const wxDataViewItem
& item
,
1506 @class wxDataViewBitmapRenderer
1508 This class is used by wxDataViewCtrl to render bitmap controls.
1513 class wxDataViewBitmapRenderer
: public wxDataViewRenderer
1519 wxDataViewBitmapRenderer(const wxString
& varianttype
= "wxBitmap",
1520 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
1521 int align
= wxDVR_DEFAULT_ALIGNMENT
,
1526 The flags used by wxDataViewColumn.
1528 enum wxDataViewColumnFlags
1530 wxDATAVIEW_COL_RESIZABLE
= 1,
1531 wxDATAVIEW_COL_SORTABLE
= 2,
1532 wxDATAVIEW_COL_REORDERABLE
= 4,
1533 wxDATAVIEW_COL_HIDDEN
= 8
1537 @class wxDataViewColumn
1539 This class represents a column in a wxDataViewCtrl.
1540 One wxDataViewColumn is bound to one column in the data model, to which the
1541 wxDataViewCtrl has been associated.
1543 An instance of wxDataViewRenderer is used by this class to render its data.
1548 class wxDataViewColumn
: public wxObject
1555 wxDataViewColumn(const wxString
& title
,
1556 wxDataViewRenderer
* renderer
,
1557 unsigned int model_column
,
1558 int width
= wxDVC_DEFAULT_WIDTH
,
1559 wxAlignment align
= wxALIGN_CENTRE
,
1560 int flags
= wxDATAVIEW_COL_RESIZABLE
);
1561 wxDataViewColumn(const wxBitmap
& bitmap
,
1562 wxDataViewRenderer
* renderer
,
1563 unsigned int model_column
,
1564 int width
= wxDVC_DEFAULT_WIDTH
,
1565 wxAlignment align
= wxALIGN_CENTRE
,
1566 int flags
= wxDATAVIEW_COL_RESIZABLE
);
1572 virtual ~wxDataViewColumn();
1575 Returns the bitmap in the header of the column, if any.
1577 const wxBitmap
& GetBitmap() const;
1580 Returns the index of the column of the model, which this
1581 wxDataViewColumn is displaying.
1583 unsigned int GetModelColumn() const;
1586 Returns the owning wxDataViewCtrl.
1588 wxDataViewCtrl
* GetOwner() const;
1591 Returns the renderer of this wxDataViewColumn.
1593 @see wxDataViewRenderer.
1595 wxDataViewRenderer
* GetRenderer() const;
1598 Returns @true if the column is reorderable.
1600 bool GetReorderable();
1603 Returns @true if the column is sortable.
1610 Returns the width of the column.
1612 virtual int GetWidth() const;
1615 Returns @true, if the sort order is ascending.
1619 virtual bool IsSortOrderAscending() const;
1622 Set the alignment of the column header.
1624 virtual void SetAlignment(wxAlignment align
);
1627 Set the bitmap of the column header.
1629 virtual void SetBitmap(const wxBitmap
& bitmap
);
1632 Indicate wether the column can be reordered by the user using the mouse.
1633 This is typically implemented visually by dragging the header button around.
1635 virtual void SetReorderable(bool reorderable
);
1638 Indicate the sort order if the implementation of the wxDataViewCtrl supports
1639 it, most commonly by showing a little arrow.
1641 virtual void SetSortOrder(bool ascending
);
1644 Indicate that the column is sortable.
1645 This does not show any sorting indicate yet, but it does make the column
1646 header clickable. Call SetSortOrder() afterwards to actually make the sort
1649 If @a sortable is @false, the column header is no longer clickable and
1650 the sort indicator (little arrow) will disappear.
1652 virtual void SetSortable(bool sortable
);
1655 Set the title of the column header to @a title.
1657 virtual void SetTitle(const wxString
& title
);
1663 @class wxDataViewTreeCtrl
1665 This class is a wxDataViewCtrl which internally uses a wxDataViewTreeStore
1666 and forwards most of its API to that class.
1667 Additionally, it uses a wxImageList to store a list of icons.
1669 The main purpose of this class is to look like a wxTreeCtrl to make a transition
1670 from it to the wxDataViewCtrl class simpler.
1674 @appearance{dataviewtreectrl.png}
1676 class wxDataViewTreeCtrl
: public wxDataViewCtrl
1682 wxDataViewTreeCtrl();
1685 Constructor. Calls Create().
1687 wxDataViewTreeCtrl(wxWindow
* parent
, wxWindowID id
,
1688 const wxPoint
& pos
= wxDefaultPosition
,
1689 const wxSize
& size
= wxDefaultSize
,
1690 long style
= wxDV_NO_HEADER
,
1691 const wxValidator
& validator
= wxDefaultValidator
);
1694 Destructor. Deletes the image list if any.
1696 virtual ~wxDataViewTreeCtrl();
1701 wxDataViewItem
AppendContainer(const wxDataViewItem
& parent
,
1702 const wxString
& text
,
1705 wxClientData
* data
= NULL
);
1710 wxDataViewItem
AppendItem(const wxDataViewItem
& parent
,
1711 const wxString
& text
,
1713 wxClientData
* data
= NULL
);
1716 Creates the control and a wxDataViewTreeStore as its internal model.
1718 bool Create(wxWindow
* parent
, wxWindowID id
,
1719 const wxPoint
& pos
= wxDefaultPosition
,
1720 const wxSize
& size
= wxDefaultSize
,
1721 long style
= wxDV_NO_HEADER
,
1722 const wxValidator
& validator
= wxDefaultValidator
);
1725 Calls the identical method from wxDataViewTreeStore.
1727 void DeleteAllItems();
1730 Calls the identical method from wxDataViewTreeStore.
1732 void DeleteChildren(const wxDataViewItem
& item
);
1735 Calls the identical method from wxDataViewTreeStore.
1737 void DeleteItem(const wxDataViewItem
& item
);
1740 Calls the identical method from wxDataViewTreeStore.
1742 int GetChildCount(const wxDataViewItem
& parent
) const;
1745 Returns the image list.
1747 wxImageList
* GetImageList();
1750 Calls the identical method from wxDataViewTreeStore.
1752 wxClientData
* GetItemData(const wxDataViewItem
& item
) const;
1755 Calls the identical method from wxDataViewTreeStore.
1757 const wxIcon
& GetItemExpandedIcon(const wxDataViewItem
& item
) const;
1760 Calls the identical method from wxDataViewTreeStore.
1762 const wxIcon
& GetItemIcon(const wxDataViewItem
& item
) const;
1765 Calls the identical method from wxDataViewTreeStore.
1767 wxString
GetItemText(const wxDataViewItem
& item
) const;
1770 Calls the identical method from wxDataViewTreeStore.
1772 wxDataViewItem
GetNthChild(const wxDataViewItem
& parent
,
1773 unsigned int pos
) const;
1779 wxDataViewTreeStore
* GetStore() const;
1780 const wxDataViewTreeStore
* GetStore() const;
1784 Calls the same method from wxDataViewTreeStore but uses
1785 an index position in the image list instead of a wxIcon.
1787 wxDataViewItem
InsertContainer(const wxDataViewItem
& parent
,
1788 const wxDataViewItem
& previous
,
1789 const wxString
& text
,
1792 wxClientData
* data
= NULL
);
1795 Calls the same method from wxDataViewTreeStore but uses
1796 an index position in the image list instead of a wxIcon.
1798 wxDataViewItem
InsertItem(const wxDataViewItem
& parent
,
1799 const wxDataViewItem
& previous
,
1800 const wxString
& text
,
1802 wxClientData
* data
= NULL
);
1805 Calls the same method from wxDataViewTreeStore but uses
1806 an index position in the image list instead of a wxIcon.
1808 wxDataViewItem
PrependContainer(const wxDataViewItem
& parent
,
1809 const wxString
& text
,
1812 wxClientData
* data
= NULL
);
1815 Calls the same method from wxDataViewTreeStore but uses
1816 an index position in the image list instead of a wxIcon.
1818 wxDataViewItem
PrependItem(const wxDataViewItem
& parent
,
1819 const wxString
& text
,
1821 wxClientData
* data
= NULL
);
1824 Sets the image list.
1826 void SetImageList(wxImageList
* imagelist
);
1829 Calls the identical method from wxDataViewTreeStore.
1831 void SetItemData(const wxDataViewItem
& item
, wxClientData
* data
);
1834 Calls the identical method from wxDataViewTreeStore.
1836 void SetItemExpandedIcon(const wxDataViewItem
& item
,
1837 const wxIcon
& icon
);
1840 Calls the identical method from wxDataViewTreeStore.
1842 void SetItemIcon(const wxDataViewItem
& item
, const wxIcon
& icon
);
1845 Calls the identical method from wxDataViewTreeStore.
1847 void SetItemText(const wxDataViewItem
& item
,
1848 const wxString
& text
);
1854 @class wxDataViewTreeStore
1856 wxDataViewTreeStore is a specialised wxDataViewModel for displaying simple
1857 trees very much like wxTreeCtrl does and it offers a similar API.
1859 This class actually stores the entire tree (therefore its name) and implements
1860 all virtual methods from the base class so it can be used directly without
1861 having to derive any class from it.
1862 This comes at the price of much reduced flexibility.
1867 class wxDataViewTreeStore
: public wxDataViewModel
1871 Constructor. Creates the invisible root node internally.
1873 wxDataViewTreeStore();
1878 virtual ~wxDataViewTreeStore();
1883 wxDataViewItem
AppendContainer(const wxDataViewItem
& parent
,
1884 const wxString
& text
,
1885 const wxIcon
& icon
= wxNullIcon
,
1886 const wxIcon
& expanded
= wxNullIcon
,
1887 wxClientData
* data
= NULL
);
1892 wxDataViewItem
AppendItem(const wxDataViewItem
& parent
,
1893 const wxString
& text
,
1894 const wxIcon
& icon
= wxNullIcon
,
1895 wxClientData
* data
= NULL
);
1898 Delete all item in the model.
1900 void DeleteAllItems();
1903 Delete all children of the item, but not the item itself.
1905 void DeleteChildren(const wxDataViewItem
& item
);
1910 void DeleteItem(const wxDataViewItem
& item
);
1913 Return the number of children of item.
1915 int GetChildCount(const wxDataViewItem
& parent
) const;
1918 Returns the client data asoociated with the item.
1920 wxClientData
* GetItemData(const wxDataViewItem
& item
) const;
1923 Returns the icon to display in expanded containers.
1925 const wxIcon
& GetItemExpandedIcon(const wxDataViewItem
& item
) const;
1928 Returns the icon of the item.
1930 const wxIcon
& GetItemIcon(const wxDataViewItem
& item
) const;
1933 Returns the text of the item.
1935 wxString
GetItemText(const wxDataViewItem
& item
) const;
1938 Returns the nth child item of item.
1940 wxDataViewItem
GetNthChild(const wxDataViewItem
& parent
,
1941 unsigned int pos
) const;
1944 Inserts a container after @a previous.
1946 wxDataViewItem
InsertContainer(const wxDataViewItem
& parent
,
1947 const wxDataViewItem
& previous
,
1948 const wxString
& text
,
1949 const wxIcon
& icon
= wxNullIcon
,
1950 const wxIcon
& expanded
= wxNullIcon
,
1951 wxClientData
* data
= NULL
);
1954 Inserts an item after @a previous.
1956 wxDataViewItem
InsertItem(const wxDataViewItem
& parent
,
1957 const wxDataViewItem
& previous
,
1958 const wxString
& text
,
1959 const wxIcon
& icon
= wxNullIcon
,
1960 wxClientData
* data
= NULL
);
1963 Inserts a container before the first child item or @a parent.
1965 wxDataViewItem
PrependContainer(const wxDataViewItem
& parent
,
1966 const wxString
& text
,
1967 const wxIcon
& icon
= wxNullIcon
,
1968 const wxIcon
& expanded
= wxNullIcon
,
1969 wxClientData
* data
= NULL
);
1972 Inserts an item before the first child item or @a parent.
1974 wxDataViewItem
PrependItem(const wxDataViewItem
& parent
,
1975 const wxString
& text
,
1976 const wxIcon
& icon
= wxNullIcon
,
1977 wxClientData
* data
= NULL
);
1980 Sets the client data associated with the item.
1982 void SetItemData(const wxDataViewItem
& item
, wxClientData
* data
);
1985 Sets the expanded icon for the item.
1987 void SetItemExpandedIcon(const wxDataViewItem
& item
,
1988 const wxIcon
& icon
);
1991 Sets the icon for the item.
1993 void SetItemIcon(const wxDataViewItem
& item
, const wxIcon
& icon
);