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