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