]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dataview.h
c4d58749374a037bf27ceb3ed6b91d05dc586f9f
[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 RowChanged( unsigned int row );
249 void RowValueChanged( unsigned int row, unsigned int col );
250
251 // convert to/from row/wxDataViewItem
252
253 unsigned int GetRow( const wxDataViewItem &item ) const;
254 wxDataViewItem GetItem( unsigned int row ) const;
255
256 // compare based on index
257
258 virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
259 unsigned int column, bool ascending );
260 virtual bool HasDefaultCompare() const;
261
262 // implement base methods
263
264 virtual void GetValue( wxVariant &variant,
265 const wxDataViewItem &item, unsigned int col ) const;
266 virtual bool SetValue( const wxVariant &variant,
267 const wxDataViewItem &item, unsigned int col );
268 virtual bool GetAttr( const wxDataViewItem &item, unsigned int col, wxDataViewItemAttr &attr );
269 virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
270 virtual bool IsContainer( const wxDataViewItem &item ) const;
271 virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
272
273 // internal
274 virtual bool IsIndexListModel() const { return true; }
275 unsigned int GetLastIndex() const { return m_lastIndex; }
276
277 private:
278 wxDataViewItemArray m_hash;
279 unsigned int m_lastIndex;
280 bool m_ordered;
281 bool m_useHash;
282 };
283
284
285 //-----------------------------------------------------------------------------
286 // wxDataViewEditorCtrlEvtHandler
287 //-----------------------------------------------------------------------------
288
289 class wxDataViewEditorCtrlEvtHandler: public wxEvtHandler
290 {
291 public:
292 wxDataViewEditorCtrlEvtHandler( wxControl *editor, wxDataViewRenderer *owner );
293
294 void AcceptChangesAndFinish();
295 void SetFocusOnIdle( bool focus = true ) { m_focusOnIdle = focus; }
296
297 protected:
298 void OnChar( wxKeyEvent &event );
299 void OnKillFocus( wxFocusEvent &event );
300 void OnIdle( wxIdleEvent &event );
301
302 private:
303 wxDataViewRenderer *m_owner;
304 wxControl *m_editorCtrl;
305 bool m_finished;
306 bool m_focusOnIdle;
307
308 private:
309 DECLARE_EVENT_TABLE()
310 };
311
312 // ---------------------------------------------------------
313 // wxDataViewRendererBase
314 // ---------------------------------------------------------
315
316 enum wxDataViewCellMode
317 {
318 wxDATAVIEW_CELL_INERT,
319 wxDATAVIEW_CELL_ACTIVATABLE,
320 wxDATAVIEW_CELL_EDITABLE
321 };
322
323 enum wxDataViewCellRenderState
324 {
325 wxDATAVIEW_CELL_SELECTED = 1,
326 wxDATAVIEW_CELL_PRELIT = 2,
327 wxDATAVIEW_CELL_INSENSITIVE = 4,
328 wxDATAVIEW_CELL_FOCUSED = 8
329 };
330
331 class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject
332 {
333 public:
334 wxDataViewRendererBase( const wxString &varianttype,
335 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
336 int alignment = wxDVR_DEFAULT_ALIGNMENT );
337
338 virtual bool Validate( wxVariant& WXUNUSED(value) )
339 { return true; }
340
341 void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
342 wxDataViewColumn* GetOwner() { return m_owner; }
343
344 // renderer properties:
345
346 virtual bool SetValue( const wxVariant& WXUNUSED(value) ) = 0;
347 virtual bool GetValue( wxVariant& WXUNUSED(value) ) const = 0;
348
349 wxString GetVariantType() const { return m_variantType; }
350
351 virtual void SetMode( wxDataViewCellMode mode ) = 0;
352 virtual wxDataViewCellMode GetMode() const = 0;
353
354 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
355 // rather an "int"; that's because for rendering cells it's allowed
356 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
357 virtual void SetAlignment( int align ) = 0;
358 virtual int GetAlignment() const = 0;
359
360 // in-place editing
361 virtual bool HasEditorCtrl()
362 { return false; }
363 virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
364 wxRect WXUNUSED(labelRect),
365 const wxVariant& WXUNUSED(value))
366 { return NULL; }
367 virtual bool GetValueFromEditorCtrl(wxControl * WXUNUSED(editor),
368 wxVariant& WXUNUSED(value))
369 { return false; }
370
371 virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect );
372 virtual void CancelEditing();
373 virtual bool FinishEditing();
374
375 wxControl *GetEditorCtrl() { return m_editorCtrl; }
376
377 protected:
378 wxString m_variantType;
379 wxDataViewColumn *m_owner;
380 wxControl *m_editorCtrl;
381 wxDataViewItem m_item; // for m_editorCtrl
382
383 // internal utility:
384 const wxDataViewCtrl* GetView() const;
385
386 protected:
387 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase)
388 };
389
390 //-----------------------------------------------------------------------------
391 // wxDataViewIconText
392 //-----------------------------------------------------------------------------
393
394 class WXDLLIMPEXP_ADV wxDataViewIconText: public wxObject
395 {
396 public:
397 wxDataViewIconText( const wxString &text = wxEmptyString, const wxIcon& icon = wxNullIcon )
398 { m_icon = icon; m_text = text; }
399 wxDataViewIconText( const wxDataViewIconText &other )
400 { m_icon = other.m_icon; m_text = other.m_text; }
401
402 void SetText( const wxString &text ) { m_text = text; }
403 wxString GetText() const { return m_text; }
404 void SetIcon( const wxIcon &icon ) { m_icon = icon; }
405 const wxIcon &GetIcon() const { return m_icon; }
406
407 private:
408 wxString m_text;
409 wxIcon m_icon;
410
411 private:
412 DECLARE_DYNAMIC_CLASS(wxDataViewIconText)
413 };
414
415 bool operator == (const wxDataViewIconText &one, const wxDataViewIconText &two);
416
417 DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV)
418
419 // ---------------------------------------------------------
420 // wxDataViewColumnBase
421 // ---------------------------------------------------------
422
423 enum wxDataViewColumnFlags
424 {
425 wxDATAVIEW_COL_RESIZABLE = 1,
426 wxDATAVIEW_COL_SORTABLE = 2,
427 wxDATAVIEW_COL_HIDDEN = 4
428 };
429
430 class WXDLLIMPEXP_ADV wxDataViewColumnBase: public wxObject
431 {
432 public:
433 wxDataViewColumnBase( const wxString &title, wxDataViewRenderer *renderer,
434 unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
435 wxAlignment align = wxALIGN_CENTER,
436 int flags = wxDATAVIEW_COL_RESIZABLE );
437 wxDataViewColumnBase( const wxBitmap &bitmap, wxDataViewRenderer *renderer,
438 unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
439 wxAlignment align = wxALIGN_CENTER,
440 int flags = wxDATAVIEW_COL_RESIZABLE );
441 virtual ~wxDataViewColumnBase();
442
443 // setters:
444
445 virtual void SetTitle( const wxString &title ) = 0;
446 virtual void SetAlignment( wxAlignment align ) = 0;
447 virtual void SetSortable( bool sortable ) = 0;
448 virtual void SetResizeable( bool resizeable ) = 0;
449 virtual void SetHidden( bool hidden ) = 0;
450 virtual void SetSortOrder( bool ascending ) = 0;
451 virtual void SetFlags( int flags );
452 virtual void SetOwner( wxDataViewCtrl *owner )
453 { m_owner = owner; }
454 virtual void SetBitmap( const wxBitmap &bitmap )
455 { m_bitmap=bitmap; }
456
457 virtual void SetMinWidth( int minWidth ) = 0;
458 virtual void SetWidth( int width ) = 0;
459
460
461 // getters:
462
463 virtual wxString GetTitle() const = 0;
464 virtual wxAlignment GetAlignment() const = 0;
465 virtual int GetWidth() const = 0;
466 virtual int GetMinWidth() const = 0;
467
468 virtual int GetFlags() const;
469
470 virtual bool IsSortable() const = 0;
471 virtual bool IsResizeable() const = 0;
472 virtual bool IsHidden() const = 0;
473 virtual bool IsSortOrderAscending() const = 0;
474
475 const wxBitmap &GetBitmap() const { return m_bitmap; }
476 unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column); }
477
478 wxDataViewCtrl *GetOwner() const { return m_owner; }
479 wxDataViewRenderer* GetRenderer() const { return m_renderer; }
480
481 protected:
482 wxDataViewRenderer *m_renderer;
483 int m_model_column;
484 wxBitmap m_bitmap;
485 wxDataViewCtrl *m_owner;
486
487 protected:
488 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase)
489 };
490
491 // ---------------------------------------------------------
492 // wxDataViewCtrlBase
493 // ---------------------------------------------------------
494
495 #define wxDV_SINGLE 0x0000 // for convenience
496 #define wxDV_MULTIPLE 0x0001 // can select multiple items
497
498 #define wxDV_NO_HEADER 0x0002 // column titles not visible
499 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
500 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
501
502 #define wxDV_ROW_LINES 0x0010 // alternating colour in rows
503
504 class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl
505 {
506 public:
507 wxDataViewCtrlBase();
508 virtual ~wxDataViewCtrlBase();
509
510 virtual bool AssociateModel( wxDataViewModel *model );
511 wxDataViewModel* GetModel();
512 const wxDataViewModel* GetModel() const;
513
514 // short cuts
515 wxDataViewColumn *PrependTextColumn( const wxString &label, unsigned int model_column,
516 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
517 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
518 int flags = wxDATAVIEW_COL_RESIZABLE );
519 wxDataViewColumn *PrependIconTextColumn( const wxString &label, unsigned int model_column,
520 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
521 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
522 int flags = wxDATAVIEW_COL_RESIZABLE );
523 wxDataViewColumn *PrependToggleColumn( const wxString &label, unsigned int model_column,
524 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
525 wxAlignment align = wxALIGN_CENTER,
526 int flags = wxDATAVIEW_COL_RESIZABLE );
527 wxDataViewColumn *PrependProgressColumn( const wxString &label, unsigned int model_column,
528 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
529 wxAlignment align = wxALIGN_CENTER,
530 int flags = wxDATAVIEW_COL_RESIZABLE );
531 wxDataViewColumn *PrependDateColumn( const wxString &label, unsigned int model_column,
532 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
533 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
534 int flags = wxDATAVIEW_COL_RESIZABLE );
535 wxDataViewColumn *PrependBitmapColumn( const wxString &label, unsigned int model_column,
536 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
537 wxAlignment align = wxALIGN_CENTER,
538 int flags = wxDATAVIEW_COL_RESIZABLE );
539 wxDataViewColumn *PrependTextColumn( const wxBitmap &label, unsigned int model_column,
540 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
541 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
542 int flags = wxDATAVIEW_COL_RESIZABLE );
543 wxDataViewColumn *PrependIconTextColumn( const wxBitmap &label, unsigned int model_column,
544 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
545 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
546 int flags = wxDATAVIEW_COL_RESIZABLE );
547 wxDataViewColumn *PrependToggleColumn( const wxBitmap &label, unsigned int model_column,
548 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
549 wxAlignment align = wxALIGN_CENTER,
550 int flags = wxDATAVIEW_COL_RESIZABLE );
551 wxDataViewColumn *PrependProgressColumn( const wxBitmap &label, unsigned int model_column,
552 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
553 wxAlignment align = wxALIGN_CENTER,
554 int flags = wxDATAVIEW_COL_RESIZABLE );
555 wxDataViewColumn *PrependDateColumn( const wxBitmap &label, unsigned int model_column,
556 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
557 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
558 int flags = wxDATAVIEW_COL_RESIZABLE );
559 wxDataViewColumn *PrependBitmapColumn( const wxBitmap &label, unsigned int model_column,
560 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
561 wxAlignment align = wxALIGN_CENTER,
562 int flags = wxDATAVIEW_COL_RESIZABLE );
563
564 wxDataViewColumn *AppendTextColumn( const wxString &label, unsigned int model_column,
565 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
566 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
567 int flags = wxDATAVIEW_COL_RESIZABLE );
568 wxDataViewColumn *AppendIconTextColumn( const wxString &label, unsigned int model_column,
569 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
570 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
571 int flags = wxDATAVIEW_COL_RESIZABLE );
572 wxDataViewColumn *AppendToggleColumn( const wxString &label, unsigned int model_column,
573 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
574 wxAlignment align = wxALIGN_CENTER,
575 int flags = wxDATAVIEW_COL_RESIZABLE );
576 wxDataViewColumn *AppendProgressColumn( const wxString &label, unsigned int model_column,
577 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
578 wxAlignment align = wxALIGN_CENTER,
579 int flags = wxDATAVIEW_COL_RESIZABLE );
580 wxDataViewColumn *AppendDateColumn( const wxString &label, unsigned int model_column,
581 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
582 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
583 int flags = wxDATAVIEW_COL_RESIZABLE );
584 wxDataViewColumn *AppendBitmapColumn( const wxString &label, unsigned int model_column,
585 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
586 wxAlignment align = wxALIGN_CENTER,
587 int flags = wxDATAVIEW_COL_RESIZABLE );
588 wxDataViewColumn *AppendTextColumn( const wxBitmap &label, unsigned int model_column,
589 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
590 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
591 int flags = wxDATAVIEW_COL_RESIZABLE );
592 wxDataViewColumn *AppendIconTextColumn( const wxBitmap &label, unsigned int model_column,
593 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
594 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
595 int flags = wxDATAVIEW_COL_RESIZABLE );
596 wxDataViewColumn *AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
597 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
598 wxAlignment align = wxALIGN_CENTER,
599 int flags = wxDATAVIEW_COL_RESIZABLE );
600 wxDataViewColumn *AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
601 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
602 wxAlignment align = wxALIGN_CENTER,
603 int flags = wxDATAVIEW_COL_RESIZABLE );
604 wxDataViewColumn *AppendDateColumn( const wxBitmap &label, unsigned int model_column,
605 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
606 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
607 int flags = wxDATAVIEW_COL_RESIZABLE );
608 wxDataViewColumn *AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
609 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
610 wxAlignment align = wxALIGN_CENTER,
611 int flags = wxDATAVIEW_COL_RESIZABLE );
612
613
614 virtual bool PrependColumn( wxDataViewColumn *col );
615 virtual bool AppendColumn( wxDataViewColumn *col );
616
617 virtual unsigned int GetColumnCount() const = 0;
618 virtual wxDataViewColumn* GetColumn( unsigned int pos ) const = 0;
619 virtual int GetColumnPosition( const wxDataViewColumn *column ) const = 0;
620
621 virtual bool DeleteColumn( wxDataViewColumn *column ) = 0;
622 virtual bool ClearColumns() = 0;
623
624 void SetExpanderColumn( wxDataViewColumn *col )
625 { m_expander_column = col ; DoSetExpanderColumn(); }
626 wxDataViewColumn *GetExpanderColumn() const
627 { return m_expander_column; }
628
629 virtual wxDataViewColumn *GetSortingColumn() const = 0;
630
631 void SetIndent( int indent )
632 { m_indent = indent ; DoSetIndent(); }
633 int GetIndent() const
634 { return m_indent; }
635
636 virtual wxDataViewItem GetSelection() const = 0;
637 virtual int GetSelections( wxDataViewItemArray & sel ) const = 0;
638 virtual void SetSelections( const wxDataViewItemArray & sel ) = 0;
639 virtual void Select( const wxDataViewItem & item ) = 0;
640 virtual void Unselect( const wxDataViewItem & item ) = 0;
641 virtual bool IsSelected( const wxDataViewItem & item ) const = 0;
642
643 virtual void SelectAll() = 0;
644 virtual void UnselectAll() = 0;
645
646 virtual void Expand( const wxDataViewItem & item ) = 0;
647 virtual void Collapse( const wxDataViewItem & item ) = 0;
648
649 virtual void EnsureVisible( const wxDataViewItem & item,
650 const wxDataViewColumn *column = NULL ) = 0;
651 virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;
652 virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
653
654 protected:
655 virtual void DoSetExpanderColumn() = 0 ;
656 virtual void DoSetIndent() = 0;
657
658 private:
659 wxDataViewModel *m_model;
660 wxDataViewColumn *m_expander_column;
661 int m_indent ;
662
663 protected:
664 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase)
665 };
666
667 // ----------------------------------------------------------------------------
668 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
669 // ----------------------------------------------------------------------------
670
671 class WXDLLIMPEXP_ADV wxDataViewEvent : public wxNotifyEvent
672 {
673 public:
674 wxDataViewEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
675 : wxNotifyEvent(commandType, winid),
676 m_item(0),
677 m_col(-1),
678 m_model(NULL),
679 m_value(wxNullVariant),
680 m_column(NULL),
681 m_pos(-1,-1)
682 { }
683
684 wxDataViewEvent(const wxDataViewEvent& event)
685 : wxNotifyEvent(event),
686 m_item(event.m_item),
687 m_col(event.m_col),
688 m_model(event.m_model),
689 m_value(event.m_value),
690 m_column(event.m_column),
691 m_pos(m_pos)
692 { }
693
694 wxDataViewItem GetItem() const { return m_item; }
695 void SetItem( const wxDataViewItem &item ) { m_item = item; }
696
697 int GetColumn() const { return m_col; }
698 void SetColumn( int col ) { m_col = col; }
699
700 wxDataViewModel* GetModel() const { return m_model; }
701 void SetModel( wxDataViewModel *model ) { m_model = model; }
702
703 const wxVariant &GetValue() const { return m_value; }
704 void SetValue( const wxVariant &value ) { m_value = value; }
705
706 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
707 void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; }
708 wxDataViewColumn *GetDataViewColumn() const { return m_column; }
709
710 // for wxEVT_DATAVIEW_CONTEXT_MENU only
711 wxPoint GetPosition() const;
712 void SetPosition( int x, int y ) { m_pos.x = x; m_pos.y = y; }
713
714 virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); }
715
716 protected:
717 wxDataViewItem m_item;
718 int m_col;
719 wxDataViewModel *m_model;
720 wxVariant m_value;
721 wxDataViewColumn *m_column;
722 wxPoint m_pos;
723
724 private:
725 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent)
726 };
727
728 BEGIN_DECLARE_EVENT_TYPES()
729 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, -1)
730
731 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, -1)
732 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED, -1)
733 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED, -1)
734 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING, -1)
735 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, -1)
736 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, -1)
737 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, -1)
738 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, -1)
739
740 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, -1)
741
742 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1)
743 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1)
744 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, -1)
745 END_DECLARE_EVENT_TYPES()
746
747 typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
748
749 #define wxDataViewEventHandler(func) \
750 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
751
752 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
753 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
754
755 #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
756
757 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
758 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
759 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
760 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
761 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
762 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
763 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
764 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
765
766 #define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn)
767
768 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
769 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
770 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
771
772 #if defined(wxUSE_GENERICDATAVIEWCTRL)
773 #include "wx/generic/dataview.h"
774 #elif defined(__WXGTK20__)
775 #include "wx/gtk/dataview.h"
776 #elif defined(__WXMAC__)
777 #include "wx/mac/dataview.h"
778 #else
779 #include "wx/generic/dataview.h"
780 #endif
781
782 // -------------------------------------
783 // wxDataViewSpinRenderer
784 // -------------------------------------
785
786 class WXDLLIMPEXP_ADV wxDataViewSpinRenderer: public wxDataViewCustomRenderer
787 {
788 public:
789 wxDataViewSpinRenderer( int min, int max,
790 wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
791 int alignment = wxDVR_DEFAULT_ALIGNMENT );
792 virtual bool HasEditorCtrl() { return true; }
793 virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
794 virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
795 virtual bool Render( wxRect rect, wxDC *dc, int state );
796 virtual wxSize GetSize() const;
797 virtual bool SetValue( const wxVariant &value );
798 virtual bool GetValue( wxVariant &value ) const;
799
800 private:
801 long m_data;
802 long m_min,m_max;
803 };
804
805 //-----------------------------------------------------------------------------
806 // wxDataViewTreeStore
807 //-----------------------------------------------------------------------------
808
809 class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode
810 {
811 public:
812 wxDataViewTreeStoreNode( wxDataViewTreeStoreNode *parent,
813 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
814 virtual ~wxDataViewTreeStoreNode();
815
816 void SetText( const wxString &text )
817 { m_text = text; }
818 wxString GetText() const
819 { return m_text; }
820 void SetIcon( const wxIcon &icon )
821 { m_icon = icon; }
822 const wxIcon &GetIcon() const
823 { return m_icon; }
824 void SetData( wxClientData *data )
825 { if (m_data) delete m_data; m_data = data; }
826 wxClientData *GetData() const
827 { return m_data; }
828
829 wxDataViewItem GetItem() const
830 { return wxDataViewItem( (void*) this ); }
831
832 virtual bool IsContainer()
833 { return false; }
834
835 wxDataViewTreeStoreNode *GetParent()
836 { return m_parent; }
837
838 private:
839 wxDataViewTreeStoreNode *m_parent;
840 wxString m_text;
841 wxIcon m_icon;
842 wxClientData *m_data;
843 };
844
845 WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode, wxDataViewTreeStoreNodeList,
846 class WXDLLIMPEXP_ADV);
847
848 class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode: public wxDataViewTreeStoreNode
849 {
850 public:
851 wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode *parent,
852 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
853 wxClientData *data = NULL );
854 virtual ~wxDataViewTreeStoreContainerNode();
855
856 const wxDataViewTreeStoreNodeList &GetChildren() const
857 { return m_children; }
858 wxDataViewTreeStoreNodeList &GetChildren()
859 { return m_children; }
860
861 void SetExpandedIcon( const wxIcon &icon )
862 { m_iconExpanded = icon; }
863 const wxIcon &GetExpandedIcon() const
864 { return m_iconExpanded; }
865
866 void SetExpanded( bool expanded = true )
867 { m_isExpanded = expanded; }
868 bool IsExpanded() const
869 { return m_isExpanded; }
870
871 virtual bool IsContainer()
872 { return true; }
873
874 private:
875 wxDataViewTreeStoreNodeList m_children;
876 wxIcon m_iconExpanded;
877 bool m_isExpanded;
878 };
879
880 //-----------------------------------------------------------------------------
881
882 class WXDLLIMPEXP_ADV wxDataViewTreeStore: public wxDataViewModel
883 {
884 public:
885 wxDataViewTreeStore();
886 ~wxDataViewTreeStore();
887
888 wxDataViewItem AppendItem( const wxDataViewItem& parent,
889 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
890 wxDataViewItem PrependItem( const wxDataViewItem& parent,
891 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
892 wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
893 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
894
895 wxDataViewItem PrependContainer( const wxDataViewItem& parent,
896 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
897 wxClientData *data = NULL );
898 wxDataViewItem AppendContainer( const wxDataViewItem& parent,
899 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
900 wxClientData *data = NULL );
901 wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
902 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
903 wxClientData *data = NULL );
904
905 wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const;
906 int GetChildCount( const wxDataViewItem& parent ) const;
907
908 void SetItemText( const wxDataViewItem& item, const wxString &text );
909 wxString GetItemText( const wxDataViewItem& item ) const;
910 void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon );
911 const wxIcon &GetItemIcon( const wxDataViewItem& item ) const;
912 void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon );
913 const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const;
914 void SetItemData( const wxDataViewItem& item, wxClientData *data );
915 wxClientData *GetItemData( const wxDataViewItem& item ) const;
916
917 void DeleteItem( const wxDataViewItem& item );
918 void DeleteChildren( const wxDataViewItem& item );
919 void DeleteAllItems();
920
921 // implement base methods
922
923 virtual void GetValue( wxVariant &variant,
924 const wxDataViewItem &item, unsigned int col ) const;
925 virtual bool SetValue( const wxVariant &variant,
926 const wxDataViewItem &item, unsigned int col );
927 virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
928 virtual bool IsContainer( const wxDataViewItem &item ) const;
929 virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
930
931 virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
932 unsigned int column, bool ascending );
933
934 virtual bool HasDefaultCompare() const
935 { return true; }
936 virtual unsigned int GetColumnCount() const
937 { return 1; };
938 virtual wxString GetColumnType( unsigned int WXUNUSED(col) ) const
939 { return wxT("wxDataViewIconText"); }
940
941 wxDataViewTreeStoreNode *FindNode( const wxDataViewItem &item ) const;
942 wxDataViewTreeStoreContainerNode *FindContainerNode( const wxDataViewItem &item ) const;
943 wxDataViewTreeStoreNode *GetRoot() const { return m_root; }
944
945 public:
946 wxDataViewTreeStoreNode *m_root;
947 };
948
949 class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl
950 {
951 public:
952 wxDataViewTreeCtrl();
953 wxDataViewTreeCtrl( wxWindow *parent, wxWindowID id,
954 const wxPoint& pos = wxDefaultPosition,
955 const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
956 const wxValidator& validator = wxDefaultValidator );
957 ~wxDataViewTreeCtrl();
958
959 bool Create( wxWindow *parent, wxWindowID id,
960 const wxPoint& pos = wxDefaultPosition,
961 const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
962 const wxValidator& validator = wxDefaultValidator );
963
964 wxDataViewTreeStore *GetStore()
965 { return (wxDataViewTreeStore*) GetModel(); }
966 const wxDataViewTreeStore *GetStore() const
967 { return (const wxDataViewTreeStore*) GetModel(); }
968
969 void SetImageList( wxImageList *imagelist );
970 wxImageList* GetImageList() { return m_imageList; }
971
972 wxDataViewItem AppendItem( const wxDataViewItem& parent,
973 const wxString &text, int icon = -1, wxClientData *data = NULL );
974 wxDataViewItem PrependItem( const wxDataViewItem& parent,
975 const wxString &text, int icon = -1, wxClientData *data = NULL );
976 wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
977 const wxString &text, int icon = -1, wxClientData *data = NULL );
978
979 wxDataViewItem PrependContainer( const wxDataViewItem& parent,
980 const wxString &text, int icon = -1, int expanded = -1,
981 wxClientData *data = NULL );
982 wxDataViewItem AppendContainer( const wxDataViewItem& parent,
983 const wxString &text, int icon = -1, int expanded = -1,
984 wxClientData *data = NULL );
985 wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
986 const wxString &text, int icon = -1, int expanded = -1,
987 wxClientData *data = NULL );
988
989 wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const
990 { return GetStore()->GetNthChild(parent, pos); }
991 int GetChildCount( const wxDataViewItem& parent ) const
992 { return GetStore()->GetChildCount(parent); }
993
994 void SetItemText( const wxDataViewItem& item, const wxString &text )
995 { GetStore()->SetItemText(item,text); }
996 wxString GetItemText( const wxDataViewItem& item ) const
997 { return GetStore()->GetItemText(item); }
998 void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon )
999 { GetStore()->SetItemIcon(item,icon); }
1000 const wxIcon &GetItemIcon( const wxDataViewItem& item ) const
1001 { return GetStore()->GetItemIcon(item); }
1002 void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon )
1003 { GetStore()->SetItemExpandedIcon(item,icon); }
1004 const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const
1005 { return GetStore()->GetItemExpandedIcon(item); }
1006 void SetItemData( const wxDataViewItem& item, wxClientData *data )
1007 { GetStore()->SetItemData(item,data); }
1008 wxClientData *GetItemData( const wxDataViewItem& item ) const
1009 { return GetStore()->GetItemData(item); }
1010
1011 void DeleteItem( const wxDataViewItem& item )
1012 { GetStore()->DeleteItem(item); }
1013 void DeleteChildren( const wxDataViewItem& item )
1014 { GetStore()->DeleteChildren(item); }
1015 void DeleteAllItems()
1016 { GetStore()->DeleteAllItems(); }
1017
1018 void OnExpanded( wxDataViewEvent &event );
1019 void OnCollapsed( wxDataViewEvent &event );
1020 void OnSize( wxSizeEvent &event );
1021
1022 private:
1023 wxImageList *m_imageList;
1024
1025 private:
1026 DECLARE_EVENT_TABLE()
1027 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl)
1028 };
1029
1030 #endif // wxUSE_DATAVIEWCTRL
1031
1032 #endif
1033 // _WX_DATAVIEW_H_BASE_