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:
64 #define wxDVR_DEFAULT_ALIGNMENT (wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL)
67 // ---------------------------------------------------------
69 // ---------------------------------------------------------
71 class WXDLLIMPEXP_ADV wxDataViewItem
74 wxDataViewItem( void* id
= NULL
)
76 wxDataViewItem( const wxDataViewItem
&item
)
78 bool IsOk() const { return m_id
!= NULL
; }
79 void* GetID() const { return m_id
; }
80 operator const void* () const { return m_id
; }
83 void Print( const wxString
&text
) const;
90 bool operator == (const wxDataViewItem
&left
, const wxDataViewItem
&right
);
92 WX_DEFINE_ARRAY(wxDataViewItem
, wxDataViewItemArray
);
94 // ---------------------------------------------------------
95 // wxDataViewModelNotifier
96 // ---------------------------------------------------------
98 class WXDLLIMPEXP_ADV wxDataViewModelNotifier
101 wxDataViewModelNotifier() { m_owner
= NULL
; }
102 virtual ~wxDataViewModelNotifier() { m_owner
= NULL
; }
104 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
) = 0;
105 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
) = 0;
106 virtual bool ItemChanged( const wxDataViewItem
&item
) = 0;
107 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
108 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
109 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
110 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
) = 0;
111 virtual bool Cleared() = 0;
113 virtual void Resort() = 0;
115 void SetOwner( wxDataViewModel
*owner
) { m_owner
= owner
; }
116 wxDataViewModel
*GetOwner() { return m_owner
; }
119 wxDataViewModel
*m_owner
;
124 // ----------------------------------------------------------------------------
125 // wxDataViewItemAttr: a structure containing the visual attributes of an item
126 // ----------------------------------------------------------------------------
128 // TODO: this should be renamed to wxItemAttr or something general like this
130 class WXDLLIMPEXP_ADV wxDataViewItemAttr
141 void SetColour(const wxColour
& colour
) { m_colour
= colour
; }
142 void SetBold( bool set
) { m_bold
= set
; }
143 void SetItalic( bool set
) { m_italic
= set
; }
146 bool HasColour() const { return m_colour
.Ok(); }
147 const wxColour
& GetColour() const { return m_colour
; }
149 bool GetBold() const { return m_bold
; }
150 bool GetItalic() const { return m_italic
; }
159 // ---------------------------------------------------------
161 // ---------------------------------------------------------
163 WX_DECLARE_LIST_WITH_DECL(wxDataViewModelNotifier
, wxDataViewModelNotifiers
,
164 class WXDLLIMPEXP_ADV
);
166 class WXDLLIMPEXP_ADV wxDataViewModel
: public wxObjectRefData
171 virtual unsigned int GetColumnCount() const = 0;
173 // return type as reported by wxVariant
174 virtual wxString
GetColumnType( unsigned int col
) const = 0;
176 // get value into a wxVariant
177 virtual void GetValue( wxVariant
&variant
,
178 const wxDataViewItem
&item
, unsigned int col
) const = 0;
180 // set value, call ValueChanged() afterwards!
181 virtual bool SetValue( const wxVariant
&variant
,
182 const wxDataViewItem
&item
, unsigned int col
) = 0;
184 // Get text attribute, return false of default attributes should be used
185 virtual bool GetAttr( const wxDataViewItem
&WXUNUSED(item
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
189 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const = 0;
190 virtual bool IsContainer( const wxDataViewItem
&item
) const = 0;
191 // Is the container just a header or an item with all columns
192 virtual bool HasContainerColumns(const wxDataViewItem
& WXUNUSED(item
)) const
194 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const = 0;
196 // define DnD capabilities
197 virtual bool IsDraggable( const wxDataViewItem
&WXUNUSED(item
) )
199 virtual size_t GetDragDataSize( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
) )
201 virtual bool GetDragData( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
),
202 void* WXUNUSED(data
), size_t WXUNUSED(size
) )
205 // delegated notifiers
206 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
207 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
208 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
209 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
210 virtual bool ItemChanged( const wxDataViewItem
&item
);
211 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
212 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
);
213 virtual bool Cleared();
216 virtual void Resort();
218 void AddNotifier( wxDataViewModelNotifier
*notifier
);
219 void RemoveNotifier( wxDataViewModelNotifier
*notifier
);
221 // default compare function
222 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
223 unsigned int column
, bool ascending
);
224 virtual bool HasDefaultCompare() const { return false; }
227 virtual bool IsVirtualListModel() const { return false; }
230 // the user should not delete this class directly: he should use DecRef() instead!
231 virtual ~wxDataViewModel() { }
233 wxDataViewModelNotifiers m_notifiers
;
236 // ---------------------------------------------------------
237 // wxDataViewIndexListModel
238 // ---------------------------------------------------------
240 class WXDLLIMPEXP_ADV wxDataViewIndexListModel
: public wxDataViewModel
243 wxDataViewIndexListModel( unsigned int initial_size
= 0 );
244 ~wxDataViewIndexListModel();
246 virtual void GetValue( wxVariant
&variant
,
247 unsigned int row
, unsigned int col
) const = 0;
249 virtual bool SetValue( const wxVariant
&variant
,
250 unsigned int row
, unsigned int col
) = 0;
252 virtual bool GetAttr( unsigned int WXUNUSED(row
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
256 void RowInserted( unsigned int before
);
258 void RowDeleted( unsigned int row
);
259 void RowsDeleted( const wxArrayInt
&rows
);
260 void RowChanged( unsigned int row
);
261 void RowValueChanged( unsigned int row
, unsigned int col
);
262 void Reset( unsigned int new_size
);
264 // convert to/from row/wxDataViewItem
266 unsigned int GetRow( const wxDataViewItem
&item
) const;
267 wxDataViewItem
GetItem( unsigned int row
) const;
269 // compare based on index
271 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
272 unsigned int column
, bool ascending
);
273 virtual bool HasDefaultCompare() const;
275 // implement base methods
277 virtual void GetValue( wxVariant
&variant
,
278 const wxDataViewItem
&item
, unsigned int col
) const;
279 virtual bool SetValue( const wxVariant
&variant
,
280 const wxDataViewItem
&item
, unsigned int col
);
281 virtual bool GetAttr( const wxDataViewItem
&item
, unsigned int col
, wxDataViewItemAttr
&attr
);
282 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
283 virtual bool IsContainer( const wxDataViewItem
&item
) const;
284 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
287 virtual bool IsVirtualListModel() const { return false; }
288 unsigned int GetLastIndex() const { return m_lastIndex
; }
291 wxDataViewItemArray m_hash
;
292 unsigned int m_lastIndex
;
297 // ---------------------------------------------------------
298 // wxDataViewVirtualListModel
299 // ---------------------------------------------------------
302 // better than nothing
303 typedef wxDataViewIndexListModel wxDataViewVirtualListModel
;
306 class WXDLLIMPEXP_ADV wxDataViewVirtualListModel
: public wxDataViewModel
309 wxDataViewVirtualListModel( unsigned int initial_size
= 0 );
310 ~wxDataViewVirtualListModel();
312 virtual void GetValue( wxVariant
&variant
,
313 unsigned int row
, unsigned int col
) const = 0;
315 virtual bool SetValue( const wxVariant
&variant
,
316 unsigned int row
, unsigned int col
) = 0;
318 virtual bool GetAttr( unsigned int WXUNUSED(row
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
322 void RowInserted( unsigned int before
);
324 void RowDeleted( unsigned int row
);
325 void RowsDeleted( const wxArrayInt
&rows
);
326 void RowChanged( unsigned int row
);
327 void RowValueChanged( unsigned int row
, unsigned int col
);
328 void Reset( unsigned int new_size
);
330 // convert to/from row/wxDataViewItem
332 unsigned int GetRow( const wxDataViewItem
&item
) const;
333 wxDataViewItem
GetItem( unsigned int row
) const;
335 // compare based on index
337 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
338 unsigned int column
, bool ascending
);
339 virtual bool HasDefaultCompare() const;
341 // implement base methods
343 virtual void GetValue( wxVariant
&variant
,
344 const wxDataViewItem
&item
, unsigned int col
) const;
345 virtual bool SetValue( const wxVariant
&variant
,
346 const wxDataViewItem
&item
, unsigned int col
);
347 virtual bool GetAttr( const wxDataViewItem
&item
, unsigned int col
, wxDataViewItemAttr
&attr
);
348 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
349 virtual bool IsContainer( const wxDataViewItem
&item
) const;
350 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
353 virtual bool IsVirtualListModel() const { return true; }
354 unsigned int GetLastIndex() const { return m_lastIndex
; }
357 wxDataViewItemArray m_hash
;
358 unsigned int m_lastIndex
;
363 //-----------------------------------------------------------------------------
364 // wxDataViewEditorCtrlEvtHandler
365 //-----------------------------------------------------------------------------
367 class wxDataViewEditorCtrlEvtHandler
: public wxEvtHandler
370 wxDataViewEditorCtrlEvtHandler( wxControl
*editor
, wxDataViewRenderer
*owner
);
372 void AcceptChangesAndFinish();
373 void SetFocusOnIdle( bool focus
= true ) { m_focusOnIdle
= focus
; }
376 void OnChar( wxKeyEvent
&event
);
377 void OnKillFocus( wxFocusEvent
&event
);
378 void OnIdle( wxIdleEvent
&event
);
381 wxDataViewRenderer
*m_owner
;
382 wxControl
*m_editorCtrl
;
387 DECLARE_EVENT_TABLE()
390 // ---------------------------------------------------------
391 // wxDataViewRendererBase
392 // ---------------------------------------------------------
394 enum wxDataViewCellMode
396 wxDATAVIEW_CELL_INERT
,
397 wxDATAVIEW_CELL_ACTIVATABLE
,
398 wxDATAVIEW_CELL_EDITABLE
401 enum wxDataViewCellRenderState
403 wxDATAVIEW_CELL_SELECTED
= 1,
404 wxDATAVIEW_CELL_PRELIT
= 2,
405 wxDATAVIEW_CELL_INSENSITIVE
= 4,
406 wxDATAVIEW_CELL_FOCUSED
= 8
409 class WXDLLIMPEXP_ADV wxDataViewRendererBase
: public wxObject
412 wxDataViewRendererBase( const wxString
&varianttype
,
413 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
414 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
416 virtual bool Validate( wxVariant
& WXUNUSED(value
) )
419 void SetOwner( wxDataViewColumn
*owner
) { m_owner
= owner
; }
420 wxDataViewColumn
* GetOwner() { return m_owner
; }
422 // renderer properties:
424 virtual bool SetValue( const wxVariant
& WXUNUSED(value
) ) = 0;
425 virtual bool GetValue( wxVariant
& WXUNUSED(value
) ) const = 0;
427 wxString
GetVariantType() const { return m_variantType
; }
429 virtual void SetMode( wxDataViewCellMode mode
) = 0;
430 virtual wxDataViewCellMode
GetMode() const = 0;
432 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
433 // rather an "int"; that's because for rendering cells it's allowed
434 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
435 virtual void SetAlignment( int align
) = 0;
436 virtual int GetAlignment() const = 0;
439 virtual bool HasEditorCtrl()
441 virtual wxControl
* CreateEditorCtrl(wxWindow
* WXUNUSED(parent
),
442 wxRect
WXUNUSED(labelRect
),
443 const wxVariant
& WXUNUSED(value
))
445 virtual bool GetValueFromEditorCtrl(wxControl
* WXUNUSED(editor
),
446 wxVariant
& WXUNUSED(value
))
449 virtual bool StartEditing( const wxDataViewItem
&item
, wxRect labelRect
);
450 virtual void CancelEditing();
451 virtual bool FinishEditing();
453 wxControl
*GetEditorCtrl() { return m_editorCtrl
; }
456 wxString m_variantType
;
457 wxDataViewColumn
*m_owner
;
458 wxControl
*m_editorCtrl
;
459 wxDataViewItem m_item
; // for m_editorCtrl
462 const wxDataViewCtrl
* GetView() const;
465 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase
)
468 //-----------------------------------------------------------------------------
469 // wxDataViewIconText
470 //-----------------------------------------------------------------------------
472 class WXDLLIMPEXP_ADV wxDataViewIconText
: public wxObject
475 wxDataViewIconText( const wxString
&text
= wxEmptyString
, const wxIcon
& icon
= wxNullIcon
)
476 : m_text(text
), m_icon(icon
)
478 wxDataViewIconText( const wxDataViewIconText
&other
)
479 { m_icon
= other
.m_icon
; m_text
= other
.m_text
; }
481 void SetText( const wxString
&text
) { m_text
= text
; }
482 wxString
GetText() const { return m_text
; }
483 void SetIcon( const wxIcon
&icon
) { m_icon
= icon
; }
484 const wxIcon
&GetIcon() const { return m_icon
; }
491 DECLARE_DYNAMIC_CLASS(wxDataViewIconText
)
494 bool operator == (const wxDataViewIconText
&one
, const wxDataViewIconText
&two
);
496 DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText
, WXDLLIMPEXP_ADV
)
498 // ---------------------------------------------------------
499 // wxDataViewColumnBase
500 // ---------------------------------------------------------
502 enum wxDataViewColumnFlags
504 wxDATAVIEW_COL_RESIZABLE
= 1,
505 wxDATAVIEW_COL_SORTABLE
= 2,
506 wxDATAVIEW_COL_REORDERABLE
= 4,
507 wxDATAVIEW_COL_HIDDEN
= 8
510 class WXDLLIMPEXP_ADV wxDataViewColumnBase
: public wxObject
513 wxDataViewColumnBase( const wxString
&title
, wxDataViewRenderer
*renderer
,
514 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
515 wxAlignment align
= wxALIGN_CENTER
,
516 int flags
= wxDATAVIEW_COL_RESIZABLE
);
517 wxDataViewColumnBase( const wxBitmap
&bitmap
, wxDataViewRenderer
*renderer
,
518 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
519 wxAlignment align
= wxALIGN_CENTER
,
520 int flags
= wxDATAVIEW_COL_RESIZABLE
);
521 virtual ~wxDataViewColumnBase();
525 virtual void SetTitle( const wxString
&title
) = 0;
526 virtual void SetAlignment( wxAlignment align
) = 0;
527 virtual void SetSortable( bool sortable
) = 0;
528 virtual void SetReorderable(bool reorderable
) = 0;
529 virtual void SetResizeable( bool resizeable
) = 0;
530 virtual void SetHidden( bool hidden
) = 0;
531 virtual void SetSortOrder( bool ascending
) = 0;
532 virtual void SetFlags( int flags
);
533 virtual void SetOwner( wxDataViewCtrl
*owner
)
535 virtual void SetBitmap( const wxBitmap
&bitmap
)
538 virtual void SetMinWidth( int minWidth
) = 0;
539 virtual void SetWidth( int width
) = 0;
544 virtual wxString
GetTitle() const = 0;
545 virtual wxAlignment
GetAlignment() const = 0;
546 virtual int GetWidth() const = 0;
547 virtual int GetMinWidth() const = 0;
549 virtual int GetFlags() const;
551 virtual bool IsHidden() const = 0;
552 virtual bool IsReorderable() const = 0;
553 virtual bool IsResizeable() const = 0;
554 virtual bool IsSortable() const = 0;
555 virtual bool IsSortOrderAscending() const = 0;
557 const wxBitmap
&GetBitmap() const { return m_bitmap
; }
558 unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column
); }
560 wxDataViewCtrl
*GetOwner() const { return m_owner
; }
561 wxDataViewRenderer
* GetRenderer() const { return m_renderer
; }
564 wxDataViewRenderer
*m_renderer
;
567 wxDataViewCtrl
*m_owner
;
570 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase
)
573 // ---------------------------------------------------------
574 // wxDataViewCtrlBase
575 // ---------------------------------------------------------
577 #define wxDV_SINGLE 0x0000 // for convenience
578 #define wxDV_MULTIPLE 0x0001 // can select multiple items
580 #define wxDV_NO_HEADER 0x0002 // column titles not visible
581 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
582 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
584 #define wxDV_ROW_LINES 0x0010 // alternating colour in rows
586 class WXDLLIMPEXP_ADV wxDataViewCtrlBase
: public wxControl
589 wxDataViewCtrlBase();
590 virtual ~wxDataViewCtrlBase();
592 virtual bool AssociateModel( wxDataViewModel
*model
);
593 wxDataViewModel
* GetModel();
594 const wxDataViewModel
* GetModel() const;
597 wxDataViewColumn
*PrependTextColumn( const wxString
&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
*PrependIconTextColumn( const wxString
&label
, unsigned int model_column
,
602 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
603 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
604 int flags
= wxDATAVIEW_COL_RESIZABLE
);
605 wxDataViewColumn
*PrependToggleColumn( const wxString
&label
, unsigned int model_column
,
606 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
607 wxAlignment align
= wxALIGN_CENTER
,
608 int flags
= wxDATAVIEW_COL_RESIZABLE
);
609 wxDataViewColumn
*PrependProgressColumn( const wxString
&label
, unsigned int model_column
,
610 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
611 wxAlignment align
= wxALIGN_CENTER
,
612 int flags
= wxDATAVIEW_COL_RESIZABLE
);
613 wxDataViewColumn
*PrependDateColumn( const wxString
&label
, unsigned int model_column
,
614 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
615 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
616 int flags
= wxDATAVIEW_COL_RESIZABLE
);
617 wxDataViewColumn
*PrependBitmapColumn( const wxString
&label
, unsigned int model_column
,
618 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
619 wxAlignment align
= wxALIGN_CENTER
,
620 int flags
= wxDATAVIEW_COL_RESIZABLE
);
621 wxDataViewColumn
*PrependTextColumn( const wxBitmap
&label
, unsigned int model_column
,
622 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
623 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
624 int flags
= wxDATAVIEW_COL_RESIZABLE
);
625 wxDataViewColumn
*PrependIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
626 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
627 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
628 int flags
= wxDATAVIEW_COL_RESIZABLE
);
629 wxDataViewColumn
*PrependToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
630 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
631 wxAlignment align
= wxALIGN_CENTER
,
632 int flags
= wxDATAVIEW_COL_RESIZABLE
);
633 wxDataViewColumn
*PrependProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
634 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
635 wxAlignment align
= wxALIGN_CENTER
,
636 int flags
= wxDATAVIEW_COL_RESIZABLE
);
637 wxDataViewColumn
*PrependDateColumn( const wxBitmap
&label
, unsigned int model_column
,
638 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
639 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
640 int flags
= wxDATAVIEW_COL_RESIZABLE
);
641 wxDataViewColumn
*PrependBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
642 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
643 wxAlignment align
= wxALIGN_CENTER
,
644 int flags
= wxDATAVIEW_COL_RESIZABLE
);
646 wxDataViewColumn
*AppendTextColumn( const wxString
&label
, unsigned int model_column
,
647 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
648 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
649 int flags
= wxDATAVIEW_COL_RESIZABLE
);
650 wxDataViewColumn
*AppendIconTextColumn( const wxString
&label
, unsigned int model_column
,
651 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
652 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
653 int flags
= wxDATAVIEW_COL_RESIZABLE
);
654 wxDataViewColumn
*AppendToggleColumn( const wxString
&label
, unsigned int model_column
,
655 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
656 wxAlignment align
= wxALIGN_CENTER
,
657 int flags
= wxDATAVIEW_COL_RESIZABLE
);
658 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
, unsigned int model_column
,
659 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
660 wxAlignment align
= wxALIGN_CENTER
,
661 int flags
= wxDATAVIEW_COL_RESIZABLE
);
662 wxDataViewColumn
*AppendDateColumn( const wxString
&label
, unsigned int model_column
,
663 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
664 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
665 int flags
= wxDATAVIEW_COL_RESIZABLE
);
666 wxDataViewColumn
*AppendBitmapColumn( const wxString
&label
, unsigned int model_column
,
667 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
668 wxAlignment align
= wxALIGN_CENTER
,
669 int flags
= wxDATAVIEW_COL_RESIZABLE
);
670 wxDataViewColumn
*AppendTextColumn( const wxBitmap
&label
, unsigned int model_column
,
671 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
672 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
673 int flags
= wxDATAVIEW_COL_RESIZABLE
);
674 wxDataViewColumn
*AppendIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
675 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
676 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
677 int flags
= wxDATAVIEW_COL_RESIZABLE
);
678 wxDataViewColumn
*AppendToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
679 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
680 wxAlignment align
= wxALIGN_CENTER
,
681 int flags
= wxDATAVIEW_COL_RESIZABLE
);
682 wxDataViewColumn
*AppendProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
683 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
684 wxAlignment align
= wxALIGN_CENTER
,
685 int flags
= wxDATAVIEW_COL_RESIZABLE
);
686 wxDataViewColumn
*AppendDateColumn( const wxBitmap
&label
, unsigned int model_column
,
687 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
688 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
689 int flags
= wxDATAVIEW_COL_RESIZABLE
);
690 wxDataViewColumn
*AppendBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
691 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
692 wxAlignment align
= wxALIGN_CENTER
,
693 int flags
= wxDATAVIEW_COL_RESIZABLE
);
696 virtual bool PrependColumn( wxDataViewColumn
*col
);
697 virtual bool AppendColumn( wxDataViewColumn
*col
);
699 virtual unsigned int GetColumnCount() const = 0;
700 virtual wxDataViewColumn
* GetColumn( unsigned int pos
) const = 0;
701 virtual int GetColumnPosition( const wxDataViewColumn
*column
) const = 0;
703 virtual bool DeleteColumn( wxDataViewColumn
*column
) = 0;
704 virtual bool ClearColumns() = 0;
706 void SetExpanderColumn( wxDataViewColumn
*col
)
707 { m_expander_column
= col
; DoSetExpanderColumn(); }
708 wxDataViewColumn
*GetExpanderColumn() const
709 { return m_expander_column
; }
711 virtual wxDataViewColumn
*GetSortingColumn() const = 0;
713 void SetIndent( int indent
)
714 { m_indent
= indent
; DoSetIndent(); }
715 int GetIndent() const
718 virtual wxDataViewItem
GetSelection() const = 0;
719 virtual int GetSelections( wxDataViewItemArray
& sel
) const = 0;
720 virtual void SetSelections( const wxDataViewItemArray
& sel
) = 0;
721 virtual void Select( const wxDataViewItem
& item
) = 0;
722 virtual void Unselect( const wxDataViewItem
& item
) = 0;
723 virtual bool IsSelected( const wxDataViewItem
& item
) const = 0;
725 virtual void SelectAll() = 0;
726 virtual void UnselectAll() = 0;
728 virtual void Expand( const wxDataViewItem
& item
) = 0;
729 virtual void Collapse( const wxDataViewItem
& item
) = 0;
731 virtual void EnsureVisible( const wxDataViewItem
& item
,
732 const wxDataViewColumn
*column
= NULL
) = 0;
733 virtual void HitTest( const wxPoint
& point
, wxDataViewItem
&item
, wxDataViewColumn
* &column
) const = 0;
734 virtual wxRect
GetItemRect( const wxDataViewItem
& item
, const wxDataViewColumn
*column
= NULL
) const = 0;
737 virtual void DoSetExpanderColumn() = 0 ;
738 virtual void DoSetIndent() = 0;
741 wxDataViewModel
*m_model
;
742 wxDataViewColumn
*m_expander_column
;
746 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase
)
749 // ----------------------------------------------------------------------------
750 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
751 // ----------------------------------------------------------------------------
753 class WXDLLIMPEXP_ADV wxDataViewEvent
: public wxNotifyEvent
756 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
757 : wxNotifyEvent(commandType
, winid
),
761 m_value(wxNullVariant
),
766 wxDataViewEvent(const wxDataViewEvent
& event
)
767 : wxNotifyEvent(event
),
768 m_item(event
.m_item
),
770 m_model(event
.m_model
),
771 m_value(event
.m_value
),
772 m_column(event
.m_column
),
776 wxDataViewItem
GetItem() const { return m_item
; }
777 void SetItem( const wxDataViewItem
&item
) { m_item
= item
; }
779 int GetColumn() const { return m_col
; }
780 void SetColumn( int col
) { m_col
= col
; }
782 wxDataViewModel
* GetModel() const { return m_model
; }
783 void SetModel( wxDataViewModel
*model
) { m_model
= model
; }
785 const wxVariant
&GetValue() const { return m_value
; }
786 void SetValue( const wxVariant
&value
) { m_value
= value
; }
788 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
789 void SetDataViewColumn( wxDataViewColumn
*col
) { m_column
= col
; }
790 wxDataViewColumn
*GetDataViewColumn() const { return m_column
; }
792 // for wxEVT_DATAVIEW_CONTEXT_MENU only
793 wxPoint
GetPosition() const { return m_pos
; }
794 void SetPosition( int x
, int y
) { m_pos
.x
= x
; m_pos
.y
= y
; }
796 virtual wxEvent
*Clone() const { return new wxDataViewEvent(*this); }
799 wxDataViewItem m_item
;
801 wxDataViewModel
*m_model
;
803 wxDataViewColumn
*m_column
;
807 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent
)
810 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED
;
812 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED
;
813 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED
;
814 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED
;
815 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING
;
816 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING
;
817 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED
;
818 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE
;
819 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED
;
821 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU
;
823 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
;
824 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
;
825 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED
;
826 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED
;
828 typedef void (wxEvtHandler::*wxDataViewEventFunction
)(wxDataViewEvent
&);
830 #define wxDataViewEventHandler(func) \
831 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
833 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
834 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
836 #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
838 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
839 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
840 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
841 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
842 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
843 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
844 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
845 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
847 #define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn)
849 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
850 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
851 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
852 #define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn)
854 #if defined(wxUSE_GENERICDATAVIEWCTRL)
855 #include "wx/generic/dataview.h"
856 #elif defined(__WXGTK20__)
857 #include "wx/gtk/dataview.h"
858 #elif defined(__WXMAC__)
859 #include "wx/mac/dataview.h"
861 #include "wx/generic/dataview.h"
864 // -------------------------------------
865 // wxDataViewSpinRenderer
866 // -------------------------------------
868 class WXDLLIMPEXP_ADV wxDataViewSpinRenderer
: public wxDataViewCustomRenderer
871 wxDataViewSpinRenderer( int min
, int max
,
872 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
873 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
874 virtual bool HasEditorCtrl() { return true; }
875 virtual wxControl
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
, const wxVariant
&value
);
876 virtual bool GetValueFromEditorCtrl( wxControl
* editor
, wxVariant
&value
);
877 virtual bool Render( wxRect rect
, wxDC
*dc
, int state
);
878 virtual wxSize
GetSize() const;
879 virtual bool SetValue( const wxVariant
&value
);
880 virtual bool GetValue( wxVariant
&value
) const;
887 //-----------------------------------------------------------------------------
888 // wxDataViewTreeStore
889 //-----------------------------------------------------------------------------
891 class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode
894 wxDataViewTreeStoreNode( wxDataViewTreeStoreNode
*parent
,
895 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
896 virtual ~wxDataViewTreeStoreNode();
898 void SetText( const wxString
&text
)
900 wxString
GetText() const
902 void SetIcon( const wxIcon
&icon
)
904 const wxIcon
&GetIcon() const
906 void SetData( wxClientData
*data
)
907 { if (m_data
) delete m_data
; m_data
= data
; }
908 wxClientData
*GetData() const
911 wxDataViewItem
GetItem() const
912 { return wxDataViewItem( (void*) this ); }
914 virtual bool IsContainer()
917 wxDataViewTreeStoreNode
*GetParent()
921 wxDataViewTreeStoreNode
*m_parent
;
924 wxClientData
*m_data
;
927 WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode
, wxDataViewTreeStoreNodeList
,
928 class WXDLLIMPEXP_ADV
);
930 class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode
: public wxDataViewTreeStoreNode
933 wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode
*parent
,
934 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
935 wxClientData
*data
= NULL
);
936 virtual ~wxDataViewTreeStoreContainerNode();
938 const wxDataViewTreeStoreNodeList
&GetChildren() const
939 { return m_children
; }
940 wxDataViewTreeStoreNodeList
&GetChildren()
941 { return m_children
; }
943 void SetExpandedIcon( const wxIcon
&icon
)
944 { m_iconExpanded
= icon
; }
945 const wxIcon
&GetExpandedIcon() const
946 { return m_iconExpanded
; }
948 void SetExpanded( bool expanded
= true )
949 { m_isExpanded
= expanded
; }
950 bool IsExpanded() const
951 { return m_isExpanded
; }
953 virtual bool IsContainer()
957 wxDataViewTreeStoreNodeList m_children
;
958 wxIcon m_iconExpanded
;
962 //-----------------------------------------------------------------------------
964 class WXDLLIMPEXP_ADV wxDataViewTreeStore
: public wxDataViewModel
967 wxDataViewTreeStore();
968 ~wxDataViewTreeStore();
970 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
971 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
972 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
973 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
974 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
975 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
977 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
978 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
979 wxClientData
*data
= NULL
);
980 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
981 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
982 wxClientData
*data
= NULL
);
983 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
984 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
985 wxClientData
*data
= NULL
);
987 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const;
988 int GetChildCount( const wxDataViewItem
& parent
) const;
990 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
);
991 wxString
GetItemText( const wxDataViewItem
& item
) const;
992 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
993 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const;
994 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
995 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const;
996 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
);
997 wxClientData
*GetItemData( const wxDataViewItem
& item
) const;
999 void DeleteItem( const wxDataViewItem
& item
);
1000 void DeleteChildren( const wxDataViewItem
& item
);
1001 void DeleteAllItems();
1003 // implement base methods
1005 virtual void GetValue( wxVariant
&variant
,
1006 const wxDataViewItem
&item
, unsigned int col
) const;
1007 virtual bool SetValue( const wxVariant
&variant
,
1008 const wxDataViewItem
&item
, unsigned int col
);
1009 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
1010 virtual bool IsContainer( const wxDataViewItem
&item
) const;
1011 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
1013 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
1014 unsigned int column
, bool ascending
);
1016 virtual bool HasDefaultCompare() const
1018 virtual unsigned int GetColumnCount() const
1020 virtual wxString
GetColumnType( unsigned int WXUNUSED(col
) ) const
1021 { return wxT("wxDataViewIconText"); }
1023 wxDataViewTreeStoreNode
*FindNode( const wxDataViewItem
&item
) const;
1024 wxDataViewTreeStoreContainerNode
*FindContainerNode( const wxDataViewItem
&item
) const;
1025 wxDataViewTreeStoreNode
*GetRoot() const { return m_root
; }
1028 wxDataViewTreeStoreNode
*m_root
;
1031 class WXDLLIMPEXP_ADV wxDataViewTreeCtrl
: public wxDataViewCtrl
1034 wxDataViewTreeCtrl();
1035 wxDataViewTreeCtrl( wxWindow
*parent
, wxWindowID id
,
1036 const wxPoint
& pos
= wxDefaultPosition
,
1037 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
1038 const wxValidator
& validator
= wxDefaultValidator
);
1039 ~wxDataViewTreeCtrl();
1041 bool Create( wxWindow
*parent
, wxWindowID id
,
1042 const wxPoint
& pos
= wxDefaultPosition
,
1043 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
1044 const wxValidator
& validator
= wxDefaultValidator
);
1046 wxDataViewTreeStore
*GetStore()
1047 { return (wxDataViewTreeStore
*) GetModel(); }
1048 const wxDataViewTreeStore
*GetStore() const
1049 { return (const wxDataViewTreeStore
*) GetModel(); }
1051 void SetImageList( wxImageList
*imagelist
);
1052 wxImageList
* GetImageList() { return m_imageList
; }
1054 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
1055 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1056 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
1057 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1058 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
1059 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1061 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
1062 const wxString
&text
, int icon
= -1, int expanded
= -1,
1063 wxClientData
*data
= NULL
);
1064 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
1065 const wxString
&text
, int icon
= -1, int expanded
= -1,
1066 wxClientData
*data
= NULL
);
1067 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
1068 const wxString
&text
, int icon
= -1, int expanded
= -1,
1069 wxClientData
*data
= NULL
);
1071 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const
1072 { return GetStore()->GetNthChild(parent
, pos
); }
1073 int GetChildCount( const wxDataViewItem
& parent
) const
1074 { return GetStore()->GetChildCount(parent
); }
1076 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
)
1077 { GetStore()->SetItemText(item
,text
); }
1078 wxString
GetItemText( const wxDataViewItem
& item
) const
1079 { return GetStore()->GetItemText(item
); }
1080 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1081 { GetStore()->SetItemIcon(item
,icon
); }
1082 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const
1083 { return GetStore()->GetItemIcon(item
); }
1084 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1085 { GetStore()->SetItemExpandedIcon(item
,icon
); }
1086 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const
1087 { return GetStore()->GetItemExpandedIcon(item
); }
1088 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
)
1089 { GetStore()->SetItemData(item
,data
); }
1090 wxClientData
*GetItemData( const wxDataViewItem
& item
) const
1091 { return GetStore()->GetItemData(item
); }
1093 void DeleteItem( const wxDataViewItem
& item
)
1094 { GetStore()->DeleteItem(item
); }
1095 void DeleteChildren( const wxDataViewItem
& item
)
1096 { GetStore()->DeleteChildren(item
); }
1097 void DeleteAllItems()
1098 { GetStore()->DeleteAllItems(); }
1100 void OnExpanded( wxDataViewEvent
&event
);
1101 void OnCollapsed( wxDataViewEvent
&event
);
1102 void OnSize( wxSizeEvent
&event
);
1105 wxImageList
*m_imageList
;
1108 DECLARE_EVENT_TABLE()
1109 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl
)
1112 #endif // wxUSE_DATAVIEWCTRL
1115 // _WX_DATAVIEW_H_BASE_