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