]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dataview.h
4a5e4f889393969e4f81c541f0f197b9b5a3acdf
[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 class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl
503 {
504 public:
505 wxDataViewCtrlBase();
506 virtual ~wxDataViewCtrlBase();
507
508 virtual bool AssociateModel( wxDataViewModel *model );
509 wxDataViewModel* GetModel();
510 const wxDataViewModel* GetModel() const;
511
512 // short cuts
513 wxDataViewColumn *PrependTextColumn( const wxString &label, unsigned int model_column,
514 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
515 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
516 int flags = wxDATAVIEW_COL_RESIZABLE );
517 wxDataViewColumn *PrependIconTextColumn( const wxString &label, unsigned int model_column,
518 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
519 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
520 int flags = wxDATAVIEW_COL_RESIZABLE );
521 wxDataViewColumn *PrependToggleColumn( const wxString &label, unsigned int model_column,
522 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
523 wxAlignment align = wxALIGN_CENTER,
524 int flags = wxDATAVIEW_COL_RESIZABLE );
525 wxDataViewColumn *PrependProgressColumn( const wxString &label, unsigned int model_column,
526 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
527 wxAlignment align = wxALIGN_CENTER,
528 int flags = wxDATAVIEW_COL_RESIZABLE );
529 wxDataViewColumn *PrependDateColumn( const wxString &label, unsigned int model_column,
530 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
531 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
532 int flags = wxDATAVIEW_COL_RESIZABLE );
533 wxDataViewColumn *PrependBitmapColumn( const wxString &label, unsigned int model_column,
534 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
535 wxAlignment align = wxALIGN_CENTER,
536 int flags = wxDATAVIEW_COL_RESIZABLE );
537 wxDataViewColumn *PrependTextColumn( const wxBitmap &label, unsigned int model_column,
538 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
539 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
540 int flags = wxDATAVIEW_COL_RESIZABLE );
541 wxDataViewColumn *PrependIconTextColumn( const wxBitmap &label, unsigned int model_column,
542 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
543 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
544 int flags = wxDATAVIEW_COL_RESIZABLE );
545 wxDataViewColumn *PrependToggleColumn( const wxBitmap &label, unsigned int model_column,
546 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
547 wxAlignment align = wxALIGN_CENTER,
548 int flags = wxDATAVIEW_COL_RESIZABLE );
549 wxDataViewColumn *PrependProgressColumn( const wxBitmap &label, unsigned int model_column,
550 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
551 wxAlignment align = wxALIGN_CENTER,
552 int flags = wxDATAVIEW_COL_RESIZABLE );
553 wxDataViewColumn *PrependDateColumn( const wxBitmap &label, unsigned int model_column,
554 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
555 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
556 int flags = wxDATAVIEW_COL_RESIZABLE );
557 wxDataViewColumn *PrependBitmapColumn( const wxBitmap &label, unsigned int model_column,
558 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
559 wxAlignment align = wxALIGN_CENTER,
560 int flags = wxDATAVIEW_COL_RESIZABLE );
561
562 wxDataViewColumn *AppendTextColumn( const wxString &label, unsigned int model_column,
563 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
564 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
565 int flags = wxDATAVIEW_COL_RESIZABLE );
566 wxDataViewColumn *AppendIconTextColumn( const wxString &label, unsigned int model_column,
567 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
568 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
569 int flags = wxDATAVIEW_COL_RESIZABLE );
570 wxDataViewColumn *AppendToggleColumn( const wxString &label, unsigned int model_column,
571 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
572 wxAlignment align = wxALIGN_CENTER,
573 int flags = wxDATAVIEW_COL_RESIZABLE );
574 wxDataViewColumn *AppendProgressColumn( const wxString &label, unsigned int model_column,
575 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
576 wxAlignment align = wxALIGN_CENTER,
577 int flags = wxDATAVIEW_COL_RESIZABLE );
578 wxDataViewColumn *AppendDateColumn( const wxString &label, unsigned int model_column,
579 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
580 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
581 int flags = wxDATAVIEW_COL_RESIZABLE );
582 wxDataViewColumn *AppendBitmapColumn( const wxString &label, unsigned int model_column,
583 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
584 wxAlignment align = wxALIGN_CENTER,
585 int flags = wxDATAVIEW_COL_RESIZABLE );
586 wxDataViewColumn *AppendTextColumn( const wxBitmap &label, unsigned int model_column,
587 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
588 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
589 int flags = wxDATAVIEW_COL_RESIZABLE );
590 wxDataViewColumn *AppendIconTextColumn( const wxBitmap &label, unsigned int model_column,
591 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
592 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
593 int flags = wxDATAVIEW_COL_RESIZABLE );
594 wxDataViewColumn *AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
595 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
596 wxAlignment align = wxALIGN_CENTER,
597 int flags = wxDATAVIEW_COL_RESIZABLE );
598 wxDataViewColumn *AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
599 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
600 wxAlignment align = wxALIGN_CENTER,
601 int flags = wxDATAVIEW_COL_RESIZABLE );
602 wxDataViewColumn *AppendDateColumn( const wxBitmap &label, unsigned int model_column,
603 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
604 wxAlignment align = (wxAlignment)(wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL),
605 int flags = wxDATAVIEW_COL_RESIZABLE );
606 wxDataViewColumn *AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
607 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
608 wxAlignment align = wxALIGN_CENTER,
609 int flags = wxDATAVIEW_COL_RESIZABLE );
610
611
612 virtual bool PrependColumn( wxDataViewColumn *col );
613 virtual bool AppendColumn( wxDataViewColumn *col );
614
615 virtual unsigned int GetColumnCount() const = 0;
616 virtual wxDataViewColumn* GetColumn( unsigned int pos ) const = 0;
617 virtual int GetColumnPosition( const wxDataViewColumn *column ) const = 0;
618
619 virtual bool DeleteColumn( wxDataViewColumn *column ) = 0;
620 virtual bool ClearColumns() = 0;
621
622 void SetExpanderColumn( wxDataViewColumn *col )
623 { m_expander_column = col ; DoSetExpanderColumn(); }
624 wxDataViewColumn *GetExpanderColumn() const
625 { return m_expander_column; }
626
627 virtual wxDataViewColumn *GetSortingColumn() const = 0;
628
629 void SetIndent( int indent )
630 { m_indent = indent ; DoSetIndent(); }
631 int GetIndent() const
632 { return m_indent; }
633
634 virtual wxDataViewItem GetSelection() const = 0;
635 virtual int GetSelections( wxDataViewItemArray & sel ) const = 0;
636 virtual void SetSelections( const wxDataViewItemArray & sel ) = 0;
637 virtual void Select( const wxDataViewItem & item ) = 0;
638 virtual void Unselect( const wxDataViewItem & item ) = 0;
639 virtual bool IsSelected( const wxDataViewItem & item ) const = 0;
640
641 virtual void SelectAll() = 0;
642 virtual void UnselectAll() = 0;
643
644 virtual void Expand( const wxDataViewItem & item ) = 0;
645 virtual void Collapse( const wxDataViewItem & item ) = 0;
646
647 virtual void EnsureVisible( const wxDataViewItem & item,
648 const wxDataViewColumn *column = NULL ) = 0;
649 virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;
650 virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
651
652 protected:
653 virtual void DoSetExpanderColumn() = 0 ;
654 virtual void DoSetIndent() = 0;
655
656 private:
657 wxDataViewModel *m_model;
658 wxDataViewColumn *m_expander_column;
659 int m_indent ;
660
661 protected:
662 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase)
663 };
664
665 // ----------------------------------------------------------------------------
666 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
667 // ----------------------------------------------------------------------------
668
669 class WXDLLIMPEXP_ADV wxDataViewEvent : public wxNotifyEvent
670 {
671 public:
672 wxDataViewEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
673 : wxNotifyEvent(commandType, winid),
674 m_item(0),
675 m_col(-1),
676 m_model(NULL),
677 m_value(wxNullVariant),
678 m_column(NULL)
679 { }
680
681 wxDataViewEvent(const wxDataViewEvent& event)
682 : wxNotifyEvent(event),
683 m_item(event.m_item),
684 m_col(event.m_col),
685 m_model(event.m_model),
686 m_value(event.m_value),
687 m_column(event.m_column)
688 { }
689
690 wxDataViewItem GetItem() const { return m_item; }
691 void SetItem( const wxDataViewItem &item ) { m_item = item; }
692
693 int GetColumn() const { return m_col; }
694 void SetColumn( int col ) { m_col = col; }
695
696 wxDataViewModel* GetModel() const { return m_model; }
697 void SetModel( wxDataViewModel *model ) { m_model = model; }
698
699 const wxVariant &GetValue() const { return m_value; }
700 void SetValue( const wxVariant &value ) { m_value = value; }
701
702 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
703 void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; }
704 wxDataViewColumn *GetDataViewColumn() const { return m_column; }
705
706 virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); }
707
708 protected:
709 wxDataViewItem m_item;
710 int m_col;
711 wxDataViewModel *m_model;
712 wxVariant m_value;
713 wxDataViewColumn *m_column;
714
715 private:
716 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent)
717 };
718
719 BEGIN_DECLARE_EVENT_TYPES()
720 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, -1)
721
722 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, -1)
723 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED, -1)
724 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED, -1)
725 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING, -1)
726 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, -1)
727 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, -1)
728 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, -1)
729 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, -1)
730
731 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1)
732 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1)
733 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, -1)
734 END_DECLARE_EVENT_TYPES()
735
736 typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
737
738 #define wxDataViewEventHandler(func) \
739 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
740
741 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
742 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
743
744 #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
745
746 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
747 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
748 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
749 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
750 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
751 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
752 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
753 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
754
755 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
756 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
757 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
758
759 #if defined(wxUSE_GENERICDATAVIEWCTRL)
760 #include "wx/generic/dataview.h"
761 #elif defined(__WXGTK20__)
762 #include "wx/gtk/dataview.h"
763 #elif defined(__WXMAC__)
764 #include "wx/mac/dataview.h"
765 #else
766 #include "wx/generic/dataview.h"
767 #endif
768
769 // -------------------------------------
770 // wxDataViewSpinRenderer
771 // -------------------------------------
772
773 class WXDLLIMPEXP_ADV wxDataViewSpinRenderer: public wxDataViewCustomRenderer
774 {
775 public:
776 wxDataViewSpinRenderer( int min, int max,
777 wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
778 int alignment = wxDVR_DEFAULT_ALIGNMENT );
779 virtual bool HasEditorCtrl() { return true; }
780 virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
781 virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
782 virtual bool Render( wxRect rect, wxDC *dc, int state );
783 virtual wxSize GetSize() const;
784 virtual bool SetValue( const wxVariant &value );
785 virtual bool GetValue( wxVariant &value ) const;
786
787 private:
788 long m_data;
789 long m_min,m_max;
790 };
791
792 //-----------------------------------------------------------------------------
793 // wxDataViewTreeStore
794 //-----------------------------------------------------------------------------
795
796 class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode
797 {
798 public:
799 wxDataViewTreeStoreNode( wxDataViewTreeStoreNode *parent,
800 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
801 virtual ~wxDataViewTreeStoreNode();
802
803 void SetText( const wxString &text )
804 { m_text = text; }
805 wxString GetText() const
806 { return m_text; }
807 void SetIcon( const wxIcon &icon )
808 { m_icon = icon; }
809 const wxIcon &GetIcon() const
810 { return m_icon; }
811 void SetData( wxClientData *data )
812 { if (m_data) delete m_data; m_data = data; }
813 wxClientData *GetData() const
814 { return m_data; }
815
816 wxDataViewItem GetItem() const
817 { return wxDataViewItem( (void*) this ); }
818
819 virtual bool IsContainer()
820 { return false; }
821
822 wxDataViewTreeStoreNode *GetParent()
823 { return m_parent; }
824
825 private:
826 wxDataViewTreeStoreNode *m_parent;
827 wxString m_text;
828 wxIcon m_icon;
829 wxClientData *m_data;
830 };
831
832 WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode, wxDataViewTreeStoreNodeList,
833 class WXDLLIMPEXP_ADV);
834
835 class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode: public wxDataViewTreeStoreNode
836 {
837 public:
838 wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode *parent,
839 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
840 wxClientData *data = NULL );
841 virtual ~wxDataViewTreeStoreContainerNode();
842
843 const wxDataViewTreeStoreNodeList &GetChildren() const
844 { return m_children; }
845 wxDataViewTreeStoreNodeList &GetChildren()
846 { return m_children; }
847
848 void SetExpandedIcon( const wxIcon &icon )
849 { m_iconExpanded = icon; }
850 const wxIcon &GetExpandedIcon() const
851 { return m_iconExpanded; }
852
853 void SetExpanded( bool expanded = true )
854 { m_isExpanded = expanded; }
855 bool IsExpanded() const
856 { return m_isExpanded; }
857
858 virtual bool IsContainer()
859 { return true; }
860
861 private:
862 wxDataViewTreeStoreNodeList m_children;
863 wxIcon m_iconExpanded;
864 bool m_isExpanded;
865 };
866
867 //-----------------------------------------------------------------------------
868
869 class WXDLLIMPEXP_ADV wxDataViewTreeStore: public wxDataViewModel
870 {
871 public:
872 wxDataViewTreeStore();
873 ~wxDataViewTreeStore();
874
875 wxDataViewItem AppendItem( const wxDataViewItem& parent,
876 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
877 wxDataViewItem PrependItem( const wxDataViewItem& parent,
878 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
879 wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
880 const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL );
881
882 wxDataViewItem PrependContainer( const wxDataViewItem& parent,
883 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
884 wxClientData *data = NULL );
885 wxDataViewItem AppendContainer( const wxDataViewItem& parent,
886 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
887 wxClientData *data = NULL );
888 wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
889 const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon,
890 wxClientData *data = NULL );
891
892 wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const;
893 int GetChildCount( const wxDataViewItem& parent ) const;
894
895 void SetItemText( const wxDataViewItem& item, const wxString &text );
896 wxString GetItemText( const wxDataViewItem& item ) const;
897 void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon );
898 const wxIcon &GetItemIcon( const wxDataViewItem& item ) const;
899 void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon );
900 const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const;
901 void SetItemData( const wxDataViewItem& item, wxClientData *data );
902 wxClientData *GetItemData( const wxDataViewItem& item ) const;
903
904 void DeleteItem( const wxDataViewItem& item );
905 void DeleteChildren( const wxDataViewItem& item );
906 void DeleteAllItems();
907
908 // implement base methods
909
910 virtual void GetValue( wxVariant &variant,
911 const wxDataViewItem &item, unsigned int col ) const;
912 virtual bool SetValue( const wxVariant &variant,
913 const wxDataViewItem &item, unsigned int col );
914 virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
915 virtual bool IsContainer( const wxDataViewItem &item ) const;
916 virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
917
918 virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
919 unsigned int column, bool ascending );
920
921 virtual bool HasDefaultCompare() const
922 { return true; }
923 virtual unsigned int GetColumnCount() const
924 { return 1; };
925 virtual wxString GetColumnType( unsigned int WXUNUSED(col) ) const
926 { return wxT("wxDataViewIconText"); }
927
928 wxDataViewTreeStoreNode *FindNode( const wxDataViewItem &item ) const;
929 wxDataViewTreeStoreContainerNode *FindContainerNode( const wxDataViewItem &item ) const;
930 wxDataViewTreeStoreNode *GetRoot() const { return m_root; }
931
932 public:
933 wxDataViewTreeStoreNode *m_root;
934 };
935
936 class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl
937 {
938 public:
939 wxDataViewTreeCtrl();
940 wxDataViewTreeCtrl( wxWindow *parent, wxWindowID id,
941 const wxPoint& pos = wxDefaultPosition,
942 const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER,
943 const wxValidator& validator = wxDefaultValidator );
944 ~wxDataViewTreeCtrl();
945
946 bool Create( wxWindow *parent, wxWindowID id,
947 const wxPoint& pos = wxDefaultPosition,
948 const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER,
949 const wxValidator& validator = wxDefaultValidator );
950
951 wxDataViewTreeStore *GetStore()
952 { return (wxDataViewTreeStore*) GetModel(); }
953 const wxDataViewTreeStore *GetStore() const
954 { return (const wxDataViewTreeStore*) GetModel(); }
955
956 void SetImageList( wxImageList *imagelist );
957 wxImageList* GetImageList() { return m_imageList; }
958
959 wxDataViewItem AppendItem( const wxDataViewItem& parent,
960 const wxString &text, int icon = -1, wxClientData *data = NULL );
961 wxDataViewItem PrependItem( const wxDataViewItem& parent,
962 const wxString &text, int icon = -1, wxClientData *data = NULL );
963 wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous,
964 const wxString &text, int icon = -1, wxClientData *data = NULL );
965
966 wxDataViewItem PrependContainer( const wxDataViewItem& parent,
967 const wxString &text, int icon = -1, int expanded = -1,
968 wxClientData *data = NULL );
969 wxDataViewItem AppendContainer( const wxDataViewItem& parent,
970 const wxString &text, int icon = -1, int expanded = -1,
971 wxClientData *data = NULL );
972 wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous,
973 const wxString &text, int icon = -1, int expanded = -1,
974 wxClientData *data = NULL );
975
976 wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const
977 { return GetStore()->GetNthChild(parent, pos); }
978 int GetChildCount( const wxDataViewItem& parent ) const
979 { return GetStore()->GetChildCount(parent); }
980
981 void SetItemText( const wxDataViewItem& item, const wxString &text )
982 { GetStore()->SetItemText(item,text); }
983 wxString GetItemText( const wxDataViewItem& item ) const
984 { return GetStore()->GetItemText(item); }
985 void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon )
986 { GetStore()->SetItemIcon(item,icon); }
987 const wxIcon &GetItemIcon( const wxDataViewItem& item ) const
988 { return GetStore()->GetItemIcon(item); }
989 void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon )
990 { GetStore()->SetItemExpandedIcon(item,icon); }
991 const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const
992 { return GetStore()->GetItemExpandedIcon(item); }
993 void SetItemData( const wxDataViewItem& item, wxClientData *data )
994 { GetStore()->SetItemData(item,data); }
995 wxClientData *GetItemData( const wxDataViewItem& item ) const
996 { return GetStore()->GetItemData(item); }
997
998 void DeleteItem( const wxDataViewItem& item )
999 { GetStore()->DeleteItem(item); }
1000 void DeleteChildren( const wxDataViewItem& item )
1001 { GetStore()->DeleteChildren(item); }
1002 void DeleteAllItems()
1003 { GetStore()->DeleteAllItems(); }
1004
1005 void OnExpanded( wxDataViewEvent &event );
1006 void OnCollapsed( wxDataViewEvent &event );
1007
1008 private:
1009 wxImageList *m_imageList;
1010
1011 private:
1012 DECLARE_EVENT_TABLE()
1013 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl)
1014 };
1015
1016 #endif // wxUSE_DATAVIEWCTRL
1017
1018 #endif
1019 // _WX_DATAVIEW_H_BASE_