1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDataViewCtrl base classes
4 // Author: Robert Roebling
5 // Modified by: Bo Yang
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DATAVIEW_H_BASE_
13 #define _WX_DATAVIEW_H_BASE_
17 #if wxUSE_DATAVIEWCTRL
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"
25 #include "wx/imaglist.h"
27 #if defined(__WXGTK20__)
29 // #define wxUSE_GENERICDATAVIEWCTRL 1
30 #elif defined(__WXMAC__)
32 #define wxUSE_GENERICDATAVIEWCTRL 1
35 // ----------------------------------------------------------------------------
36 // wxDataViewCtrl flags
37 // ----------------------------------------------------------------------------
39 // ----------------------------------------------------------------------------
40 // wxDataViewCtrl globals
41 // ----------------------------------------------------------------------------
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
;
50 extern WXDLLIMPEXP_DATA_ADV(const wxChar
) wxDataViewCtrlNameStr
[];
52 // the default width of new (text) columns:
53 #define wxDVC_DEFAULT_WIDTH 80
55 // the default width of new toggle columns:
56 #define wxDVC_TOGGLE_DEFAULT_WIDTH 30
58 // the default minimal width of the columns:
59 #define wxDVC_DEFAULT_MINWIDTH 30
61 // the default alignment of wxDataViewRenderers:
62 #define wxDVR_DEFAULT_ALIGNMENT (wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL)
65 // ---------------------------------------------------------
67 // ---------------------------------------------------------
69 class WXDLLIMPEXP_ADV wxDataViewItem
72 wxDataViewItem( void* id
= NULL
)
74 wxDataViewItem( const wxDataViewItem
&item
)
76 bool IsOk() const { return m_id
!= NULL
; }
77 void* GetID() const { return m_id
; }
78 operator const void* () const { return m_id
; }
81 void Print( const wxString
&text
) const;
88 bool operator == (const wxDataViewItem
&left
, const wxDataViewItem
&right
);
90 WX_DEFINE_ARRAY(wxDataViewItem
, wxDataViewItemArray
);
92 // ---------------------------------------------------------
93 // wxDataViewModelNotifier
94 // ---------------------------------------------------------
96 class WXDLLIMPEXP_ADV wxDataViewModelNotifier
99 wxDataViewModelNotifier() { }
100 virtual ~wxDataViewModelNotifier() { m_owner
= NULL
; }
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;
111 virtual void Resort() = 0;
113 void SetOwner( wxDataViewModel
*owner
) { m_owner
= owner
; }
114 wxDataViewModel
*GetOwner() { return m_owner
; }
117 wxDataViewModel
*m_owner
;
122 // ----------------------------------------------------------------------------
123 // wxDataViewItemAttr: a structure containing the visual attributes of an item
124 // ----------------------------------------------------------------------------
126 // TODO: this should be renamed to wxItemAttr or something general like this
128 class WXDLLIMPEXP_ADV wxDataViewItemAttr
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
; }
144 bool HasColour() const { return m_colour
.Ok(); }
145 const wxColour
& GetColour() const { return m_colour
; }
147 bool GetBold() const { return m_bold
; }
148 bool GetItalic() const { return m_italic
; }
157 // ---------------------------------------------------------
159 // ---------------------------------------------------------
161 WX_DECLARE_LIST_WITH_DECL(wxDataViewModelNotifier
, wxDataViewModelNotifiers
,
162 class WXDLLIMPEXP_ADV
);
164 class WXDLLIMPEXP_ADV wxDataViewModel
: public wxObjectRefData
169 virtual unsigned int GetColumnCount() const = 0;
171 // return type as reported by wxVariant
172 virtual wxString
GetColumnType( unsigned int col
) const = 0;
174 // get value into a wxVariant
175 virtual void GetValue( wxVariant
&variant
,
176 const wxDataViewItem
&item
, unsigned int col
) const = 0;
178 // set value, call ValueChanged() afterwards!
179 virtual bool SetValue( const wxVariant
&variant
,
180 const wxDataViewItem
&item
, unsigned int col
) = 0;
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
) )
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
192 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const = 0;
194 // define DnD capabilities
195 virtual bool IsDraggable( const wxDataViewItem
&WXUNUSED(item
) )
197 virtual size_t GetDragDataSize( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
) )
199 virtual bool GetDragData( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
),
200 void* WXUNUSED(data
), size_t WXUNUSED(size
) )
203 // delegated notifiers
204 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
205 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
206 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
207 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
208 virtual bool ItemChanged( const wxDataViewItem
&item
);
209 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
210 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
);
211 virtual bool Cleared();
214 virtual void Resort();
216 void AddNotifier( wxDataViewModelNotifier
*notifier
);
217 void RemoveNotifier( wxDataViewModelNotifier
*notifier
);
219 // default compare function
220 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
221 unsigned int column
, bool ascending
);
222 virtual bool HasDefaultCompare() const { return false; }
225 virtual bool IsIndexListModel() const { return false; }
228 // the user should not delete this class directly: he should use DecRef() instead!
229 virtual ~wxDataViewModel() { }
231 wxDataViewModelNotifiers m_notifiers
;
234 // ---------------------------------------------------------
235 // wxDataViewIndexListModel
236 // ---------------------------------------------------------
238 class WXDLLIMPEXP_ADV wxDataViewIndexListModel
: public wxDataViewModel
241 wxDataViewIndexListModel( unsigned int initial_size
= 0 );
242 ~wxDataViewIndexListModel();
244 virtual void GetValue( wxVariant
&variant
,
245 unsigned int row
, unsigned int col
) const = 0;
247 virtual bool SetValue( const wxVariant
&variant
,
248 unsigned int row
, unsigned int col
) = 0;
250 virtual bool GetAttr( unsigned int WXUNUSED(row
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
254 void RowInserted( unsigned int before
);
256 void RowDeleted( unsigned int row
);
257 void RowsDeleted( const wxArrayInt
&rows
);
258 void RowChanged( unsigned int row
);
259 void RowValueChanged( unsigned int row
, unsigned int col
);
260 void Reset( unsigned int new_size
);
262 // convert to/from row/wxDataViewItem
264 unsigned int GetRow( const wxDataViewItem
&item
) const;
265 wxDataViewItem
GetItem( unsigned int row
) const;
267 // compare based on index
269 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
270 unsigned int column
, bool ascending
);
271 virtual bool HasDefaultCompare() const;
273 // implement base methods
275 virtual void GetValue( wxVariant
&variant
,
276 const wxDataViewItem
&item
, unsigned int col
) const;
277 virtual bool SetValue( const wxVariant
&variant
,
278 const wxDataViewItem
&item
, unsigned int col
);
279 virtual bool GetAttr( const wxDataViewItem
&item
, unsigned int col
, wxDataViewItemAttr
&attr
);
280 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
281 virtual bool IsContainer( const wxDataViewItem
&item
) const;
282 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
285 virtual bool IsIndexListModel() const { return true; }
286 unsigned int GetLastIndex() const { return m_lastIndex
; }
289 wxDataViewItemArray m_hash
;
290 unsigned int m_lastIndex
;
296 //-----------------------------------------------------------------------------
297 // wxDataViewEditorCtrlEvtHandler
298 //-----------------------------------------------------------------------------
300 class wxDataViewEditorCtrlEvtHandler
: public wxEvtHandler
303 wxDataViewEditorCtrlEvtHandler( wxControl
*editor
, wxDataViewRenderer
*owner
);
305 void AcceptChangesAndFinish();
306 void SetFocusOnIdle( bool focus
= true ) { m_focusOnIdle
= focus
; }
309 void OnChar( wxKeyEvent
&event
);
310 void OnKillFocus( wxFocusEvent
&event
);
311 void OnIdle( wxIdleEvent
&event
);
314 wxDataViewRenderer
*m_owner
;
315 wxControl
*m_editorCtrl
;
320 DECLARE_EVENT_TABLE()
323 // ---------------------------------------------------------
324 // wxDataViewRendererBase
325 // ---------------------------------------------------------
327 enum wxDataViewCellMode
329 wxDATAVIEW_CELL_INERT
,
330 wxDATAVIEW_CELL_ACTIVATABLE
,
331 wxDATAVIEW_CELL_EDITABLE
334 enum wxDataViewCellRenderState
336 wxDATAVIEW_CELL_SELECTED
= 1,
337 wxDATAVIEW_CELL_PRELIT
= 2,
338 wxDATAVIEW_CELL_INSENSITIVE
= 4,
339 wxDATAVIEW_CELL_FOCUSED
= 8
342 class WXDLLIMPEXP_ADV wxDataViewRendererBase
: public wxObject
345 wxDataViewRendererBase( const wxString
&varianttype
,
346 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
347 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
349 virtual bool Validate( wxVariant
& WXUNUSED(value
) )
352 void SetOwner( wxDataViewColumn
*owner
) { m_owner
= owner
; }
353 wxDataViewColumn
* GetOwner() { return m_owner
; }
355 // renderer properties:
357 virtual bool SetValue( const wxVariant
& WXUNUSED(value
) ) = 0;
358 virtual bool GetValue( wxVariant
& WXUNUSED(value
) ) const = 0;
360 wxString
GetVariantType() const { return m_variantType
; }
362 virtual void SetMode( wxDataViewCellMode mode
) = 0;
363 virtual wxDataViewCellMode
GetMode() const = 0;
365 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
366 // rather an "int"; that's because for rendering cells it's allowed
367 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
368 virtual void SetAlignment( int align
) = 0;
369 virtual int GetAlignment() const = 0;
372 virtual bool HasEditorCtrl()
374 virtual wxControl
* CreateEditorCtrl(wxWindow
* WXUNUSED(parent
),
375 wxRect
WXUNUSED(labelRect
),
376 const wxVariant
& WXUNUSED(value
))
378 virtual bool GetValueFromEditorCtrl(wxControl
* WXUNUSED(editor
),
379 wxVariant
& WXUNUSED(value
))
382 virtual bool StartEditing( const wxDataViewItem
&item
, wxRect labelRect
);
383 virtual void CancelEditing();
384 virtual bool FinishEditing();
386 wxControl
*GetEditorCtrl() { return m_editorCtrl
; }
389 wxString m_variantType
;
390 wxDataViewColumn
*m_owner
;
391 wxControl
*m_editorCtrl
;
392 wxDataViewItem m_item
; // for m_editorCtrl
395 const wxDataViewCtrl
* GetView() const;
398 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase
)
401 //-----------------------------------------------------------------------------
402 // wxDataViewIconText
403 //-----------------------------------------------------------------------------
405 class WXDLLIMPEXP_ADV wxDataViewIconText
: public wxObject
408 wxDataViewIconText( const wxString
&text
= wxEmptyString
, const wxIcon
& icon
= wxNullIcon
)
409 { m_icon
= icon
; m_text
= text
; }
410 wxDataViewIconText( const wxDataViewIconText
&other
)
411 { m_icon
= other
.m_icon
; m_text
= other
.m_text
; }
413 void SetText( const wxString
&text
) { m_text
= text
; }
414 wxString
GetText() const { return m_text
; }
415 void SetIcon( const wxIcon
&icon
) { m_icon
= icon
; }
416 const wxIcon
&GetIcon() const { return m_icon
; }
423 DECLARE_DYNAMIC_CLASS(wxDataViewIconText
)
426 bool operator == (const wxDataViewIconText
&one
, const wxDataViewIconText
&two
);
428 DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText
, WXDLLIMPEXP_ADV
)
430 // ---------------------------------------------------------
431 // wxDataViewColumnBase
432 // ---------------------------------------------------------
434 enum wxDataViewColumnFlags
436 wxDATAVIEW_COL_RESIZABLE
= 1,
437 wxDATAVIEW_COL_SORTABLE
= 2,
438 wxDATAVIEW_COL_REORDERABLE
= 4,
439 wxDATAVIEW_COL_HIDDEN
= 8
442 class WXDLLIMPEXP_ADV wxDataViewColumnBase
: public wxObject
445 wxDataViewColumnBase( const wxString
&title
, wxDataViewRenderer
*renderer
,
446 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
447 wxAlignment align
= wxALIGN_CENTER
,
448 int flags
= wxDATAVIEW_COL_RESIZABLE
);
449 wxDataViewColumnBase( const wxBitmap
&bitmap
, wxDataViewRenderer
*renderer
,
450 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
451 wxAlignment align
= wxALIGN_CENTER
,
452 int flags
= wxDATAVIEW_COL_RESIZABLE
);
453 virtual ~wxDataViewColumnBase();
457 virtual void SetTitle( const wxString
&title
) = 0;
458 virtual void SetAlignment( wxAlignment align
) = 0;
459 virtual void SetSortable( bool sortable
) = 0;
460 virtual void SetReorderable(bool reorderable
) = 0;
461 virtual void SetResizeable( bool resizeable
) = 0;
462 virtual void SetHidden( bool hidden
) = 0;
463 virtual void SetSortOrder( bool ascending
) = 0;
464 virtual void SetFlags( int flags
);
465 virtual void SetOwner( wxDataViewCtrl
*owner
)
467 virtual void SetBitmap( const wxBitmap
&bitmap
)
470 virtual void SetMinWidth( int minWidth
) = 0;
471 virtual void SetWidth( int width
) = 0;
476 virtual wxString
GetTitle() const = 0;
477 virtual wxAlignment
GetAlignment() const = 0;
478 virtual int GetWidth() const = 0;
479 virtual int GetMinWidth() const = 0;
481 virtual int GetFlags() const;
483 virtual bool IsHidden() const = 0;
484 virtual bool IsReorderable() const = 0;
485 virtual bool IsResizeable() const = 0;
486 virtual bool IsSortable() const = 0;
487 virtual bool IsSortOrderAscending() const = 0;
489 const wxBitmap
&GetBitmap() const { return m_bitmap
; }
490 unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column
); }
492 wxDataViewCtrl
*GetOwner() const { return m_owner
; }
493 wxDataViewRenderer
* GetRenderer() const { return m_renderer
; }
496 wxDataViewRenderer
*m_renderer
;
499 wxDataViewCtrl
*m_owner
;
502 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase
)
505 // ---------------------------------------------------------
506 // wxDataViewCtrlBase
507 // ---------------------------------------------------------
509 #define wxDV_SINGLE 0x0000 // for convenience
510 #define wxDV_MULTIPLE 0x0001 // can select multiple items
512 #define wxDV_NO_HEADER 0x0002 // column titles not visible
513 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
514 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
516 #define wxDV_ROW_LINES 0x0010 // alternating colour in rows
518 class WXDLLIMPEXP_ADV wxDataViewCtrlBase
: public wxControl
521 wxDataViewCtrlBase();
522 virtual ~wxDataViewCtrlBase();
524 virtual bool AssociateModel( wxDataViewModel
*model
);
525 wxDataViewModel
* GetModel();
526 const wxDataViewModel
* GetModel() const;
529 wxDataViewColumn
*PrependTextColumn( const wxString
&label
, unsigned int model_column
,
530 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
531 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
532 int flags
= wxDATAVIEW_COL_RESIZABLE
);
533 wxDataViewColumn
*PrependIconTextColumn( const wxString
&label
, unsigned int model_column
,
534 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
535 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
536 int flags
= wxDATAVIEW_COL_RESIZABLE
);
537 wxDataViewColumn
*PrependToggleColumn( const wxString
&label
, unsigned int model_column
,
538 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
539 wxAlignment align
= wxALIGN_CENTER
,
540 int flags
= wxDATAVIEW_COL_RESIZABLE
);
541 wxDataViewColumn
*PrependProgressColumn( const wxString
&label
, unsigned int model_column
,
542 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
543 wxAlignment align
= wxALIGN_CENTER
,
544 int flags
= wxDATAVIEW_COL_RESIZABLE
);
545 wxDataViewColumn
*PrependDateColumn( const wxString
&label
, unsigned int model_column
,
546 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
547 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
548 int flags
= wxDATAVIEW_COL_RESIZABLE
);
549 wxDataViewColumn
*PrependBitmapColumn( const wxString
&label
, unsigned int model_column
,
550 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
551 wxAlignment align
= wxALIGN_CENTER
,
552 int flags
= wxDATAVIEW_COL_RESIZABLE
);
553 wxDataViewColumn
*PrependTextColumn( const wxBitmap
&label
, unsigned int model_column
,
554 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
555 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
556 int flags
= wxDATAVIEW_COL_RESIZABLE
);
557 wxDataViewColumn
*PrependIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
558 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
559 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
560 int flags
= wxDATAVIEW_COL_RESIZABLE
);
561 wxDataViewColumn
*PrependToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
562 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
563 wxAlignment align
= wxALIGN_CENTER
,
564 int flags
= wxDATAVIEW_COL_RESIZABLE
);
565 wxDataViewColumn
*PrependProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
566 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
567 wxAlignment align
= wxALIGN_CENTER
,
568 int flags
= wxDATAVIEW_COL_RESIZABLE
);
569 wxDataViewColumn
*PrependDateColumn( const wxBitmap
&label
, unsigned int model_column
,
570 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
571 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
572 int flags
= wxDATAVIEW_COL_RESIZABLE
);
573 wxDataViewColumn
*PrependBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
574 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
575 wxAlignment align
= wxALIGN_CENTER
,
576 int flags
= wxDATAVIEW_COL_RESIZABLE
);
578 wxDataViewColumn
*AppendTextColumn( const wxString
&label
, unsigned int model_column
,
579 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
580 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
581 int flags
= wxDATAVIEW_COL_RESIZABLE
);
582 wxDataViewColumn
*AppendIconTextColumn( const wxString
&label
, unsigned int model_column
,
583 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
584 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
585 int flags
= wxDATAVIEW_COL_RESIZABLE
);
586 wxDataViewColumn
*AppendToggleColumn( const wxString
&label
, unsigned int model_column
,
587 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
588 wxAlignment align
= wxALIGN_CENTER
,
589 int flags
= wxDATAVIEW_COL_RESIZABLE
);
590 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
, unsigned int model_column
,
591 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
592 wxAlignment align
= wxALIGN_CENTER
,
593 int flags
= wxDATAVIEW_COL_RESIZABLE
);
594 wxDataViewColumn
*AppendDateColumn( const wxString
&label
, unsigned int model_column
,
595 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
596 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
597 int flags
= wxDATAVIEW_COL_RESIZABLE
);
598 wxDataViewColumn
*AppendBitmapColumn( const wxString
&label
, unsigned int model_column
,
599 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
600 wxAlignment align
= wxALIGN_CENTER
,
601 int flags
= wxDATAVIEW_COL_RESIZABLE
);
602 wxDataViewColumn
*AppendTextColumn( const wxBitmap
&label
, unsigned int model_column
,
603 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
604 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
605 int flags
= wxDATAVIEW_COL_RESIZABLE
);
606 wxDataViewColumn
*AppendIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
607 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
608 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
609 int flags
= wxDATAVIEW_COL_RESIZABLE
);
610 wxDataViewColumn
*AppendToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
611 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
612 wxAlignment align
= wxALIGN_CENTER
,
613 int flags
= wxDATAVIEW_COL_RESIZABLE
);
614 wxDataViewColumn
*AppendProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
615 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
616 wxAlignment align
= wxALIGN_CENTER
,
617 int flags
= wxDATAVIEW_COL_RESIZABLE
);
618 wxDataViewColumn
*AppendDateColumn( const wxBitmap
&label
, unsigned int model_column
,
619 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
620 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
621 int flags
= wxDATAVIEW_COL_RESIZABLE
);
622 wxDataViewColumn
*AppendBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
623 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
624 wxAlignment align
= wxALIGN_CENTER
,
625 int flags
= wxDATAVIEW_COL_RESIZABLE
);
628 virtual bool PrependColumn( wxDataViewColumn
*col
);
629 virtual bool AppendColumn( wxDataViewColumn
*col
);
631 virtual unsigned int GetColumnCount() const = 0;
632 virtual wxDataViewColumn
* GetColumn( unsigned int pos
) const = 0;
633 virtual int GetColumnPosition( const wxDataViewColumn
*column
) const = 0;
635 virtual bool DeleteColumn( wxDataViewColumn
*column
) = 0;
636 virtual bool ClearColumns() = 0;
638 void SetExpanderColumn( wxDataViewColumn
*col
)
639 { m_expander_column
= col
; DoSetExpanderColumn(); }
640 wxDataViewColumn
*GetExpanderColumn() const
641 { return m_expander_column
; }
643 virtual wxDataViewColumn
*GetSortingColumn() const = 0;
645 void SetIndent( int indent
)
646 { m_indent
= indent
; DoSetIndent(); }
647 int GetIndent() const
650 virtual wxDataViewItem
GetSelection() const = 0;
651 virtual int GetSelections( wxDataViewItemArray
& sel
) const = 0;
652 virtual void SetSelections( const wxDataViewItemArray
& sel
) = 0;
653 virtual void Select( const wxDataViewItem
& item
) = 0;
654 virtual void Unselect( const wxDataViewItem
& item
) = 0;
655 virtual bool IsSelected( const wxDataViewItem
& item
) const = 0;
657 virtual void SelectAll() = 0;
658 virtual void UnselectAll() = 0;
660 virtual void Expand( const wxDataViewItem
& item
) = 0;
661 virtual void Collapse( const wxDataViewItem
& item
) = 0;
663 virtual void EnsureVisible( const wxDataViewItem
& item
,
664 const wxDataViewColumn
*column
= NULL
) = 0;
665 virtual void HitTest( const wxPoint
& point
, wxDataViewItem
&item
, wxDataViewColumn
* &column
) const = 0;
666 virtual wxRect
GetItemRect( const wxDataViewItem
& item
, const wxDataViewColumn
*column
= NULL
) const = 0;
669 virtual void DoSetExpanderColumn() = 0 ;
670 virtual void DoSetIndent() = 0;
673 wxDataViewModel
*m_model
;
674 wxDataViewColumn
*m_expander_column
;
678 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase
)
681 // ----------------------------------------------------------------------------
682 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
683 // ----------------------------------------------------------------------------
685 class WXDLLIMPEXP_ADV wxDataViewEvent
: public wxNotifyEvent
688 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
689 : wxNotifyEvent(commandType
, winid
),
693 m_value(wxNullVariant
),
698 wxDataViewEvent(const wxDataViewEvent
& event
)
699 : wxNotifyEvent(event
),
700 m_item(event
.m_item
),
702 m_model(event
.m_model
),
703 m_value(event
.m_value
),
704 m_column(event
.m_column
),
708 wxDataViewItem
GetItem() const { return m_item
; }
709 void SetItem( const wxDataViewItem
&item
) { m_item
= item
; }
711 int GetColumn() const { return m_col
; }
712 void SetColumn( int col
) { m_col
= col
; }
714 wxDataViewModel
* GetModel() const { return m_model
; }
715 void SetModel( wxDataViewModel
*model
) { m_model
= model
; }
717 const wxVariant
&GetValue() const { return m_value
; }
718 void SetValue( const wxVariant
&value
) { m_value
= value
; }
720 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
721 void SetDataViewColumn( wxDataViewColumn
*col
) { m_column
= col
; }
722 wxDataViewColumn
*GetDataViewColumn() const { return m_column
; }
724 // for wxEVT_DATAVIEW_CONTEXT_MENU only
725 wxPoint
GetPosition() const;
726 void SetPosition( int x
, int y
) { m_pos
.x
= x
; m_pos
.y
= y
; }
728 virtual wxEvent
*Clone() const { return new wxDataViewEvent(*this); }
731 wxDataViewItem m_item
;
733 wxDataViewModel
*m_model
;
735 wxDataViewColumn
*m_column
;
739 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent
)
742 BEGIN_DECLARE_EVENT_TYPES()
743 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED
, -1)
745 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED
, -1)
746 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED
, -1)
747 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED
, -1)
748 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING
, -1)
749 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING
, -1)
750 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED
, -1)
751 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE
, -1)
752 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED
, -1)
754 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU
, -1)
756 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
, -1)
757 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
, -1)
758 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED
, -1)
759 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED
, -1)
760 END_DECLARE_EVENT_TYPES()
762 typedef void (wxEvtHandler::*wxDataViewEventFunction
)(wxDataViewEvent
&);
764 #define wxDataViewEventHandler(func) \
765 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
767 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
768 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
770 #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
772 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
773 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
774 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
775 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
776 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
777 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
778 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
779 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
781 #define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn)
783 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
784 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
785 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
786 #define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn)
788 #if defined(wxUSE_GENERICDATAVIEWCTRL)
789 #include "wx/generic/dataview.h"
790 #elif defined(__WXGTK20__)
791 #include "wx/gtk/dataview.h"
792 #elif defined(__WXMAC__)
793 #include "wx/mac/dataview.h"
795 #include "wx/generic/dataview.h"
798 // -------------------------------------
799 // wxDataViewSpinRenderer
800 // -------------------------------------
802 class WXDLLIMPEXP_ADV wxDataViewSpinRenderer
: public wxDataViewCustomRenderer
805 wxDataViewSpinRenderer( int min
, int max
,
806 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
807 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
808 virtual bool HasEditorCtrl() { return true; }
809 virtual wxControl
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
, const wxVariant
&value
);
810 virtual bool GetValueFromEditorCtrl( wxControl
* editor
, wxVariant
&value
);
811 virtual bool Render( wxRect rect
, wxDC
*dc
, int state
);
812 virtual wxSize
GetSize() const;
813 virtual bool SetValue( const wxVariant
&value
);
814 virtual bool GetValue( wxVariant
&value
) const;
821 //-----------------------------------------------------------------------------
822 // wxDataViewTreeStore
823 //-----------------------------------------------------------------------------
825 class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode
828 wxDataViewTreeStoreNode( wxDataViewTreeStoreNode
*parent
,
829 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
830 virtual ~wxDataViewTreeStoreNode();
832 void SetText( const wxString
&text
)
834 wxString
GetText() const
836 void SetIcon( const wxIcon
&icon
)
838 const wxIcon
&GetIcon() const
840 void SetData( wxClientData
*data
)
841 { if (m_data
) delete m_data
; m_data
= data
; }
842 wxClientData
*GetData() const
845 wxDataViewItem
GetItem() const
846 { return wxDataViewItem( (void*) this ); }
848 virtual bool IsContainer()
851 wxDataViewTreeStoreNode
*GetParent()
855 wxDataViewTreeStoreNode
*m_parent
;
858 wxClientData
*m_data
;
861 WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode
, wxDataViewTreeStoreNodeList
,
862 class WXDLLIMPEXP_ADV
);
864 class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode
: public wxDataViewTreeStoreNode
867 wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode
*parent
,
868 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
869 wxClientData
*data
= NULL
);
870 virtual ~wxDataViewTreeStoreContainerNode();
872 const wxDataViewTreeStoreNodeList
&GetChildren() const
873 { return m_children
; }
874 wxDataViewTreeStoreNodeList
&GetChildren()
875 { return m_children
; }
877 void SetExpandedIcon( const wxIcon
&icon
)
878 { m_iconExpanded
= icon
; }
879 const wxIcon
&GetExpandedIcon() const
880 { return m_iconExpanded
; }
882 void SetExpanded( bool expanded
= true )
883 { m_isExpanded
= expanded
; }
884 bool IsExpanded() const
885 { return m_isExpanded
; }
887 virtual bool IsContainer()
891 wxDataViewTreeStoreNodeList m_children
;
892 wxIcon m_iconExpanded
;
896 //-----------------------------------------------------------------------------
898 class WXDLLIMPEXP_ADV wxDataViewTreeStore
: public wxDataViewModel
901 wxDataViewTreeStore();
902 ~wxDataViewTreeStore();
904 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
905 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
906 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
907 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
908 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
909 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
911 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
912 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
913 wxClientData
*data
= NULL
);
914 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
915 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
916 wxClientData
*data
= NULL
);
917 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
918 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
919 wxClientData
*data
= NULL
);
921 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const;
922 int GetChildCount( const wxDataViewItem
& parent
) const;
924 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
);
925 wxString
GetItemText( const wxDataViewItem
& item
) const;
926 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
927 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const;
928 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
929 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const;
930 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
);
931 wxClientData
*GetItemData( const wxDataViewItem
& item
) const;
933 void DeleteItem( const wxDataViewItem
& item
);
934 void DeleteChildren( const wxDataViewItem
& item
);
935 void DeleteAllItems();
937 // implement base methods
939 virtual void GetValue( wxVariant
&variant
,
940 const wxDataViewItem
&item
, unsigned int col
) const;
941 virtual bool SetValue( const wxVariant
&variant
,
942 const wxDataViewItem
&item
, unsigned int col
);
943 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
944 virtual bool IsContainer( const wxDataViewItem
&item
) const;
945 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
947 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
948 unsigned int column
, bool ascending
);
950 virtual bool HasDefaultCompare() const
952 virtual unsigned int GetColumnCount() const
954 virtual wxString
GetColumnType( unsigned int WXUNUSED(col
) ) const
955 { return wxT("wxDataViewIconText"); }
957 wxDataViewTreeStoreNode
*FindNode( const wxDataViewItem
&item
) const;
958 wxDataViewTreeStoreContainerNode
*FindContainerNode( const wxDataViewItem
&item
) const;
959 wxDataViewTreeStoreNode
*GetRoot() const { return m_root
; }
962 wxDataViewTreeStoreNode
*m_root
;
965 class WXDLLIMPEXP_ADV wxDataViewTreeCtrl
: public wxDataViewCtrl
968 wxDataViewTreeCtrl();
969 wxDataViewTreeCtrl( wxWindow
*parent
, wxWindowID id
,
970 const wxPoint
& pos
= wxDefaultPosition
,
971 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
972 const wxValidator
& validator
= wxDefaultValidator
);
973 ~wxDataViewTreeCtrl();
975 bool Create( wxWindow
*parent
, wxWindowID id
,
976 const wxPoint
& pos
= wxDefaultPosition
,
977 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
978 const wxValidator
& validator
= wxDefaultValidator
);
980 wxDataViewTreeStore
*GetStore()
981 { return (wxDataViewTreeStore
*) GetModel(); }
982 const wxDataViewTreeStore
*GetStore() const
983 { return (const wxDataViewTreeStore
*) GetModel(); }
985 void SetImageList( wxImageList
*imagelist
);
986 wxImageList
* GetImageList() { return m_imageList
; }
988 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
989 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
990 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
991 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
992 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
993 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
995 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
996 const wxString
&text
, int icon
= -1, int expanded
= -1,
997 wxClientData
*data
= NULL
);
998 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
999 const wxString
&text
, int icon
= -1, int expanded
= -1,
1000 wxClientData
*data
= NULL
);
1001 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
1002 const wxString
&text
, int icon
= -1, int expanded
= -1,
1003 wxClientData
*data
= NULL
);
1005 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const
1006 { return GetStore()->GetNthChild(parent
, pos
); }
1007 int GetChildCount( const wxDataViewItem
& parent
) const
1008 { return GetStore()->GetChildCount(parent
); }
1010 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
)
1011 { GetStore()->SetItemText(item
,text
); }
1012 wxString
GetItemText( const wxDataViewItem
& item
) const
1013 { return GetStore()->GetItemText(item
); }
1014 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1015 { GetStore()->SetItemIcon(item
,icon
); }
1016 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const
1017 { return GetStore()->GetItemIcon(item
); }
1018 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1019 { GetStore()->SetItemExpandedIcon(item
,icon
); }
1020 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const
1021 { return GetStore()->GetItemExpandedIcon(item
); }
1022 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
)
1023 { GetStore()->SetItemData(item
,data
); }
1024 wxClientData
*GetItemData( const wxDataViewItem
& item
) const
1025 { return GetStore()->GetItemData(item
); }
1027 void DeleteItem( const wxDataViewItem
& item
)
1028 { GetStore()->DeleteItem(item
); }
1029 void DeleteChildren( const wxDataViewItem
& item
)
1030 { GetStore()->DeleteChildren(item
); }
1031 void DeleteAllItems()
1032 { GetStore()->DeleteAllItems(); }
1034 void OnExpanded( wxDataViewEvent
&event
);
1035 void OnCollapsed( wxDataViewEvent
&event
);
1036 void OnSize( wxSizeEvent
&event
);
1039 wxImageList
*m_imageList
;
1042 DECLARE_EVENT_TABLE()
1043 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl
)
1046 #endif // wxUSE_DATAVIEWCTRL
1049 // _WX_DATAVIEW_H_BASE_