]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dataview.h
0f64e7f156a750f0f0bb748aeaeb2e6a23b07565
[wxWidgets.git] / include / wx / dataview.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dataview.h
3 // Purpose: wxDataViewCtrl base classes
4 // Author: Robert Roebling
5 // Modified by: Bo Yang
6 // Created: 08.01.06
7 // RCS-ID: $Id$
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DATAVIEW_H_BASE_
13 #define _WX_DATAVIEW_H_BASE_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_DATAVIEWCTRL
18
19 #include "wx/control.h"
20 #include "wx/textctrl.h"
21 #include "wx/bitmap.h"
22 #include "wx/variant.h"
23 #include "wx/dynarray.h"
24 #include "wx/icon.h"
25 #include "wx/imaglist.h"
26
27 #if defined(__WXGTK20__)
28 // for testing
29 // #define wxUSE_GENERICDATAVIEWCTRL 1
30 #elif defined(__WXMAC__)
31 #else
32 #define wxUSE_GENERICDATAVIEWCTRL 1
33 #endif
34
35 // ----------------------------------------------------------------------------
36 // wxDataViewCtrl flags
37 // ----------------------------------------------------------------------------
38
39 // ----------------------------------------------------------------------------
40 // wxDataViewCtrl globals
41 // ----------------------------------------------------------------------------
42
43 class WXDLLIMPEXP_FWD_ADV wxDataViewItem;
44 class WXDLLIMPEXP_FWD_ADV wxDataViewModel;
45 class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl;
46 class WXDLLIMPEXP_FWD_ADV wxDataViewColumn;
47 class WXDLLIMPEXP_FWD_ADV wxDataViewRenderer;
48 class WXDLLIMPEXP_FWD_ADV wxDataViewModelNotifier;
49
50 extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxDataViewCtrlNameStr[];
51
52 // the default width of new (text) columns:
53 #define wxDVC_DEFAULT_WIDTH 80
54
55 // the default width of new toggle columns:
56 #define wxDVC_TOGGLE_DEFAULT_WIDTH 30
57
58 // the default minimal width of the columns:
59 #define wxDVC_DEFAULT_MINWIDTH 30
60
61 // the default alignment of wxDataViewRenderers:
62 #define wxDVR_DEFAULT_ALIGNMENT (wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL)
63
64
65 // ---------------------------------------------------------
66 // wxDataViewItem
67 // ---------------------------------------------------------
68
69 class WXDLLIMPEXP_ADV wxDataViewItem
70 {
71 public:
72 wxDataViewItem( void* id = NULL )
73 { m_id = id; }
74 wxDataViewItem( const wxDataViewItem &item )
75 { m_id = item.m_id; }
76 bool IsOk() const { return m_id != NULL; }
77 void* GetID() const { return m_id; }
78 operator const void* () const { return m_id; }
79
80 #ifdef __WXDEBUG__
81 void Print( const wxString &text ) const;
82 #endif
83
84 private:
85 void* m_id;
86 };
87
88 bool operator == (const wxDataViewItem &left, const wxDataViewItem &right);
89
90 WX_DEFINE_ARRAY(wxDataViewItem, wxDataViewItemArray);
91
92 // ---------------------------------------------------------
93 // wxDataViewModelNotifier
94 // ---------------------------------------------------------
95
96 class WXDLLIMPEXP_ADV wxDataViewModelNotifier
97 {
98 public:
99 wxDataViewModelNotifier() { }
100 virtual ~wxDataViewModelNotifier() { m_owner = NULL; }
101
102 virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0;
103 virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0;
104 virtual bool ItemChanged( const wxDataViewItem &item ) = 0;
105 virtual bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items );
106 virtual bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items );
107 virtual bool ItemsChanged( const wxDataViewItemArray &items );
108 virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ) = 0;
109 virtual bool Cleared() = 0;
110
111 virtual void Resort() = 0;
112
113 void SetOwner( wxDataViewModel *owner ) { m_owner = owner; }
114 wxDataViewModel *GetOwner() { return m_owner; }
115
116 private:
117 wxDataViewModel *m_owner;
118 };
119
120
121
122 // ----------------------------------------------------------------------------
123 // wxDataViewItemAttr: a structure containing the visual attributes of an item
124 // ----------------------------------------------------------------------------
125
126 // TODO: this should be renamed to wxItemAttr or something general like this
127
128 class WXDLLIMPEXP_ADV wxDataViewItemAttr
129 {
130 public:
131 // ctors
132 wxDataViewItemAttr()
133 {
134 m_bold = false;
135 m_italic = false;
136 }
137
138 // setters
139 void SetColour(const wxColour& colour) { m_colour = colour; }
140 void SetBold( bool set ) { m_bold = set; }
141 void SetItalic( bool set ) { m_italic = set; }
142
143 // accessors
144 bool HasColour() const { return m_colour.Ok(); }
145 const wxColour& GetColour() const { return m_colour; }
146
147 bool GetBold() const { return m_bold; }
148 bool GetItalic() const { return m_italic; }
149
150 private:
151 wxColour m_colour;
152 bool m_bold;
153 bool m_italic;
154 };
155
156
157 // ---------------------------------------------------------
158 // wxDataViewModel
159 // ---------------------------------------------------------
160
161 WX_DECLARE_LIST_WITH_DECL(wxDataViewModelNotifier, wxDataViewModelNotifiers,
162 class WXDLLIMPEXP_ADV);
163
164 class WXDLLIMPEXP_ADV wxDataViewModel: public wxObjectRefData
165 {
166 public:
167 wxDataViewModel();
168
169 virtual unsigned int GetColumnCount() const = 0;
170
171 // return type as reported by wxVariant
172 virtual wxString GetColumnType( unsigned int col ) const = 0;
173
174 // get value into a wxVariant
175 virtual void GetValue( wxVariant &variant,
176 const wxDataViewItem &item, unsigned int col ) const = 0;
177
178 // set value, call ValueChanged() afterwards!
179 virtual bool SetValue( const wxVariant &variant,
180 const wxDataViewItem &item, unsigned int col ) = 0;
181
182 // Get text attribute, return false of default attributes should be used
183 virtual bool GetAttr( const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) )
184 { return false; }
185
186 // define hierachy
187 virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const = 0;
188 virtual bool IsContainer( const wxDataViewItem &item ) const = 0;
189 // Is the container just a header or an item with all columns
190 virtual bool HasContainerColumns(const wxDataViewItem& WXUNUSED(item)) const
191 { return false; }
192 virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const = 0;
193
194 // delegated notifiers
195 virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item );
196 virtual bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items );
197 virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item );
198 virtual bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items );
199 virtual bool ItemChanged( const wxDataViewItem &item );
200 virtual bool ItemsChanged( const wxDataViewItemArray &items );
201 virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col );
202 virtual bool Cleared();
203
204 // delegatd action
205 virtual void Resort();
206
207 void AddNotifier( wxDataViewModelNotifier *notifier );
208 void RemoveNotifier( wxDataViewModelNotifier *notifier );
209
210 // default compare function
211 virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
212 unsigned int column, bool ascending );
213 virtual bool HasDefaultCompare() const { return false; }
214
215 // internal
216 virtual bool IsIndexListModel() const { return false; }
217
218 protected:
219 // the user should not delete this class directly: he should use DecRef() instead!
220 virtual ~wxDataViewModel() { }
221
222 wxDataViewModelNotifiers m_notifiers;
223 };
224
225 // ---------------------------------------------------------
226 // wxDataViewIndexListModel
227 // ---------------------------------------------------------
228
229 class WXDLLIMPEXP_ADV wxDataViewIndexListModel: public wxDataViewModel
230 {
231 public:
232 wxDataViewIndexListModel( unsigned int initial_size = 0 );
233 ~wxDataViewIndexListModel();
234
235 virtual void GetValue( wxVariant &variant,
236 unsigned int row, unsigned int col ) const = 0;
237
238 virtual bool SetValue( const wxVariant &variant,
239 unsigned int row, unsigned int col ) = 0;
240
241 virtual bool GetAttr( unsigned int WXUNUSED(row), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) )
242 { return false; }
243
244 void RowPrepended();
245 void RowInserted( unsigned int before );
246 void RowAppended();
247 void RowDeleted( unsigned int row );
248 void RowsDeleted( const wxArrayInt &rows );
249 void RowChanged( unsigned int row );
250 void RowValueChanged( unsigned int row, unsigned int col );
251
252 // convert to/from row/wxDataViewItem
253
254 unsigned int GetRow( const wxDataViewItem &item ) const;
255 wxDataViewItem GetItem( unsigned int row ) const;
256
257 // compare based on index
258
259 virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
260 unsigned int column, bool ascending );
261 virtual bool HasDefaultCompare() const;
262
263 // implement base methods
264
265 virtual void GetValue( wxVariant &variant,
266 const wxDataViewItem &item, unsigned int col ) const;
267 virtual bool SetValue( const wxVariant &variant,
268 const wxDataViewItem &item, unsigned int col );
269 virtual bool GetAttr( const wxDataViewItem &item, unsigned int col, wxDataViewItemAttr &attr );
270 virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
271 virtual bool IsContainer( const wxDataViewItem &item ) const;
272 virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
273
274 // internal
275 virtual bool IsIndexListModel() const { return true; }
276 unsigned int GetLastIndex() const { return m_lastIndex; }
277
278 private:
279 wxDataViewItemArray m_hash;
280 unsigned int m_lastIndex;
281 bool m_ordered;
282 bool m_useHash;
283 };
284
285
286 //-----------------------------------------------------------------------------
287 // wxDataViewEditorCtrlEvtHandler
288 //-----------------------------------------------------------------------------
289
290 class wxDataViewEditorCtrlEvtHandler: public wxEvtHandler
291 {
292 public:
293 wxDataViewEditorCtrlEvtHandler( wxControl *editor, wxDataViewRenderer *owner );
294
295 void AcceptChangesAndFinish();
296 void SetFocusOnIdle( bool focus = true ) { m_focusOnIdle = focus; }
297
298 protected:
299 void OnChar( wxKeyEvent &event );
300 void OnKillFocus( wxFocusEvent &event );
301 void OnIdle( wxIdleEvent &event );
302
303 private:
304 wxDataViewRenderer *m_owner;
305 wxControl *m_editorCtrl;
306 bool m_finished;
307 bool m_focusOnIdle;
308
309 private:
310 DECLARE_EVENT_TABLE()
311 };
312
313 // ---------------------------------------------------------
314 // wxDataViewRendererBase
315 // ---------------------------------------------------------
316
317 enum wxDataViewCellMode
318 {
319 wxDATAVIEW_CELL_INERT,
320 wxDATAVIEW_CELL_ACTIVATABLE,
321 wxDATAVIEW_CELL_EDITABLE
322 };
323
324 enum wxDataViewCellRenderState
325 {
326 wxDATAVIEW_CELL_SELECTED = 1,
327 wxDATAVIEW_CELL_PRELIT = 2,
328 wxDATAVIEW_CELL_INSENSITIVE = 4,
329 wxDATAVIEW_CELL_FOCUSED = 8
330 };
331
332 class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject
333 {
334 public:
335 wxDataViewRendererBase( const wxString &varianttype,
336 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
337 int alignment = wxDVR_DEFAULT_ALIGNMENT );
338
339 virtual bool Validate( wxVariant& WXUNUSED(value) )
340 { return true; }
341
342 void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
343 wxDataViewColumn* GetOwner() { return m_owner; }
344
345 // renderer properties:
346
347 virtual bool SetValue( const wxVariant& WXUNUSED(value) ) = 0;
348 virtual bool GetValue( wxVariant& WXUNUSED(value) ) const = 0;
349
350 wxString GetVariantType() const { return m_variantType; }
351
352 virtual void SetMode( wxDataViewCellMode mode ) = 0;
353 virtual wxDataViewCellMode GetMode() const = 0;
354
355 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
356 // rather an "int"; that's because for rendering cells it's allowed
357 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
358 virtual void SetAlignment( int align ) = 0;
359 virtual int GetAlignment() const = 0;
360
361 // in-place editing
362 virtual bool HasEditorCtrl()
363 { return false; }
364 virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
365 wxRect WXUNUSED(labelRect),
366 const wxVariant& WXUNUSED(value))
367 { return NULL; }
368 virtual bool GetValueFromEditorCtrl(wxControl * WXUNUSED(editor),
369 wxVariant& WXUNUSED(value))
370 { return false; }
371
372 virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect );
373 virtual void CancelEditing();
374 virtual bool FinishEditing();
375
376 wxControl *GetEditorCtrl() { return m_editorCtrl; }
377
378 protected:
379 wxString m_variantType;
380 wxDataViewColumn *m_owner;
381 wxControl *m_editorCtrl;
382 wxDataViewItem m_item; // for m_editorCtrl
383
384 // internal utility:
385 const wxDataViewCtrl* GetView() const;
386
387 protected:
388 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase)
389 };
390
391 //-----------------------------------------------------------------------------
392 // wxDataViewIconText
393 //-----------------------------------------------------------------------------
394
395 class WXDLLIMPEXP_ADV wxDataViewIconText: public wxObject
396 {
397 public:
398 wxDataViewIconText( const wxString &text = wxEmptyString, const wxIcon& icon = wxNullIcon )
399 { m_icon = icon; m_text = text; }
400 wxDataViewIconText( const wxDataViewIconText &other )
401 { m_icon = other.m_icon; m_text = other.m_text; }
402
403 void SetText( const wxString &text ) { m_text = text; }
404 wxString GetText() const { return m_text; }
405 void SetIcon( const wxIcon &icon ) { m_icon = icon; }
406 const wxIcon &GetIcon() const { return m_icon; }
407
408 private:
409 wxString m_text;
410 wxIcon m_icon;
411
412 private:
413 DECLARE_DYNAMIC_CLASS(wxDataViewIconText)
414 };
415
416 bool operator == (const wxDataViewIconText &one, const wxDataViewIconText &two);
417
418 DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV)
419
420 // ---------------------------------------------------------
421 // wxDataViewColumnBase
422 // ---------------------------------------------------------
423
424 enum wxDataViewColumnFlags
425 {
426 wxDATAVIEW_COL_RESIZABLE = 1,
427 wxDATAVIEW_COL_SORTABLE = 2,
428 wxDATAVIEW_COL_HIDDEN = 4
429 };
430
431 class WXDLLIMPEXP_ADV wxDataViewColumnBase: public wxObject
432 {
433 public:
434 wxDataViewColumnBase( const wxString &title, wxDataViewRenderer *renderer,
435 unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
436 wxAlignment align = wxALIGN_CENTER,
437 int flags = wxDATAVIEW_COL_RESIZABLE );
438 wxDataViewColumnBase( const wxBitmap &bitmap, wxDataViewRenderer *renderer,
439 unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
440 wxAlignment align = wxALIGN_CENTER,
441 int flags = wxDATAVIEW_COL_RESIZABLE );
442 virtual ~wxDataViewColumnBase();
443
444 // setters:
445
446 virtual void SetTitle( const wxString &title ) = 0;
447 virtual void SetAlignment( wxAlignment align ) = 0;
448 virtual void SetSortable( bool sortable ) = 0;
449 virtual void SetResizeable( bool resizeable ) = 0;
450 virtual void SetHidden( bool hidden ) = 0;
451 virtual void SetSortOrder( bool ascending ) = 0;
452 virtual void SetFlags( int flags );
453 virtual void SetOwner( wxDataViewCtrl *owner )
454 { m_owner = owner; }
455 virtual void SetBitmap( const wxBitmap &bitmap )
456 { m_bitmap=bitmap; }
457
458 virtual void SetMinWidth( int minWidth ) = 0;
459 virtual void SetWidth( int width ) = 0;
460
461
462 // getters:
463
464 virtual wxString GetTitle() const = 0;
465 virtual wxAlignment GetAlignment() const = 0;
466 virtual int GetWidth() const = 0;
467 virtual int GetMinWidth() const = 0;
468
469 virtual int GetFlags() const;
470
471 virtual bool IsSortable() const = 0;
472 virtual bool IsResizeable() const = 0;
473 virtual bool IsHidden() const = 0;
474 virtual bool IsSortOrderAscending() const = 0;
475
476 const wxBitmap &GetBitmap() const { return m_bitmap; }
477 unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column); }
478
479 wxDataViewCtrl *GetOwner() const { return m_owner; }
480 wxDataViewRenderer* GetRenderer() const { return m_renderer; }
481
482 protected:
483 wxDataViewRenderer *m_renderer;
484 int m_model_column;
485 wxBitmap m_bitmap;
486 wxDataViewCtrl *m_owner;
487
488 protected:
489 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase)
490 };
491
492 // ---------------------------------------------------------
493 // wxDataViewCtrlBase
494 // ---------------------------------------------------------
495
496 #define wxDV_SINGLE 0x0000 // for convenience
497 #define wxDV_MULTIPLE 0x0001 // can select multiple items
498
499 #define wxDV_NO_HEADER 0x0002 // column titles not visible
500 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
501 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
502
503 #define wxDV_ROW_LINES 0x0010 // alternating colour in rows
504
505 class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl
506 {
507 public:
508 wxDataViewCtrlBase();
509 virtual ~wxDataViewCtrlBase();
510
511 virtual bool AssociateModel( wxDataViewModel *model );
512 wxDataViewModel* GetModel();
513 const wxDataViewModel* GetModel() const;
514
515 // short cuts
516 wxDataViewColumn *PrependTextColumn( const wxString &label, unsigned int model_column,
517 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
518 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
519 int flags = wxDATAVIEW_COL_RESIZABLE );
520 wxDataViewColumn *PrependIconTextColumn( const wxString &label, unsigned int model_column,
521 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
522 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
523 int flags = wxDATAVIEW_COL_RESIZABLE );
524 wxDataViewColumn *PrependToggleColumn( const wxString &label, unsigned int model_column,
525 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
526 wxAlignment align = wxALIGN_CENTER,
527 int flags = wxDATAVIEW_COL_RESIZABLE );
528 wxDataViewColumn *PrependProgressColumn( const wxString &label, unsigned int model_column,
529 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
530 wxAlignment align = wxALIGN_CENTER,
531 int flags = wxDATAVIEW_COL_RESIZABLE );
532 wxDataViewColumn *PrependDateColumn( const wxString &label, unsigned int model_column,
533 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
534 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
535 int flags = wxDATAVIEW_COL_RESIZABLE );
536 wxDataViewColumn *PrependBitmapColumn( const wxString &label, unsigned int model_column,
537 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
538 wxAlignment align = wxALIGN_CENTER,
539 int flags = wxDATAVIEW_COL_RESIZABLE );
540 wxDataViewColumn *PrependTextColumn( const wxBitmap &label, unsigned int model_column,
541 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
542 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
543 int flags = wxDATAVIEW_COL_RESIZABLE );
544 wxDataViewColumn *PrependIconTextColumn( const wxBitmap &label, unsigned int model_column,
545 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
546 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
547 int flags = wxDATAVIEW_COL_RESIZABLE );
548 wxDataViewColumn *PrependToggleColumn( const wxBitmap &label, unsigned int model_column,
549 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
550 wxAlignment align = wxALIGN_CENTER,
551 int flags = wxDATAVIEW_COL_RESIZABLE );
552 wxDataViewColumn *PrependProgressColumn( const wxBitmap &label, unsigned int model_column,
553 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
554 wxAlignment align = wxALIGN_CENTER,
555 int flags = wxDATAVIEW_COL_RESIZABLE );
556 wxDataViewColumn *PrependDateColumn( const wxBitmap &label, unsigned int model_column,
557 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
558 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
559 int flags = wxDATAVIEW_COL_RESIZABLE );
560 wxDataViewColumn *PrependBitmapColumn( const wxBitmap &label, unsigned int model_column,
561 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
562 wxAlignment align = wxALIGN_CENTER,
563 int flags = wxDATAVIEW_COL_RESIZABLE );
564
565 wxDataViewColumn *AppendTextColumn( const wxString &label, unsigned int model_column,
566 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
567 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
568 int flags = wxDATAVIEW_COL_RESIZABLE );
569 wxDataViewColumn *AppendIconTextColumn( const wxString &label, unsigned int model_column,
570 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
571 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
572 int flags = wxDATAVIEW_COL_RESIZABLE );
573 wxDataViewColumn *AppendToggleColumn( const wxString &label, unsigned int model_column,
574 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
575 wxAlignment align = wxALIGN_CENTER,
576 int flags = wxDATAVIEW_COL_RESIZABLE );
577 wxDataViewColumn *AppendProgressColumn( const wxString &label, unsigned int model_column,
578 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
579 wxAlignment align = wxALIGN_CENTER,
580 int flags = wxDATAVIEW_COL_RESIZABLE );
581 wxDataViewColumn *AppendDateColumn( const wxString &label, unsigned int model_column,
582 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
583 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
584 int flags = wxDATAVIEW_COL_RESIZABLE );
585 wxDataViewColumn *AppendBitmapColumn( const wxString &label, unsigned int model_column,
586 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
587 wxAlignment align = wxALIGN_CENTER,
588 int flags = wxDATAVIEW_COL_RESIZABLE );
589 wxDataViewColumn *AppendTextColumn( const wxBitmap &label, unsigned int model_column,
590 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
591 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
592 int flags = wxDATAVIEW_COL_RESIZABLE );
593 wxDataViewColumn *AppendIconTextColumn( const wxBitmap &label, unsigned int model_column,
594 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
595 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
596 int flags = wxDATAVIEW_COL_RESIZABLE );
597 wxDataViewColumn *AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
598 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
599 wxAlignment align = wxALIGN_CENTER,
600 int flags = wxDATAVIEW_COL_RESIZABLE );
601 wxDataViewColumn *AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
602 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
603 wxAlignment align = wxALIGN_CENTER,
604 int flags = wxDATAVIEW_COL_RESIZABLE );
605 wxDataViewColumn *AppendDateColumn( const wxBitmap &label, unsigned int model_column,
606 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
607 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
608 int flags = wxDATAVIEW_COL_RESIZABLE );
609 wxDataViewColumn *AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
610 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
611 wxAlignment align = wxALIGN_CENTER,
612 int flags = wxDATAVIEW_COL_RESIZABLE );
613
614
615 virtual bool PrependColumn( wxDataViewColumn *col );
616 virtual bool AppendColumn( wxDataViewColumn *col );
617
618 virtual unsigned int GetColumnCount() const = 0;
619 virtual wxDataViewColumn* GetColumn( unsigned int pos ) const = 0;
620 virtual int GetColumnPosition( const wxDataViewColumn *column ) const = 0;
621
622 virtual bool DeleteColumn( wxDataViewColumn *column ) = 0;
623 virtual bool ClearColumns() = 0;
624
625 void SetExpanderColumn( wxDataViewColumn *col )
626 { m_expander_column = col ; DoSetExpanderColumn(); }
627 wxDataViewColumn *GetExpanderColumn() const
628 { return m_expander_column; }
629
630 virtual wxDataViewColumn *GetSortingColumn() const = 0;
631
632 void SetIndent( int indent )
633 { m_indent = indent ; DoSetIndent(); }
634 int GetIndent() const
635 { return m_indent; }
636
637 virtual wxDataViewItem GetSelection() const = 0;
638 virtual int GetSelections( wxDataViewItemArray & sel ) const = 0;
639 virtual void SetSelections( const wxDataViewItemArray & sel ) = 0;
640 virtual void Select( const wxDataViewItem & item ) = 0;
641 virtual void Unselect( const wxDataViewItem & item ) = 0;
642 virtual bool IsSelected( const wxDataViewItem & item ) const = 0;
643
644 virtual void SelectAll() = 0;
645 virtual void UnselectAll() = 0;
646
647 virtual void Expand( const wxDataViewItem & item ) = 0;
648 virtual void Collapse( const wxDataViewItem & item ) = 0;
649
650 virtual void EnsureVisible( const wxDataViewItem & item,
651 const wxDataViewColumn *column = NULL ) = 0;
652 virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;
653 virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
654
655 protected:
656 virtual void DoSetExpanderColumn() = 0 ;
657 virtual void DoSetIndent() = 0;
658
659 private:
660 wxDataViewModel *m_model;
661 wxDataViewColumn *m_expander_column;
662 int m_indent ;
663
664 protected:
665 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase)
666 };
667
668 // ----------------------------------------------------------------------------
669 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
670 // ----------------------------------------------------------------------------
671
672 class WXDLLIMPEXP_ADV wxDataViewEvent : public wxNotifyEvent
673 {
674 public:
675 wxDataViewEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
676 : wxNotifyEvent(commandType, winid),
677 m_item(0),
678 m_col(-1),
679 m_model(NULL),
680 m_value(wxNullVariant),
681 m_column(NULL),
682 m_pos(-1,-1)
683 { }
684
685 wxDataViewEvent(const wxDataViewEvent& event)
686 : wxNotifyEvent(event),
687 m_item(event.m_item),
688 m_col(event.m_col),
689 m_model(event.m_model),
690 m_value(event.m_value),
691 m_column(event.m_column),
692 m_pos(m_pos)
693 { }
694
695 wxDataViewItem GetItem() const { return m_item; }
696 void SetItem( const wxDataViewItem &item ) { m_item = item; }
697
698 int GetColumn() const { return m_col; }
699 void SetColumn( int col ) { m_col = col; }
700
701 wxDataViewModel* GetModel() const { return m_model; }
702 void SetModel( wxDataViewModel *model ) { m_model = model; }
703
704 const wxVariant &GetValue() const { return m_value; }
705 void SetValue( const wxVariant &value ) { m_value = value; }
706
707 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
708 void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; }
709 wxDataViewColumn *GetDataViewColumn() const { return m_column; }
710
711 // for wxEVT_DATAVIEW_CONTEXT_MENU only
712 wxPoint GetPosition() const;
713 void SetPosition( int x, int y ) { m_pos.x = x; m_pos.y = y; }
714
715 virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); }
716
717 protected:
718 wxDataViewItem m_item;
719 int m_col;
720 wxDataViewModel *m_model;
721 wxVariant m_value;
722 wxDataViewColumn *m_column;
723 wxPoint m_pos;
724
725 private:
726 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent)
727 };
728
729 BEGIN_DECLARE_EVENT_TYPES()
730 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, -1)
731
732 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, -1)
733 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED, -1)
734 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED, -1)
735 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING, -1)
736 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, -1)
737 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, -1)
738 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, -1)
739 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, -1)
740
741 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, -1)
742
743 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1)
744 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1)
745 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, -1)
746 END_DECLARE_EVENT_TYPES()
747
748 typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
749
750 #define wxDataViewEventHandler(func) \
751 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
752
753 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
754 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
755
756 #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
757
758 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
759 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
760 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
761 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
762 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
763 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
764 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
765 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
766
767 #define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn)
768
769 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
770 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
771 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
772
773 #if defined(wxUSE_GENERICDATAVIEWCTRL)
774 #include "wx/generic/dataview.h"
775 #elif defined(__WXGTK20__)
776 #include "wx/gtk/dataview.h"
777 #elif defined(__WXMAC__)
778 #include "wx/mac/dataview.h"
779 #else
780 #include "wx/generic/dataview.h"
781 #endif
782
783 // -------------------------------------
784 // wxDataViewSpinRenderer
785 // -------------------------------------
786
787 class WXDLLIMPEXP_ADV wxDataViewSpinRenderer: public wxDataViewCustomRenderer
788 {
789 public:
790 wxDataViewSpinRenderer( int min, int max,
791 wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
792 int alignment = wxDVR_DEFAULT_ALIGNMENT );
793 virtual bool HasEditorCtrl() { return true; }
794 virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
795 virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
796 virtual bool Render( wxRect rect, wxDC *dc, int state );
797 virtual wxSize GetSize() const;
798 virtual bool SetValue( const wxVariant &value );
799 virtual bool GetValue( wxVariant &value ) const;
800
801 private:
802 long m_data;
803 long m_min,m_max;
804 };
805
806 //-----------------------------------------------------------------------------
807 // wxDataViewTreeStore
808 //-----------------------------------------------------------------------------
809
810 class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode
811 {
812 public:
813 wxDataViewTreeStoreNode( wxDataViewTreeStoreNode *parent,
814 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
815 virtual ~wxDataViewTreeStoreNode();
816
817 void SetText( const wxString &text )
818 { m_text = text; }
819 wxString GetText() const
820 { return m_text; }
821 void SetIcon( const wxIcon &icon )
822 { m_icon = icon; }
823 const wxIcon &GetIcon() const
824 { return m_icon; }
825 void SetData( wxClientData *data )
826 { if (m_data) delete m_data; m_data = data; }
827 wxClientData *GetData() const
828 { return m_data; }
829
830 wxDataViewItem GetItem() const
831 { return wxDataViewItem( (void*) this ); }
832
833 virtual bool IsContainer()
834 { return false; }
835
836 wxDataViewTreeStoreNode *GetParent()
837 { return m_parent; }
838
839 private:
840 wxDataViewTreeStoreNode *m_parent;
841 wxString m_text;
842 wxIcon m_icon;
843 wxClientData *m_data;
844 };
845
846 WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode, wxDataViewTreeStoreNodeList,
847 class WXDLLIMPEXP_ADV);
848
849 class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode: public wxDataViewTreeStoreNode
850 {
851 public:
852 wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode *parent,
853 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
854 wxClientData *data = NULL );
855 virtual ~wxDataViewTreeStoreContainerNode();
856
857 const wxDataViewTreeStoreNodeList &GetChildren() const
858 { return m_children; }
859 wxDataViewTreeStoreNodeList &GetChildren()
860 { return m_children; }
861
862 void SetExpandedIcon( const wxIcon &icon )
863 { m_iconExpanded = icon; }
864 const wxIcon &GetExpandedIcon() const
865 { return m_iconExpanded; }
866
867 void SetExpanded( bool expanded = true )
868 { m_isExpanded = expanded; }
869 bool IsExpanded() const
870 { return m_isExpanded; }
871
872 virtual bool IsContainer()
873 { return true; }
874
875 private:
876 wxDataViewTreeStoreNodeList m_children;
877 wxIcon m_iconExpanded;
878 bool m_isExpanded;
879 };
880
881 //-----------------------------------------------------------------------------
882
883 class WXDLLIMPEXP_ADV wxDataViewTreeStore: public wxDataViewModel
884 {
885 public:
886 wxDataViewTreeStore();
887 ~wxDataViewTreeStore();
888
889 wxDataViewItem AppendItem( const wxDataViewItem& parent,
890 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
891 wxDataViewItem PrependItem( const wxDataViewItem& parent,
892 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
893 wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
894 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
895
896 wxDataViewItem PrependContainer( const wxDataViewItem& parent,
897 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
898 wxClientData *data = NULL );
899 wxDataViewItem AppendContainer( const wxDataViewItem& parent,
900 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
901 wxClientData *data = NULL );
902 wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
903 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
904 wxClientData *data = NULL );
905
906 wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const;
907 int GetChildCount( const wxDataViewItem& parent ) const;
908
909 void SetItemText( const wxDataViewItem& item, const wxString &text );
910 wxString GetItemText( const wxDataViewItem& item ) const;
911 void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon );
912 const wxIcon &GetItemIcon( const wxDataViewItem& item ) const;
913 void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon );
914 const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const;
915 void SetItemData( const wxDataViewItem& item, wxClientData *data );
916 wxClientData *GetItemData( const wxDataViewItem& item ) const;
917
918 void DeleteItem( const wxDataViewItem& item );
919 void DeleteChildren( const wxDataViewItem& item );
920 void DeleteAllItems();
921
922 // implement base methods
923
924 virtual void GetValue( wxVariant &variant,
925 const wxDataViewItem &item, unsigned int col ) const;
926 virtual bool SetValue( const wxVariant &variant,
927 const wxDataViewItem &item, unsigned int col );
928 virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
929 virtual bool IsContainer( const wxDataViewItem &item ) const;
930 virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
931
932 virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
933 unsigned int column, bool ascending );
934
935 virtual bool HasDefaultCompare() const
936 { return true; }
937 virtual unsigned int GetColumnCount() const
938 { return 1; };
939 virtual wxString GetColumnType( unsigned int WXUNUSED(col) ) const
940 { return wxT("wxDataViewIconText"); }
941
942 wxDataViewTreeStoreNode *FindNode( const wxDataViewItem &item ) const;
943 wxDataViewTreeStoreContainerNode *FindContainerNode( const wxDataViewItem &item ) const;
944 wxDataViewTreeStoreNode *GetRoot() const { return m_root; }
945
946 public:
947 wxDataViewTreeStoreNode *m_root;
948 };
949
950 class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl
951 {
952 public:
953 wxDataViewTreeCtrl();
954 wxDataViewTreeCtrl( wxWindow *parent, wxWindowID id,
955 const wxPoint& pos = wxDefaultPosition,
956 const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
957 const wxValidator& validator = wxDefaultValidator );
958 ~wxDataViewTreeCtrl();
959
960 bool Create( wxWindow *parent, wxWindowID id,
961 const wxPoint& pos = wxDefaultPosition,
962 const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
963 const wxValidator& validator = wxDefaultValidator );
964
965 wxDataViewTreeStore *GetStore()
966 { return (wxDataViewTreeStore*) GetModel(); }
967 const wxDataViewTreeStore *GetStore() const
968 { return (const wxDataViewTreeStore*) GetModel(); }
969
970 void SetImageList( wxImageList *imagelist );
971 wxImageList* GetImageList() { return m_imageList; }
972
973 wxDataViewItem AppendItem( const wxDataViewItem& parent,
974 const wxString &text, int icon = -1, wxClientData *data = NULL );
975 wxDataViewItem PrependItem( const wxDataViewItem& parent,
976 const wxString &text, int icon = -1, wxClientData *data = NULL );
977 wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
978 const wxString &text, int icon = -1, wxClientData *data = NULL );
979
980 wxDataViewItem PrependContainer( const wxDataViewItem& parent,
981 const wxString &text, int icon = -1, int expanded = -1,
982 wxClientData *data = NULL );
983 wxDataViewItem AppendContainer( const wxDataViewItem& parent,
984 const wxString &text, int icon = -1, int expanded = -1,
985 wxClientData *data = NULL );
986 wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
987 const wxString &text, int icon = -1, int expanded = -1,
988 wxClientData *data = NULL );
989
990 wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const
991 { return GetStore()->GetNthChild(parent, pos); }
992 int GetChildCount( const wxDataViewItem& parent ) const
993 { return GetStore()->GetChildCount(parent); }
994
995 void SetItemText( const wxDataViewItem& item, const wxString &text )
996 { GetStore()->SetItemText(item,text); }
997 wxString GetItemText( const wxDataViewItem& item ) const
998 { return GetStore()->GetItemText(item); }
999 void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon )
1000 { GetStore()->SetItemIcon(item,icon); }
1001 const wxIcon &GetItemIcon( const wxDataViewItem& item ) const
1002 { return GetStore()->GetItemIcon(item); }
1003 void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon )
1004 { GetStore()->SetItemExpandedIcon(item,icon); }
1005 const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const
1006 { return GetStore()->GetItemExpandedIcon(item); }
1007 void SetItemData( const wxDataViewItem& item, wxClientData *data )
1008 { GetStore()->SetItemData(item,data); }
1009 wxClientData *GetItemData( const wxDataViewItem& item ) const
1010 { return GetStore()->GetItemData(item); }
1011
1012 void DeleteItem( const wxDataViewItem& item )
1013 { GetStore()->DeleteItem(item); }
1014 void DeleteChildren( const wxDataViewItem& item )
1015 { GetStore()->DeleteChildren(item); }
1016 void DeleteAllItems()
1017 { GetStore()->DeleteAllItems(); }
1018
1019 void OnExpanded( wxDataViewEvent &event );
1020 void OnCollapsed( wxDataViewEvent &event );
1021 void OnSize( wxSizeEvent &event );
1022
1023 private:
1024 wxImageList *m_imageList;
1025
1026 private:
1027 DECLARE_EVENT_TABLE()
1028 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl)
1029 };
1030
1031 #endif // wxUSE_DATAVIEWCTRL
1032
1033 #endif
1034 // _WX_DATAVIEW_H_BASE_