]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/dataview.h
Document wxTP_DEFAULT as a standalone constant.
[wxWidgets.git] / interface / wx / dataview.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: dataview.h
80932a3e 3// Purpose: interface of wxDataView* classes
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
b321b61c 9
23324ae1
FM
10/**
11 @class wxDataViewModel
7c913512 12
c4e57202
FM
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
a36bceb6
RR
23 Note that wxDataViewModel does not define the position or index of any item
24 in the control because different controls might display the same data differently.
25 wxDataViewModel does provide a wxDataViewModel::Compare method which the
26 wxDataViewCtrl may use to sort the data either in conjunction with a column
27 header or without (see wxDataViewModel::HasDefaultCompare).
7c913512 28
c4e57202
FM
29 wxDataViewModel (as indeed the entire wxDataViewCtrl code) is using wxVariant
30 to store data and its type in a generic way. wxVariant can be extended to contain
a36bceb6
RR
31 almost any data without changes to the original class. To a certain extent,
32 you can use (the somewhat more elegant) wxAny instead of wxVariant as there
33 is code to convert between the two, but it is unclear what impact this will
34 have on performance.
35
36 Since you will usually allow the wxDataViewCtrl to change your data
37 through its graphical interface, you will also have to override
38 wxDataViewModel::SetValue which the wxDataViewCtrl will call when a change
39 to some data has been committed.
7c913512 40
a36bceb6
RR
41 If the data represented by the model is changed by something else than its
42 associated wxDataViewCtrl, the control has to be notified about the change.
c4e57202
FM
43 Depending on what happened you need to call one of the following methods:
44 - wxDataViewModel::ValueChanged,
45 - wxDataViewModel::ItemAdded,
46 - wxDataViewModel::ItemDeleted,
47 - wxDataViewModel::ItemChanged,
48 - wxDataViewModel::Cleared.
49
50 There are plural forms for notification of addition, change or removal of
51 several item at once. See:
52 - wxDataViewModel::ItemsAdded,
53 - wxDataViewModel::ItemsDeleted,
54 - wxDataViewModel::ItemsChanged.
55
c4e57202
FM
56 This class maintains a list of wxDataViewModelNotifier which link this class
57 to the specific implementations on the supported platforms so that e.g. calling
58 wxDataViewModel::ValueChanged on this model will just call
59 wxDataViewModelNotifier::ValueChanged for each notifier that has been added.
60 You can also add your own notifier in order to get informed about any changes
23324ae1 61 to the data in the list model.
7c913512 62
c4e57202 63 Currently wxWidgets provides the following models apart from the base model:
bda698ed
RR
64 wxDataViewIndexListModel, wxDataViewVirtualListModel, wxDataViewTreeStore,
65 wxDataViewListStore.
7c913512 66
e4e83d3a 67 Note that wxDataViewModel is reference counted, derives from wxRefCounter
c4e57202
FM
68 and cannot be deleted directly as it can be shared by several wxDataViewCtrls.
69 This implies that you need to decrease the reference count after
23324ae1 70 associating the model with a control like this:
7c913512 71
23324ae1 72 @code
14f73cf1 73 wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, wxID_ANY );
23324ae1 74 wxDataViewModel *musicModel = new MyMusicModel;
14f73cf1
FM
75 m_musicCtrl->AssociateModel( musicModel );
76 musicModel->DecRef(); // avoid memory leak !!
43c64cc6 77
23324ae1
FM
78 // add columns now
79 @endcode
7c913512 80
a36bceb6
RR
81 A potentially better way to avoid memory leaks is to use wxObjectDataPtr
82
83 @code
84 wxObjectDataPtr<MyMusicModel> musicModel;
85
86 wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, wxID_ANY );
87 musicModel = new MyMusicModel;
88 m_musicCtrl->AssociateModel( musicModel.get() );
89
90 // add columns now
91 @endcode
92
93
23324ae1 94 @library{wxadv}
b321b61c 95 @category{dvc}
23324ae1 96*/
e4e83d3a 97class wxDataViewModel : public wxRefCounter
23324ae1
FM
98{
99public:
100 /**
101 Constructor.
102 */
103 wxDataViewModel();
104
23324ae1 105 /**
c4e57202 106 Adds a wxDataViewModelNotifier to the model.
23324ae1
FM
107 */
108 void AddNotifier(wxDataViewModelNotifier* notifier);
109
795dac4c
VZ
110 /**
111 Change the value of the given item and update the control to reflect
112 it.
113
114 This function simply calls SetValue() and, if it succeeded,
115 ValueChanged().
116
117 @since 2.9.1
118
d86f721a 119 @param variant
795dac4c
VZ
120 The new value.
121 @param item
122 The item (row) to update.
123 @param col
124 The column to update.
125 @return
126 @true if both SetValue() and ValueChanged() returned @true.
127 */
128 bool ChangeValue(const wxVariant& variant,
129 const wxDataViewItem& item,
130 unsigned int col);
131
23324ae1 132 /**
c4e57202
FM
133 Called to inform the model that all data has been cleared.
134 The control will reread the data from the model again.
23324ae1
FM
135 */
136 virtual bool Cleared();
137
138 /**
139 The compare function to be used by control. The default compare function
140 sorts by container and other items separately and in ascending order.
141 Override this for a different sorting behaviour.
c4e57202
FM
142
143 @see HasDefaultCompare().
23324ae1
FM
144 */
145 virtual int Compare(const wxDataViewItem& item1,
146 const wxDataViewItem& item2,
147 unsigned int column,
862de7b3 148 bool ascending) const;
23324ae1
FM
149
150 /**
13f184c0 151 Override this to indicate that the item has special font attributes.
c4e57202
FM
152 This only affects the wxDataViewTextRendererText renderer.
153
7fadac88
VZ
154 The base class version always simply returns @false.
155
c4e57202 156 @see wxDataViewItemAttr.
7fadac88
VZ
157
158 @param item
159 The item for which the attribute is requested.
160 @param col
161 The column of the item for which the attribute is requested.
162 @param attr
163 The attribute to be filled in if the function returns @true.
164 @return
165 @true if this item has an attribute or @false otherwise.
23324ae1 166 */
fadc2df6 167 virtual bool GetAttr(const wxDataViewItem& item, unsigned int col,
7fadac88 168 wxDataViewItemAttr& attr) const;
23324ae1 169
98f8e666
VZ
170 /**
171 Override this to indicate that the item should be disabled.
172
173 Disabled items are displayed differently (e.g. grayed out) and cannot
174 be interacted with.
175
176 The base class version always returns @true, thus making all items
177 enabled by default.
178
179 @param item
180 The item whose enabled status is requested.
181 @param col
182 The column of the item whose enabled status is requested.
183 @return
184 @true if this item should be enabled, @false otherwise.
185
cf5d4c76 186 @note Currently disabling items is not supported by the wxOSX/Carbon
e97f9fbd 187 implementation.
98f8e666
VZ
188
189 @since 2.9.2
190 */
191 virtual bool IsEnabled(const wxDataViewItem &item,
192 unsigned int col) const;
193
23324ae1 194 /**
c4e57202
FM
195 Override this so the control can query the child items of an item.
196 Returns the number of items.
23324ae1
FM
197 */
198 virtual unsigned int GetChildren(const wxDataViewItem& item,
fadc2df6 199 wxDataViewItemArray& children) const = 0;
23324ae1
FM
200
201 /**
202 Override this to indicate the number of columns in the model.
203 */
b91c4601 204 virtual unsigned int GetColumnCount() const = 0;
23324ae1
FM
205
206 /**
207 Override this to indicate what type of data is stored in the
c4e57202
FM
208 column specified by @a col.
209
210 This should return a string indicating the type of data as reported by wxVariant.
23324ae1 211 */
b91c4601 212 virtual wxString GetColumnType(unsigned int col) const = 0;
23324ae1
FM
213
214 /**
215 Override this to indicate which wxDataViewItem representing the parent
57ab6f23 216 of @a item or an invalid wxDataViewItem if the root item is
23324ae1
FM
217 the parent item.
218 */
b91c4601 219 virtual wxDataViewItem GetParent(const wxDataViewItem& item) const = 0;
23324ae1
FM
220
221 /**
c4e57202 222 Override this to indicate the value of @a item.
23324ae1
FM
223 A wxVariant is used to store the data.
224 */
b91c4601
FM
225 virtual void GetValue(wxVariant& variant, const wxDataViewItem& item,
226 unsigned int col) const = 0;
23324ae1
FM
227
228 /**
c4e57202
FM
229 Override this method to indicate if a container item merely acts as a
230 headline (or for categorisation) or if it also acts a normal item with
57ab6f23 231 entries for further columns. By default returns @false.
23324ae1 232 */
328f5751 233 virtual bool HasContainerColumns(const wxDataViewItem& item) const;
23324ae1
FM
234
235 /**
236 Override this to indicate that the model provides a default compare
237 function that the control should use if no wxDataViewColumn has been
238 chosen for sorting. Usually, the user clicks on a column header for
c4e57202
FM
239 sorting, the data will be sorted alphanumerically.
240
241 If any other order (e.g. by index or order of appearance) is required,
242 then this should be used.
243 See wxDataViewIndexListModel for a model which makes use of this.
23324ae1 244 */
328f5751 245 virtual bool HasDefaultCompare() const;
23324ae1 246
b372f20e
VZ
247 /**
248 Return true if there is a value in the given column of this item.
249
250 All normal items have values in all columns but the container items
251 only show their label in the first column (@a col == 0) by default (but
252 see HasContainerColumns()). So this function always returns true for
253 the first column while for the other ones it returns true only if the
254 item is not a container or HasContainerColumns() was overridden to
255 return true for it.
256
257 @since 2.9.1
258 */
259 bool HasValue(const wxDataViewItem& item, unsigned col) const;
260
23324ae1 261 /**
4cc4bfaf 262 Override this to indicate of @a item is a container, i.e. if
23324ae1
FM
263 it can have child items.
264 */
b91c4601 265 virtual bool IsContainer(const wxDataViewItem& item) const = 0;
23324ae1
FM
266
267 /**
c4e57202 268 Call this to inform the model that an item has been added to the data.
23324ae1 269 */
9ca2afd1 270 bool ItemAdded(const wxDataViewItem& parent,
23324ae1
FM
271 const wxDataViewItem& item);
272
273 /**
274 Call this to inform the model that an item has changed.
c4e57202 275
3a194bda 276 This will eventually emit a @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
23324ae1
FM
277 event (in which the column fields will not be set) to the user.
278 */
9ca2afd1 279 bool ItemChanged(const wxDataViewItem& item);
23324ae1
FM
280
281 /**
282 Call this to inform the model that an item has been deleted from the data.
283 */
9ca2afd1 284 bool ItemDeleted(const wxDataViewItem& parent,
23324ae1
FM
285 const wxDataViewItem& item);
286
287 /**
c4e57202 288 Call this to inform the model that several items have been added to the data.
23324ae1 289 */
9ca2afd1 290 bool ItemsAdded(const wxDataViewItem& parent,
23324ae1
FM
291 const wxDataViewItemArray& items);
292
293 /**
294 Call this to inform the model that several items have changed.
c4e57202 295
3a194bda 296 This will eventually emit @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
23324ae1
FM
297 events (in which the column fields will not be set) to the user.
298 */
9ca2afd1 299 bool ItemsChanged(const wxDataViewItemArray& items);
23324ae1
FM
300
301 /**
302 Call this to inform the model that several items have been deleted.
303 */
9ca2afd1 304 bool ItemsDeleted(const wxDataViewItem& parent,
23324ae1
FM
305 const wxDataViewItemArray& items);
306
307 /**
4cc4bfaf 308 Remove the @a notifier from the list of notifiers.
23324ae1
FM
309 */
310 void RemoveNotifier(wxDataViewModelNotifier* notifier);
311
312 /**
c4e57202 313 Call this to initiate a resort after the sort function has been changed.
23324ae1
FM
314 */
315 virtual void Resort();
316
317 /**
318 This gets called in order to set a value in the data model.
795dac4c 319
c4e57202
FM
320 The most common scenario is that the wxDataViewCtrl calls this method
321 after the user changed some data in the view.
322
795dac4c
VZ
323 This is the function you need to override in your derived class but if
324 you want to call it, ChangeValue() is usually more convenient as
325 otherwise you need to manually call ValueChanged() to update the
326 control itself.
23324ae1 327 */
795dac4c
VZ
328 virtual bool SetValue(const wxVariant& variant,
329 const wxDataViewItem& item,
b91c4601 330 unsigned int col) = 0;
23324ae1
FM
331
332 /**
c4e57202
FM
333 Call this to inform this model that a value in the model has been changed.
334 This is also called from wxDataViewCtrl's internal editing code, e.g. when
335 editing a text field in the control.
336
3a194bda 337 This will eventually emit a @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
23324ae1
FM
338 event to the user.
339 */
340 virtual bool ValueChanged(const wxDataViewItem& item,
341 unsigned int col);
5e6e278d
FM
342
343protected:
344
345 /**
346 Destructor. This should not be called directly. Use DecRef() instead.
347 */
348 virtual ~wxDataViewModel();
23324ae1
FM
349};
350
351
e54c96f1 352
e39de702 353/**
b955766e 354 @class wxDataViewListModel
e39de702 355
b955766e
RR
356 Base class with abstract API for wxDataViewIndexListModel and
357 wxDataViewVirtualListModel.
e39de702 358
8ed522d9 359 @library{wxadv}
b321b61c 360 @category{dvc}
e39de702 361*/
b955766e 362class wxDataViewListModel : public wxDataViewModel
e39de702
RR
363{
364public:
e39de702
RR
365
366 /**
367 Destructor.
368 */
adaaa686 369 virtual ~wxDataViewIndexListModel();
e39de702
RR
370
371 /**
372 Compare method that sorts the items by their index.
373 */
374 int Compare(const wxDataViewItem& item1,
375 const wxDataViewItem& item2,
2ccd2adc 376 unsigned int column, bool ascending) const;
e39de702
RR
377
378 /**
13f184c0 379 Override this to indicate that the row has special font attributes.
c4e57202
FM
380 This only affects the wxDataViewTextRendererText() renderer.
381
7fadac88
VZ
382 The base class version always simply returns @false.
383
c4e57202 384 @see wxDataViewItemAttr.
7fadac88
VZ
385
386 @param row
387 The row for which the attribute is requested.
388 @param col
389 The column for which the attribute is requested.
390 @param attr
391 The attribute to be filled in if the function returns @true.
392 @return
393 @true if this item has an attribute or @false otherwise.
e39de702 394 */
8eff6c56 395 virtual bool GetAttrByRow(unsigned int row, unsigned int col,
7fadac88 396 wxDataViewItemAttr& attr) const;
e39de702 397
98f8e666
VZ
398 /**
399 Override this if you want to disable specific items.
400
401 The base class version always returns @true, thus making all items
402 enabled by default.
403
404 @param row
405 The row of the item whose enabled status is requested.
406 @param col
407 The column of the item whose enabled status is requested.
408 @return
409 @true if the item at this row and column should be enabled,
410 @false otherwise.
411
412 @note See wxDataViewModel::IsEnabled() for the current status of
413 support for disabling the items under different platforms.
414
415 @since 2.9.2
416 */
417 virtual bool IsEnabledByRow(unsigned int row,
418 unsigned int col) const;
419
74d9b8fb 420 /**
47e2f881 421 Returns the number of items (or rows) in the list.
74d9b8fb
VZ
422 */
423 unsigned int GetCount() const;
424
e39de702
RR
425 /**
426 Returns the wxDataViewItem at the given @e row.
427 */
428 wxDataViewItem GetItem(unsigned int row) const;
429
430 /**
431 Returns the position of given @e item.
432 */
433 unsigned int GetRow(const wxDataViewItem& item) const;
434
435 /**
436 Override this to allow getting values from the model.
437 */
8eff6c56 438 virtual void GetValueByRow(wxVariant& variant, unsigned int row,
fadc2df6 439 unsigned int col) const = 0;
e39de702
RR
440
441 /**
c4e57202
FM
442 Call this after if the data has to be read again from the model.
443 This is useful after major changes when calling the methods below
444 (possibly thousands of times) doesn't make sense.
e39de702
RR
445 */
446 void Reset(unsigned int new_size);
447
448 /**
449 Call this after a row has been appended to the model.
450 */
451 void RowAppended();
452
453 /**
454 Call this after a row has been changed.
455 */
456 void RowChanged(unsigned int row);
457
458 /**
459 Call this after a row has been deleted.
460 */
461 void RowDeleted(unsigned int row);
462
463 /**
464 Call this after a row has been inserted at the given position.
465 */
466 void RowInserted(unsigned int before);
467
468 /**
469 Call this after a row has been prepended to the model.
470 */
471 void RowPrepended();
472
473 /**
474 Call this after a value has been changed.
475 */
476 void RowValueChanged(unsigned int row, unsigned int col);
477
478 /**
c4e57202
FM
479 Call this after rows have been deleted.
480 The array will internally get copied and sorted in descending order so
481 that the rows with the highest position will be deleted first.
e39de702
RR
482 */
483 void RowsDeleted(const wxArrayInt& rows);
484
485 /**
486 Called in order to set a value in the model.
487 */
8eff6c56 488 virtual bool SetValueByRow(const wxVariant& variant, unsigned int row,
fadc2df6 489 unsigned int col) = 0;
e39de702
RR
490};
491
492
b955766e
RR
493/**
494 @class wxDataViewIndexListModel
495
496 wxDataViewIndexListModel is a specialized data model which lets you address
497 an item by its position (row) rather than its wxDataViewItem (which you can
498 obtain from this class).
499 This model also provides its own wxDataViewIndexListModel::Compare
500 method which sorts the model's data by the index.
501
502 This model is not a virtual model since the control stores each wxDataViewItem.
503 Use wxDataViewVirtualListModel if you need to display millions of items or
504 have other reason to use a virtual control.
505
506 @see wxDataViewListModel for the API.
507
508 @library{wxadv}
509 @category{dvc}
510*/
511
512class wxDataViewIndexListModel : public wxDataViewListModel
513{
514public:
515 /**
516 Constructor.
517 */
518 wxDataViewIndexListModel(unsigned int initial_size = 0);
519
520};
e39de702
RR
521
522/**
523 @class wxDataViewVirtualListModel
e39de702 524
c4e57202
FM
525 wxDataViewVirtualListModel is a specialized data model which lets you address
526 an item by its position (row) rather than its wxDataViewItem and as such offers
527 the exact same interface as wxDataViewIndexListModel.
528 The important difference is that under platforms other than OS X, using this
529 model will result in a truly virtual control able to handle millions of items
b955766e 530 as the control doesn't store any item (a feature not supported by OS X).
e39de702 531
b955766e 532 @see wxDataViewListModel for the API.
e39de702 533
8ed522d9 534 @library{wxadv}
b321b61c 535 @category{dvc}
e39de702 536*/
b955766e
RR
537
538class wxDataViewVirtualListModel : public wxDataViewListModel
e39de702
RR
539{
540public:
541 /**
542 Constructor.
543 */
544 wxDataViewVirtualListModel(unsigned int initial_size = 0);
74d9b8fb 545
6da3d196 546};
e39de702
RR
547
548
549
23324ae1
FM
550/**
551 @class wxDataViewItemAttr
7c913512 552
c4e57202
FM
553 This class is used to indicate to a wxDataViewCtrl that a certain item
554 (see wxDataViewItem) has extra font attributes for its renderer.
555 For this, it is required to override wxDataViewModel::GetAttr.
7c913512 556
c4e57202 557 Attributes are currently only supported by wxDataViewTextRendererText.
7c913512 558
23324ae1 559 @library{wxadv}
b321b61c 560 @category{dvc}
23324ae1 561*/
7c913512 562class wxDataViewItemAttr
23324ae1
FM
563{
564public:
565 /**
566 Constructor.
567 */
568 wxDataViewItemAttr();
569
570 /**
571 Call this to indicate that the item shall be displayed in bold text.
572 */
573 void SetBold(bool set);
574
575 /**
c4e57202 576 Call this to indicate that the item shall be displayed with that colour.
23324ae1
FM
577 */
578 void SetColour(const wxColour& colour);
579
1c959a62
VZ
580 /**
581 Call this to set the background colour to use.
582
583 Currently this attribute is only supported in the generic version of
584 wxDataViewCtrl and ignored by the native GTK+ and OS X implementations.
585
586 @since 2.9.4
587 */
588 void SetBackgroundColour(const wxColour& colour);
589
23324ae1
FM
590 /**
591 Call this to indicate that the item shall be displayed in italic text.
592 */
593 void SetItalic(bool set);
594};
595
596
e54c96f1 597
23324ae1
FM
598/**
599 @class wxDataViewItem
7c913512 600
c4e57202 601 wxDataViewItem is a small opaque class that represents an item in a wxDataViewCtrl
fe45d6ff 602 in a persistent way, i.e. independent of the position of the item in the control
c4e57202
FM
603 or changes to its contents.
604
605 It must hold a unique ID of type @e void* in its only field and can be converted
606 to and from it.
607
608 If the ID is @NULL the wxDataViewItem is invalid and wxDataViewItem::IsOk will
609 return @false which used in many places in the API of wxDataViewCtrl to
610 indicate that e.g. no item was found. An ID of @NULL is also used to indicate
611 the invisible root. Examples for this are wxDataViewModel::GetParent and
23324ae1 612 wxDataViewModel::GetChildren.
7c913512 613
23324ae1 614 @library{wxadv}
b321b61c 615 @category{dvc}
23324ae1 616*/
7c913512 617class wxDataViewItem
23324ae1
FM
618{
619public:
620 //@{
621 /**
c4e57202 622 Constructor.
23324ae1 623 */
d5c4a81f 624 wxDataViewItem();
7c913512 625 wxDataViewItem(const wxDataViewItem& item);
d5c4a81f 626 explicit wxDataViewItem(void* id);
23324ae1
FM
627 //@}
628
629 /**
630 Returns the ID.
631 */
328f5751 632 void* GetID() const;
23324ae1
FM
633
634 /**
c4e57202 635 Returns @true if the ID is not @NULL.
23324ae1 636 */
328f5751 637 bool IsOk() const;
23324ae1
FM
638};
639
640
e9321277
RD
641// ----------------------------------------------------------------------------
642// wxDataViewCtrl flags
643// ----------------------------------------------------------------------------
644
645// size of a wxDataViewRenderer without contents:
646#define wxDVC_DEFAULT_RENDERER_SIZE 20
647
648// the default width of new (text) columns:
649#define wxDVC_DEFAULT_WIDTH 80
650
651// the default width of new toggle columns:
652#define wxDVC_TOGGLE_DEFAULT_WIDTH 30
653
654// the default minimal width of the columns:
655#define wxDVC_DEFAULT_MINWIDTH 30
656
657// The default alignment of wxDataViewRenderers is to take
658// the alignment from the column it owns.
659#define wxDVR_DEFAULT_ALIGNMENT -1
660
661#define wxDV_SINGLE 0x0000 // for convenience
662#define wxDV_MULTIPLE 0x0001 // can select multiple items
663
664#define wxDV_NO_HEADER 0x0002 // column titles not visible
665#define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
666#define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
667
668#define wxDV_ROW_LINES 0x0010 // alternating colour in rows
669#define wxDV_VARIABLE_LINE_HEIGHT 0x0020 // variable line height
670
ea8fa3c4
RD
671// events
672
673wxEventType wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED;
674
675wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED;
676wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING;
677wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED;
678wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING;
679wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED;
680wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING;
681wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED;
682wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE;
683wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED;
684
685wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU;
686
687wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK;
688wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK;
689wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED;
690wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED;
691wxEventType wxEVT_COMMAND_DATAVIEW_CACHE_HINT;
692
693wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG;
694wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE;
695wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_DROP;
e54c96f1 696
23324ae1
FM
697/**
698 @class wxDataViewCtrl
7c913512 699
c4e57202
FM
700 wxDataViewCtrl is a control to display data either in a tree like fashion or
701 in a tabular form or both.
02b51ae5 702
c4e57202
FM
703 If you only need to display a simple tree structure with an API more like the
704 older wxTreeCtrl class, then the specialized wxDataViewTreeCtrl can be used.
02b51ae5 705 Likewise, if you only want to display simple table structure you can use
832df171
RR
706 the specialized wxDataViewListCtrl class. Both wxDataViewTreeCtrl and
707 wxDataViewListCtrl can be used without defining your own wxDataViewModel.
c4e57202
FM
708
709 A wxDataViewItem is used to represent a (visible) item in the control.
710
80932a3e 711 Unlike wxListCtrl, wxDataViewCtrl doesn't get its data from the user through
c4e57202
FM
712 virtual functions or by setting it directly. Instead you need to write your own
713 wxDataViewModel and associate it with this control.
714 Then you need to add a number of wxDataViewColumn to this control to define
715 what each column shall display. Each wxDataViewColumn in turn owns 1 instance
716 of a wxDataViewRenderer to render its cells.
717
718 A number of standard renderers for rendering text, dates, images, toggle,
719 a progress bar etc. are provided. Additionally, the user can write custom
80932a3e 720 renderers deriving from wxDataViewCustomRenderer for displaying anything.
c4e57202
FM
721
722 All data transfer from the control to the model and the user code is done
723 through wxVariant which can be extended to support more data formats as necessary.
724 Accordingly, all type information uses the strings returned from wxVariant::GetType.
7c913512 725
23324ae1 726 @beginStyleTable
8c6791e4 727 @style{wxDV_SINGLE}
23324ae1 728 Single selection mode. This is the default.
8c6791e4 729 @style{wxDV_MULTIPLE}
23324ae1 730 Multiple selection mode.
8c6791e4 731 @style{wxDV_ROW_LINES}
23324ae1 732 Use alternating colours for rows if supported by platform and theme.
cc72cde0
VZ
733 Currently only supported by the native GTK and OS X implementations
734 but not by the generic one.
8c6791e4 735 @style{wxDV_HORIZ_RULES}
23324ae1 736 Display fine rules between row if supported.
8c6791e4 737 @style{wxDV_VERT_RULES}
23324ae1 738 Display fine rules between columns is supported.
d7c6d397 739 @style{wxDV_VARIABLE_LINE_HEIGHT}
c4e57202 740 Allow variable line heights.
14f73cf1 741 This can be inefficient when displaying large number of items.
b5123fb6
VZ
742 @style{wxDV_NO_HEADER}
743 Do not show column headers (which are shown by default).
23324ae1 744 @endStyleTable
7c913512 745
3051a44a 746 @beginEventEmissionTable{wxDataViewEvent}
7d01d660 747 @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)}
14f73cf1 748 Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event.
7d01d660 749 @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)}
14f73cf1 750 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.
3e978cf7 751 @event{EVT_DATAVIEW_ITEM_START_EDITING(id, func)}
b0c7cd8e 752 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING event. This
3e978cf7 753 event can be vetoed in order to prevent editing on an item by item
b0c7cd8e 754 basis.
7d01d660 755 @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)}
14f73cf1 756 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event.
7d01d660 757 @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)}
14f73cf1 758 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event.
7d01d660 759 @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)}
14f73cf1 760 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event.
7d01d660 761 @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)}
14f73cf1 762 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event.
7d01d660 763 @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)}
14f73cf1 764 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event.
7d01d660 765 @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)}
14f73cf1 766 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event.
7d01d660 767 @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)}
14f73cf1 768 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event.
7d01d660 769 @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)}
7ed24cb6
VZ
770 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event
771 generated when the user right clicks inside the control. Notice that
772 this menu is generated even if the click didn't occur on any valid
773 item, in this case wxDataViewEvent::GetItem() simply returns an
774 invalid item.
7d01d660 775 @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)}
2392b8e8 776 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK event.
7d01d660 777 @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)}
14f73cf1 778 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event.
7d01d660 779 @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)}
14f73cf1 780 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event.
7d01d660 781 @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
14f73cf1 782 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event.
591cc82d 783 @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)}
14f73cf1 784 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event.
e4de825e 785 @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)}
14f73cf1 786 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event.
e4de825e 787 @event{EVT_DATAVIEW_ITEM_DROP(id, func)}
14f73cf1 788 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event.
7d01d660 789 @endEventTable
b91c4601 790
23324ae1 791 @library{wxadv}
b321b61c 792 @category{ctrl,dvc}
7e59b885 793 @appearance{dataviewctrl.png}
23324ae1
FM
794*/
795class wxDataViewCtrl : public wxControl
796{
797public:
23324ae1 798 /**
19723525 799 Default Constructor.
23324ae1
FM
800 */
801 wxDataViewCtrl();
b91c4601 802
19723525
RR
803 /**
804 Constructor. Calls Create().
805 */
7c913512
FM
806 wxDataViewCtrl(wxWindow* parent, wxWindowID id,
807 const wxPoint& pos = wxDefaultPosition,
808 const wxSize& size = wxDefaultSize,
809 long style = 0,
8eb99915
RR
810 const wxValidator& validator = wxDefaultValidator,
811 const wxString& name = wxDataViewCtrlNameStr);
23324ae1
FM
812
813 /**
814 Destructor.
815 */
adaaa686 816 virtual ~wxDataViewCtrl();
23324ae1 817
e39de702 818 /**
19723525 819 Appends a wxDataViewColumn to the control. Returns @true on success.
c4e57202 820
e39de702
RR
821 Note that there is a number of short cut methods which implicitly create
822 a wxDataViewColumn and a wxDataViewRenderer for it (see below).
823 */
824 virtual bool AppendColumn(wxDataViewColumn* col);
825
19723525
RR
826 /**
827 Prepends a wxDataViewColumn to the control. Returns @true on success.
c4e57202 828
19723525
RR
829 Note that there is a number of short cut methods which implicitly create
830 a wxDataViewColumn and a wxDataViewRenderer for it.
831 */
832 virtual bool PrependColumn(wxDataViewColumn* col);
833
834 /**
835 Inserts a wxDataViewColumn to the control. Returns @true on success.
836 */
837 virtual bool InsertColumn(unsigned int pos, wxDataViewColumn* col);
b91c4601 838
23324ae1
FM
839 //@{
840 /**
841 Appends a column for rendering a bitmap. Returns the wxDataViewColumn
842 created in the function or @NULL on failure.
843 */
844 wxDataViewColumn* AppendBitmapColumn(const wxString& label,
845 unsigned int model_column,
846 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
847 int width = -1,
848 wxAlignment align = wxALIGN_CENTER,
849 int flags = wxDATAVIEW_COL_RESIZABLE);
7c913512
FM
850 wxDataViewColumn* AppendBitmapColumn(const wxBitmap& label,
851 unsigned int model_column,
852 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
853 int width = -1,
854 wxAlignment align = wxALIGN_CENTER,
855 int flags = wxDATAVIEW_COL_RESIZABLE);
23324ae1
FM
856 //@}
857
23324ae1
FM
858 //@{
859 /**
860 Appends a column for rendering a date. Returns the wxDataViewColumn
861 created in the function or @NULL on failure.
b91c4601 862
c4e57202
FM
863 @note The @a align parameter is applied to both the column header and
864 the column renderer.
23324ae1
FM
865 */
866 wxDataViewColumn* AppendDateColumn(const wxString& label,
867 unsigned int model_column,
868 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
869 int width = -1,
882678eb 870 wxAlignment align = wxALIGN_NOT,
23324ae1 871 int flags = wxDATAVIEW_COL_RESIZABLE);
7c913512
FM
872 wxDataViewColumn* AppendDateColumn(const wxBitmap& label,
873 unsigned int model_column,
874 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
875 int width = -1,
882678eb 876 wxAlignment align = wxALIGN_NOT,
7c913512 877 int flags = wxDATAVIEW_COL_RESIZABLE);
23324ae1
FM
878 //@}
879
880 //@{
881 /**
882 Appends a column for rendering text with an icon. Returns the wxDataViewColumn
c4e57202
FM
883 created in the function or @NULL on failure.
884 This method uses the wxDataViewIconTextRenderer class.
b91c4601 885
c4e57202
FM
886 @note The @a align parameter is applied to both the column header and
887 the column renderer.
23324ae1
FM
888 */
889 wxDataViewColumn* AppendIconTextColumn(const wxString& label,
890 unsigned int model_column,
891 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
892 int width = -1,
882678eb 893 wxAlignment align = wxALIGN_NOT,
23324ae1 894 int flags = wxDATAVIEW_COL_RESIZABLE);
7c913512
FM
895 wxDataViewColumn* AppendIconTextColumn(const wxBitmap& label,
896 unsigned int model_column,
897 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
898 int width = -1,
882678eb 899 wxAlignment align = wxALIGN_NOT,
7c913512 900 int flags = wxDATAVIEW_COL_RESIZABLE);
23324ae1
FM
901 //@}
902
903 //@{
904 /**
905 Appends a column for rendering a progress indicator. Returns the
e39de702 906 wxDataViewColumn created in the function or @NULL on failure.
b91c4601 907
c4e57202
FM
908 @note The @a align parameter is applied to both the column header and
909 the column renderer.
23324ae1
FM
910 */
911 wxDataViewColumn* AppendProgressColumn(const wxString& label,
912 unsigned int model_column,
913 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
914 int width = 80,
915 wxAlignment align = wxALIGN_CENTER,
916 int flags = wxDATAVIEW_COL_RESIZABLE);
7c913512
FM
917 wxDataViewColumn* AppendProgressColumn(const wxBitmap& label,
918 unsigned int model_column,
919 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
920 int width = 80,
921 wxAlignment align = wxALIGN_CENTER,
922 int flags = wxDATAVIEW_COL_RESIZABLE);
23324ae1
FM
923 //@}
924
925 //@{
926 /**
927 Appends a column for rendering text. Returns the wxDataViewColumn
928 created in the function or @NULL on failure.
b91c4601 929
c4e57202
FM
930 @note The @a align parameter is applied to both the column header and
931 the column renderer.
23324ae1
FM
932 */
933 wxDataViewColumn* AppendTextColumn(const wxString& label,
934 unsigned int model_column,
935 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
936 int width = -1,
882678eb 937 wxAlignment align = wxALIGN_NOT,
23324ae1 938 int flags = wxDATAVIEW_COL_RESIZABLE);
7c913512
FM
939 wxDataViewColumn* AppendTextColumn(const wxBitmap& label,
940 unsigned int model_column,
941 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
942 int width = -1,
882678eb 943 wxAlignment align = wxALIGN_NOT,
7c913512 944 int flags = wxDATAVIEW_COL_RESIZABLE);
23324ae1
FM
945 //@}
946
947 //@{
948 /**
949 Appends a column for rendering a toggle. Returns the wxDataViewColumn
950 created in the function or @NULL on failure.
b91c4601 951
c4e57202
FM
952 @note The @a align parameter is applied to both the column header and
953 the column renderer.
23324ae1
FM
954 */
955 wxDataViewColumn* AppendToggleColumn(const wxString& label,
956 unsigned int model_column,
957 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
958 int width = 30,
959 wxAlignment align = wxALIGN_CENTER,
960 int flags = wxDATAVIEW_COL_RESIZABLE);
7c913512
FM
961 wxDataViewColumn* AppendToggleColumn(const wxBitmap& label,
962 unsigned int model_column,
963 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
964 int width = 30,
965 wxAlignment align = wxALIGN_CENTER,
966 int flags = wxDATAVIEW_COL_RESIZABLE);
23324ae1
FM
967 //@}
968
969 /**
c4e57202
FM
970 Associates a wxDataViewModel with the control.
971 This increases the reference count of the model by 1.
23324ae1
FM
972 */
973 virtual bool AssociateModel(wxDataViewModel* model);
974
975 /**
976 Removes all columns.
977 */
978 virtual bool ClearColumns();
979
23324ae1
FM
980 /**
981 Collapses the item.
982 */
adaaa686 983 virtual void Collapse(const wxDataViewItem& item);
23324ae1
FM
984
985 /**
986 Create the control. Useful for two step creation.
987 */
988 bool Create(wxWindow* parent, wxWindowID id,
989 const wxPoint& pos = wxDefaultPosition,
990 const wxSize& size = wxDefaultSize,
991 long style = 0,
8eb99915
RR
992 const wxValidator& validator = wxDefaultValidator,
993 const wxString& name = wxDataViewCtrlNameStr);
23324ae1
FM
994
995 /**
996 Deletes given column.
997 */
50ec54b6 998 virtual bool DeleteColumn(wxDataViewColumn* column);
23324ae1 999
907f09f4
VS
1000 /**
1001 Programmatically starts editing given cell of @a item.
1002
1003 Doesn't do anything if the item or this column is not editable.
1004
1005 @note Currently not implemented in wxOSX/Carbon.
1006
1007 @since 2.9.4
1008 */
1009 virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column);
1010
e4de825e
RR
1011 /**
1012 Enable drag operations using the given @a format.
1013 */
1014 virtual bool EnableDragSource( const wxDataFormat &format );
02b51ae5 1015
e4de825e
RR
1016 /**
1017 Enable drop operations using the given @a format.
1018 */
1019 virtual bool EnableDropTarget( const wxDataFormat &format );
02b51ae5 1020
23324ae1
FM
1021 /**
1022 Call this to ensure that the given item is visible.
1023 */
fadc2df6
FM
1024 virtual void EnsureVisible(const wxDataViewItem& item,
1025 const wxDataViewColumn* column = NULL);
23324ae1
FM
1026
1027 /**
1028 Expands the item.
1029 */
adaaa686 1030 virtual void Expand(const wxDataViewItem& item);
23324ae1 1031
4219d8b0
RR
1032 /**
1033 Expands all ancestors of the @a item. This method also
1034 ensures that the item itself as well as all ancestor
1035 items have been read from the model by the control.
1036 */
1037 virtual void ExpandAncestors( const wxDataViewItem & item );
798c0d87 1038
23324ae1 1039 /**
c4e57202
FM
1040 Returns pointer to the column. @a pos refers to the position in the
1041 control which may change after reordering columns by the user.
23324ae1 1042 */
328f5751 1043 virtual wxDataViewColumn* GetColumn(unsigned int pos) const;
23324ae1
FM
1044
1045 /**
1046 Returns the number of columns.
1047 */
328f5751 1048 virtual unsigned int GetColumnCount() const;
23324ae1
FM
1049
1050 /**
1051 Returns the position of the column or -1 if not found in the control.
1052 */
328f5751 1053 virtual int GetColumnPosition(const wxDataViewColumn* column) const;
23324ae1
FM
1054
1055 /**
1056 Returns column containing the expanders.
1057 */
328f5751 1058 wxDataViewColumn* GetExpanderColumn() const;
23324ae1 1059
80ce465c
VZ
1060 /**
1061 Returns the currently focused item.
1062
1063 This is the item that the keyboard commands apply to. It may be invalid
1064 if there is no focus currently.
1065
1066 This method is mostly useful for the controls with @c wxDV_MULTIPLE
1067 style as in the case of single selection it returns the same thing as
1068 GetSelection().
1069
1070 Notice that under all platforms except Mac OS X the currently focused
1071 item may be selected or not but under OS X the current item is always
1072 selected.
1073
ee1377e1 1074 @see SetCurrentItem(), GetCurrentColumn()
80ce465c
VZ
1075
1076 @since 2.9.2
1077 */
1078 wxDataViewItem GetCurrentItem() const;
1079
ee1377e1
VS
1080 /**
1081 Returns the column that currently has focus.
1082
1083 If the focus is set to individual cell within the currently focused
1084 item (as opposed to being on the item as a whole), then this is the
1085 column that the focus is on.
1086
1087 Returns NULL if no column currently has focus.
1088
1089 @see GetCurrentItem()
1090
1091 @since 2.9.4
1092 */
1093 wxDataViewColumn *GetCurrentColumn() const;
1094
23324ae1
FM
1095 /**
1096 Returns indentation.
1097 */
328f5751 1098 int GetIndent() const;
23324ae1
FM
1099
1100 /**
7f15deea
VZ
1101 Returns item rectangle.
1102
1103 This method is currently not implemented at all in wxGTK and only
1104 implemented for non-@NULL @a col argument in wxOSX. It is fully
1105 implemented in the generic version of the control.
1106
1107 @param item
1108 A valid item.
1109 @param col
1110 If non-@NULL, the rectangle returned corresponds to the
1111 intersection of the item with the specified column. If @NULL, the
1112 rectangle spans all the columns.
23324ae1 1113 */
fadc2df6
FM
1114 virtual wxRect GetItemRect(const wxDataViewItem& item,
1115 const wxDataViewColumn* col = NULL) const;
23324ae1
FM
1116
1117 /**
c4e57202 1118 Returns pointer to the data model associated with the control (if any).
23324ae1 1119 */
adaaa686 1120 wxDataViewModel* GetModel();
23324ae1 1121
fa93d732
VZ
1122 /**
1123 Returns the number of currently selected items.
1124
1125 This method may be called for both the controls with single and
1126 multiple selections and returns the number of selected item, possibly
1127 0, in any case.
1128
1129 @since 2.9.3
1130 */
1131 virtual int GetSelectedItemsCount() const;
1132
23324ae1
FM
1133 /**
1134 Returns first selected item or an invalid item if none is selected.
fa93d732
VZ
1135
1136 This method may be called for both the controls with single and
1137 multiple selections but returns an invalid item if more than one item
1138 is selected in the latter case, use HasSelection() to determine if
1139 there are any selected items when using multiple selection.
23324ae1 1140 */
adaaa686 1141 virtual wxDataViewItem GetSelection() const;
23324ae1
FM
1142
1143 /**
c4e57202 1144 Fills @a sel with currently selected items and returns their number.
fa93d732
VZ
1145
1146 This method may be called for both the controls with single and
1147 multiple selections. In the single selection case it returns the array
1148 with at most one element in it.
1149
1150 @see GetSelectedItemsCount()
23324ae1 1151 */
adaaa686 1152 virtual int GetSelections(wxDataViewItemArray& sel) const;
23324ae1
FM
1153
1154 /**
1155 Returns the wxDataViewColumn currently responsible for sorting
1156 or @NULL if none has been selected.
1157 */
328f5751 1158 virtual wxDataViewColumn* GetSortingColumn() const;
23324ae1 1159
fa93d732
VZ
1160 /**
1161 Returns true if any items are currently selected.
1162
1163 This method may be called for both the controls with single and
1164 multiple selections.
1165
1166 Calling this method is equivalent to calling GetSelectedItemsCount()
1167 and comparing its result with 0 but is more clear and might also be
1168 implemented more efficiently in the future.
1169
1170 @since 2.9.3
1171 */
1172 bool HasSelection() const;
1173
23324ae1
FM
1174 /**
1175 Hittest.
1176 */
fadc2df6
FM
1177 virtual void HitTest(const wxPoint& point, wxDataViewItem& item,
1178 wxDataViewColumn*& col) const;
23324ae1 1179
739a8399
RR
1180 /**
1181 Return @true if the item is expanded.
739a8399
RR
1182 */
1183 virtual bool IsExpanded(const wxDataViewItem& item) const;
1184
23324ae1
FM
1185 /**
1186 Return @true if the item is selected.
1187 */
adaaa686 1188 virtual bool IsSelected(const wxDataViewItem& item) const;
23324ae1
FM
1189
1190 /**
1191 Select the given item.
1e184300
VZ
1192
1193 In single selection mode this changes the (unique) currently selected
1194 item. In multi selection mode, the @a item is selected and the
1195 previously selected items remain selected.
23324ae1 1196 */
adaaa686 1197 virtual void Select(const wxDataViewItem& item);
23324ae1
FM
1198
1199 /**
1200 Select all items.
1201 */
adaaa686 1202 virtual void SelectAll();
23324ae1
FM
1203
1204 /**
1205 Set which column shall contain the tree-like expanders.
1206 */
4cc4bfaf 1207 void SetExpanderColumn(wxDataViewColumn* col);
23324ae1 1208
80ce465c
VZ
1209 /**
1210 Changes the currently focused item.
1211
1212 The @a item parameter must be valid, there is no way to remove the
1213 current item from the control.
1214
1215 In single selection mode, calling this method is the same as calling
1216 Select() and is thus not very useful. In multiple selection mode this
1217 method only moves the current item however without changing the
1218 selection except under OS X where the current item is always selected,
1219 so calling SetCurrentItem() selects @a item if it hadn't been selected
1220 before.
1221
1222 @see GetCurrentItem()
1223
1224 @since 2.9.2
1225 */
1226 void SetCurrentItem(const wxDataViewItem& item);
1227
23324ae1 1228 /**
57ab6f23 1229 Sets the indentation.
23324ae1
FM
1230 */
1231 void SetIndent(int indent);
1232
1233 /**
1234 Sets the selection to the array of wxDataViewItems.
1235 */
adaaa686 1236 virtual void SetSelections(const wxDataViewItemArray& sel);
23324ae1
FM
1237
1238 /**
1239 Unselect the given item.
1240 */
adaaa686 1241 virtual void Unselect(const wxDataViewItem& item);
23324ae1
FM
1242
1243 /**
c4e57202
FM
1244 Unselect all item.
1245 This method only has effect if multiple selections are allowed.
23324ae1 1246 */
adaaa686 1247 virtual void UnselectAll();
bbfd4548
VZ
1248
1249 /**
1250 Sets the row height.
1251
1252 This function can only be used when all rows have the same height, i.e.
1253 when wxDV_VARIABLE_LINE_HEIGHT flag is not used.
1254
0f4a54a6
VZ
1255 Currently this is implemented in the generic and native GTK versions
1256 only and nothing is done (and @false returned) when using OS X port.
1257
1258 Also notice that this method can only be used to increase the row
1259 height compared with the default one (as determined by the return value
1260 of wxDataViewRenderer::GetSize()), if it is set to a too small value
1261 then the minimum required by the renderers will be used.
bbfd4548
VZ
1262
1263 @return @true if the line height was changed or @false otherwise.
1264
1265 @since 2.9.2
1266 */
1267 virtual bool SetRowHeight(int rowHeight);
23324ae1
FM
1268};
1269
1270
e54c96f1 1271
23324ae1
FM
1272/**
1273 @class wxDataViewModelNotifier
7c913512 1274
c4e57202
FM
1275 A wxDataViewModelNotifier instance is owned by a wxDataViewModel and mirrors
1276 its notification interface.
1277 See the documentation of that class for further information.
7c913512 1278
8ed522d9 1279 @library{wxadv}
b321b61c 1280 @category{dvc}
23324ae1 1281*/
7c913512 1282class wxDataViewModelNotifier
23324ae1
FM
1283{
1284public:
1285 /**
1286 Constructor.
1287 */
1288 wxDataViewModelNotifier();
1289
1290 /**
1291 Destructor.
1292 */
adaaa686 1293 virtual ~wxDataViewModelNotifier();
23324ae1
FM
1294
1295 /**
1296 Called by owning model.
1297 */
b91c4601 1298 virtual bool Cleared() = 0;
23324ae1
FM
1299
1300 /**
1301 Get owning wxDataViewModel.
1302 */
e51bf699 1303 wxDataViewModel* GetOwner() const;
23324ae1
FM
1304
1305 /**
1306 Called by owning model.
63e55c0a
VS
1307
1308 @return Always return @true from this function in derived classes.
23324ae1 1309 */
fadc2df6
FM
1310 virtual bool ItemAdded(const wxDataViewItem& parent,
1311 const wxDataViewItem& item) = 0;
23324ae1
FM
1312
1313 /**
1314 Called by owning model.
63e55c0a
VS
1315
1316 @return Always return @true from this function in derived classes.
23324ae1 1317 */
b91c4601 1318 virtual bool ItemChanged(const wxDataViewItem& item) = 0;
23324ae1
FM
1319
1320 /**
1321 Called by owning model.
63e55c0a
VS
1322
1323 @return Always return @true from this function in derived classes.
23324ae1 1324 */
fadc2df6
FM
1325 virtual bool ItemDeleted(const wxDataViewItem& parent,
1326 const wxDataViewItem& item) = 0;
23324ae1
FM
1327
1328 /**
1329 Called by owning model.
63e55c0a
VS
1330
1331 @return Always return @true from this function in derived classes.
23324ae1 1332 */
fadc2df6
FM
1333 virtual bool ItemsAdded(const wxDataViewItem& parent,
1334 const wxDataViewItemArray& items);
23324ae1
FM
1335
1336 /**
1337 Called by owning model.
63e55c0a
VS
1338
1339 @return Always return @true from this function in derived classes.
23324ae1 1340 */
adaaa686 1341 virtual bool ItemsChanged(const wxDataViewItemArray& items);
23324ae1
FM
1342
1343 /**
1344 Called by owning model.
63e55c0a
VS
1345
1346 @return Always return @true from this function in derived classes.
23324ae1 1347 */
fadc2df6
FM
1348 virtual bool ItemsDeleted(const wxDataViewItem& parent,
1349 const wxDataViewItemArray& items);
23324ae1
FM
1350
1351 /**
1352 Called by owning model.
1353 */
b91c4601 1354 virtual void Resort() = 0;
23324ae1
FM
1355
1356 /**
1357 Set owner of this notifier. Used internally.
1358 */
1359 void SetOwner(wxDataViewModel* owner);
1360
1361 /**
1362 Called by owning model.
63e55c0a
VS
1363
1364 @return Always return @true from this function in derived classes.
23324ae1 1365 */
b91c4601 1366 virtual bool ValueChanged(const wxDataViewItem& item, unsigned int col) = 0;
23324ae1
FM
1367};
1368
1369
c4e57202
FM
1370/**
1371 The mode of a data-view cell; see wxDataViewRenderer for more info.
1372*/
1373enum wxDataViewCellMode
1374{
dc73d7f5
VS
1375 /**
1376 The cell only displays information and cannot be manipulated or
1377 otherwise interacted with in any way.
1378
1379 Note that this doesn't mean that the row being drawn can't be selected,
1380 just that a particular element of it cannot be individually modified.
1381 */
c4e57202
FM
1382 wxDATAVIEW_CELL_INERT,
1383
1384 /**
dc73d7f5
VS
1385 Indicates that the cell can be @em activated by clicking it or using
1386 keyboard.
1387
1388 Activating a cell is an alternative to showing inline editor when the
1389 value can be edited in a simple way that doesn't warrant full editor
1390 control. The most typical use of cell activation is toggling the
1391 checkbox in wxDataViewToggleRenderer; others would be e.g. an embedded
1392 volume slider or a five-star rating column.
1393
1394 The exact means of activating a cell are platform-dependent, but they
1395 are usually similar to those used for inline editing of values.
1396 Typically, a cell would be activated by Space or Enter keys or by left
1397 mouse click.
1398
1399 @note Do not confuse this with item activation in wxDataViewCtrl
1400 and the wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. That one is
1401 used for activating the item (or, to put it differently, the
1402 entire row) similarly to analogous messages in wxTreeCtrl and
1403 wxListCtrl, and the effect differs (play a song, open a file
1404 etc.). Cell activation, on the other hand, is all about
1405 interacting with the individual cell.
1406
1407 @see wxDataViewCustomRenderer::ActivateCell()
c4e57202
FM
1408 */
1409 wxDATAVIEW_CELL_ACTIVATABLE,
1410
1411 /**
dc73d7f5
VS
1412 Indicates that the user can edit the data in-place in an inline editor
1413 control that will show up when the user wants to edit the cell.
1414
1415 A typical example of this behaviour is changing the filename in a file
1416 managers.
1417
1418 Editing is typically triggered by slowly double-clicking the cell or by
1419 a platform-dependent keyboard shortcut (F2 is typical on Windows, Space
1420 and/or Enter is common elsewhere and supported on Windows too).
1421
1422 @see wxDataViewCustomRenderer::CreateEditorCtrl()
c4e57202
FM
1423 */
1424 wxDATAVIEW_CELL_EDITABLE
1425};
1426
1427/**
1428 The values of this enum controls how a wxDataViewRenderer should display
1429 its contents in a cell.
1430*/
1431enum wxDataViewCellRenderState
1432{
1433 wxDATAVIEW_CELL_SELECTED = 1,
1434 wxDATAVIEW_CELL_PRELIT = 2,
1435 wxDATAVIEW_CELL_INSENSITIVE = 4,
1436 wxDATAVIEW_CELL_FOCUSED = 8
1437};
e54c96f1 1438
23324ae1
FM
1439/**
1440 @class wxDataViewRenderer
7c913512 1441
5b99d5d8 1442 This class is used by wxDataViewCtrl to render the individual cells.
c4e57202
FM
1443 One instance of a renderer class is owned by a wxDataViewColumn.
1444 There is a number of ready-to-use renderers provided:
1445 - wxDataViewTextRenderer,
c4e57202
FM
1446 - wxDataViewIconTextRenderer,
1447 - wxDataViewToggleRenderer,
1448 - wxDataViewProgressRenderer,
1449 - wxDataViewBitmapRenderer,
1450 - wxDataViewDateRenderer,
1451 - wxDataViewSpinRenderer.
f4fcd648 1452 - wxDataViewChoiceRenderer.
7c913512 1453
23324ae1
FM
1454 Additionally, the user can write own renderers by deriving from
1455 wxDataViewCustomRenderer.
7c913512 1456
c4e57202
FM
1457 The ::wxDataViewCellMode and ::wxDataViewCellRenderState flags accepted
1458 by the constructors respectively controls what actions the cell data allows
1459 and how the renderer should display its contents in a cell.
7c913512 1460
23324ae1 1461 @library{wxadv}
b321b61c 1462 @category{dvc}
23324ae1
FM
1463*/
1464class wxDataViewRenderer : public wxObject
1465{
1466public:
1467 /**
b91c4601 1468 Constructor.
23324ae1
FM
1469 */
1470 wxDataViewRenderer(const wxString& varianttype,
1471 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
f2b7492a 1472 int align = wxDVR_DEFAULT_ALIGNMENT );
23324ae1 1473
c937bcac
VZ
1474 /**
1475 Enable or disable replacing parts of the item text with ellipsis to
1476 make it fit the column width.
1477
1478 This method only makes sense for the renderers working with text, such
1479 as wxDataViewTextRenderer or wxDataViewIconTextRenderer.
1480
1481 By default wxELLIPSIZE_MIDDLE is used.
1482
1483 @param mode
1484 Ellipsization mode, use wxELLIPSIZE_NONE to disable.
1485
1486 @since 2.9.1
1487 */
1488 void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
1489
1490 /**
1491 Disable replacing parts of the item text with ellipsis.
1492
1493 If ellipsizing is disabled, the string will be truncated if it doesn't
1494 fit.
1495
1496 This is the same as @code EnableEllipsize(wxELLIPSIZE_NONE) @endcode.
1497
1498 @since 2.9.1
1499 */
1500 void DisableEllipsize();
1501
20c36737 1502 /**
f2b7492a 1503 Returns the alignment. See SetAlignment()
20c36737
RR
1504 */
1505 virtual int GetAlignment() const;
1506
c937bcac
VZ
1507 /**
1508 Returns the ellipsize mode used by the renderer.
1509
1510 If the return value is wxELLIPSIZE_NONE, the text is simply truncated
1511 if it doesn't fit.
1512
1513 @see EnableEllipsize()
1514 */
1515 wxEllipsizeMode GetEllipsizeMode() const;
1516
23324ae1
FM
1517 /**
1518 Returns the cell mode.
1519 */
adaaa686 1520 virtual wxDataViewCellMode GetMode() const;
23324ae1
FM
1521
1522 /**
1523 Returns pointer to the owning wxDataViewColumn.
1524 */
adaaa686 1525 wxDataViewColumn* GetOwner() const;
23324ae1
FM
1526
1527 /**
1528 This methods retrieves the value from the renderer in order to
c4e57202
FM
1529 transfer the value back to the data model.
1530
1531 Returns @false on failure.
23324ae1 1532 */
b91c4601 1533 virtual bool GetValue(wxVariant& value) const = 0;
23324ae1
FM
1534
1535 /**
c4e57202 1536 Returns a string with the type of the wxVariant supported by this renderer.
23324ae1 1537 */
adaaa686 1538 wxString GetVariantType() const;
23324ae1 1539
20c36737 1540 /**
c4e57202
FM
1541 Sets the alignment of the renderer's content.
1542 The default value of @c wxDVR_DEFAULT_ALIGMENT indicates that the content
1543 should have the same alignment as the column header.
1544
1545 The method is not implemented under OS X and the renderer always aligns
1546 its contents as the column header on that platform. The other platforms
f2b7492a 1547 support both vertical and horizontal alignment.
20c36737
RR
1548 */
1549 virtual void SetAlignment( int align );
23324ae1 1550 /**
c4e57202
FM
1551 Sets the owning wxDataViewColumn.
1552 This is usually called from within wxDataViewColumn.
23324ae1 1553 */
adaaa686 1554 void SetOwner(wxDataViewColumn* owner);
23324ae1
FM
1555
1556 /**
c4e57202 1557 Set the value of the renderer (and thus its cell) to @a value.
23324ae1
FM
1558 The internal code will then render this cell with this data.
1559 */
b91c4601 1560 virtual bool SetValue(const wxVariant& value) = 0;
23324ae1
FM
1561
1562 /**
1563 Before data is committed to the data model, it is passed to this
1564 method where it can be checked for validity. This can also be
1565 used for checking a valid range or limiting the user input in
1566 a certain aspect (e.g. max number of characters or only alphanumeric
c4e57202
FM
1567 input, ASCII only etc.). Return @false if the value is not valid.
1568
23324ae1
FM
1569 Please note that due to implementation limitations, this validation
1570 is done after the editing control already is destroyed and the
1571 editing process finished.
1572 */
1573 virtual bool Validate(wxVariant& value);
1574};
1575
1576
e54c96f1 1577
23324ae1
FM
1578/**
1579 @class wxDataViewTextRenderer
7c913512 1580
c4e57202
FM
1581 wxDataViewTextRenderer is used for rendering text.
1582 It supports in-place editing if desired.
7c913512 1583
23324ae1 1584 @library{wxadv}
b321b61c 1585 @category{dvc}
23324ae1
FM
1586*/
1587class wxDataViewTextRenderer : public wxDataViewRenderer
1588{
1589public:
1590 /**
c4e57202 1591 The ctor.
23324ae1
FM
1592 */
1593 wxDataViewTextRenderer(const wxString& varianttype = "string",
05303ccd
RR
1594 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1595 int align = wxDVR_DEFAULT_ALIGNMENT );
23324ae1
FM
1596};
1597
1598
e54c96f1 1599
f2b7492a
RR
1600/**
1601 @class wxDataViewIconTextRenderer
f2b7492a
RR
1602
1603 The wxDataViewIconTextRenderer class is used to display text with
1604 a small icon next to it as it is typically done in a file manager.
c4e57202
FM
1605
1606 This classes uses the wxDataViewIconText helper class to store its data.
4d68a949
BP
1607 wxDataViewIconText can be converted to and from a wxVariant using the left
1608 shift operator.
f2b7492a
RR
1609
1610 @library{wxadv}
b321b61c 1611 @category{dvc}
f2b7492a
RR
1612*/
1613class wxDataViewIconTextRenderer : public wxDataViewRenderer
1614{
1615public:
1616 /**
c4e57202 1617 The ctor.
f2b7492a
RR
1618 */
1619 wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText",
1620 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1621 int align = wxDVR_DEFAULT_ALIGNMENT );
1622};
1623
1624
1625
23324ae1
FM
1626/**
1627 @class wxDataViewProgressRenderer
7c913512 1628
c4e57202 1629 This class is used by wxDataViewCtrl to render progress bars.
7c913512 1630
23324ae1 1631 @library{wxadv}
b321b61c 1632 @category{dvc}
23324ae1
FM
1633*/
1634class wxDataViewProgressRenderer : public wxDataViewRenderer
1635{
1636public:
1637 /**
c4e57202 1638 The ctor.
23324ae1
FM
1639 */
1640 wxDataViewProgressRenderer(const wxString& label = wxEmptyString,
1641 const wxString& varianttype = "long",
05303ccd
RR
1642 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1643 int align = wxDVR_DEFAULT_ALIGNMENT );
23324ae1
FM
1644};
1645
1646
e54c96f1 1647
23324ae1
FM
1648/**
1649 @class wxDataViewSpinRenderer
7c913512 1650
c4e57202
FM
1651 This is a specialized renderer for rendering integer values.
1652 It supports modifying the values in-place by using a wxSpinCtrl.
23324ae1 1653 The renderer only support variants of type @e long.
7c913512 1654
8ed522d9 1655 @library{wxadv}
b321b61c 1656 @category{dvc}
23324ae1
FM
1657*/
1658class wxDataViewSpinRenderer : public wxDataViewCustomRenderer
1659{
1660public:
1661 /**
c4e57202
FM
1662 Constructor.
1663 @a min and @a max indicate the minimum and maximum values for the wxSpinCtrl.
23324ae1
FM
1664 */
1665 wxDataViewSpinRenderer(int min, int max,
1666 wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
05303ccd 1667 int align = wxDVR_DEFAULT_ALIGNMENT);
23324ae1
FM
1668};
1669
1670
e54c96f1 1671
23324ae1
FM
1672/**
1673 @class wxDataViewToggleRenderer
7c913512 1674
c4e57202 1675 This class is used by wxDataViewCtrl to render toggle controls.
7c913512 1676
23324ae1 1677 @library{wxadv}
b321b61c 1678 @category{dvc}
23324ae1
FM
1679*/
1680class wxDataViewToggleRenderer : public wxDataViewRenderer
1681{
1682public:
1683 /**
c4e57202 1684 The ctor.
23324ae1
FM
1685 */
1686 wxDataViewToggleRenderer(const wxString& varianttype = "bool",
50ec54b6
FM
1687 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1688 int align = wxDVR_DEFAULT_ALIGNMENT);
23324ae1
FM
1689};
1690
1691
f4fcd648 1692/**
df8cd0bd
VZ
1693 A wxDataViewCtrl renderer using wxChoice control and values of strings in
1694 it.
f4fcd648
RR
1695
1696 This class is used by wxDataViewCtrl to render choice controls.
1697 It stores a string so that SetValue() and GetValue() operate
1698 on a variant holding a string.
1699
df8cd0bd
VZ
1700 @see wxDataViewChoiceByIndexRenderer
1701
f4fcd648
RR
1702 @library{wxadv}
1703 @category{dvc}
1704*/
1705
1706class wxDataViewChoiceRenderer: public wxDataViewRenderer
1707{
1708public:
1709 /**
1710 The ctor.
1711 */
1712 wxDataViewChoiceRenderer( const wxArrayString &choices,
1713 wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
1714 int alignment = wxDVR_DEFAULT_ALIGNMENT );
1715
1716 /**
1717 Returns the choice referred to by index.
1718 */
1719 wxString GetChoice(size_t index) const;
df8cd0bd 1720
f4fcd648
RR
1721 /**
1722 Returns all choices.
1723 */
1724 const wxArrayString& GetChoices() const;
1725};
1726
e54c96f1 1727
df8cd0bd
VZ
1728/**
1729 A wxDataViewCtrl renderer using wxChoice control and indexes into it.
1730
1731 Unlike its base wxDataViewChoiceRenderer class, this one stores the choice
1732 index, i.e. an @c int, in the variant used by its SetValue() and
1733 GetValue().
1734
1735 @library{wxadv}
1736 @category{dvc}
1737*/
1738class wxDataViewChoiceByIndexRenderer : public wxDataViewChoiceRenderer
1739{
1740public:
1741 /**
1742 The ctor.
1743 */
1744 wxDataViewChoiceByIndexRenderer( const wxArrayString &choices,
1745 wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
1746 int alignment = wxDVR_DEFAULT_ALIGNMENT );
1747};
1748
1749
23324ae1 1750/**
5b99d5d8 1751 @class wxDataViewDateRenderer
7c913512 1752
c4e57202 1753 This class is used by wxDataViewCtrl to render calendar controls.
7c913512 1754
5b99d5d8 1755 @library{wxadv}
b321b61c 1756 @category{dvc}
23324ae1 1757*/
5b99d5d8 1758class wxDataViewDateRenderer : public wxDataViewRenderer
23324ae1
FM
1759{
1760public:
23324ae1 1761 /**
c4e57202 1762 The ctor.
23324ae1 1763 */
5b99d5d8 1764 wxDataViewDateRenderer(const wxString& varianttype = "datetime",
50ec54b6
FM
1765 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
1766 int align = wxDVR_DEFAULT_ALIGNMENT);
5b99d5d8 1767};
23324ae1 1768
3c4f71cc 1769
23324ae1 1770
5b99d5d8
RR
1771/**
1772 @class wxDataViewCustomRenderer
23324ae1 1773
5b99d5d8 1774 You need to derive a new class from wxDataViewCustomRenderer in
c4e57202
FM
1775 order to write a new renderer.
1776
1777 You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue,
1778 wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render.
1779
1780 If you want your renderer to support in-place editing then you also need to override
1781 wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl
5b99d5d8 1782 and wxDataViewCustomRenderer::GetValueFromEditorCtrl.
c4e57202
FM
1783
1784 Note that a special event handler will be pushed onto that editor control
1785 which handles @e \<ENTER\> and focus out events in order to end the editing.
23324ae1 1786
5b99d5d8 1787 @library{wxadv}
b321b61c 1788 @category{dvc}
5b99d5d8
RR
1789*/
1790class wxDataViewCustomRenderer : public wxDataViewRenderer
1791{
1792public:
23324ae1 1793 /**
5b99d5d8 1794 Constructor.
23324ae1 1795 */
5b99d5d8
RR
1796 wxDataViewCustomRenderer(const wxString& varianttype = "string",
1797 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
b91c4601 1798 int align = -1, bool no_init = false);
23324ae1
FM
1799
1800 /**
5b99d5d8 1801 Destructor.
23324ae1 1802 */
adaaa686 1803 virtual ~wxDataViewCustomRenderer();
23324ae1 1804
23324ae1 1805 /**
dc73d7f5
VS
1806 Override this to react to cell @em activation. Activating a cell is an
1807 alternative to showing inline editor when the value can be edited in a
1808 simple way that doesn't warrant full editor control. The most typical
1809 use of cell activation is toggling the checkbox in
1810 wxDataViewToggleRenderer; others would be e.g. an embedded volume
1811 slider or a five-star rating column.
1812
1813 The exact means of activating a cell are platform-dependent, but they
1814 are usually similar to those used for inline editing of values.
1815 Typically, a cell would be activated by Space or Enter keys or by left
1816 mouse click.
1817
1818 This method will only be called if the cell has the
1819 wxDATAVIEW_CELL_ACTIVATABLE mode.
1820
1821 @param cell
1822 Coordinates of the activated cell's area.
1823 @param model
1824 The model to manipulate in response.
1825 @param item
1826 Activated item.
1827 @param col
1828 Activated column of @a item.
1829 @param mouseEvent
1830 If the activation was triggered by mouse click, contains the
1831 corresponding event. Is @NULL otherwise (for keyboard activation).
1832 Mouse coordinates are adjusted to be relative to the cell.
1833
1834 @since 2.9.3
1835
1836 @note Do not confuse this method with item activation in wxDataViewCtrl
1837 and the wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. That one is
1838 used for activating the item (or, to put it differently, the
1839 entire row) similarly to analogous messages in wxTreeCtrl and
1840 wxListCtrl, and the effect differs (play a song, open a file
1841 etc.). Cell activation, on the other hand, is all about
1842 interacting with the individual cell.
1843
1844 @see CreateEditorCtrl()
23324ae1 1845 */
dc73d7f5
VS
1846 virtual bool ActivateCell(const wxRect& cell,
1847 wxDataViewModel* model,
1848 const wxDataViewItem & item,
1849 unsigned int col,
1850 const wxMouseEvent *mouseEvent);
23324ae1
FM
1851
1852 /**
5b99d5d8 1853 Override this to create the actual editor control once editing
c4e57202
FM
1854 is about to start.
1855
dc73d7f5
VS
1856 This method will only be called if the cell has the
1857 wxDATAVIEW_CELL_EDITABLE mode. Editing is typically triggered by slowly
1858 double-clicking the cell or by a platform-dependent keyboard shortcut
1859 (F2 is typical on Windows, Space and/or Enter is common elsewhere and
1860 supported on Windows too).
1861
1862 @param parent
1863 The parent of the editor control.
1864 @param labelRect
1865 Indicates the position and size of the editor control. The control
1866 should be created in place of the cell and @a labelRect should be
1867 respected as much as possible.
1868 @param value
1869 Initial value of the editor.
1870
1871 An example:
c4e57202
FM
1872 @code
1873 {
1874 long l = value;
1875 return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
1876 labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l );
1877 }
1878 @endcode
dc73d7f5
VS
1879
1880 @see ActivateCell()
23324ae1 1881 */
64c70359
VS
1882 virtual wxWindow* CreateEditorCtrl(wxWindow* parent,
1883 wxRect labelRect,
1884 const wxVariant& value);
23324ae1
FM
1885
1886 /**
62265c2c
VZ
1887 Return the attribute to be used for rendering.
1888
1889 This function may be called from Render() implementation to use the
1890 attributes defined for the item if the renderer supports them.
1891
1892 Notice that when Render() is called, the wxDC object passed to it is
1893 already set up to use the correct attributes (e.g. its font is set to
1894 bold or italic version if wxDataViewItemAttr::GetBold() or GetItalic()
1895 returns true) so it may not be necessary to call it explicitly if you
1896 only want to render text using the items attributes.
1897
1898 @since 2.9.1
1899 */
1900 const wxDataViewItemAttr& GetAttr() const;
23324ae1
FM
1901
1902 /**
5b99d5d8 1903 Return size required to show content.
23324ae1 1904 */
b91c4601 1905 virtual wxSize GetSize() const = 0;
23324ae1
FM
1906
1907 /**
80093617 1908 Override this so that the renderer can get the value from the editor
c4e57202
FM
1909 control (pointed to by @a editor):
1910 @code
1911 {
1912 wxSpinCtrl *sc = (wxSpinCtrl*) editor;
1913 long l = sc->GetValue();
1914 value = l;
1915 return true;
1916 }
1917 @endcode
23324ae1 1918 */
64c70359 1919 virtual bool GetValueFromEditorCtrl(wxWindow* editor,
5b99d5d8 1920 wxVariant& value);
23324ae1
FM
1921
1922 /**
c4e57202 1923 Override this and make it return @true in order to
5b99d5d8 1924 indicate that this renderer supports in-place editing.
23324ae1 1925 */
220bfe15 1926 virtual bool HasEditorCtrl() const;
23324ae1
FM
1927
1928 /**
80093617 1929 Override this to react to a left click.
c4e57202 1930 This method will only be called in @c wxDATAVIEW_CELL_ACTIVATABLE mode.
23324ae1 1931 */
548fa9c1
VS
1932 virtual bool LeftClick( const wxPoint& cursor,
1933 const wxRect& cell,
5b99d5d8
RR
1934 wxDataViewModel * model,
1935 const wxDataViewItem & item,
1936 unsigned int col );
23324ae1
FM
1937
1938 /**
c4e57202
FM
1939 Override this to render the cell.
1940 Before this is called, wxDataViewRenderer::SetValue was called
5b99d5d8 1941 so that this instance knows what to render.
23324ae1 1942 */
b91c4601 1943 virtual bool Render(wxRect cell, wxDC* dc, int state) = 0;
23324ae1
FM
1944
1945 /**
c4e57202
FM
1946 This method should be called from within Render() whenever you need to
1947 render simple text.
1948 This will ensure that the correct colour, font and vertical alignment will
1949 be chosen so the text will look the same as text drawn by native renderers.
23324ae1 1950 */
50ec54b6 1951 void RenderText(const wxString& text, int xoffset, wxRect cell,
5b99d5d8 1952 wxDC* dc, int state);
23324ae1
FM
1953
1954 /**
80093617 1955 Override this to start a drag operation. Not yet supported.
23324ae1 1956 */
548fa9c1
VS
1957 virtual bool StartDrag(const wxPoint& cursor,
1958 const wxRect& cell,
5b99d5d8
RR
1959 wxDataViewModel* model,
1960 const wxDataViewItem & item,
1961 unsigned int col);
23324ae1
FM
1962};
1963
1964
e54c96f1 1965
23324ae1 1966/**
5b99d5d8 1967 @class wxDataViewBitmapRenderer
7c913512 1968
c4e57202 1969 This class is used by wxDataViewCtrl to render bitmap controls.
7c913512 1970
23324ae1 1971 @library{wxadv}
b321b61c 1972 @category{dvc}
23324ae1 1973*/
5b99d5d8 1974class wxDataViewBitmapRenderer : public wxDataViewRenderer
23324ae1
FM
1975{
1976public:
1977 /**
c4e57202 1978 The ctor.
23324ae1 1979 */
5b99d5d8
RR
1980 wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap",
1981 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
14d922d1 1982 int align = wxDVR_DEFAULT_ALIGNMENT);
5b99d5d8
RR
1983};
1984
23324ae1 1985
c4e57202
FM
1986/**
1987 The flags used by wxDataViewColumn.
02b51ae5 1988 Can be combined together.
c4e57202
FM
1989*/
1990enum wxDataViewColumnFlags
1991{
1992 wxDATAVIEW_COL_RESIZABLE = 1,
1993 wxDATAVIEW_COL_SORTABLE = 2,
1994 wxDATAVIEW_COL_REORDERABLE = 4,
1995 wxDATAVIEW_COL_HIDDEN = 8
1996};
23324ae1 1997
5b99d5d8
RR
1998/**
1999 @class wxDataViewColumn
5b99d5d8
RR
2000
2001 This class represents a column in a wxDataViewCtrl.
739a8399 2002 One wxDataViewColumn is bound to one column in the data model to which the
c4e57202 2003 wxDataViewCtrl has been associated.
5b99d5d8 2004
c4e57202 2005 An instance of wxDataViewRenderer is used by this class to render its data.
5b99d5d8
RR
2006
2007 @library{wxadv}
b321b61c 2008 @category{dvc}
5b99d5d8 2009*/
c9c59db7 2010class wxDataViewColumn : public wxSettableHeaderColumn
5b99d5d8
RR
2011{
2012public:
23324ae1 2013 /**
02b51ae5
FM
2014 Constructs a text column.
2015
2016 @param title
2017 The title of the column.
2018 @param renderer
2019 The class which will render the contents of this column.
2020 @param model_column
2021 The index of the model's column which is associated with this object.
2022 @param width
2023 The width of the column.
2024 The @c wxDVC_DEFAULT_WIDTH value is the fixed default value.
2025 @param align
2026 The alignment of the column title.
2027 @param flags
2028 One or more flags of the ::wxDataViewColumnFlags enumeration.
23324ae1 2029 */
5b99d5d8
RR
2030 wxDataViewColumn(const wxString& title,
2031 wxDataViewRenderer* renderer,
2032 unsigned int model_column,
2033 int width = wxDVC_DEFAULT_WIDTH,
882678eb 2034 wxAlignment align = wxALIGN_CENTER,
5b99d5d8 2035 int flags = wxDATAVIEW_COL_RESIZABLE);
02b51ae5
FM
2036
2037 /**
2038 Constructs a bitmap column.
2039
2040 @param bitmap
2041 The bitmap of the column.
2042 @param renderer
2043 The class which will render the contents of this column.
2044 @param model_column
2045 The index of the model's column which is associated with this object.
2046 @param width
2047 The width of the column.
2048 The @c wxDVC_DEFAULT_WIDTH value is the fixed default value.
2049 @param align
2050 The alignment of the column title.
2051 @param flags
2052 One or more flags of the ::wxDataViewColumnFlags enumeration.
2053 */
5b99d5d8
RR
2054 wxDataViewColumn(const wxBitmap& bitmap,
2055 wxDataViewRenderer* renderer,
2056 unsigned int model_column,
2057 int width = wxDVC_DEFAULT_WIDTH,
882678eb 2058 wxAlignment align = wxALIGN_CENTER,
5b99d5d8 2059 int flags = wxDATAVIEW_COL_RESIZABLE);
23324ae1 2060
23324ae1 2061 /**
5b99d5d8
RR
2062 Returns the index of the column of the model, which this
2063 wxDataViewColumn is displaying.
23324ae1 2064 */
adaaa686 2065 unsigned int GetModelColumn() const;
23324ae1
FM
2066
2067 /**
5b99d5d8 2068 Returns the owning wxDataViewCtrl.
23324ae1 2069 */
e51bf699 2070 wxDataViewCtrl* GetOwner() const;
23324ae1
FM
2071
2072 /**
5b99d5d8 2073 Returns the renderer of this wxDataViewColumn.
c4e57202
FM
2074
2075 @see wxDataViewRenderer.
23324ae1 2076 */
adaaa686 2077 wxDataViewRenderer* GetRenderer() const;
23324ae1
FM
2078};
2079
2080
e54c96f1 2081
832df171
RR
2082/**
2083 @class wxDataViewListCtrl
2084
2085 This class is a wxDataViewCtrl which internally uses a wxDataViewListStore
2086 and forwards most of its API to that class.
2087
2088 The purpose of this class is to offer a simple way to display and
2089 edit a small table of data without having to write your own wxDataViewModel.
2090
23efa4bf 2091 @code
14f73cf1 2092 wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, wxID_ANY );
02b51ae5 2093
95b20f41
RR
2094 listctrl->AppendToggleColumn( "Toggle" );
2095 listctrl->AppendTextColumn( "Text" );
02b51ae5 2096
23efa4bf 2097 wxVector<wxVariant> data;
14f73cf1
FM
2098 data.push_back( wxVariant(true) );
2099 data.push_back( wxVariant("row 1") );
23efa4bf 2100 listctrl->AppendItem( data );
02b51ae5 2101
23efa4bf 2102 data.clear();
14f73cf1
FM
2103 data.push_back( wxVariant(false) );
2104 data.push_back( wxVariant("row 3") );
23efa4bf
RR
2105 listctrl->AppendItem( data );
2106 @endcode
43c64cc6 2107
14f73cf1
FM
2108 @beginStyleTable
2109 See wxDataViewCtrl for the list of supported styles.
2110 @endStyleTable
43c64cc6 2111
14f73cf1
FM
2112 @beginEventEmissionTable
2113 See wxDataViewCtrl for the list of events emitted by this class.
2114 @endEventTable
23efa4bf 2115
832df171
RR
2116 @library{wxadv}
2117 @category{ctrl,dvc}
2118*/
832df171
RR
2119class wxDataViewListCtrl: public wxDataViewCtrl
2120{
b75b04d4 2121public:
832df171
RR
2122 /**
2123 Default ctor.
2124 */
2125 wxDataViewListCtrl();
02b51ae5 2126
832df171
RR
2127 /**
2128 Constructor. Calls Create().
2129 */
2130 wxDataViewListCtrl( wxWindow *parent, wxWindowID id,
2131 const wxPoint& pos = wxDefaultPosition,
2132 const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
2133 const wxValidator& validator = wxDefaultValidator );
02b51ae5 2134
832df171
RR
2135 /**
2136 Destructor. Deletes the image list if any.
2137 */
2138 ~wxDataViewListCtrl();
2139
2140 /**
2141 Creates the control and a wxDataViewListStore as its internal model.
2142 */
2143 bool Create( wxWindow *parent, wxWindowID id,
2144 const wxPoint& pos = wxDefaultPosition,
2145 const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES,
2146 const wxValidator& validator = wxDefaultValidator );
2147
2148 //@{
2149 /**
2150 Returns the store.
2151 */
2152 wxDataViewListStore *GetStore();
2153 const wxDataViewListStore *GetStore() const;
2154 //@}
2155
17de95e4
VS
2156 /**
2157 Returns the position of given @e item or wxNOT_FOUND if it's
2158 not a valid item.
2159
2160 @since 2.9.2
2161 */
2162 int ItemToRow(const wxDataViewItem &item) const;
2163
2164 /**
2165 Returns the wxDataViewItem at the given @e row.
2166
2167 @since 2.9.2
2168 */
2169 wxDataViewItem RowToItem(int row) const;
2170
fa629ada
VS
2171 //@{
2172 /**
2173 @name Selection handling functions
2174 */
2175
2176 /**
2177 Returns index of the selected row or wxNOT_FOUND.
2178
2179 @see wxDataViewCtrl::GetSelection()
2180
2181 @since 2.9.2
2182 */
2183 int GetSelectedRow() const;
2184
2185 /**
2186 Selects given row.
2187
2188 @see wxDataViewCtrl::Select()
2189
2190 @since 2.9.2
2191 */
2192 void SelectRow(unsigned row);
2193
2194 /**
2195 Unselects given row.
2196
2197 @see wxDataViewCtrl::Unselect()
2198
2199 @since 2.9.2
2200 */
2201 void UnselectRow(unsigned row);
2202
2203 /**
2204 Returns true if @a row is selected.
2205
2206 @see wxDataViewCtrl::IsSelected()
2207
2208 @since 2.9.2
2209 */
2210 bool IsRowSelected(unsigned row) const;
2211
2212 //@}
2213
832df171 2214 /**
14f73cf1
FM
2215 @name Column management functions
2216 */
2217 //@{
43c64cc6 2218
14f73cf1
FM
2219 /**
2220 Appends a column to the control and additionally appends a
2221 column to the store with the type string.
2222 */
2ccd2adc 2223 virtual bool AppendColumn( wxDataViewColumn *column );
14f73cf1
FM
2224
2225 /**
2226 Appends a column to the control and additionally appends a
2227 column to the list store with the type @a varianttype.
832df171 2228 */
95b20f41 2229 void AppendColumn( wxDataViewColumn *column, const wxString &varianttype );
02b51ae5 2230
832df171 2231 /**
14f73cf1 2232 Appends a text column to the control and the store.
43c64cc6 2233
14f73cf1
FM
2234 See wxDataViewColumn::wxDataViewColumn for more info about
2235 the parameters.
832df171 2236 */
14f73cf1
FM
2237 wxDataViewColumn *AppendTextColumn( const wxString &label,
2238 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
43c64cc6 2239 int width = -1, wxAlignment align = wxALIGN_LEFT,
14f73cf1 2240 int flags = wxDATAVIEW_COL_RESIZABLE );
02b51ae5 2241
832df171 2242 /**
14f73cf1 2243 Appends a toggle column to the control and the store.
43c64cc6 2244
14f73cf1
FM
2245 See wxDataViewColumn::wxDataViewColumn for more info about
2246 the parameters.
832df171 2247 */
14f73cf1
FM
2248 wxDataViewColumn *AppendToggleColumn( const wxString &label,
2249 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
43c64cc6 2250 int width = -1, wxAlignment align = wxALIGN_LEFT,
14f73cf1 2251 int flags = wxDATAVIEW_COL_RESIZABLE );
02b51ae5 2252
95b20f41 2253 /**
14f73cf1 2254 Appends a progress column to the control and the store.
02b51ae5 2255
14f73cf1
FM
2256 See wxDataViewColumn::wxDataViewColumn for more info about
2257 the parameters.
95b20f41 2258 */
14f73cf1
FM
2259 wxDataViewColumn *AppendProgressColumn( const wxString &label,
2260 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
43c64cc6 2261 int width = -1, wxAlignment align = wxALIGN_LEFT,
14f73cf1 2262 int flags = wxDATAVIEW_COL_RESIZABLE );
02b51ae5 2263
95b20f41 2264 /**
14f73cf1 2265 Appends an icon-and-text column to the control and the store.
02b51ae5 2266
14f73cf1
FM
2267 See wxDataViewColumn::wxDataViewColumn for more info about
2268 the parameters.
95b20f41 2269 */
14f73cf1
FM
2270 wxDataViewColumn *AppendIconTextColumn( const wxString &label,
2271 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
43c64cc6 2272 int width = -1, wxAlignment align = wxALIGN_LEFT,
14f73cf1 2273 int flags = wxDATAVIEW_COL_RESIZABLE );
02b51ae5 2274
95b20f41 2275 /**
14f73cf1 2276 Inserts a column to the control and additionally inserts a
95b20f41
RR
2277 column to the store with the type string.
2278 */
2ccd2adc 2279 virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *column );
02b51ae5 2280
832df171 2281 /**
14f73cf1
FM
2282 Inserts a column to the control and additionally inserts a
2283 column to the list store with the type @a varianttype.
832df171 2284 */
43c64cc6 2285 void InsertColumn( unsigned int pos, wxDataViewColumn *column,
14f73cf1 2286 const wxString &varianttype );
02b51ae5 2287
832df171 2288 /**
14f73cf1
FM
2289 Prepends a column to the control and additionally prepends a
2290 column to the store with the type string.
832df171 2291 */
2ccd2adc 2292 virtual bool PrependColumn( wxDataViewColumn *column );
02b51ae5 2293
832df171 2294 /**
14f73cf1
FM
2295 Prepends a column to the control and additionally prepends a
2296 column to the list store with the type @a varianttype.
832df171 2297 */
14f73cf1 2298 void PrependColumn( wxDataViewColumn *column, const wxString &varianttype );
02b51ae5 2299
14f73cf1 2300 //@}
43c64cc6
VZ
2301
2302
832df171 2303 /**
14f73cf1 2304 @name Item management functions
832df171 2305 */
14f73cf1 2306 //@{
43c64cc6 2307
832df171
RR
2308 /**
2309 Appends an item (=row) to the control and store.
2310 */
2311 void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
2312
2313 /**
2314 Prepends an item (=row) to the control and store.
2315 */
2316 void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
2317
2318 /**
2319 Inserts an item (=row) to the control and store.
2320 */
14f73cf1 2321 void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL );
02b51ae5 2322
832df171
RR
2323 /**
2324 Delete the row at position @a row.
2325 */
2326 void DeleteItem( unsigned row );
02b51ae5 2327
832df171
RR
2328 /**
2329 Delete all items (= all rows).
2330 */
2331 void DeleteAllItems();
02b51ae5 2332
832df171
RR
2333 /**
2334 Sets the value in the store and update the control.
2335 */
2336 void SetValue( const wxVariant &value, unsigned int row, unsigned int col );
02b51ae5 2337
832df171
RR
2338 /**
2339 Returns the value from the store.
2340 */
2341 void GetValue( wxVariant &value, unsigned int row, unsigned int col );
02b51ae5 2342
832df171 2343 /**
02b51ae5
FM
2344 Sets the value in the store and update the control.
2345
57ab6f23 2346 This method assumes that the string is stored in respective
832df171
RR
2347 column.
2348 */
2349 void SetTextValue( const wxString &value, unsigned int row, unsigned int col );
02b51ae5 2350
832df171
RR
2351 /**
2352 Returns the value from the store.
02b51ae5 2353
57ab6f23 2354 This method assumes that the string is stored in respective
832df171
RR
2355 column.
2356 */
2357 wxString GetTextValue( unsigned int row, unsigned int col ) const;
02b51ae5 2358
832df171 2359 /**
02b51ae5
FM
2360 Sets the value in the store and update the control.
2361
57ab6f23 2362 This method assumes that the boolean value is stored in
832df171
RR
2363 respective column.
2364 */
2365 void SetToggleValue( bool value, unsigned int row, unsigned int col );
02b51ae5 2366
832df171
RR
2367 /**
2368 Returns the value from the store.
02b51ae5 2369
57ab6f23 2370 This method assumes that the boolean value is stored in
832df171
RR
2371 respective column.
2372 */
2373 bool GetToggleValue( unsigned int row, unsigned int col ) const;
43c64cc6 2374
14f73cf1 2375 //@}
832df171
RR
2376};
2377
2378
23324ae1 2379/**
5b99d5d8 2380 @class wxDataViewTreeCtrl
7c913512 2381
c4e57202
FM
2382 This class is a wxDataViewCtrl which internally uses a wxDataViewTreeStore
2383 and forwards most of its API to that class.
2384 Additionally, it uses a wxImageList to store a list of icons.
2385
43c64cc6
VZ
2386 The main purpose of this class is to provide a simple upgrade path for code
2387 using wxTreeCtrl.
14f73cf1
FM
2388
2389 @beginStyleTable
2390 See wxDataViewCtrl for the list of supported styles.
2391 @endStyleTable
43c64cc6 2392
14f73cf1
FM
2393 @beginEventEmissionTable
2394 See wxDataViewCtrl for the list of events emitted by this class.
2395 @endEventTable
7c913512 2396
8ed522d9 2397 @library{wxadv}
b321b61c 2398 @category{ctrl,dvc}
7e59b885 2399 @appearance{dataviewtreectrl.png}
23324ae1 2400*/
5b99d5d8 2401class wxDataViewTreeCtrl : public wxDataViewCtrl
23324ae1
FM
2402{
2403public:
2404 /**
c4e57202 2405 Default ctor.
5b99d5d8
RR
2406 */
2407 wxDataViewTreeCtrl();
c4e57202
FM
2408
2409 /**
43c64cc6
VZ
2410 Constructor.
2411
2412 Calls Create().
c4e57202 2413 */
5b99d5d8
RR
2414 wxDataViewTreeCtrl(wxWindow* parent, wxWindowID id,
2415 const wxPoint& pos = wxDefaultPosition,
2416 const wxSize& size = wxDefaultSize,
43c64cc6 2417 long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
5b99d5d8 2418 const wxValidator& validator = wxDefaultValidator);
3c4f71cc 2419
5b99d5d8
RR
2420 /**
2421 Destructor. Deletes the image list if any.
23324ae1 2422 */
adaaa686 2423 virtual ~wxDataViewTreeCtrl();
23324ae1 2424
5b99d5d8 2425 /**
b75b04d4 2426 Appends a container to the given @a parent.
5b99d5d8
RR
2427 */
2428 wxDataViewItem AppendContainer(const wxDataViewItem& parent,
2429 const wxString& text,
2430 int icon = -1,
2431 int expanded = -1,
2432 wxClientData* data = NULL);
e54c96f1 2433
5b99d5d8 2434 /**
b75b04d4 2435 Appends an item to the given @a parent.
5b99d5d8
RR
2436 */
2437 wxDataViewItem AppendItem(const wxDataViewItem& parent,
2438 const wxString& text,
2439 int icon = -1,
2440 wxClientData* data = NULL);
7c913512 2441
5b99d5d8 2442 /**
c4e57202 2443 Creates the control and a wxDataViewTreeStore as its internal model.
43c64cc6
VZ
2444
2445 The default tree column created by this method is an editable column
2446 using wxDataViewIconTextRenderer as its renderer.
5b99d5d8
RR
2447 */
2448 bool Create(wxWindow* parent, wxWindowID id,
2449 const wxPoint& pos = wxDefaultPosition,
2450 const wxSize& size = wxDefaultSize,
43c64cc6 2451 long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
5b99d5d8
RR
2452 const wxValidator& validator = wxDefaultValidator);
2453
2454 /**
2455 Calls the identical method from wxDataViewTreeStore.
2456 */
2457 void DeleteAllItems();
7c913512 2458
23324ae1 2459 /**
5b99d5d8
RR
2460 Calls the identical method from wxDataViewTreeStore.
2461 */
2462 void DeleteChildren(const wxDataViewItem& item);
3c4f71cc 2463
5b99d5d8
RR
2464 /**
2465 Calls the identical method from wxDataViewTreeStore.
23324ae1 2466 */
5b99d5d8 2467 void DeleteItem(const wxDataViewItem& item);
23324ae1 2468
5b99d5d8
RR
2469 /**
2470 Calls the identical method from wxDataViewTreeStore.
2471 */
2472 int GetChildCount(const wxDataViewItem& parent) const;
23324ae1 2473
5b99d5d8
RR
2474 /**
2475 Returns the image list.
2476 */
2477 wxImageList* GetImageList();
05303ccd 2478
5b99d5d8
RR
2479 /**
2480 Calls the identical method from wxDataViewTreeStore.
2481 */
2482 wxClientData* GetItemData(const wxDataViewItem& item) const;
05303ccd 2483
5b99d5d8
RR
2484 /**
2485 Calls the identical method from wxDataViewTreeStore.
2486 */
b91c4601 2487 const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const;
05303ccd 2488
05303ccd 2489 /**
5b99d5d8 2490 Calls the identical method from wxDataViewTreeStore.
05303ccd 2491 */
b91c4601 2492 const wxIcon& GetItemIcon(const wxDataViewItem& item) const;
05303ccd
RR
2493
2494 /**
5b99d5d8 2495 Calls the identical method from wxDataViewTreeStore.
05303ccd 2496 */
5b99d5d8
RR
2497 wxString GetItemText(const wxDataViewItem& item) const;
2498
2499 /**
2500 Calls the identical method from wxDataViewTreeStore.
2501 */
2502 wxDataViewItem GetNthChild(const wxDataViewItem& parent,
2503 unsigned int pos) const;
05303ccd 2504
5b99d5d8 2505 //@{
05303ccd 2506 /**
5b99d5d8 2507 Returns the store.
05303ccd 2508 */
882678eb 2509 wxDataViewTreeStore* GetStore();
5b99d5d8
RR
2510 const wxDataViewTreeStore* GetStore() const;
2511 //@}
05303ccd
RR
2512
2513 /**
c4e57202
FM
2514 Calls the same method from wxDataViewTreeStore but uses
2515 an index position in the image list instead of a wxIcon.
05303ccd 2516 */
5b99d5d8
RR
2517 wxDataViewItem InsertContainer(const wxDataViewItem& parent,
2518 const wxDataViewItem& previous,
2519 const wxString& text,
2520 int icon = -1,
2521 int expanded = -1,
2522 wxClientData* data = NULL);
05303ccd
RR
2523
2524 /**
c4e57202
FM
2525 Calls the same method from wxDataViewTreeStore but uses
2526 an index position in the image list instead of a wxIcon.
05303ccd 2527 */
5b99d5d8
RR
2528 wxDataViewItem InsertItem(const wxDataViewItem& parent,
2529 const wxDataViewItem& previous,
2530 const wxString& text,
2531 int icon = -1,
2532 wxClientData* data = NULL);
05303ccd 2533
8ddda15b
RR
2534 /**
2535 Returns true if item is a container.
2536 */
2537 bool IsContainer( const wxDataViewItem& item );
2538
05303ccd 2539 /**
c4e57202
FM
2540 Calls the same method from wxDataViewTreeStore but uses
2541 an index position in the image list instead of a wxIcon.
05303ccd 2542 */
5b99d5d8
RR
2543 wxDataViewItem PrependContainer(const wxDataViewItem& parent,
2544 const wxString& text,
2545 int icon = -1,
2546 int expanded = -1,
2547 wxClientData* data = NULL);
05303ccd
RR
2548
2549 /**
c4e57202
FM
2550 Calls the same method from wxDataViewTreeStore but uses
2551 an index position in the image list instead of a wxIcon.
05303ccd 2552 */
5b99d5d8
RR
2553 wxDataViewItem PrependItem(const wxDataViewItem& parent,
2554 const wxString& text,
2555 int icon = -1,
2556 wxClientData* data = NULL);
05303ccd
RR
2557
2558 /**
5b99d5d8 2559 Sets the image list.
05303ccd 2560 */
5b99d5d8 2561 void SetImageList(wxImageList* imagelist);
05303ccd
RR
2562
2563 /**
5b99d5d8 2564 Calls the identical method from wxDataViewTreeStore.
05303ccd 2565 */
5b99d5d8 2566 void SetItemData(const wxDataViewItem& item, wxClientData* data);
05303ccd
RR
2567
2568 /**
5b99d5d8 2569 Calls the identical method from wxDataViewTreeStore.
05303ccd 2570 */
5b99d5d8
RR
2571 void SetItemExpandedIcon(const wxDataViewItem& item,
2572 const wxIcon& icon);
05303ccd
RR
2573
2574 /**
5b99d5d8 2575 Calls the identical method from wxDataViewTreeStore.
05303ccd 2576 */
5b99d5d8 2577 void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon);
05303ccd
RR
2578
2579 /**
5b99d5d8 2580 Calls the identical method from wxDataViewTreeStore.
05303ccd 2581 */
5b99d5d8
RR
2582 void SetItemText(const wxDataViewItem& item,
2583 const wxString& text);
05303ccd
RR
2584};
2585
2586
bda698ed
RR
2587/**
2588 @class wxDataViewListStore
2589
2590 wxDataViewListStore is a specialised wxDataViewModel for storing
2591 a simple table of data. Since it derives from wxDataViewIndexListModel
2592 its data is be accessed by row (i.e. by index) instead of only
2593 by wxDataViewItem.
2594
02b51ae5 2595 This class actually stores the values (therefore its name)
bda698ed 2596 and implements all virtual methods from the base classes so it can be
02b51ae5 2597 used directly without having to derive any class from it, but it is
bda698ed
RR
2598 mostly used from within wxDataViewListCtrl.
2599
2600 @library{wxadv}
2601 @category{dvc}
2602*/
2603
2604class wxDataViewListStore: public wxDataViewIndexListModel
2605{
2606public:
2607 /**
02b51ae5 2608 Constructor
bda698ed
RR
2609 */
2610 wxDataViewListStore();
02b51ae5 2611
bda698ed 2612 /**
02b51ae5 2613 Destructor
bda698ed
RR
2614 */
2615 ~wxDataViewListStore();
2616
2617 /**
02b51ae5
FM
2618 Prepends a data column.
2619
2620 @a variantype indicates the type of values store in the column.
2621
2622 This does not automatically fill in any (default) values in
2623 rows which exist in the store already.
bda698ed
RR
2624 */
2625 void PrependColumn( const wxString &varianttype );
2626
2627 /**
02b51ae5
FM
2628 Inserts a data column before @a pos.
2629
2630 @a variantype indicates the type of values store in the column.
2631
2632 This does not automatically fill in any (default) values in
2633 rows which exist in the store already.
bda698ed
RR
2634 */
2635 void InsertColumn( unsigned int pos, const wxString &varianttype );
2636
2637 /**
02b51ae5
FM
2638 Appends a data column.
2639
2640 @a variantype indicates the type of values store in the column.
2641
2642 This does not automatically fill in any (default) values in
2643 rows which exist in the store already.
bda698ed
RR
2644 */
2645 void AppendColumn( const wxString &varianttype );
02b51ae5 2646
bda698ed
RR
2647 /**
2648 Appends an item (=row) and fills it with @a values.
02b51ae5 2649
bda698ed
RR
2650 The values must match the values specifies in the column
2651 in number and type. No (default) values are filled in
2652 automatically.
2653 */
2654 void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
02b51ae5 2655
bda698ed
RR
2656 /**
2657 Prepends an item (=row) and fills it with @a values.
02b51ae5 2658
bda698ed
RR
2659 The values must match the values specifies in the column
2660 in number and type. No (default) values are filled in
2661 automatically.
2662 */
2663 void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL );
02b51ae5 2664
bda698ed
RR
2665 /**
2666 Inserts an item (=row) and fills it with @a values.
02b51ae5 2667
bda698ed
RR
2668 The values must match the values specifies in the column
2669 in number and type. No (default) values are filled in
2670 automatically.
2671 */
2672 void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL );
02b51ae5 2673
bda698ed
RR
2674 /**
2675 Delete the item (=row) at position @a pos.
2676 */
2677 void DeleteItem( unsigned pos );
02b51ae5 2678
bda698ed
RR
2679 /**
2680 Delete all item (=all rows) in the store.
2681 */
2682 void DeleteAllItems();
2683
2684 /**
57ab6f23 2685 Overridden from wxDataViewModel
bda698ed
RR
2686 */
2687 virtual unsigned int GetColumnCount() const;
2688
2689 /**
57ab6f23 2690 Overridden from wxDataViewModel
bda698ed
RR
2691 */
2692 virtual wxString GetColumnType( unsigned int col ) const;
2693
2694 /**
57ab6f23 2695 Overridden from wxDataViewIndexListModel
bda698ed
RR
2696 */
2697 virtual void GetValueByRow( wxVariant &value,
2698 unsigned int row, unsigned int col ) const;
2699
2700 /**
57ab6f23 2701 Overridden from wxDataViewIndexListModel
bda698ed
RR
2702 */
2703 virtual bool SetValueByRow( const wxVariant &value,
2704 unsigned int row, unsigned int col );
2705};
2706
05303ccd
RR
2707
2708/**
5b99d5d8 2709 @class wxDataViewTreeStore
05303ccd 2710
57ab6f23 2711 wxDataViewTreeStore is a specialised wxDataViewModel for storing simple
c4e57202
FM
2712 trees very much like wxTreeCtrl does and it offers a similar API.
2713
02b51ae5 2714 This class actually stores the entire tree and the values (therefore its name)
8eff6c56 2715 and implements all virtual methods from the base class so it can be used directly
bda698ed
RR
2716 without having to derive any class from it, but it is mostly used from within
2717 wxDataViewTreeCtrl.
05303ccd
RR
2718
2719 @library{wxadv}
b321b61c 2720 @category{dvc}
05303ccd 2721*/
5b99d5d8 2722class wxDataViewTreeStore : public wxDataViewModel
05303ccd
RR
2723{
2724public:
2725 /**
5b99d5d8 2726 Constructor. Creates the invisible root node internally.
05303ccd 2727 */
5b99d5d8 2728 wxDataViewTreeStore();
e54c96f1 2729
5b99d5d8
RR
2730 /**
2731 Destructor.
2732 */
adaaa686 2733 virtual ~wxDataViewTreeStore();
7c913512 2734
5b99d5d8
RR
2735 /**
2736 Append a container.
2737 */
2738 wxDataViewItem AppendContainer(const wxDataViewItem& parent,
2739 const wxString& text,
2740 const wxIcon& icon = wxNullIcon,
2741 const wxIcon& expanded = wxNullIcon,
2742 wxClientData* data = NULL);
7c913512 2743
5b99d5d8
RR
2744 /**
2745 Append an item.
2746 */
2747 wxDataViewItem AppendItem(const wxDataViewItem& parent,
2748 const wxString& text,
2749 const wxIcon& icon = wxNullIcon,
2750 wxClientData* data = NULL);
7c913512 2751
23324ae1 2752 /**
5b99d5d8 2753 Delete all item in the model.
23324ae1 2754 */
5b99d5d8 2755 void DeleteAllItems();
23324ae1
FM
2756
2757 /**
5b99d5d8 2758 Delete all children of the item, but not the item itself.
23324ae1 2759 */
5b99d5d8 2760 void DeleteChildren(const wxDataViewItem& item);
23324ae1
FM
2761
2762 /**
5b99d5d8 2763 Delete this item.
23324ae1 2764 */
5b99d5d8 2765 void DeleteItem(const wxDataViewItem& item);
23324ae1
FM
2766
2767 /**
5b99d5d8 2768 Return the number of children of item.
23324ae1 2769 */
5b99d5d8 2770 int GetChildCount(const wxDataViewItem& parent) const;
23324ae1
FM
2771
2772 /**
57ab6f23 2773 Returns the client data associated with the item.
23324ae1 2774 */
5b99d5d8 2775 wxClientData* GetItemData(const wxDataViewItem& item) const;
23324ae1
FM
2776
2777 /**
5b99d5d8 2778 Returns the icon to display in expanded containers.
23324ae1 2779 */
b91c4601 2780 const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const;
23324ae1
FM
2781
2782 /**
5b99d5d8 2783 Returns the icon of the item.
23324ae1 2784 */
b91c4601 2785 const wxIcon& GetItemIcon(const wxDataViewItem& item) const;
23324ae1
FM
2786
2787 /**
5b99d5d8 2788 Returns the text of the item.
23324ae1 2789 */
5b99d5d8 2790 wxString GetItemText(const wxDataViewItem& item) const;
23324ae1
FM
2791
2792 /**
5b99d5d8 2793 Returns the nth child item of item.
23324ae1 2794 */
5b99d5d8
RR
2795 wxDataViewItem GetNthChild(const wxDataViewItem& parent,
2796 unsigned int pos) const;
23324ae1
FM
2797
2798 /**
c4e57202 2799 Inserts a container after @a previous.
23324ae1 2800 */
5b99d5d8
RR
2801 wxDataViewItem InsertContainer(const wxDataViewItem& parent,
2802 const wxDataViewItem& previous,
2803 const wxString& text,
2804 const wxIcon& icon = wxNullIcon,
2805 const wxIcon& expanded = wxNullIcon,
2806 wxClientData* data = NULL);
23324ae1
FM
2807
2808 /**
c4e57202 2809 Inserts an item after @a previous.
23324ae1 2810 */
5b99d5d8
RR
2811 wxDataViewItem InsertItem(const wxDataViewItem& parent,
2812 const wxDataViewItem& previous,
2813 const wxString& text,
2814 const wxIcon& icon = wxNullIcon,
2815 wxClientData* data = NULL);
23324ae1
FM
2816
2817 /**
c4e57202 2818 Inserts a container before the first child item or @a parent.
23324ae1 2819 */
5b99d5d8
RR
2820 wxDataViewItem PrependContainer(const wxDataViewItem& parent,
2821 const wxString& text,
2822 const wxIcon& icon = wxNullIcon,
2823 const wxIcon& expanded = wxNullIcon,
2824 wxClientData* data = NULL);
23324ae1
FM
2825
2826 /**
c4e57202 2827 Inserts an item before the first child item or @a parent.
23324ae1 2828 */
5b99d5d8
RR
2829 wxDataViewItem PrependItem(const wxDataViewItem& parent,
2830 const wxString& text,
2831 const wxIcon& icon = wxNullIcon,
2832 wxClientData* data = NULL);
23324ae1
FM
2833
2834 /**
5b99d5d8 2835 Sets the client data associated with the item.
23324ae1 2836 */
5b99d5d8 2837 void SetItemData(const wxDataViewItem& item, wxClientData* data);
23324ae1
FM
2838
2839 /**
5b99d5d8 2840 Sets the expanded icon for the item.
23324ae1 2841 */
5b99d5d8
RR
2842 void SetItemExpandedIcon(const wxDataViewItem& item,
2843 const wxIcon& icon);
23324ae1
FM
2844
2845 /**
5b99d5d8 2846 Sets the icon for the item.
23324ae1 2847 */
5b99d5d8 2848 void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon);
23324ae1 2849};
e54c96f1 2850
80932a3e
FM
2851
2852/**
2853 @class wxDataViewIconText
2854
2855 wxDataViewIconText is used by wxDataViewIconTextRenderer for data transfer.
2856 This class can be converted to and from a wxVariant.
2857
2858 @library{wxadv}
2859 @category{dvc}
2860*/
2861class wxDataViewIconText : public wxObject
2862{
2863public:
2864 //@{
2865 /**
2866 Constructor.
2867 */
2868 wxDataViewIconText(const wxString& text = wxEmptyString,
2869 const wxIcon& icon = wxNullIcon);
2870 wxDataViewIconText(const wxDataViewIconText& other);
2871 //@}
2872
2873 /**
2874 Gets the icon.
2875 */
2876 const wxIcon& GetIcon() const;
2877
2878 /**
2879 Gets the text.
2880 */
2881 wxString GetText() const;
2882
2883 /**
2884 Set the icon.
2885 */
2886 void SetIcon(const wxIcon& icon);
2887
2888 /**
2889 Set the text.
2890 */
2891 void SetText(const wxString& text);
2892};
2893
2894
2895
2896/**
2897 @class wxDataViewEvent
2898
2899 This is the event class for the wxDataViewCtrl notifications.
2900
14f73cf1
FM
2901 @beginEventTable{wxDataViewEvent}
2902 @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)}
2903 Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event.
2904 @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)}
2905 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.
2906 @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)}
2907 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event.
2908 @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)}
2909 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event.
2910 @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)}
2911 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event.
2912 @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)}
2913 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event.
2914 @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)}
2915 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event.
2916 @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)}
2917 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event.
2918 @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)}
2919 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event.
2920 @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)}
2921 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event.
2922 @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)}
2392b8e8 2923 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK event.
14f73cf1
FM
2924 @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)}
2925 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event.
2926 @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)}
2927 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event.
2928 @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
2929 Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event.
2930 @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)}
2931 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event.
2932 @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)}
2933 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event.
2934 @event{EVT_DATAVIEW_ITEM_DROP(id, func)}
2935 Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event.
47a8b1e1
VZ
2936 @event{EVT_DATAVIEW_CACHE_HINT(id, func)}
2937 Process a @c wxEVT_COMMAND_DATAVIEW_CACHE_HINT event.
14f73cf1 2938 @endEventTable
43c64cc6 2939
80932a3e
FM
2940 @library{wxadv}
2941 @category{events,dvc}
2942*/
2943class wxDataViewEvent : public wxNotifyEvent
2944{
2945public:
80932a3e
FM
2946 /**
2947 Constructor. Typically used by wxWidgets internals only.
2948 */
2949 wxDataViewEvent(wxEventType commandType = wxEVT_NULL,
2950 int winid = 0);
80932a3e
FM
2951
2952 /**
2953 Returns the position of the column in the control or -1
2954 if no column field was set by the event emitter.
2955 */
2956 int GetColumn() const;
2957
2958 /**
2959 Returns a pointer to the wxDataViewColumn from which
2960 the event was emitted or @NULL.
2961 */
2962 wxDataViewColumn* GetDataViewColumn() const;
2963
2964 /**
2965 Returns the wxDataViewModel associated with the event.
2966 */
2967 wxDataViewModel* GetModel() const;
2968
2969 /**
57ab6f23 2970 Returns the position of a context menu event in screen coordinates.
80932a3e
FM
2971 */
2972 wxPoint GetPosition() const;
2973
2974 /**
2975 Returns a reference to a value.
2976 */
2977 const wxVariant& GetValue() const;
2978
2a648479
VZ
2979 /**
2980 Can be used to determine whether the new value is going to be accepted
2981 in wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE handler.
2982
2983 Returns @true if editing the item was cancelled or if the user tried to
2984 enter an invalid value (refused by wxDataViewRenderer::Validate()). If
2985 this method returns @false, it means that the value in the model is
2986 about to be changed to the new one.
2987
2988 Notice that wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event handler can
2989 call wxNotifyEvent::Veto() to prevent this from happening.
2990
2991 Currently support for setting this field and for vetoing the change is
2992 only available in the generic version of wxDataViewCtrl, i.e. under MSW
2993 but not GTK nor OS X.
2994
2995 @since 2.9.3
2996 */
2997 bool IsEditCancelled() const;
2998
80932a3e
FM
2999 /**
3000 Sets the column index associated with this event.
3001 */
3002 void SetColumn(int col);
3003
3004 /**
2392b8e8 3005 For @c wxEVT_DATAVIEW_COLUMN_HEADER_CLICK only.
80932a3e
FM
3006 */
3007 void SetDataViewColumn(wxDataViewColumn* col);
3008
3009 /**
3010 Sets the dataview model associated with this event.
3011 */
3012 void SetModel(wxDataViewModel* model);
3013
3014 /**
3015 Sets the value associated with this event.
3016 */
3017 void SetValue(const wxVariant& value);
02b51ae5 3018
591cc82d 3019 /**
e4de825e 3020 Set wxDataObject for data transfer within a drag operation.
591cc82d
RR
3021 */
3022 void SetDataObject( wxDataObject *obj );
02b51ae5 3023
e4de825e
RR
3024 /**
3025 Gets the wxDataFormat during a drop operation.
3026 */
3027 wxDataFormat GetDataFormat() const;
02b51ae5 3028
e4de825e
RR
3029 /**
3030 Gets the data size for a drop data transfer.
3031 */
3032 size_t GetDataSize() const;
02b51ae5 3033
e4de825e
RR
3034 /**
3035 Gets the data buffer for a drop data transfer.
591cc82d 3036 */
e4de825e 3037 void *GetDataBuffer() const;
47a8b1e1 3038
c04be1a2
VZ
3039 /**
3040 Specify the kind of the drag operation to perform.
3041
3042 This method can be used inside a wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG
3043 handler in order to configure the drag operation. Valid values are
3044 ::wxDrag_CopyOnly (default), ::wxDrag_AllowMove (allow the data to be
3045 moved) and ::wxDrag_DefaultMove.
3046
3047 Currently it is only honoured by the generic version of wxDataViewCtrl
3048 (used e.g. under MSW) and not supported by the native GTK and OS X
3049 versions.
3050
3051 @see GetDropEffect()
3052
3053 @since 2.9.4
3054 */
3055 void SetDragFlags(int flags);
3056
3057 /**
3058 Returns the effect the user requested to happen to the dropped data.
3059
3060 This function can be used inside
3061 wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE and
3062 wxEVT_COMMAND_DATAVIEW_ITEM_DROP handlers and returns whether the user
3063 is trying to copy (the return value is ::wxDragCopy) or move (if the
3064 return value is ::wxDragMove) the data.
3065
3066 Currently this is only available when using the generic version of
3067 wxDataViewCtrl (used e.g. under MSW) and always returns ::wxDragNone in
3068 the GTK and OS X native versions.
3069
3070 @since 2.9.4
3071 */
3072 wxDragResult GetDropEffect() const;
3073
47a8b1e1
VZ
3074 /**
3075 Return the first row that will be displayed.
3076 */
3077 int GetCacheFrom() const;
3078
3079 /**
3080 Return the last row that will be displayed.
3081 */
3082 int GetCacheTo() const;
80932a3e
FM
3083};
3084