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 class WXDLLIMPEXP_FWD_CORE wxDataFormat
;
29 #if defined(__WXGTK20__)
31 // #define wxUSE_GENERICDATAVIEWCTRL 1
32 #elif defined(__WXMAC__)
34 #define wxUSE_GENERICDATAVIEWCTRL 1
37 // ----------------------------------------------------------------------------
38 // wxDataViewCtrl flags
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
42 // wxDataViewCtrl globals
43 // ----------------------------------------------------------------------------
45 class WXDLLIMPEXP_FWD_ADV wxDataViewItem
;
46 class WXDLLIMPEXP_FWD_ADV wxDataViewModel
;
47 class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl
;
48 class WXDLLIMPEXP_FWD_ADV wxDataViewColumn
;
49 class WXDLLIMPEXP_FWD_ADV wxDataViewRenderer
;
50 class WXDLLIMPEXP_FWD_ADV wxDataViewModelNotifier
;
52 extern WXDLLIMPEXP_DATA_ADV(const wxChar
) wxDataViewCtrlNameStr
[];
54 // the default width of new (text) columns:
55 #define wxDVC_DEFAULT_WIDTH 80
57 // the default width of new toggle columns:
58 #define wxDVC_TOGGLE_DEFAULT_WIDTH 30
60 // the default minimal width of the columns:
61 #define wxDVC_DEFAULT_MINWIDTH 30
63 // The default alignment of wxDataViewRenderers is to take
64 // the alignment from the column it owns.
65 #define wxDVR_DEFAULT_ALIGNMENT -1
68 // ---------------------------------------------------------
70 // ---------------------------------------------------------
72 class WXDLLIMPEXP_ADV wxDataViewItem
75 wxDataViewItem( void* id
= NULL
)
77 wxDataViewItem( const wxDataViewItem
&item
)
79 bool IsOk() const { return m_id
!= NULL
; }
80 void* GetID() const { return m_id
; }
81 operator const void* () const { return m_id
; }
84 void Print( const wxString
&text
) const;
91 bool operator == (const wxDataViewItem
&left
, const wxDataViewItem
&right
);
93 WX_DEFINE_ARRAY(wxDataViewItem
, wxDataViewItemArray
);
95 // ---------------------------------------------------------
96 // wxDataViewModelNotifier
97 // ---------------------------------------------------------
99 class WXDLLIMPEXP_ADV wxDataViewModelNotifier
102 wxDataViewModelNotifier() { m_owner
= NULL
; }
103 virtual ~wxDataViewModelNotifier() { m_owner
= NULL
; }
105 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
) = 0;
106 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
) = 0;
107 virtual bool ItemChanged( const wxDataViewItem
&item
) = 0;
108 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
109 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
110 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
111 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
) = 0;
112 virtual bool Cleared() = 0;
114 virtual void Resort() = 0;
116 void SetOwner( wxDataViewModel
*owner
) { m_owner
= owner
; }
117 wxDataViewModel
*GetOwner() const { return m_owner
; }
120 wxDataViewModel
*m_owner
;
125 // ----------------------------------------------------------------------------
126 // wxDataViewItemAttr: a structure containing the visual attributes of an item
127 // ----------------------------------------------------------------------------
129 // TODO: this should be renamed to wxItemAttr or something general like this
131 class WXDLLIMPEXP_ADV wxDataViewItemAttr
142 void SetColour(const wxColour
& colour
) { m_colour
= colour
; }
143 void SetBold( bool set
) { m_bold
= set
; }
144 void SetItalic( bool set
) { m_italic
= set
; }
147 bool HasColour() const { return m_colour
.Ok(); }
148 const wxColour
& GetColour() const { return m_colour
; }
150 bool GetBold() const { return m_bold
; }
151 bool GetItalic() const { return m_italic
; }
160 // ---------------------------------------------------------
162 // ---------------------------------------------------------
164 WX_DECLARE_LIST_WITH_DECL(wxDataViewModelNotifier
, wxDataViewModelNotifiers
,
165 class WXDLLIMPEXP_ADV
);
167 class WXDLLIMPEXP_ADV wxDataViewModel
: public wxObjectRefData
172 virtual unsigned int GetColumnCount() const = 0;
174 // return type as reported by wxVariant
175 virtual wxString
GetColumnType( unsigned int col
) const = 0;
177 // get value into a wxVariant
178 virtual void GetValue( wxVariant
&variant
,
179 const wxDataViewItem
&item
, unsigned int col
) const = 0;
181 // set value, call ValueChanged() afterwards!
182 virtual bool SetValue( const wxVariant
&variant
,
183 const wxDataViewItem
&item
, unsigned int col
) = 0;
185 // Get text attribute, return false of default attributes should be used
186 virtual bool GetAttr( const wxDataViewItem
&WXUNUSED(item
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
190 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const = 0;
191 virtual bool IsContainer( const wxDataViewItem
&item
) const = 0;
192 // Is the container just a header or an item with all columns
193 virtual bool HasContainerColumns(const wxDataViewItem
& WXUNUSED(item
)) const
195 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const = 0;
197 // define DnD capabilities
198 virtual bool IsDraggable( const wxDataViewItem
&WXUNUSED(item
) )
200 virtual size_t GetDragDataSize( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
) )
202 virtual bool GetDragData( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
),
203 void* WXUNUSED(data
), size_t WXUNUSED(size
) )
206 // delegated notifiers
207 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
208 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
209 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
210 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
211 virtual bool ItemChanged( const wxDataViewItem
&item
);
212 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
213 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
);
214 virtual bool Cleared();
217 virtual void Resort();
219 void AddNotifier( wxDataViewModelNotifier
*notifier
);
220 void RemoveNotifier( wxDataViewModelNotifier
*notifier
);
222 // default compare function
223 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
224 unsigned int column
, bool ascending
);
225 virtual bool HasDefaultCompare() const { return false; }
228 virtual bool IsVirtualListModel() const { return false; }
231 // the user should not delete this class directly: he should use DecRef() instead!
232 virtual ~wxDataViewModel() { }
234 wxDataViewModelNotifiers m_notifiers
;
237 // ---------------------------------------------------------
238 // wxDataViewIndexListModel
239 // ---------------------------------------------------------
241 class WXDLLIMPEXP_ADV wxDataViewIndexListModel
: public wxDataViewModel
244 wxDataViewIndexListModel( unsigned int initial_size
= 0 );
245 ~wxDataViewIndexListModel();
247 virtual void GetValue( wxVariant
&variant
,
248 unsigned int row
, unsigned int col
) const = 0;
250 virtual bool SetValue( const wxVariant
&variant
,
251 unsigned int row
, unsigned int col
) = 0;
253 virtual bool GetAttr( unsigned int WXUNUSED(row
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
257 void RowInserted( unsigned int before
);
259 void RowDeleted( unsigned int row
);
260 void RowsDeleted( const wxArrayInt
&rows
);
261 void RowChanged( unsigned int row
);
262 void RowValueChanged( unsigned int row
, unsigned int col
);
263 void Reset( unsigned int new_size
);
265 // convert to/from row/wxDataViewItem
267 unsigned int GetRow( const wxDataViewItem
&item
) const;
268 wxDataViewItem
GetItem( unsigned int row
) const;
270 // compare based on index
272 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
273 unsigned int column
, bool ascending
);
274 virtual bool HasDefaultCompare() const;
276 // implement base methods
278 virtual void GetValue( wxVariant
&variant
,
279 const wxDataViewItem
&item
, unsigned int col
) const;
280 virtual bool SetValue( const wxVariant
&variant
,
281 const wxDataViewItem
&item
, unsigned int col
);
282 virtual bool GetAttr( const wxDataViewItem
&item
, unsigned int col
, wxDataViewItemAttr
&attr
);
283 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
284 virtual bool IsContainer( const wxDataViewItem
&item
) const;
285 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
288 virtual bool IsVirtualListModel() const { return false; }
289 unsigned int GetLastIndex() const { return m_lastIndex
; }
292 wxDataViewItemArray m_hash
;
293 unsigned int m_lastIndex
;
298 // ---------------------------------------------------------
299 // wxDataViewVirtualListModel
300 // ---------------------------------------------------------
303 // better than nothing
304 typedef wxDataViewIndexListModel wxDataViewVirtualListModel
;
307 class WXDLLIMPEXP_ADV wxDataViewVirtualListModel
: public wxDataViewModel
310 wxDataViewVirtualListModel( unsigned int initial_size
= 0 );
311 ~wxDataViewVirtualListModel();
313 virtual void GetValue( wxVariant
&variant
,
314 unsigned int row
, unsigned int col
) const = 0;
316 virtual bool SetValue( const wxVariant
&variant
,
317 unsigned int row
, unsigned int col
) = 0;
319 virtual bool GetAttr( unsigned int WXUNUSED(row
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
323 void RowInserted( unsigned int before
);
325 void RowDeleted( unsigned int row
);
326 void RowsDeleted( const wxArrayInt
&rows
);
327 void RowChanged( unsigned int row
);
328 void RowValueChanged( unsigned int row
, unsigned int col
);
329 void Reset( unsigned int new_size
);
331 // convert to/from row/wxDataViewItem
333 unsigned int GetRow( const wxDataViewItem
&item
) const;
334 wxDataViewItem
GetItem( unsigned int row
) const;
336 // compare based on index
338 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
339 unsigned int column
, bool ascending
);
340 virtual bool HasDefaultCompare() const;
342 // implement base methods
344 virtual void GetValue( wxVariant
&variant
,
345 const wxDataViewItem
&item
, unsigned int col
) const;
346 virtual bool SetValue( const wxVariant
&variant
,
347 const wxDataViewItem
&item
, unsigned int col
);
348 virtual bool GetAttr( const wxDataViewItem
&item
, unsigned int col
, wxDataViewItemAttr
&attr
);
349 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
350 virtual bool IsContainer( const wxDataViewItem
&item
) const;
351 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
354 virtual bool IsVirtualListModel() const { return true; }
355 unsigned int GetLastIndex() const { return m_lastIndex
; }
358 wxDataViewItemArray m_hash
;
359 unsigned int m_lastIndex
;
364 //-----------------------------------------------------------------------------
365 // wxDataViewEditorCtrlEvtHandler
366 //-----------------------------------------------------------------------------
368 class wxDataViewEditorCtrlEvtHandler
: public wxEvtHandler
371 wxDataViewEditorCtrlEvtHandler( wxControl
*editor
, wxDataViewRenderer
*owner
);
373 void AcceptChangesAndFinish();
374 void SetFocusOnIdle( bool focus
= true ) { m_focusOnIdle
= focus
; }
377 void OnChar( wxKeyEvent
&event
);
378 void OnKillFocus( wxFocusEvent
&event
);
379 void OnIdle( wxIdleEvent
&event
);
382 wxDataViewRenderer
*m_owner
;
383 wxControl
*m_editorCtrl
;
388 DECLARE_EVENT_TABLE()
391 // ---------------------------------------------------------
392 // wxDataViewRendererBase
393 // ---------------------------------------------------------
395 enum wxDataViewCellMode
397 wxDATAVIEW_CELL_INERT
,
398 wxDATAVIEW_CELL_ACTIVATABLE
,
399 wxDATAVIEW_CELL_EDITABLE
402 enum wxDataViewCellRenderState
404 wxDATAVIEW_CELL_SELECTED
= 1,
405 wxDATAVIEW_CELL_PRELIT
= 2,
406 wxDATAVIEW_CELL_INSENSITIVE
= 4,
407 wxDATAVIEW_CELL_FOCUSED
= 8
410 class WXDLLIMPEXP_ADV wxDataViewRendererBase
: public wxObject
413 wxDataViewRendererBase( const wxString
&varianttype
,
414 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
415 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
417 virtual bool Validate( wxVariant
& WXUNUSED(value
) )
420 void SetOwner( wxDataViewColumn
*owner
) { m_owner
= owner
; }
421 wxDataViewColumn
* GetOwner() const { return m_owner
; }
423 // renderer properties:
425 virtual bool SetValue( const wxVariant
& WXUNUSED(value
) ) = 0;
426 virtual bool GetValue( wxVariant
& WXUNUSED(value
) ) const = 0;
428 wxString
GetVariantType() const { return m_variantType
; }
430 virtual void SetMode( wxDataViewCellMode mode
) = 0;
431 virtual wxDataViewCellMode
GetMode() const = 0;
433 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
434 // rather an "int"; that's because for rendering cells it's allowed
435 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
436 virtual void SetAlignment( int align
) = 0;
437 virtual int GetAlignment() const = 0;
440 virtual bool HasEditorCtrl()
442 virtual wxControl
* CreateEditorCtrl(wxWindow
* WXUNUSED(parent
),
443 wxRect
WXUNUSED(labelRect
),
444 const wxVariant
& WXUNUSED(value
))
446 virtual bool GetValueFromEditorCtrl(wxControl
* WXUNUSED(editor
),
447 wxVariant
& WXUNUSED(value
))
450 virtual bool StartEditing( const wxDataViewItem
&item
, wxRect labelRect
);
451 virtual void CancelEditing();
452 virtual bool FinishEditing();
454 wxControl
*GetEditorCtrl() { return m_editorCtrl
; }
457 wxString m_variantType
;
458 wxDataViewColumn
*m_owner
;
459 wxControl
*m_editorCtrl
;
460 wxDataViewItem m_item
; // for m_editorCtrl
463 const wxDataViewCtrl
* GetView() const;
466 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase
)
469 //-----------------------------------------------------------------------------
470 // wxDataViewIconText
471 //-----------------------------------------------------------------------------
473 class WXDLLIMPEXP_ADV wxDataViewIconText
: public wxObject
476 wxDataViewIconText( const wxString
&text
= wxEmptyString
, const wxIcon
& icon
= wxNullIcon
)
477 : m_text(text
), m_icon(icon
)
479 wxDataViewIconText( const wxDataViewIconText
&other
)
480 { m_icon
= other
.m_icon
; m_text
= other
.m_text
; }
482 void SetText( const wxString
&text
) { m_text
= text
; }
483 wxString
GetText() const { return m_text
; }
484 void SetIcon( const wxIcon
&icon
) { m_icon
= icon
; }
485 const wxIcon
&GetIcon() const { return m_icon
; }
492 DECLARE_DYNAMIC_CLASS(wxDataViewIconText
)
495 bool operator == (const wxDataViewIconText
&one
, const wxDataViewIconText
&two
);
497 DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText
, WXDLLIMPEXP_ADV
)
499 // ---------------------------------------------------------
500 // wxDataViewColumnBase
501 // ---------------------------------------------------------
503 enum wxDataViewColumnFlags
505 wxDATAVIEW_COL_RESIZABLE
= 1,
506 wxDATAVIEW_COL_SORTABLE
= 2,
507 wxDATAVIEW_COL_REORDERABLE
= 4,
508 wxDATAVIEW_COL_HIDDEN
= 8
511 class WXDLLIMPEXP_ADV wxDataViewColumnBase
: public wxObject
514 wxDataViewColumnBase( const wxString
&title
, wxDataViewRenderer
*renderer
,
515 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
516 wxAlignment align
= wxALIGN_CENTER
,
517 int flags
= wxDATAVIEW_COL_RESIZABLE
);
518 wxDataViewColumnBase( const wxBitmap
&bitmap
, wxDataViewRenderer
*renderer
,
519 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
520 wxAlignment align
= wxALIGN_CENTER
,
521 int flags
= wxDATAVIEW_COL_RESIZABLE
);
522 virtual ~wxDataViewColumnBase();
526 virtual void SetTitle( const wxString
&title
) = 0;
527 virtual void SetAlignment( wxAlignment align
) = 0;
528 virtual void SetSortable( bool sortable
) = 0;
529 virtual void SetReorderable(bool reorderable
) = 0;
530 virtual void SetResizeable( bool resizeable
) = 0;
531 virtual void SetHidden( bool hidden
) = 0;
532 virtual void SetSortOrder( bool ascending
) = 0;
533 virtual void SetFlags( int flags
);
534 virtual void SetOwner( wxDataViewCtrl
*owner
)
536 virtual void SetBitmap( const wxBitmap
&bitmap
)
539 virtual void SetMinWidth( int minWidth
) = 0;
540 virtual void SetWidth( int width
) = 0;
545 virtual wxString
GetTitle() const = 0;
546 virtual wxAlignment
GetAlignment() const = 0;
547 virtual int GetWidth() const = 0;
548 virtual int GetMinWidth() const = 0;
550 virtual int GetFlags() const;
552 virtual bool IsHidden() const = 0;
553 virtual bool IsReorderable() const = 0;
554 virtual bool IsResizeable() const = 0;
555 virtual bool IsSortable() const = 0;
556 virtual bool IsSortOrderAscending() const = 0;
558 const wxBitmap
&GetBitmap() const { return m_bitmap
; }
559 unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column
); }
561 wxDataViewCtrl
*GetOwner() const { return m_owner
; }
562 wxDataViewRenderer
* GetRenderer() const { return m_renderer
; }
565 wxDataViewRenderer
*m_renderer
;
568 wxDataViewCtrl
*m_owner
;
571 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase
)
574 // ---------------------------------------------------------
575 // wxDataViewCtrlBase
576 // ---------------------------------------------------------
578 #define wxDV_SINGLE 0x0000 // for convenience
579 #define wxDV_MULTIPLE 0x0001 // can select multiple items
581 #define wxDV_NO_HEADER 0x0002 // column titles not visible
582 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
583 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
585 #define wxDV_ROW_LINES 0x0010 // alternating colour in rows
587 class WXDLLIMPEXP_ADV wxDataViewCtrlBase
: public wxControl
590 wxDataViewCtrlBase();
591 virtual ~wxDataViewCtrlBase();
593 virtual bool AssociateModel( wxDataViewModel
*model
);
594 wxDataViewModel
* GetModel();
595 const wxDataViewModel
* GetModel() const;
598 wxDataViewColumn
*PrependTextColumn( const wxString
&label
, unsigned int model_column
,
599 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
600 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
601 int flags
= wxDATAVIEW_COL_RESIZABLE
);
602 wxDataViewColumn
*PrependIconTextColumn( const wxString
&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
*PrependToggleColumn( const wxString
&label
, unsigned int model_column
,
607 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
608 wxAlignment align
= wxALIGN_CENTER
,
609 int flags
= wxDATAVIEW_COL_RESIZABLE
);
610 wxDataViewColumn
*PrependProgressColumn( const wxString
&label
, unsigned int model_column
,
611 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
612 wxAlignment align
= wxALIGN_CENTER
,
613 int flags
= wxDATAVIEW_COL_RESIZABLE
);
614 wxDataViewColumn
*PrependDateColumn( const wxString
&label
, unsigned int model_column
,
615 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
616 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
617 int flags
= wxDATAVIEW_COL_RESIZABLE
);
618 wxDataViewColumn
*PrependBitmapColumn( const wxString
&label
, unsigned int model_column
,
619 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
620 wxAlignment align
= wxALIGN_CENTER
,
621 int flags
= wxDATAVIEW_COL_RESIZABLE
);
622 wxDataViewColumn
*PrependTextColumn( const wxBitmap
&label
, unsigned int model_column
,
623 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
624 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
625 int flags
= wxDATAVIEW_COL_RESIZABLE
);
626 wxDataViewColumn
*PrependIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
627 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
628 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
629 int flags
= wxDATAVIEW_COL_RESIZABLE
);
630 wxDataViewColumn
*PrependToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
631 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
632 wxAlignment align
= wxALIGN_CENTER
,
633 int flags
= wxDATAVIEW_COL_RESIZABLE
);
634 wxDataViewColumn
*PrependProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
635 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
636 wxAlignment align
= wxALIGN_CENTER
,
637 int flags
= wxDATAVIEW_COL_RESIZABLE
);
638 wxDataViewColumn
*PrependDateColumn( const wxBitmap
&label
, unsigned int model_column
,
639 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
640 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
641 int flags
= wxDATAVIEW_COL_RESIZABLE
);
642 wxDataViewColumn
*PrependBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
643 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
644 wxAlignment align
= wxALIGN_CENTER
,
645 int flags
= wxDATAVIEW_COL_RESIZABLE
);
647 wxDataViewColumn
*AppendTextColumn( const wxString
&label
, unsigned int model_column
,
648 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
649 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
650 int flags
= wxDATAVIEW_COL_RESIZABLE
);
651 wxDataViewColumn
*AppendIconTextColumn( const wxString
&label
, unsigned int model_column
,
652 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
653 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
654 int flags
= wxDATAVIEW_COL_RESIZABLE
);
655 wxDataViewColumn
*AppendToggleColumn( const wxString
&label
, unsigned int model_column
,
656 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
657 wxAlignment align
= wxALIGN_CENTER
,
658 int flags
= wxDATAVIEW_COL_RESIZABLE
);
659 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
, unsigned int model_column
,
660 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
661 wxAlignment align
= wxALIGN_CENTER
,
662 int flags
= wxDATAVIEW_COL_RESIZABLE
);
663 wxDataViewColumn
*AppendDateColumn( const wxString
&label
, unsigned int model_column
,
664 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
665 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
666 int flags
= wxDATAVIEW_COL_RESIZABLE
);
667 wxDataViewColumn
*AppendBitmapColumn( const wxString
&label
, unsigned int model_column
,
668 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
669 wxAlignment align
= wxALIGN_CENTER
,
670 int flags
= wxDATAVIEW_COL_RESIZABLE
);
671 wxDataViewColumn
*AppendTextColumn( const wxBitmap
&label
, unsigned int model_column
,
672 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
673 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
674 int flags
= wxDATAVIEW_COL_RESIZABLE
);
675 wxDataViewColumn
*AppendIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
676 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
677 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
678 int flags
= wxDATAVIEW_COL_RESIZABLE
);
679 wxDataViewColumn
*AppendToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
680 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
681 wxAlignment align
= wxALIGN_CENTER
,
682 int flags
= wxDATAVIEW_COL_RESIZABLE
);
683 wxDataViewColumn
*AppendProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
684 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
685 wxAlignment align
= wxALIGN_CENTER
,
686 int flags
= wxDATAVIEW_COL_RESIZABLE
);
687 wxDataViewColumn
*AppendDateColumn( const wxBitmap
&label
, unsigned int model_column
,
688 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
689 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
690 int flags
= wxDATAVIEW_COL_RESIZABLE
);
691 wxDataViewColumn
*AppendBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
692 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
693 wxAlignment align
= wxALIGN_CENTER
,
694 int flags
= wxDATAVIEW_COL_RESIZABLE
);
697 virtual bool PrependColumn( wxDataViewColumn
*col
);
698 virtual bool AppendColumn( wxDataViewColumn
*col
);
700 virtual unsigned int GetColumnCount() const = 0;
701 virtual wxDataViewColumn
* GetColumn( unsigned int pos
) const = 0;
702 virtual int GetColumnPosition( const wxDataViewColumn
*column
) const = 0;
704 virtual bool DeleteColumn( wxDataViewColumn
*column
) = 0;
705 virtual bool ClearColumns() = 0;
707 void SetExpanderColumn( wxDataViewColumn
*col
)
708 { m_expander_column
= col
; DoSetExpanderColumn(); }
709 wxDataViewColumn
*GetExpanderColumn() const
710 { return m_expander_column
; }
712 virtual wxDataViewColumn
*GetSortingColumn() const = 0;
714 void SetIndent( int indent
)
715 { m_indent
= indent
; DoSetIndent(); }
716 int GetIndent() const
719 virtual wxDataViewItem
GetSelection() const = 0;
720 virtual int GetSelections( wxDataViewItemArray
& sel
) const = 0;
721 virtual void SetSelections( const wxDataViewItemArray
& sel
) = 0;
722 virtual void Select( const wxDataViewItem
& item
) = 0;
723 virtual void Unselect( const wxDataViewItem
& item
) = 0;
724 virtual bool IsSelected( const wxDataViewItem
& item
) const = 0;
726 virtual void SelectAll() = 0;
727 virtual void UnselectAll() = 0;
729 virtual void Expand( const wxDataViewItem
& item
) = 0;
730 virtual void Collapse( const wxDataViewItem
& item
) = 0;
732 virtual void EnsureVisible( const wxDataViewItem
& item
,
733 const wxDataViewColumn
*column
= NULL
) = 0;
734 virtual void HitTest( const wxPoint
& point
, wxDataViewItem
&item
, wxDataViewColumn
* &column
) const = 0;
735 virtual wxRect
GetItemRect( const wxDataViewItem
& item
, const wxDataViewColumn
*column
= NULL
) const = 0;
738 virtual void DoSetExpanderColumn() = 0 ;
739 virtual void DoSetIndent() = 0;
742 wxDataViewModel
*m_model
;
743 wxDataViewColumn
*m_expander_column
;
747 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase
)
750 // ----------------------------------------------------------------------------
751 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
752 // ----------------------------------------------------------------------------
754 class WXDLLIMPEXP_ADV wxDataViewEvent
: public wxNotifyEvent
757 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
758 : wxNotifyEvent(commandType
, winid
),
762 m_value(wxNullVariant
),
767 wxDataViewEvent(const wxDataViewEvent
& event
)
768 : wxNotifyEvent(event
),
769 m_item(event
.m_item
),
771 m_model(event
.m_model
),
772 m_value(event
.m_value
),
773 m_column(event
.m_column
),
777 wxDataViewItem
GetItem() const { return m_item
; }
778 void SetItem( const wxDataViewItem
&item
) { m_item
= item
; }
780 int GetColumn() const { return m_col
; }
781 void SetColumn( int col
) { m_col
= col
; }
783 wxDataViewModel
* GetModel() const { return m_model
; }
784 void SetModel( wxDataViewModel
*model
) { m_model
= model
; }
786 const wxVariant
&GetValue() const { return m_value
; }
787 void SetValue( const wxVariant
&value
) { m_value
= value
; }
789 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
790 void SetDataViewColumn( wxDataViewColumn
*col
) { m_column
= col
; }
791 wxDataViewColumn
*GetDataViewColumn() const { return m_column
; }
793 // for wxEVT_DATAVIEW_CONTEXT_MENU only
794 wxPoint
GetPosition() const { return m_pos
; }
795 void SetPosition( int x
, int y
) { m_pos
.x
= x
; m_pos
.y
= y
; }
797 virtual wxEvent
*Clone() const { return new wxDataViewEvent(*this); }
800 wxDataViewItem m_item
;
802 wxDataViewModel
*m_model
;
804 wxDataViewColumn
*m_column
;
808 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent
)
811 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED
;
813 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED
;
814 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED
;
815 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED
;
816 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING
;
817 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING
;
818 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED
;
819 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE
;
820 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED
;
822 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU
;
824 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
;
825 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
;
826 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED
;
827 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED
;
829 typedef void (wxEvtHandler::*wxDataViewEventFunction
)(wxDataViewEvent
&);
831 #define wxDataViewEventHandler(func) \
832 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
834 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
835 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
837 #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
839 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
840 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
841 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
842 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
843 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
844 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
845 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
846 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
848 #define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn)
850 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
851 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
852 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
853 #define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn)
855 #if defined(wxUSE_GENERICDATAVIEWCTRL)
856 #include "wx/generic/dataview.h"
857 #elif defined(__WXGTK20__)
858 #include "wx/gtk/dataview.h"
859 #elif defined(__WXMAC__)
860 #include "wx/mac/dataview.h"
862 #include "wx/generic/dataview.h"
865 // -------------------------------------
866 // wxDataViewSpinRenderer
867 // -------------------------------------
869 class WXDLLIMPEXP_ADV wxDataViewSpinRenderer
: public wxDataViewCustomRenderer
872 wxDataViewSpinRenderer( int min
, int max
,
873 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
874 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
875 virtual bool HasEditorCtrl() { return true; }
876 virtual wxControl
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
, const wxVariant
&value
);
877 virtual bool GetValueFromEditorCtrl( wxControl
* editor
, wxVariant
&value
);
878 virtual bool Render( wxRect rect
, wxDC
*dc
, int state
);
879 virtual wxSize
GetSize() const;
880 virtual bool SetValue( const wxVariant
&value
);
881 virtual bool GetValue( wxVariant
&value
) const;
888 //-----------------------------------------------------------------------------
889 // wxDataViewTreeStore
890 //-----------------------------------------------------------------------------
892 class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode
895 wxDataViewTreeStoreNode( wxDataViewTreeStoreNode
*parent
,
896 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
897 virtual ~wxDataViewTreeStoreNode();
899 void SetText( const wxString
&text
)
901 wxString
GetText() const
903 void SetIcon( const wxIcon
&icon
)
905 const wxIcon
&GetIcon() const
907 void SetData( wxClientData
*data
)
908 { if (m_data
) delete m_data
; m_data
= data
; }
909 wxClientData
*GetData() const
912 wxDataViewItem
GetItem() const
913 { return wxDataViewItem( (void*) this ); }
915 virtual bool IsContainer()
918 wxDataViewTreeStoreNode
*GetParent()
922 wxDataViewTreeStoreNode
*m_parent
;
925 wxClientData
*m_data
;
928 WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode
, wxDataViewTreeStoreNodeList
,
929 class WXDLLIMPEXP_ADV
);
931 class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode
: public wxDataViewTreeStoreNode
934 wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode
*parent
,
935 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
936 wxClientData
*data
= NULL
);
937 virtual ~wxDataViewTreeStoreContainerNode();
939 const wxDataViewTreeStoreNodeList
&GetChildren() const
940 { return m_children
; }
941 wxDataViewTreeStoreNodeList
&GetChildren()
942 { return m_children
; }
944 void SetExpandedIcon( const wxIcon
&icon
)
945 { m_iconExpanded
= icon
; }
946 const wxIcon
&GetExpandedIcon() const
947 { return m_iconExpanded
; }
949 void SetExpanded( bool expanded
= true )
950 { m_isExpanded
= expanded
; }
951 bool IsExpanded() const
952 { return m_isExpanded
; }
954 virtual bool IsContainer()
958 wxDataViewTreeStoreNodeList m_children
;
959 wxIcon m_iconExpanded
;
963 //-----------------------------------------------------------------------------
965 class WXDLLIMPEXP_ADV wxDataViewTreeStore
: public wxDataViewModel
968 wxDataViewTreeStore();
969 ~wxDataViewTreeStore();
971 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
972 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
973 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
974 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
975 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
976 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
978 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
979 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
980 wxClientData
*data
= NULL
);
981 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
982 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
983 wxClientData
*data
= NULL
);
984 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
985 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
986 wxClientData
*data
= NULL
);
988 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const;
989 int GetChildCount( const wxDataViewItem
& parent
) const;
991 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
);
992 wxString
GetItemText( const wxDataViewItem
& item
) const;
993 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
994 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const;
995 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
996 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const;
997 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
);
998 wxClientData
*GetItemData( const wxDataViewItem
& item
) const;
1000 void DeleteItem( const wxDataViewItem
& item
);
1001 void DeleteChildren( const wxDataViewItem
& item
);
1002 void DeleteAllItems();
1004 // implement base methods
1006 virtual void GetValue( wxVariant
&variant
,
1007 const wxDataViewItem
&item
, unsigned int col
) const;
1008 virtual bool SetValue( const wxVariant
&variant
,
1009 const wxDataViewItem
&item
, unsigned int col
);
1010 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
1011 virtual bool IsContainer( const wxDataViewItem
&item
) const;
1012 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
1014 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
1015 unsigned int column
, bool ascending
);
1017 virtual bool HasDefaultCompare() const
1019 virtual unsigned int GetColumnCount() const
1021 virtual wxString
GetColumnType( unsigned int WXUNUSED(col
) ) const
1022 { return wxT("wxDataViewIconText"); }
1024 wxDataViewTreeStoreNode
*FindNode( const wxDataViewItem
&item
) const;
1025 wxDataViewTreeStoreContainerNode
*FindContainerNode( const wxDataViewItem
&item
) const;
1026 wxDataViewTreeStoreNode
*GetRoot() const { return m_root
; }
1029 wxDataViewTreeStoreNode
*m_root
;
1032 class WXDLLIMPEXP_ADV wxDataViewTreeCtrl
: public wxDataViewCtrl
1035 wxDataViewTreeCtrl();
1036 wxDataViewTreeCtrl( wxWindow
*parent
, wxWindowID id
,
1037 const wxPoint
& pos
= wxDefaultPosition
,
1038 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
1039 const wxValidator
& validator
= wxDefaultValidator
);
1040 ~wxDataViewTreeCtrl();
1042 bool Create( wxWindow
*parent
, wxWindowID id
,
1043 const wxPoint
& pos
= wxDefaultPosition
,
1044 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
1045 const wxValidator
& validator
= wxDefaultValidator
);
1047 wxDataViewTreeStore
*GetStore()
1048 { return (wxDataViewTreeStore
*) GetModel(); }
1049 const wxDataViewTreeStore
*GetStore() const
1050 { return (const wxDataViewTreeStore
*) GetModel(); }
1052 void SetImageList( wxImageList
*imagelist
);
1053 wxImageList
* GetImageList() { return m_imageList
; }
1055 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
1056 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1057 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
1058 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1059 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
1060 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1062 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
1063 const wxString
&text
, int icon
= -1, int expanded
= -1,
1064 wxClientData
*data
= NULL
);
1065 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
1066 const wxString
&text
, int icon
= -1, int expanded
= -1,
1067 wxClientData
*data
= NULL
);
1068 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
1069 const wxString
&text
, int icon
= -1, int expanded
= -1,
1070 wxClientData
*data
= NULL
);
1072 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const
1073 { return GetStore()->GetNthChild(parent
, pos
); }
1074 int GetChildCount( const wxDataViewItem
& parent
) const
1075 { return GetStore()->GetChildCount(parent
); }
1077 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
)
1078 { GetStore()->SetItemText(item
,text
); }
1079 wxString
GetItemText( const wxDataViewItem
& item
) const
1080 { return GetStore()->GetItemText(item
); }
1081 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1082 { GetStore()->SetItemIcon(item
,icon
); }
1083 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const
1084 { return GetStore()->GetItemIcon(item
); }
1085 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1086 { GetStore()->SetItemExpandedIcon(item
,icon
); }
1087 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const
1088 { return GetStore()->GetItemExpandedIcon(item
); }
1089 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
)
1090 { GetStore()->SetItemData(item
,data
); }
1091 wxClientData
*GetItemData( const wxDataViewItem
& item
) const
1092 { return GetStore()->GetItemData(item
); }
1094 void DeleteItem( const wxDataViewItem
& item
)
1095 { GetStore()->DeleteItem(item
); }
1096 void DeleteChildren( const wxDataViewItem
& item
)
1097 { GetStore()->DeleteChildren(item
); }
1098 void DeleteAllItems()
1099 { GetStore()->DeleteAllItems(); }
1101 void OnExpanded( wxDataViewEvent
&event
);
1102 void OnCollapsed( wxDataViewEvent
&event
);
1103 void OnSize( wxSizeEvent
&event
);
1106 wxImageList
*m_imageList
;
1109 DECLARE_EVENT_TABLE()
1110 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl
)
1113 #endif // wxUSE_DATAVIEWCTRL
1116 // _WX_DATAVIEW_H_BASE_