]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/dataview.h
deprecate wxDrawObject (#9860)
[wxWidgets.git] / interface / wx / dataview.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dataview.h
3 // Purpose: interface of wxDataView* classes
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 /**
11 @class wxDataViewModel
12
13 wxDataViewModel is the base class for all data model to be displayed by a
14 wxDataViewCtrl.
15
16 All other models derive from it and must implement its pure virtual functions
17 in order to define a complete data model. In detail, you need to override
18 wxDataViewModel::IsContainer, wxDataViewModel::GetParent, wxDataViewModel::GetChildren,
19 wxDataViewModel::GetColumnCount, wxDataViewModel::GetColumnType and
20 wxDataViewModel::GetValue in order to define the data model which acts as an
21 interface between your actual data and the wxDataViewCtrl.
22
23 Since you will usually also allow the wxDataViewCtrl to change your data
24 through its graphical interface, you will also have to override
25 wxDataViewModel::SetValue which the wxDataViewCtrl will call when a change
26 to some data has been commited.
27
28 wxDataViewModel (as indeed the entire wxDataViewCtrl code) is using wxVariant
29 to store data and its type in a generic way. wxVariant can be extended to contain
30 almost any data without changes to the original class.
31
32 The data that is presented through this data model is expected to change at
33 run-time. You need to inform the data model when a change happened.
34 Depending on what happened you need to call one of the following methods:
35 - wxDataViewModel::ValueChanged,
36 - wxDataViewModel::ItemAdded,
37 - wxDataViewModel::ItemDeleted,
38 - wxDataViewModel::ItemChanged,
39 - wxDataViewModel::Cleared.
40
41 There are plural forms for notification of addition, change or removal of
42 several item at once. See:
43 - wxDataViewModel::ItemsAdded,
44 - wxDataViewModel::ItemsDeleted,
45 - wxDataViewModel::ItemsChanged.
46
47 Note that wxDataViewModel does not define the position or index of any item
48 in the control because different controls might display the same data differently.
49 wxDataViewModel does provide a wxDataViewModel::Compare method which the
50 wxDataViewCtrl may use to sort the data either in conjunction with a column
51 header or without (see wxDataViewModel::HasDefaultCompare).
52
53 This class maintains a list of wxDataViewModelNotifier which link this class
54 to the specific implementations on the supported platforms so that e.g. calling
55 wxDataViewModel::ValueChanged on this model will just call
56 wxDataViewModelNotifier::ValueChanged for each notifier that has been added.
57 You can also add your own notifier in order to get informed about any changes
58 to the data in the list model.
59
60 Currently wxWidgets provides the following models apart from the base model:
61 wxDataViewIndexListModel, wxDataViewVirtualListModel, wxDataViewTreeStore,
62 wxDataViewListStore.
63
64 Note that wxDataViewModel is reference counted, derives from wxObjectRefData
65 and cannot be deleted directly as it can be shared by several wxDataViewCtrls.
66 This implies that you need to decrease the reference count after
67 associating the model with a control like this:
68
69 @code
70 wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, ID_MUSIC_CTRL );
71 wxDataViewModel *musicModel = new MyMusicModel;
72 m_musicCtrl-AssociateModel( musicModel );
73 musicModel-DecRef(); // avoid memory leak !!
74 // add columns now
75 @endcode
76
77
78 @library{wxadv}
79 @category{dvc}
80 */
81 class wxDataViewModel : public wxObjectRefData
82 {
83 public:
84 /**
85 Constructor.
86 */
87 wxDataViewModel();
88
89 /**
90 Adds a wxDataViewModelNotifier to the model.
91 */
92 void AddNotifier(wxDataViewModelNotifier* notifier);
93
94 /**
95 Called to inform the model that all data has been cleared.
96 The control will reread the data from the model again.
97 */
98 virtual bool Cleared();
99
100 /**
101 The compare function to be used by control. The default compare function
102 sorts by container and other items separately and in ascending order.
103 Override this for a different sorting behaviour.
104
105 @see HasDefaultCompare().
106 */
107 virtual int Compare(const wxDataViewItem& item1,
108 const wxDataViewItem& item2,
109 unsigned int column,
110 bool ascending);
111
112 /**
113 Override this to indicate that the item has special font attributes.
114 This only affects the wxDataViewTextRendererText renderer.
115
116 @see wxDataViewItemAttr.
117 */
118 virtual bool GetAttr(const wxDataViewItem& item, unsigned int col,
119 wxDataViewItemAttr& attr);
120
121 /**
122 Override this so the control can query the child items of an item.
123 Returns the number of items.
124 */
125 virtual unsigned int GetChildren(const wxDataViewItem& item,
126 wxDataViewItemArray& children) const = 0;
127
128 /**
129 Override this to indicate the number of columns in the model.
130 */
131 virtual unsigned int GetColumnCount() const = 0;
132
133 /**
134 Override this to indicate what type of data is stored in the
135 column specified by @a col.
136
137 This should return a string indicating the type of data as reported by wxVariant.
138 */
139 virtual wxString GetColumnType(unsigned int col) const = 0;
140
141 /**
142 Override this to indicate which wxDataViewItem representing the parent
143 of @a item or an invalid wxDataViewItem if the the root item is
144 the parent item.
145 */
146 virtual wxDataViewItem GetParent(const wxDataViewItem& item) const = 0;
147
148 /**
149 Override this to indicate the value of @a item.
150 A wxVariant is used to store the data.
151 */
152 virtual void GetValue(wxVariant& variant, const wxDataViewItem& item,
153 unsigned int col) const = 0;
154
155 /**
156 Override this method to indicate if a container item merely acts as a
157 headline (or for categorisation) or if it also acts a normal item with
158 entries for futher columns. By default returns @false.
159 */
160 virtual bool HasContainerColumns(const wxDataViewItem& item) const;
161
162 /**
163 Override this to indicate that the model provides a default compare
164 function that the control should use if no wxDataViewColumn has been
165 chosen for sorting. Usually, the user clicks on a column header for
166 sorting, the data will be sorted alphanumerically.
167
168 If any other order (e.g. by index or order of appearance) is required,
169 then this should be used.
170 See wxDataViewIndexListModel for a model which makes use of this.
171 */
172 virtual bool HasDefaultCompare() const;
173
174 /**
175 Override this to indicate of @a item is a container, i.e. if
176 it can have child items.
177 */
178 virtual bool IsContainer(const wxDataViewItem& item) const = 0;
179
180 /**
181 Call this to inform the model that an item has been added to the data.
182 */
183 virtual bool ItemAdded(const wxDataViewItem& parent,
184 const wxDataViewItem& item);
185
186 /**
187 Call this to inform the model that an item has changed.
188
189 This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
190 event (in which the column fields will not be set) to the user.
191 */
192 virtual bool ItemChanged(const wxDataViewItem& item);
193
194 /**
195 Call this to inform the model that an item has been deleted from the data.
196 */
197 virtual bool ItemDeleted(const wxDataViewItem& parent,
198 const wxDataViewItem& item);
199
200 /**
201 Call this to inform the model that several items have been added to the data.
202 */
203 virtual bool ItemsAdded(const wxDataViewItem& parent,
204 const wxDataViewItemArray& items);
205
206 /**
207 Call this to inform the model that several items have changed.
208
209 This will eventually emit wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
210 events (in which the column fields will not be set) to the user.
211 */
212 virtual bool ItemsChanged(const wxDataViewItemArray& items);
213
214 /**
215 Call this to inform the model that several items have been deleted.
216 */
217 virtual bool ItemsDeleted(const wxDataViewItem& parent,
218 const wxDataViewItemArray& items);
219
220 /**
221 Remove the @a notifier from the list of notifiers.
222 */
223 void RemoveNotifier(wxDataViewModelNotifier* notifier);
224
225 /**
226 Call this to initiate a resort after the sort function has been changed.
227 */
228 virtual void Resort();
229
230 /**
231 This gets called in order to set a value in the data model.
232 The most common scenario is that the wxDataViewCtrl calls this method
233 after the user changed some data in the view.
234
235 Afterwards ValueChanged() has to be called!
236 */
237 virtual bool SetValue(const wxVariant& variant, const wxDataViewItem& item,
238 unsigned int col) = 0;
239
240 /**
241 Call this to inform this model that a value in the model has been changed.
242 This is also called from wxDataViewCtrl's internal editing code, e.g. when
243 editing a text field in the control.
244
245 This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
246 event to the user.
247 */
248 virtual bool ValueChanged(const wxDataViewItem& item,
249 unsigned int col);
250
251 protected:
252
253 /**
254 Destructor. This should not be called directly. Use DecRef() instead.
255 */
256 virtual ~wxDataViewModel();
257 };
258
259
260
261 /**
262 @class wxDataViewIndexListModel
263
264 wxDataViewIndexListModel is a specialized data model which lets you address
265 an item by its position (row) rather than its wxDataViewItem (which you can
266 obtain from this class).
267 This model also provides its own wxDataViewIndexListModel::Compare
268 method which sorts the model's data by the index.
269
270 This model is not a virtual model since the control stores each wxDataViewItem.
271 Use wxDataViewVirtualListModel if you need to display millions of items or
272 have other reason to use a virtual control.
273
274 @library{wxadv}
275 @category{dvc}
276 */
277 class wxDataViewIndexListModel : public wxDataViewModel
278 {
279 public:
280 /**
281 Constructor.
282 */
283 wxDataViewIndexListModel(unsigned int initial_size = 0);
284
285 /**
286 Destructor.
287 */
288 virtual ~wxDataViewIndexListModel();
289
290 /**
291 Compare method that sorts the items by their index.
292 */
293 int Compare(const wxDataViewItem& item1,
294 const wxDataViewItem& item2,
295 unsigned int column, bool ascending);
296
297 /**
298 Override this to indicate that the row has special font attributes.
299 This only affects the wxDataViewTextRendererText() renderer.
300
301 @see wxDataViewItemAttr.
302 */
303 virtual bool GetAttrByRow(unsigned int row, unsigned int col,
304 wxDataViewItemAttr& attr);
305
306 /**
307 Returns the wxDataViewItem at the given @e row.
308 */
309 wxDataViewItem GetItem(unsigned int row) const;
310
311 /**
312 Returns the position of given @e item.
313 */
314 unsigned int GetRow(const wxDataViewItem& item) const;
315
316 /**
317 Override this to allow getting values from the model.
318 */
319 virtual void GetValueByRow(wxVariant& variant, unsigned int row,
320 unsigned int col) const = 0;
321
322 /**
323 Call this after if the data has to be read again from the model.
324 This is useful after major changes when calling the methods below
325 (possibly thousands of times) doesn't make sense.
326 */
327 void Reset(unsigned int new_size);
328
329 /**
330 Call this after a row has been appended to the model.
331 */
332 void RowAppended();
333
334 /**
335 Call this after a row has been changed.
336 */
337 void RowChanged(unsigned int row);
338
339 /**
340 Call this after a row has been deleted.
341 */
342 void RowDeleted(unsigned int row);
343
344 /**
345 Call this after a row has been inserted at the given position.
346 */
347 void RowInserted(unsigned int before);
348
349 /**
350 Call this after a row has been prepended to the model.
351 */
352 void RowPrepended();
353
354 /**
355 Call this after a value has been changed.
356 */
357 void RowValueChanged(unsigned int row, unsigned int col);
358
359 /**
360 Call this after rows have been deleted.
361 The array will internally get copied and sorted in descending order so
362 that the rows with the highest position will be deleted first.
363 */
364 void RowsDeleted(const wxArrayInt& rows);
365
366 /**
367 Called in order to set a value in the model.
368 */
369 virtual bool SetValueByRow(const wxVariant& variant, unsigned int row,
370 unsigned int col) = 0;
371 };
372
373
374
375 /**
376 @class wxDataViewVirtualListModel
377
378 wxDataViewVirtualListModel is a specialized data model which lets you address
379 an item by its position (row) rather than its wxDataViewItem and as such offers
380 the exact same interface as wxDataViewIndexListModel.
381 The important difference is that under platforms other than OS X, using this
382 model will result in a truly virtual control able to handle millions of items
383 as the control doesn't store any item (a feature not supported by the
384 Carbon API under OS X).
385
386 @see wxDataViewIndexListModel for the API.
387
388 @library{wxadv}
389 @category{dvc}
390 */
391 class wxDataViewVirtualListModel : public wxDataViewModel
392 {
393 public:
394 /**
395 Constructor.
396 */
397 wxDataViewVirtualListModel(unsigned int initial_size = 0);
398 };
399
400
401
402 /**
403 @class wxDataViewItemAttr
404
405 This class is used to indicate to a wxDataViewCtrl that a certain item
406 (see wxDataViewItem) has extra font attributes for its renderer.
407 For this, it is required to override wxDataViewModel::GetAttr.
408
409 Attributes are currently only supported by wxDataViewTextRendererText.
410
411 @library{wxadv}
412 @category{dvc}
413 */
414 class wxDataViewItemAttr
415 {
416 public:
417 /**
418 Constructor.
419 */
420 wxDataViewItemAttr();
421
422 /**
423 Call this to indicate that the item shall be displayed in bold text.
424 */
425 void SetBold(bool set);
426
427 /**
428 Call this to indicate that the item shall be displayed with that colour.
429 */
430 void SetColour(const wxColour& colour);
431
432 /**
433 Call this to indicate that the item shall be displayed in italic text.
434 */
435 void SetItalic(bool set);
436 };
437
438
439
440 /**
441 @class wxDataViewItem
442
443 wxDataViewItem is a small opaque class that represents an item in a wxDataViewCtrl
444 in a persistent way, i.e. indepent of the position of the item in the control
445 or changes to its contents.
446
447 It must hold a unique ID of type @e void* in its only field and can be converted
448 to and from it.
449
450 If the ID is @NULL the wxDataViewItem is invalid and wxDataViewItem::IsOk will
451 return @false which used in many places in the API of wxDataViewCtrl to
452 indicate that e.g. no item was found. An ID of @NULL is also used to indicate
453 the invisible root. Examples for this are wxDataViewModel::GetParent and
454 wxDataViewModel::GetChildren.
455
456 @library{wxadv}
457 @category{dvc}
458 */
459 class wxDataViewItem
460 {
461 public:
462 //@{
463 /**
464 Constructor.
465 */
466 wxDataViewItem(void* id = NULL);
467 wxDataViewItem(const wxDataViewItem& item);
468 //@}
469
470 /**
471 Returns the ID.
472 */
473 void* GetID() const;
474
475 /**
476 Returns @true if the ID is not @NULL.
477 */
478 bool IsOk() const;
479 };
480
481
482
483 /**
484 @class wxDataViewCtrl
485
486 wxDataViewCtrl is a control to display data either in a tree like fashion or
487 in a tabular form or both.
488
489 If you only need to display a simple tree structure with an API more like the
490 older wxTreeCtrl class, then the specialized wxDataViewTreeCtrl can be used.
491 Likewise, if you only want to display simple table structure you can use
492 the specialized wxDataViewListCtrl class. Both wxDataViewTreeCtrl and
493 wxDataViewListCtrl can be used without defining your own wxDataViewModel.
494
495 A wxDataViewItem is used to represent a (visible) item in the control.
496
497 Unlike wxListCtrl, wxDataViewCtrl doesn't get its data from the user through
498 virtual functions or by setting it directly. Instead you need to write your own
499 wxDataViewModel and associate it with this control.
500 Then you need to add a number of wxDataViewColumn to this control to define
501 what each column shall display. Each wxDataViewColumn in turn owns 1 instance
502 of a wxDataViewRenderer to render its cells.
503
504 A number of standard renderers for rendering text, dates, images, toggle,
505 a progress bar etc. are provided. Additionally, the user can write custom
506 renderers deriving from wxDataViewCustomRenderer for displaying anything.
507
508 All data transfer from the control to the model and the user code is done
509 through wxVariant which can be extended to support more data formats as necessary.
510 Accordingly, all type information uses the strings returned from wxVariant::GetType.
511
512 @beginStyleTable
513 @style{wxDV_SINGLE}
514 Single selection mode. This is the default.
515 @style{wxDV_MULTIPLE}
516 Multiple selection mode.
517 @style{wxDV_ROW_LINES}
518 Use alternating colours for rows if supported by platform and theme.
519 @style{wxDV_HORIZ_RULES}
520 Display fine rules between row if supported.
521 @style{wxDV_VERT_RULES}
522 Display fine rules between columns is supported.
523 @style{wxDV_VARIABLE_LINE_HEIGHT}
524 Allow variable line heights.
525 This can be inefficient when displaying large number of items.
526 @endStyleTable
527
528 @beginEventTable{wxDataViewEvent}
529 @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)}
530 Process a wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event.
531 @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)}
532 Process a wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.
533 @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)}
534 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event.
535 @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)}
536 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event.
537 @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)}
538 Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event.
539 @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)}
540 Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event.
541 @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)}
542 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event.
543 @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)}
544 Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event.
545 @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)}
546 Process a wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event.
547 @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)}
548 Process a wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event.
549 @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)}
550 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event.
551 @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)}
552 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event.
553 @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)}
554 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event.
555 @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
556 Process a wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event.
557 @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)}
558 Process a wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event.
559 @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)}
560 Process a wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event.
561 @event{EVT_DATAVIEW_ITEM_DROP(id, func)}
562 Process a wxEVT_COMMAND_DATAVIEW_ITEM_DROP event.
563 @endEventTable
564
565 @library{wxadv}
566 @category{ctrl,dvc}
567 @appearance{dataviewctrl.png}
568 */
569 class wxDataViewCtrl : public wxControl
570 {
571 public:
572 /**
573 Default Constructor.
574 */
575 wxDataViewCtrl();
576
577 /**
578 Constructor. Calls Create().
579 */
580 wxDataViewCtrl(wxWindow* parent, wxWindowID id,
581 const wxPoint& pos = wxDefaultPosition,
582 const wxSize& size = wxDefaultSize,
583 long style = 0,
584 const wxValidator& validator = wxDefaultValidator);
585
586 /**
587 Destructor.
588 */
589 virtual ~wxDataViewCtrl();
590
591 /**
592 Appends a wxDataViewColumn to the control. Returns @true on success.
593
594 Note that there is a number of short cut methods which implicitly create
595 a wxDataViewColumn and a wxDataViewRenderer for it (see below).
596 */
597 virtual bool AppendColumn(wxDataViewColumn* col);
598
599 /**
600 Prepends a wxDataViewColumn to the control. Returns @true on success.
601
602 Note that there is a number of short cut methods which implicitly create
603 a wxDataViewColumn and a wxDataViewRenderer for it.
604 */
605 virtual bool PrependColumn(wxDataViewColumn* col);
606
607 /**
608 Inserts a wxDataViewColumn to the control. Returns @true on success.
609 */
610 virtual bool InsertColumn(unsigned int pos, wxDataViewColumn* col);
611
612 //@{
613 /**
614 Appends a column for rendering a bitmap. Returns the wxDataViewColumn
615 created in the function or @NULL on failure.
616 */
617 wxDataViewColumn* AppendBitmapColumn(const wxString& label,
618 unsigned int model_column,
619 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
620 int width = -1,
621 wxAlignment align = wxALIGN_CENTER,
622 int flags = wxDATAVIEW_COL_RESIZABLE);
623 wxDataViewColumn* AppendBitmapColumn(const wxBitmap& label,
624 unsigned int model_column,
625 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
626 int width = -1,
627 wxAlignment align = wxALIGN_CENTER,
628 int flags = wxDATAVIEW_COL_RESIZABLE);
629 //@}
630
631 //@{
632 /**
633 Appends a column for rendering a date. Returns the wxDataViewColumn
634 created in the function or @NULL on failure.
635
636 @note The @a align parameter is applied to both the column header and
637 the column renderer.
638 */
639 wxDataViewColumn* AppendDateColumn(const wxString& label,
640 unsigned int model_column,
641 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
642 int width = -1,
643 wxAlignment align = wxALIGN_NOT,
644 int flags = wxDATAVIEW_COL_RESIZABLE);
645 wxDataViewColumn* AppendDateColumn(const wxBitmap& label,
646 unsigned int model_column,
647 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
648 int width = -1,
649 wxAlignment align = wxALIGN_NOT,
650 int flags = wxDATAVIEW_COL_RESIZABLE);
651 //@}
652
653 //@{
654 /**
655 Appends a column for rendering text with an icon. Returns the wxDataViewColumn
656 created in the function or @NULL on failure.
657 This method uses the wxDataViewIconTextRenderer class.
658
659 @note The @a align parameter is applied to both the column header and
660 the column renderer.
661 */
662 wxDataViewColumn* AppendIconTextColumn(const wxString& label,
663 unsigned int model_column,
664 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
665 int width = -1,
666 wxAlignment align = wxALIGN_NOT,
667 int flags = wxDATAVIEW_COL_RESIZABLE);
668 wxDataViewColumn* AppendIconTextColumn(const wxBitmap& label,
669 unsigned int model_column,
670 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
671 int width = -1,
672 wxAlignment align = wxALIGN_NOT,
673 int flags = wxDATAVIEW_COL_RESIZABLE);
674 //@}
675
676 //@{
677 /**
678 Appends a column for rendering a progress indicator. Returns the
679 wxDataViewColumn created in the function or @NULL on failure.
680
681 @note The @a align parameter is applied to both the column header and
682 the column renderer.
683 */
684 wxDataViewColumn* AppendProgressColumn(const wxString& label,
685 unsigned int model_column,
686 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
687 int width = 80,
688 wxAlignment align = wxALIGN_CENTER,
689 int flags = wxDATAVIEW_COL_RESIZABLE);
690 wxDataViewColumn* AppendProgressColumn(const wxBitmap& label,
691 unsigned int model_column,
692 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
693 int width = 80,
694 wxAlignment align = wxALIGN_CENTER,
695 int flags = wxDATAVIEW_COL_RESIZABLE);
696 //@}
697
698 //@{
699 /**
700 Appends a column for rendering text. Returns the wxDataViewColumn
701 created in the function or @NULL on failure.
702
703 @note The @a align parameter is applied to both the column header and
704 the column renderer.
705 */
706 wxDataViewColumn* AppendTextColumn(const wxString& label,
707 unsigned int model_column,
708 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
709 int width = -1,
710 wxAlignment align = wxALIGN_NOT,
711 int flags = wxDATAVIEW_COL_RESIZABLE);
712 wxDataViewColumn* AppendTextColumn(const wxBitmap& label,
713 unsigned int model_column,
714 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
715 int width = -1,
716 wxAlignment align = wxALIGN_NOT,
717 int flags = wxDATAVIEW_COL_RESIZABLE);
718 //@}
719
720 //@{
721 /**
722 Appends a column for rendering a toggle. Returns the wxDataViewColumn
723 created in the function or @NULL on failure.
724
725 @note The @a align parameter is applied to both the column header and
726 the column renderer.
727 */
728 wxDataViewColumn* AppendToggleColumn(const wxString& label,
729 unsigned int model_column,
730 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
731 int width = 30,
732 wxAlignment align = wxALIGN_CENTER,
733 int flags = wxDATAVIEW_COL_RESIZABLE);
734 wxDataViewColumn* AppendToggleColumn(const wxBitmap& label,
735 unsigned int model_column,
736 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
737 int width = 30,
738 wxAlignment align = wxALIGN_CENTER,
739 int flags = wxDATAVIEW_COL_RESIZABLE);
740 //@}
741
742 /**
743 Associates a wxDataViewModel with the control.
744 This increases the reference count of the model by 1.
745 */
746 virtual bool AssociateModel(wxDataViewModel* model);
747
748 /**
749 Removes all columns.
750 */
751 virtual bool ClearColumns();
752
753 /**
754 Collapses the item.
755 */
756 virtual void Collapse(const wxDataViewItem& item);
757
758 /**
759 Create the control. Useful for two step creation.
760 */
761 bool Create(wxWindow* parent, wxWindowID id,
762 const wxPoint& pos = wxDefaultPosition,
763 const wxSize& size = wxDefaultSize,
764 long style = 0,
765 const wxValidator& validator = wxDefaultValidator);
766
767 /**
768 Deletes given column.
769 */
770 virtual bool DeleteColumn(wxDataViewColumn* column);
771
772 /**
773 Enable drag operations using the given @a format.
774 */
775 virtual bool EnableDragSource( const wxDataFormat &format );
776
777 /**
778 Enable drop operations using the given @a format.
779 */
780 virtual bool EnableDropTarget( const wxDataFormat &format );
781
782 /**
783 Call this to ensure that the given item is visible.
784 */
785 virtual void EnsureVisible(const wxDataViewItem& item,
786 const wxDataViewColumn* column = NULL);
787
788 /**
789 Expands the item.
790 */
791 virtual void Expand(const wxDataViewItem& item);
792
793 /**
794 Expands all ancestors of the @a item. This method also
795 ensures that the item itself as well as all ancestor
796 items have been read from the model by the control.
797 */
798 virtual void ExpandAncestors( const wxDataViewItem & item );
799
800 /**
801 Returns pointer to the column. @a pos refers to the position in the
802 control which may change after reordering columns by the user.
803 */
804 virtual wxDataViewColumn* GetColumn(unsigned int pos) const;
805
806 /**
807 Returns the number of columns.
808 */
809 virtual unsigned int GetColumnCount() const;
810
811 /**
812 Returns the position of the column or -1 if not found in the control.
813 */
814 virtual int GetColumnPosition(const wxDataViewColumn* column) const;
815
816 /**
817 Returns column containing the expanders.
818 */
819 wxDataViewColumn* GetExpanderColumn() const;
820
821 /**
822 Returns indentation.
823 */
824 int GetIndent() const;
825
826 /**
827 Returns item rect.
828 */
829 virtual wxRect GetItemRect(const wxDataViewItem& item,
830 const wxDataViewColumn* col = NULL) const;
831
832 /**
833 Returns pointer to the data model associated with the control (if any).
834 */
835 wxDataViewModel* GetModel();
836
837 /**
838 Returns first selected item or an invalid item if none is selected.
839 */
840 virtual wxDataViewItem GetSelection() const;
841
842 /**
843 Fills @a sel with currently selected items and returns their number.
844 */
845 virtual int GetSelections(wxDataViewItemArray& sel) const;
846
847 /**
848 Returns the wxDataViewColumn currently responsible for sorting
849 or @NULL if none has been selected.
850 */
851 virtual wxDataViewColumn* GetSortingColumn() const;
852
853 /**
854 Hittest.
855 */
856 virtual void HitTest(const wxPoint& point, wxDataViewItem& item,
857 wxDataViewColumn*& col) const;
858
859 /**
860 Return @true if the item is expanded.
861 */
862 virtual bool IsExpanded(const wxDataViewItem& item) const;
863
864 /**
865 Return @true if the item is selected.
866 */
867 virtual bool IsSelected(const wxDataViewItem& item) const;
868
869 /**
870 Select the given item.
871 */
872 virtual void Select(const wxDataViewItem& item);
873
874 /**
875 Select all items.
876 */
877 virtual void SelectAll();
878
879 /**
880 Set which column shall contain the tree-like expanders.
881 */
882 void SetExpanderColumn(wxDataViewColumn* col);
883
884 /**
885 Sets the indendation.
886 */
887 void SetIndent(int indent);
888
889 /**
890 Sets the selection to the array of wxDataViewItems.
891 */
892 virtual void SetSelections(const wxDataViewItemArray& sel);
893
894 /**
895 Unselect the given item.
896 */
897 virtual void Unselect(const wxDataViewItem& item);
898
899 /**
900 Unselect all item.
901 This method only has effect if multiple selections are allowed.
902 */
903 virtual void UnselectAll();
904 };
905
906
907
908 /**
909 @class wxDataViewModelNotifier
910
911 A wxDataViewModelNotifier instance is owned by a wxDataViewModel and mirrors
912 its notification interface.
913 See the documentation of that class for further information.
914
915 @library{wxadv}
916 @category{dvc}
917 */
918 class wxDataViewModelNotifier
919 {
920 public:
921 /**
922 Constructor.
923 */
924 wxDataViewModelNotifier();
925
926 /**
927 Destructor.
928 */
929 virtual ~wxDataViewModelNotifier();
930
931 /**
932 Called by owning model.
933 */
934 virtual bool Cleared() = 0;
935
936 /**
937 Get owning wxDataViewModel.
938 */
939 wxDataViewModel* GetOwner() const;
940
941 /**
942 Called by owning model.
943 */
944 virtual bool ItemAdded(const wxDataViewItem& parent,
945 const wxDataViewItem& item) = 0;
946
947 /**
948 Called by owning model.
949 */
950 virtual bool ItemChanged(const wxDataViewItem& item) = 0;
951
952 /**
953 Called by owning model.
954 */
955 virtual bool ItemDeleted(const wxDataViewItem& parent,
956 const wxDataViewItem& item) = 0;
957
958 /**
959 Called by owning model.
960 */
961 virtual bool ItemsAdded(const wxDataViewItem& parent,
962 const wxDataViewItemArray& items);
963
964 /**
965 Called by owning model.
966 */
967 virtual bool ItemsChanged(const wxDataViewItemArray& items);
968
969 /**
970 Called by owning model.
971 */
972 virtual bool ItemsDeleted(const wxDataViewItem& parent,
973 const wxDataViewItemArray& items);
974
975 /**
976 Called by owning model.
977 */
978 virtual void Resort() = 0;
979
980 /**
981 Set owner of this notifier. Used internally.
982 */
983 void SetOwner(wxDataViewModel* owner);
984
985 /**
986 Called by owning model.
987 */
988 virtual bool ValueChanged(const wxDataViewItem& item, unsigned int col) = 0;
989 };
990
991
992 /**
993 The mode of a data-view cell; see wxDataViewRenderer for more info.
994 */
995 enum wxDataViewCellMode
996 {
997 wxDATAVIEW_CELL_INERT,
998
999 /**
1000 Indicates that the user can double click the cell and something will
1001 happen (e.g. a window for editing a date will pop up).
1002 */
1003 wxDATAVIEW_CELL_ACTIVATABLE,
1004
1005 /**
1006 Indicates that the user can edit the data in-place, i.e. an control
1007 will show up after a slow click on the cell. This behaviour is best
1008 known from changing the filename in most file managers etc.
1009 */
1010 wxDATAVIEW_CELL_EDITABLE
1011 };
1012
1013 /**
1014 The values of this enum controls how a wxDataViewRenderer should display
1015 its contents in a cell.
1016 */
1017 enum wxDataViewCellRenderState
1018 {
1019 wxDATAVIEW_CELL_SELECTED = 1,
1020 wxDATAVIEW_CELL_PRELIT = 2,
1021 wxDATAVIEW_CELL_INSENSITIVE = 4,
1022 wxDATAVIEW_CELL_FOCUSED = 8
1023 };
1024
1025 /**
1026 @class wxDataViewRenderer
1027
1028 This class is used by wxDataViewCtrl to render the individual cells.
1029 One instance of a renderer class is owned by a wxDataViewColumn.
1030 There is a number of ready-to-use renderers provided:
1031 - wxDataViewTextRenderer,
1032 - wxDataViewTextRendererAttr,
1033 - wxDataViewIconTextRenderer,
1034 - wxDataViewToggleRenderer,
1035 - wxDataViewProgressRenderer,
1036 - wxDataViewBitmapRenderer,
1037 - wxDataViewDateRenderer,
1038 - wxDataViewSpinRenderer.
1039
1040 Additionally, the user can write own renderers by deriving from
1041 wxDataViewCustomRenderer.
1042
1043 The ::wxDataViewCellMode and ::wxDataViewCellRenderState flags accepted
1044 by the constructors respectively controls what actions the cell data allows
1045 and how the renderer should display its contents in a cell.
1046
1047 @library{wxadv}
1048 @category{dvc}
1049 */
1050 class wxDataViewRenderer : public wxObject
1051 {
1052 public:
1053 /**
1054 Constructor.
1055 */
1056 wxDataViewRenderer(const wxString& varianttype,
1057 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1058 int align = wxDVR_DEFAULT_ALIGNMENT );
1059
1060 /**
1061 Returns the alignment. See SetAlignment()
1062 */
1063 virtual int GetAlignment() const;
1064
1065 /**
1066 Returns the cell mode.
1067 */
1068 virtual wxDataViewCellMode GetMode() const;
1069
1070 /**
1071 Returns pointer to the owning wxDataViewColumn.
1072 */
1073 wxDataViewColumn* GetOwner() const;
1074
1075 /**
1076 This methods retrieves the value from the renderer in order to
1077 transfer the value back to the data model.
1078
1079 Returns @false on failure.
1080 */
1081 virtual bool GetValue(wxVariant& value) const = 0;
1082
1083 /**
1084 Returns a string with the type of the wxVariant supported by this renderer.
1085 */
1086 wxString GetVariantType() const;
1087
1088 /**
1089 Sets the alignment of the renderer's content.
1090 The default value of @c wxDVR_DEFAULT_ALIGMENT indicates that the content
1091 should have the same alignment as the column header.
1092
1093 The method is not implemented under OS X and the renderer always aligns
1094 its contents as the column header on that platform. The other platforms
1095 support both vertical and horizontal alignment.
1096 */
1097 virtual void SetAlignment( int align );
1098 /**
1099 Sets the owning wxDataViewColumn.
1100 This is usually called from within wxDataViewColumn.
1101 */
1102 void SetOwner(wxDataViewColumn* owner);
1103
1104 /**
1105 Set the value of the renderer (and thus its cell) to @a value.
1106 The internal code will then render this cell with this data.
1107 */
1108 virtual bool SetValue(const wxVariant& value) = 0;
1109
1110 /**
1111 Before data is committed to the data model, it is passed to this
1112 method where it can be checked for validity. This can also be
1113 used for checking a valid range or limiting the user input in
1114 a certain aspect (e.g. max number of characters or only alphanumeric
1115 input, ASCII only etc.). Return @false if the value is not valid.
1116
1117 Please note that due to implementation limitations, this validation
1118 is done after the editing control already is destroyed and the
1119 editing process finished.
1120 */
1121 virtual bool Validate(wxVariant& value);
1122 };
1123
1124
1125
1126 /**
1127 @class wxDataViewTextRenderer
1128
1129 wxDataViewTextRenderer is used for rendering text.
1130 It supports in-place editing if desired.
1131
1132 @library{wxadv}
1133 @category{dvc}
1134 */
1135 class wxDataViewTextRenderer : public wxDataViewRenderer
1136 {
1137 public:
1138 /**
1139 The ctor.
1140 */
1141 wxDataViewTextRenderer(const wxString& varianttype = "string",
1142 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1143 int align = wxDVR_DEFAULT_ALIGNMENT );
1144 };
1145
1146
1147
1148 /**
1149 @class wxDataViewIconTextRenderer
1150
1151 The wxDataViewIconTextRenderer class is used to display text with
1152 a small icon next to it as it is typically done in a file manager.
1153
1154 This classes uses the wxDataViewIconText helper class to store its data.
1155 wxDataViewIonText can be converted to and from a wxVariant using the left shift
1156 operator.
1157
1158 @library{wxadv}
1159 @category{dvc}
1160 */
1161 class wxDataViewIconTextRenderer : public wxDataViewRenderer
1162 {
1163 public:
1164 /**
1165 The ctor.
1166 */
1167 wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText",
1168 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1169 int align = wxDVR_DEFAULT_ALIGNMENT );
1170 };
1171
1172
1173
1174 /**
1175 @class wxDataViewProgressRenderer
1176
1177 This class is used by wxDataViewCtrl to render progress bars.
1178
1179 @library{wxadv}
1180 @category{dvc}
1181 */
1182 class wxDataViewProgressRenderer : public wxDataViewRenderer
1183 {
1184 public:
1185 /**
1186 The ctor.
1187 */
1188 wxDataViewProgressRenderer(const wxString& label = wxEmptyString,
1189 const wxString& varianttype = "long",
1190 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1191 int align = wxDVR_DEFAULT_ALIGNMENT );
1192 };
1193
1194
1195
1196 /**
1197 @class wxDataViewSpinRenderer
1198
1199 This is a specialized renderer for rendering integer values.
1200 It supports modifying the values in-place by using a wxSpinCtrl.
1201 The renderer only support variants of type @e long.
1202
1203 @library{wxadv}
1204 @category{dvc}
1205 */
1206 class wxDataViewSpinRenderer : public wxDataViewCustomRenderer
1207 {
1208 public:
1209 /**
1210 Constructor.
1211 @a min and @a max indicate the minimum and maximum values for the wxSpinCtrl.
1212 */
1213 wxDataViewSpinRenderer(int min, int max,
1214 wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
1215 int align = wxDVR_DEFAULT_ALIGNMENT);
1216 };
1217
1218
1219
1220 /**
1221 @class wxDataViewToggleRenderer
1222
1223 This class is used by wxDataViewCtrl to render toggle controls.
1224
1225 @library{wxadv}
1226 @category{dvc}
1227 */
1228 class wxDataViewToggleRenderer : public wxDataViewRenderer
1229 {
1230 public:
1231 /**
1232 The ctor.
1233 */
1234 wxDataViewToggleRenderer(const wxString& varianttype = "bool",
1235 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1236 int align = wxDVR_DEFAULT_ALIGNMENT);
1237 };
1238
1239
1240
1241 /**
1242 @class wxDataViewDateRenderer
1243
1244 This class is used by wxDataViewCtrl to render calendar controls.
1245
1246 @library{wxadv}
1247 @category{dvc}
1248 */
1249 class wxDataViewDateRenderer : public wxDataViewRenderer
1250 {
1251 public:
1252 /**
1253 The ctor.
1254 */
1255 wxDataViewDateRenderer(const wxString& varianttype = "datetime",
1256 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
1257 int align = wxDVR_DEFAULT_ALIGNMENT);
1258 };
1259
1260
1261
1262 /**
1263 @class wxDataViewTextRendererAttr
1264
1265 The same as wxDataViewTextRenderer but with support for font attributes.
1266 Font attributes are currently only supported under GTK+ and MSW.
1267
1268 @see wxDataViewModel::GetAttr and wxDataViewItemAttr.
1269
1270 @library{wxadv}
1271 @category{dvc}
1272 */
1273 class wxDataViewTextRendererAttr : public wxDataViewTextRenderer
1274 {
1275 public:
1276 /**
1277 The ctor.
1278 */
1279 wxDataViewTextRendererAttr(const wxString& varianttype = "string",
1280 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1281 int align = wxDVR_DEFAULT_ALIGNMENT);
1282 };
1283
1284
1285
1286 /**
1287 @class wxDataViewCustomRenderer
1288
1289 You need to derive a new class from wxDataViewCustomRenderer in
1290 order to write a new renderer.
1291
1292 You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue,
1293 wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render.
1294
1295 If you want your renderer to support in-place editing then you also need to override
1296 wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl
1297 and wxDataViewCustomRenderer::GetValueFromEditorCtrl.
1298
1299 Note that a special event handler will be pushed onto that editor control
1300 which handles @e \<ENTER\> and focus out events in order to end the editing.
1301
1302 @library{wxadv}
1303 @category{dvc}
1304 */
1305 class wxDataViewCustomRenderer : public wxDataViewRenderer
1306 {
1307 public:
1308 /**
1309 Constructor.
1310 */
1311 wxDataViewCustomRenderer(const wxString& varianttype = "string",
1312 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1313 int align = -1, bool no_init = false);
1314
1315 /**
1316 Destructor.
1317 */
1318 virtual ~wxDataViewCustomRenderer();
1319
1320 /**
1321 Override this to react to double clicks or ENTER.
1322 This method will only be called in wxDATAVIEW_CELL_ACTIVATABLE mode.
1323 */
1324 virtual bool Activate( wxRect cell,
1325 wxDataViewModel* model,
1326 const wxDataViewItem & item,
1327 unsigned int col );
1328
1329 /**
1330 Override this to create the actual editor control once editing
1331 is about to start.
1332
1333 @a parent is the parent of the editor control, @a labelRect indicates the
1334 position and size of the editor control and @a value is its initial value:
1335 @code
1336 {
1337 long l = value;
1338 return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
1339 labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l );
1340 }
1341 @endcode
1342 */
1343 virtual wxControl* CreateEditorCtrl(wxWindow* parent,
1344 wxRect labelRect,
1345 const wxVariant& value);
1346
1347 /**
1348 Create DC on request. Internal.
1349 */
1350 virtual wxDC* GetDC();
1351
1352 /**
1353 Return size required to show content.
1354 */
1355 virtual wxSize GetSize() const = 0;
1356
1357 /**
1358 Overrride this so that the renderer can get the value from the editor
1359 control (pointed to by @a editor):
1360 @code
1361 {
1362 wxSpinCtrl *sc = (wxSpinCtrl*) editor;
1363 long l = sc->GetValue();
1364 value = l;
1365 return true;
1366 }
1367 @endcode
1368 */
1369 virtual bool GetValueFromEditorCtrl(wxControl* editor,
1370 wxVariant& value);
1371
1372 /**
1373 Override this and make it return @true in order to
1374 indicate that this renderer supports in-place editing.
1375 */
1376 virtual bool HasEditorCtrl();
1377
1378 /**
1379 Overrride this to react to a left click.
1380 This method will only be called in @c wxDATAVIEW_CELL_ACTIVATABLE mode.
1381 */
1382 virtual bool LeftClick( wxPoint cursor,
1383 wxRect cell,
1384 wxDataViewModel * model,
1385 const wxDataViewItem & item,
1386 unsigned int col );
1387
1388 /**
1389 Override this to render the cell.
1390 Before this is called, wxDataViewRenderer::SetValue was called
1391 so that this instance knows what to render.
1392 */
1393 virtual bool Render(wxRect cell, wxDC* dc, int state) = 0;
1394
1395 /**
1396 This method should be called from within Render() whenever you need to
1397 render simple text.
1398 This will ensure that the correct colour, font and vertical alignment will
1399 be chosen so the text will look the same as text drawn by native renderers.
1400 */
1401 void RenderText(const wxString& text, int xoffset, wxRect cell,
1402 wxDC* dc, int state);
1403
1404 /**
1405 Overrride this to start a drag operation. Not yet supported.
1406 */
1407 virtual bool StartDrag(wxPoint cursor, wxRect cell,
1408 wxDataViewModel* model,
1409 const wxDataViewItem & item,
1410 unsigned int col);
1411 };
1412
1413
1414
1415 /**
1416 @class wxDataViewBitmapRenderer
1417
1418 This class is used by wxDataViewCtrl to render bitmap controls.
1419
1420 @library{wxadv}
1421 @category{dvc}
1422 */
1423 class wxDataViewBitmapRenderer : public wxDataViewRenderer
1424 {
1425 public:
1426 /**
1427 The ctor.
1428 */
1429 wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap",
1430 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1431 int align = wxDVR_DEFAULT_ALIGNMENT);
1432 };
1433
1434
1435 /**
1436 The flags used by wxDataViewColumn.
1437 */
1438 enum wxDataViewColumnFlags
1439 {
1440 wxDATAVIEW_COL_RESIZABLE = 1,
1441 wxDATAVIEW_COL_SORTABLE = 2,
1442 wxDATAVIEW_COL_REORDERABLE = 4,
1443 wxDATAVIEW_COL_HIDDEN = 8
1444 };
1445
1446 /**
1447 @class wxDataViewColumn
1448
1449 This class represents a column in a wxDataViewCtrl.
1450 One wxDataViewColumn is bound to one column in the data model to which the
1451 wxDataViewCtrl has been associated.
1452
1453 An instance of wxDataViewRenderer is used by this class to render its data.
1454
1455 @library{wxadv}
1456 @category{dvc}
1457 */
1458 class wxDataViewColumn : public wxHeaderColumn
1459 {
1460 public:
1461 //@{
1462 /**
1463 Constructors.
1464 */
1465 wxDataViewColumn(const wxString& title,
1466 wxDataViewRenderer* renderer,
1467 unsigned int model_column,
1468 int width = wxDVC_DEFAULT_WIDTH,
1469 wxAlignment align = wxALIGN_CENTER,
1470 int flags = wxDATAVIEW_COL_RESIZABLE);
1471 wxDataViewColumn(const wxBitmap& bitmap,
1472 wxDataViewRenderer* renderer,
1473 unsigned int model_column,
1474 int width = wxDVC_DEFAULT_WIDTH,
1475 wxAlignment align = wxALIGN_CENTER,
1476 int flags = wxDATAVIEW_COL_RESIZABLE);
1477 //@}
1478
1479 /**
1480 Returns the index of the column of the model, which this
1481 wxDataViewColumn is displaying.
1482 */
1483 unsigned int GetModelColumn() const;
1484
1485 /**
1486 Returns the owning wxDataViewCtrl.
1487 */
1488 wxDataViewCtrl* GetOwner() const;
1489
1490 /**
1491 Returns the renderer of this wxDataViewColumn.
1492
1493 @see wxDataViewRenderer.
1494 */
1495 wxDataViewRenderer* GetRenderer() const;
1496 };
1497
1498
1499
1500 /**
1501 @class wxDataViewListCtrl
1502
1503 This class is a wxDataViewCtrl which internally uses a wxDataViewListStore
1504 and forwards most of its API to that class.
1505
1506 The purpose of this class is to offer a simple way to display and
1507 edit a small table of data without having to write your own wxDataViewModel.
1508
1509 @code
1510 wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, -1 );
1511
1512 listctrl->AppendToggleColumn( "Toggle" );
1513 listctrl->AppendTextColumn( "Text" );
1514
1515 wxVector<wxVariant> data;
1516 data.push_back( true );
1517 data.push_back( "row 1" );
1518 listctrl->AppendItem( data );
1519
1520 data.clear();
1521 data.push_back( false );
1522 data.push_back( "row 3" );
1523 listctrl->AppendItem( data );
1524 @endcode
1525
1526
1527 @library{wxadv}
1528 @category{ctrl,dvc}
1529 */
1530 class wxDataViewListCtrl: public wxDataViewCtrl
1531 {
1532 public:
1533 /**
1534 Default ctor.
1535 */
1536 wxDataViewListCtrl();
1537
1538 /**
1539 Constructor. Calls Create().
1540 */
1541 wxDataViewListCtrl( wxWindow *parent, wxWindowID id,
1542 const wxPoint& pos = wxDefaultPosition,
1543 const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
1544 const wxValidator& validator = wxDefaultValidator );
1545
1546 /**
1547 Destructor. Deletes the image list if any.
1548 */
1549 ~wxDataViewListCtrl();
1550
1551 /**
1552 Creates the control and a wxDataViewListStore as its internal model.
1553 */
1554 bool Create( wxWindow *parent, wxWindowID id,
1555 const wxPoint& pos = wxDefaultPosition,
1556 const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
1557 const wxValidator& validator = wxDefaultValidator );
1558
1559 //@{
1560 /**
1561 Returns the store.
1562 */
1563 wxDataViewListStore *GetStore();
1564 const wxDataViewListStore *GetStore() const;
1565 //@}
1566
1567 /**
1568 Appends a column to the control and additonally appends a
1569 column to the store with the type @a varianttype.
1570 */
1571 void AppendColumn( wxDataViewColumn *column, const wxString &varianttype );
1572
1573 /**
1574 Prepends a column to the control and additonally prepends a
1575 column to the store with the type @a varianttype.
1576 */
1577 void PrependColumn( wxDataViewColumn *column, const wxString &varianttype );
1578
1579 /**
1580 Inserts a column to the control and additonally inserts a
1581 column to the store with the type @a varianttype.
1582 */
1583 void InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype );
1584
1585 /**
1586 Overridden from wxDataViewCtrl
1587
1588 Appends a column to the control and additonally appends a
1589 column to the store with the type string.
1590 */
1591 virtual void AppendColumn( wxDataViewColumn *column );
1592
1593 /**
1594 Overridden from wxDataViewCtrl
1595
1596 Prepends a column to the control and additonally prepends a
1597 column to the store with the type string.
1598 */
1599 virtual void PrependColumn( wxDataViewColumn *column );
1600
1601 /**
1602 Overridden from wxDataViewCtrl
1603
1604 Inserts a column to the control and additonally inserts a
1605 column to the store with the type string.
1606 */
1607 virtual void InsertColumn( unsigned int pos, wxDataViewColumn *column );
1608
1609 /**
1610 Inserts a text column to the control and the store.
1611 */
1612 wxDataViewColumn *AppendTextColumn( const wxString &label,
1613 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1614 int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
1615
1616 /**
1617 Inserts a toggle column to the control and the store.
1618 */
1619 wxDataViewColumn *AppendToggleColumn( const wxString &label,
1620 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
1621 int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
1622
1623 /**
1624 Inserts a progress column to the control and the store.
1625 */
1626 wxDataViewColumn *AppendProgressColumn( const wxString &label,
1627 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1628 int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
1629
1630 /**
1631 Inserts a icon and text column to the control and the store.
1632 */
1633 wxDataViewColumn *AppendIconTextColumn( const wxString &label,
1634 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1635 int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE );
1636
1637 /**
1638 Appends an item (=row) to the control and store.
1639 */
1640 void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
1641
1642 /**
1643 Prepends an item (=row) to the control and store.
1644 */
1645 void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
1646
1647 /**
1648 Inserts an item (=row) to the control and store.
1649 */
1650 void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL );
1651
1652 /**
1653 Delete the row at position @a row.
1654 */
1655 void DeleteItem( unsigned row );
1656
1657 /**
1658 Delete all items (= all rows).
1659 */
1660 void DeleteAllItems();
1661
1662 /**
1663 Sets the value in the store and update the control.
1664 */
1665 void SetValue( const wxVariant &value, unsigned int row, unsigned int col );
1666
1667 /**
1668 Returns the value from the store.
1669 */
1670 void GetValue( wxVariant &value, unsigned int row, unsigned int col );
1671
1672 /**
1673 Sets the value in the store and update the control.
1674
1675 This method assumes that the a string is stored in respective
1676 column.
1677 */
1678 void SetTextValue( const wxString &value, unsigned int row, unsigned int col );
1679
1680 /**
1681 Returns the value from the store.
1682
1683 This method assumes that the a string is stored in respective
1684 column.
1685 */
1686 wxString GetTextValue( unsigned int row, unsigned int col ) const;
1687
1688 /**
1689 Sets the value in the store and update the control.
1690
1691 This method assumes that the a boolean value is stored in
1692 respective column.
1693 */
1694 void SetToggleValue( bool value, unsigned int row, unsigned int col );
1695
1696 /**
1697 Returns the value from the store.
1698
1699 This method assumes that the a boolean value is stored in
1700 respective column.
1701 */
1702 bool GetToggleValue( unsigned int row, unsigned int col ) const;
1703 };
1704
1705
1706 /**
1707 @class wxDataViewTreeCtrl
1708
1709 This class is a wxDataViewCtrl which internally uses a wxDataViewTreeStore
1710 and forwards most of its API to that class.
1711 Additionally, it uses a wxImageList to store a list of icons.
1712
1713 The main purpose of this class is to look like a wxTreeCtrl to make a transition
1714 from it to the wxDataViewCtrl class simpler.
1715
1716 @library{wxadv}
1717 @category{ctrl,dvc}
1718 @appearance{dataviewtreectrl.png}
1719 */
1720 class wxDataViewTreeCtrl : public wxDataViewCtrl
1721 {
1722 public:
1723 /**
1724 Default ctor.
1725 */
1726 wxDataViewTreeCtrl();
1727
1728 /**
1729 Constructor. Calls Create().
1730 */
1731 wxDataViewTreeCtrl(wxWindow* parent, wxWindowID id,
1732 const wxPoint& pos = wxDefaultPosition,
1733 const wxSize& size = wxDefaultSize,
1734 long style = wxDV_NO_HEADER,
1735 const wxValidator& validator = wxDefaultValidator);
1736
1737 /**
1738 Destructor. Deletes the image list if any.
1739 */
1740 virtual ~wxDataViewTreeCtrl();
1741
1742 /**
1743 Appends a container to the given @a parent.
1744 */
1745 wxDataViewItem AppendContainer(const wxDataViewItem& parent,
1746 const wxString& text,
1747 int icon = -1,
1748 int expanded = -1,
1749 wxClientData* data = NULL);
1750
1751 /**
1752 Appends an item to the given @a parent.
1753 */
1754 wxDataViewItem AppendItem(const wxDataViewItem& parent,
1755 const wxString& text,
1756 int icon = -1,
1757 wxClientData* data = NULL);
1758
1759 /**
1760 Creates the control and a wxDataViewTreeStore as its internal model.
1761 */
1762 bool Create(wxWindow* parent, wxWindowID id,
1763 const wxPoint& pos = wxDefaultPosition,
1764 const wxSize& size = wxDefaultSize,
1765 long style = wxDV_NO_HEADER,
1766 const wxValidator& validator = wxDefaultValidator);
1767
1768 /**
1769 Calls the identical method from wxDataViewTreeStore.
1770 */
1771 void DeleteAllItems();
1772
1773 /**
1774 Calls the identical method from wxDataViewTreeStore.
1775 */
1776 void DeleteChildren(const wxDataViewItem& item);
1777
1778 /**
1779 Calls the identical method from wxDataViewTreeStore.
1780 */
1781 void DeleteItem(const wxDataViewItem& item);
1782
1783 /**
1784 Calls the identical method from wxDataViewTreeStore.
1785 */
1786 int GetChildCount(const wxDataViewItem& parent) const;
1787
1788 /**
1789 Returns the image list.
1790 */
1791 wxImageList* GetImageList();
1792
1793 /**
1794 Calls the identical method from wxDataViewTreeStore.
1795 */
1796 wxClientData* GetItemData(const wxDataViewItem& item) const;
1797
1798 /**
1799 Calls the identical method from wxDataViewTreeStore.
1800 */
1801 const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const;
1802
1803 /**
1804 Calls the identical method from wxDataViewTreeStore.
1805 */
1806 const wxIcon& GetItemIcon(const wxDataViewItem& item) const;
1807
1808 /**
1809 Calls the identical method from wxDataViewTreeStore.
1810 */
1811 wxString GetItemText(const wxDataViewItem& item) const;
1812
1813 /**
1814 Calls the identical method from wxDataViewTreeStore.
1815 */
1816 wxDataViewItem GetNthChild(const wxDataViewItem& parent,
1817 unsigned int pos) const;
1818
1819 //@{
1820 /**
1821 Returns the store.
1822 */
1823 wxDataViewTreeStore* GetStore();
1824 const wxDataViewTreeStore* GetStore() const;
1825 //@}
1826
1827 /**
1828 Calls the same method from wxDataViewTreeStore but uses
1829 an index position in the image list instead of a wxIcon.
1830 */
1831 wxDataViewItem InsertContainer(const wxDataViewItem& parent,
1832 const wxDataViewItem& previous,
1833 const wxString& text,
1834 int icon = -1,
1835 int expanded = -1,
1836 wxClientData* data = NULL);
1837
1838 /**
1839 Calls the same method from wxDataViewTreeStore but uses
1840 an index position in the image list instead of a wxIcon.
1841 */
1842 wxDataViewItem InsertItem(const wxDataViewItem& parent,
1843 const wxDataViewItem& previous,
1844 const wxString& text,
1845 int icon = -1,
1846 wxClientData* data = NULL);
1847
1848 /**
1849 Calls the same method from wxDataViewTreeStore but uses
1850 an index position in the image list instead of a wxIcon.
1851 */
1852 wxDataViewItem PrependContainer(const wxDataViewItem& parent,
1853 const wxString& text,
1854 int icon = -1,
1855 int expanded = -1,
1856 wxClientData* data = NULL);
1857
1858 /**
1859 Calls the same method from wxDataViewTreeStore but uses
1860 an index position in the image list instead of a wxIcon.
1861 */
1862 wxDataViewItem PrependItem(const wxDataViewItem& parent,
1863 const wxString& text,
1864 int icon = -1,
1865 wxClientData* data = NULL);
1866
1867 /**
1868 Sets the image list.
1869 */
1870 void SetImageList(wxImageList* imagelist);
1871
1872 /**
1873 Calls the identical method from wxDataViewTreeStore.
1874 */
1875 void SetItemData(const wxDataViewItem& item, wxClientData* data);
1876
1877 /**
1878 Calls the identical method from wxDataViewTreeStore.
1879 */
1880 void SetItemExpandedIcon(const wxDataViewItem& item,
1881 const wxIcon& icon);
1882
1883 /**
1884 Calls the identical method from wxDataViewTreeStore.
1885 */
1886 void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon);
1887
1888 /**
1889 Calls the identical method from wxDataViewTreeStore.
1890 */
1891 void SetItemText(const wxDataViewItem& item,
1892 const wxString& text);
1893 };
1894
1895
1896 /**
1897 @class wxDataViewListStore
1898
1899 wxDataViewListStore is a specialised wxDataViewModel for storing
1900 a simple table of data. Since it derives from wxDataViewIndexListModel
1901 its data is be accessed by row (i.e. by index) instead of only
1902 by wxDataViewItem.
1903
1904 This class actually stores the values (therefore its name)
1905 and implements all virtual methods from the base classes so it can be
1906 used directly without having to derive any class from it, but it is
1907 mostly used from within wxDataViewListCtrl.
1908
1909 @library{wxadv}
1910 @category{dvc}
1911 */
1912
1913 class wxDataViewListStore: public wxDataViewIndexListModel
1914 {
1915 public:
1916 /**
1917 Constructor
1918 */
1919 wxDataViewListStore();
1920
1921 /**
1922 Destructor
1923 */
1924 ~wxDataViewListStore();
1925
1926 /**
1927 Prepends a data column.
1928
1929 @a variantype indicates the type of values store in the column.
1930
1931 This does not automatically fill in any (default) values in
1932 rows which exist in the store already.
1933 */
1934 void PrependColumn( const wxString &varianttype );
1935
1936 /**
1937 Inserts a data column before @a pos.
1938
1939 @a variantype indicates the type of values store in the column.
1940
1941 This does not automatically fill in any (default) values in
1942 rows which exist in the store already.
1943 */
1944 void InsertColumn( unsigned int pos, const wxString &varianttype );
1945
1946 /**
1947 Apppends a data column.
1948
1949 @a variantype indicates the type of values store in the column.
1950
1951 This does not automatically fill in any (default) values in
1952 rows which exist in the store already.
1953 */
1954 void AppendColumn( const wxString &varianttype );
1955
1956 /**
1957 Appends an item (=row) and fills it with @a values.
1958
1959 The values must match the values specifies in the column
1960 in number and type. No (default) values are filled in
1961 automatically.
1962 */
1963 void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
1964
1965 /**
1966 Prepends an item (=row) and fills it with @a values.
1967
1968 The values must match the values specifies in the column
1969 in number and type. No (default) values are filled in
1970 automatically.
1971 */
1972 void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
1973
1974 /**
1975 Inserts an item (=row) and fills it with @a values.
1976
1977 The values must match the values specifies in the column
1978 in number and type. No (default) values are filled in
1979 automatically.
1980 */
1981 void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL );
1982
1983 /**
1984 Delete the item (=row) at position @a pos.
1985 */
1986 void DeleteItem( unsigned pos );
1987
1988 /**
1989 Delete all item (=all rows) in the store.
1990 */
1991 void DeleteAllItems();
1992
1993 /**
1994 Overriden from wxDataViewModel
1995 */
1996 virtual unsigned int GetColumnCount() const;
1997
1998 /**
1999 Overriden from wxDataViewModel
2000 */
2001 virtual wxString GetColumnType( unsigned int col ) const;
2002
2003 /**
2004 Overriden from wxDataViewIndexListModel
2005 */
2006 virtual void GetValueByRow( wxVariant &value,
2007 unsigned int row, unsigned int col ) const;
2008
2009 /**
2010 Overriden from wxDataViewIndexListModel
2011 */
2012 virtual bool SetValueByRow( const wxVariant &value,
2013 unsigned int row, unsigned int col );
2014 };
2015
2016
2017 /**
2018 @class wxDataViewTreeStore
2019
2020 wxDataViewTreeStore is a specialised wxDataViewModel for stroing simple
2021 trees very much like wxTreeCtrl does and it offers a similar API.
2022
2023 This class actually stores the entire tree and the values (therefore its name)
2024 and implements all virtual methods from the base class so it can be used directly
2025 without having to derive any class from it, but it is mostly used from within
2026 wxDataViewTreeCtrl.
2027
2028 @library{wxadv}
2029 @category{dvc}
2030 */
2031 class wxDataViewTreeStore : public wxDataViewModel
2032 {
2033 public:
2034 /**
2035 Constructor. Creates the invisible root node internally.
2036 */
2037 wxDataViewTreeStore();
2038
2039 /**
2040 Destructor.
2041 */
2042 virtual ~wxDataViewTreeStore();
2043
2044 /**
2045 Append a container.
2046 */
2047 wxDataViewItem AppendContainer(const wxDataViewItem& parent,
2048 const wxString& text,
2049 const wxIcon& icon = wxNullIcon,
2050 const wxIcon& expanded = wxNullIcon,
2051 wxClientData* data = NULL);
2052
2053 /**
2054 Append an item.
2055 */
2056 wxDataViewItem AppendItem(const wxDataViewItem& parent,
2057 const wxString& text,
2058 const wxIcon& icon = wxNullIcon,
2059 wxClientData* data = NULL);
2060
2061 /**
2062 Delete all item in the model.
2063 */
2064 void DeleteAllItems();
2065
2066 /**
2067 Delete all children of the item, but not the item itself.
2068 */
2069 void DeleteChildren(const wxDataViewItem& item);
2070
2071 /**
2072 Delete this item.
2073 */
2074 void DeleteItem(const wxDataViewItem& item);
2075
2076 /**
2077 Return the number of children of item.
2078 */
2079 int GetChildCount(const wxDataViewItem& parent) const;
2080
2081 /**
2082 Returns the client data asoociated with the item.
2083 */
2084 wxClientData* GetItemData(const wxDataViewItem& item) const;
2085
2086 /**
2087 Returns the icon to display in expanded containers.
2088 */
2089 const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const;
2090
2091 /**
2092 Returns the icon of the item.
2093 */
2094 const wxIcon& GetItemIcon(const wxDataViewItem& item) const;
2095
2096 /**
2097 Returns the text of the item.
2098 */
2099 wxString GetItemText(const wxDataViewItem& item) const;
2100
2101 /**
2102 Returns the nth child item of item.
2103 */
2104 wxDataViewItem GetNthChild(const wxDataViewItem& parent,
2105 unsigned int pos) const;
2106
2107 /**
2108 Inserts a container after @a previous.
2109 */
2110 wxDataViewItem InsertContainer(const wxDataViewItem& parent,
2111 const wxDataViewItem& previous,
2112 const wxString& text,
2113 const wxIcon& icon = wxNullIcon,
2114 const wxIcon& expanded = wxNullIcon,
2115 wxClientData* data = NULL);
2116
2117 /**
2118 Inserts an item after @a previous.
2119 */
2120 wxDataViewItem InsertItem(const wxDataViewItem& parent,
2121 const wxDataViewItem& previous,
2122 const wxString& text,
2123 const wxIcon& icon = wxNullIcon,
2124 wxClientData* data = NULL);
2125
2126 /**
2127 Inserts a container before the first child item or @a parent.
2128 */
2129 wxDataViewItem PrependContainer(const wxDataViewItem& parent,
2130 const wxString& text,
2131 const wxIcon& icon = wxNullIcon,
2132 const wxIcon& expanded = wxNullIcon,
2133 wxClientData* data = NULL);
2134
2135 /**
2136 Inserts an item before the first child item or @a parent.
2137 */
2138 wxDataViewItem PrependItem(const wxDataViewItem& parent,
2139 const wxString& text,
2140 const wxIcon& icon = wxNullIcon,
2141 wxClientData* data = NULL);
2142
2143 /**
2144 Sets the client data associated with the item.
2145 */
2146 void SetItemData(const wxDataViewItem& item, wxClientData* data);
2147
2148 /**
2149 Sets the expanded icon for the item.
2150 */
2151 void SetItemExpandedIcon(const wxDataViewItem& item,
2152 const wxIcon& icon);
2153
2154 /**
2155 Sets the icon for the item.
2156 */
2157 void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon);
2158 };
2159
2160
2161 /**
2162 @class wxDataViewIconText
2163
2164 wxDataViewIconText is used by wxDataViewIconTextRenderer for data transfer.
2165 This class can be converted to and from a wxVariant.
2166
2167 @library{wxadv}
2168 @category{dvc}
2169 */
2170 class wxDataViewIconText : public wxObject
2171 {
2172 public:
2173 //@{
2174 /**
2175 Constructor.
2176 */
2177 wxDataViewIconText(const wxString& text = wxEmptyString,
2178 const wxIcon& icon = wxNullIcon);
2179 wxDataViewIconText(const wxDataViewIconText& other);
2180 //@}
2181
2182 /**
2183 Gets the icon.
2184 */
2185 const wxIcon& GetIcon() const;
2186
2187 /**
2188 Gets the text.
2189 */
2190 wxString GetText() const;
2191
2192 /**
2193 Set the icon.
2194 */
2195 void SetIcon(const wxIcon& icon);
2196
2197 /**
2198 Set the text.
2199 */
2200 void SetText(const wxString& text);
2201 };
2202
2203
2204
2205 /**
2206 @class wxDataViewEvent
2207
2208 This is the event class for the wxDataViewCtrl notifications.
2209
2210 @library{wxadv}
2211 @category{events,dvc}
2212 */
2213 class wxDataViewEvent : public wxNotifyEvent
2214 {
2215 public:
2216 /**
2217 Constructor. Typically used by wxWidgets internals only.
2218 */
2219 wxDataViewEvent(wxEventType commandType = wxEVT_NULL,
2220 int winid = 0);
2221
2222 /**
2223 Returns the position of the column in the control or -1
2224 if no column field was set by the event emitter.
2225 */
2226 int GetColumn() const;
2227
2228 /**
2229 Returns a pointer to the wxDataViewColumn from which
2230 the event was emitted or @NULL.
2231 */
2232 wxDataViewColumn* GetDataViewColumn() const;
2233
2234 /**
2235 Returns the wxDataViewModel associated with the event.
2236 */
2237 wxDataViewModel* GetModel() const;
2238
2239 /**
2240 Returns a the position of a context menu event in screen coordinates.
2241 */
2242 wxPoint GetPosition() const;
2243
2244 /**
2245 Returns a reference to a value.
2246 */
2247 const wxVariant& GetValue() const;
2248
2249 /**
2250 Sets the column index associated with this event.
2251 */
2252 void SetColumn(int col);
2253
2254 /**
2255 For wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only.
2256 */
2257 void SetDataViewColumn(wxDataViewColumn* col);
2258
2259 /**
2260 Sets the dataview model associated with this event.
2261 */
2262 void SetModel(wxDataViewModel* model);
2263
2264 /**
2265 Sets the value associated with this event.
2266 */
2267 void SetValue(const wxVariant& value);
2268
2269 /**
2270 Set wxDataObject for data transfer within a drag operation.
2271 */
2272 void SetDataObject( wxDataObject *obj );
2273
2274 /**
2275 Used internally. Gets associated wxDataObject for data transfer
2276 within a drag operation.
2277 */
2278 wxDataObject *GetDataObject() const;
2279
2280 /**
2281 Used internally. Sets the wxDataFormat during a drop operation.
2282 */
2283 void SetDataFormat( const wxDataFormat &format );
2284
2285 /**
2286 Gets the wxDataFormat during a drop operation.
2287 */
2288 wxDataFormat GetDataFormat() const;
2289
2290 /**
2291 Used internally. Sets the data size for a drop data transfer.
2292 */
2293 void SetDataSize( size_t size );
2294
2295 /**
2296 Gets the data size for a drop data transfer.
2297 */
2298 size_t GetDataSize() const;
2299
2300 /**
2301 Used internally. Sets the data buffer for a drop data transfer.
2302 */
2303 void SetDataBuffer( void* buf );
2304
2305 /**
2306 Gets the data buffer for a drop data transfer.
2307 */
2308 void *GetDataBuffer() const;
2309 };
2310