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"
26 #include "wx/weakref.h"
28 class WXDLLIMPEXP_FWD_CORE wxDataFormat
;
30 #if defined(__WXGTK20__)
32 // #define wxUSE_GENERICDATAVIEWCTRL 1
33 #elif defined(__WXMAC__)
35 #define wxUSE_GENERICDATAVIEWCTRL 1
38 // ----------------------------------------------------------------------------
39 // wxDataViewCtrl flags
40 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
43 // wxDataViewCtrl globals
44 // ----------------------------------------------------------------------------
46 class WXDLLIMPEXP_FWD_ADV wxDataViewItem
;
47 class WXDLLIMPEXP_FWD_ADV wxDataViewModel
;
48 class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl
;
49 class WXDLLIMPEXP_FWD_ADV wxDataViewColumn
;
50 class WXDLLIMPEXP_FWD_ADV wxDataViewRenderer
;
51 class WXDLLIMPEXP_FWD_ADV wxDataViewModelNotifier
;
53 extern WXDLLIMPEXP_DATA_ADV(const wxChar
) wxDataViewCtrlNameStr
[];
55 // the default width of new (text) columns:
56 #define wxDVC_DEFAULT_WIDTH 80
58 // the default width of new toggle columns:
59 #define wxDVC_TOGGLE_DEFAULT_WIDTH 30
61 // the default minimal width of the columns:
62 #define wxDVC_DEFAULT_MINWIDTH 30
64 // The default alignment of wxDataViewRenderers is to take
65 // the alignment from the column it owns.
66 #define wxDVR_DEFAULT_ALIGNMENT -1
69 // ---------------------------------------------------------
71 // ---------------------------------------------------------
73 class WXDLLIMPEXP_ADV wxDataViewItem
76 wxDataViewItem( void* id
= NULL
)
78 wxDataViewItem( const wxDataViewItem
&item
)
80 bool IsOk() const { return m_id
!= NULL
; }
81 void* GetID() const { return m_id
; }
82 operator const void* () const { return m_id
; }
85 void Print( const wxString
&text
) const;
92 bool operator == (const wxDataViewItem
&left
, const wxDataViewItem
&right
);
94 WX_DEFINE_ARRAY(wxDataViewItem
, wxDataViewItemArray
);
96 // ---------------------------------------------------------
97 // wxDataViewModelNotifier
98 // ---------------------------------------------------------
100 class WXDLLIMPEXP_ADV wxDataViewModelNotifier
103 wxDataViewModelNotifier() { m_owner
= NULL
; }
104 virtual ~wxDataViewModelNotifier() { m_owner
= NULL
; }
106 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
) = 0;
107 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
) = 0;
108 virtual bool ItemChanged( const wxDataViewItem
&item
) = 0;
109 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
110 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
111 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
112 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
) = 0;
113 virtual bool Cleared() = 0;
115 virtual void Resort() = 0;
117 void SetOwner( wxDataViewModel
*owner
) { m_owner
= owner
; }
118 wxDataViewModel
*GetOwner() const { return m_owner
; }
121 wxDataViewModel
*m_owner
;
126 // ----------------------------------------------------------------------------
127 // wxDataViewItemAttr: a structure containing the visual attributes of an item
128 // ----------------------------------------------------------------------------
130 // TODO: this should be renamed to wxItemAttr or something general like this
132 class WXDLLIMPEXP_ADV wxDataViewItemAttr
143 void SetColour(const wxColour
& colour
) { m_colour
= colour
; }
144 void SetBold( bool set
) { m_bold
= set
; }
145 void SetItalic( bool set
) { m_italic
= set
; }
148 bool HasColour() const { return m_colour
.Ok(); }
149 const wxColour
& GetColour() const { return m_colour
; }
151 bool GetBold() const { return m_bold
; }
152 bool GetItalic() const { return m_italic
; }
161 // ---------------------------------------------------------
163 // ---------------------------------------------------------
165 WX_DECLARE_LIST_WITH_DECL(wxDataViewModelNotifier
, wxDataViewModelNotifiers
,
166 class WXDLLIMPEXP_ADV
);
168 class WXDLLIMPEXP_ADV wxDataViewModel
: public wxObjectRefData
173 virtual unsigned int GetColumnCount() const = 0;
175 // return type as reported by wxVariant
176 virtual wxString
GetColumnType( unsigned int col
) const = 0;
178 // get value into a wxVariant
179 virtual void GetValue( wxVariant
&variant
,
180 const wxDataViewItem
&item
, unsigned int col
) const = 0;
182 // set value, call ValueChanged() afterwards!
183 virtual bool SetValue( const wxVariant
&variant
,
184 const wxDataViewItem
&item
, unsigned int col
) = 0;
186 // Get text attribute, return false of default attributes should be used
187 virtual bool GetAttr( const wxDataViewItem
&WXUNUSED(item
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
191 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const = 0;
192 virtual bool IsContainer( const wxDataViewItem
&item
) const = 0;
193 // Is the container just a header or an item with all columns
194 virtual bool HasContainerColumns(const wxDataViewItem
& WXUNUSED(item
)) const
196 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const = 0;
198 // define DnD capabilities
199 virtual bool IsDraggable( const wxDataViewItem
&WXUNUSED(item
) )
201 virtual size_t GetDragDataSize( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
) )
203 virtual bool GetDragData( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
),
204 void* WXUNUSED(data
), size_t WXUNUSED(size
) )
207 // delegated notifiers
208 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
209 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
210 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
211 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
212 virtual bool ItemChanged( const wxDataViewItem
&item
);
213 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
214 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
);
215 virtual bool Cleared();
218 virtual void Resort();
220 void AddNotifier( wxDataViewModelNotifier
*notifier
);
221 void RemoveNotifier( wxDataViewModelNotifier
*notifier
);
223 // default compare function
224 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
225 unsigned int column
, bool ascending
);
226 virtual bool HasDefaultCompare() const { return false; }
229 virtual bool IsVirtualListModel() const { return false; }
232 // the user should not delete this class directly: he should use DecRef() instead!
233 virtual ~wxDataViewModel() { }
235 wxDataViewModelNotifiers m_notifiers
;
238 // ---------------------------------------------------------
239 // wxDataViewIndexListModel
240 // ---------------------------------------------------------
242 class WXDLLIMPEXP_ADV wxDataViewIndexListModel
: public wxDataViewModel
245 wxDataViewIndexListModel( unsigned int initial_size
= 0 );
246 ~wxDataViewIndexListModel();
248 virtual void GetValue( wxVariant
&variant
,
249 unsigned int row
, unsigned int col
) const = 0;
251 virtual bool SetValue( const wxVariant
&variant
,
252 unsigned int row
, unsigned int col
) = 0;
254 virtual bool GetAttr( unsigned int WXUNUSED(row
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
258 void RowInserted( unsigned int before
);
260 void RowDeleted( unsigned int row
);
261 void RowsDeleted( const wxArrayInt
&rows
);
262 void RowChanged( unsigned int row
);
263 void RowValueChanged( unsigned int row
, unsigned int col
);
264 void Reset( unsigned int new_size
);
266 // convert to/from row/wxDataViewItem
268 unsigned int GetRow( const wxDataViewItem
&item
) const;
269 wxDataViewItem
GetItem( unsigned int row
) const;
271 // compare based on index
273 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
274 unsigned int column
, bool ascending
);
275 virtual bool HasDefaultCompare() const;
277 // implement base methods
279 virtual void GetValue( wxVariant
&variant
,
280 const wxDataViewItem
&item
, unsigned int col
) const;
281 virtual bool SetValue( const wxVariant
&variant
,
282 const wxDataViewItem
&item
, unsigned int col
);
283 virtual bool GetAttr( const wxDataViewItem
&item
, unsigned int col
, wxDataViewItemAttr
&attr
);
284 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
285 virtual bool IsContainer( const wxDataViewItem
&item
) const;
286 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
289 virtual bool IsVirtualListModel() const { return false; }
290 unsigned int GetLastIndex() const { return m_lastIndex
; }
293 wxDataViewItemArray m_hash
;
294 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
);
416 ~wxDataViewRendererBase();
418 virtual bool Validate( wxVariant
& WXUNUSED(value
) )
421 void SetOwner( wxDataViewColumn
*owner
) { m_owner
= owner
; }
422 wxDataViewColumn
* GetOwner() const { return m_owner
; }
424 // renderer properties:
426 virtual bool SetValue( const wxVariant
& WXUNUSED(value
) ) = 0;
427 virtual bool GetValue( wxVariant
& WXUNUSED(value
) ) const = 0;
429 wxString
GetVariantType() const { return m_variantType
; }
431 virtual void SetMode( wxDataViewCellMode mode
) = 0;
432 virtual wxDataViewCellMode
GetMode() const = 0;
434 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
435 // rather an "int"; that's because for rendering cells it's allowed
436 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
437 virtual void SetAlignment( int align
) = 0;
438 virtual int GetAlignment() const = 0;
441 virtual bool HasEditorCtrl()
443 virtual wxControl
* CreateEditorCtrl(wxWindow
* WXUNUSED(parent
),
444 wxRect
WXUNUSED(labelRect
),
445 const wxVariant
& WXUNUSED(value
))
447 virtual bool GetValueFromEditorCtrl(wxControl
* WXUNUSED(editor
),
448 wxVariant
& WXUNUSED(value
))
451 virtual bool StartEditing( const wxDataViewItem
&item
, wxRect labelRect
);
452 virtual void CancelEditing();
453 virtual bool FinishEditing();
455 wxControl
*GetEditorCtrl() { return m_editorCtrl
; }
458 wxString m_variantType
;
459 wxDataViewColumn
*m_owner
;
460 wxWeakRef
<wxControl
> m_editorCtrl
;
461 wxDataViewItem m_item
; // for m_editorCtrl
464 const wxDataViewCtrl
* GetView() const;
467 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase
)
470 //-----------------------------------------------------------------------------
471 // wxDataViewIconText
472 //-----------------------------------------------------------------------------
474 class WXDLLIMPEXP_ADV wxDataViewIconText
: public wxObject
477 wxDataViewIconText( const wxString
&text
= wxEmptyString
, const wxIcon
& icon
= wxNullIcon
)
478 : m_text(text
), m_icon(icon
)
480 wxDataViewIconText( const wxDataViewIconText
&other
)
482 { m_icon
= other
.m_icon
; m_text
= other
.m_text
; }
484 void SetText( const wxString
&text
) { m_text
= text
; }
485 wxString
GetText() const { return m_text
; }
486 void SetIcon( const wxIcon
&icon
) { m_icon
= icon
; }
487 const wxIcon
&GetIcon() const { return m_icon
; }
494 DECLARE_DYNAMIC_CLASS(wxDataViewIconText
)
497 bool operator == (const wxDataViewIconText
&one
, const wxDataViewIconText
&two
);
499 DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText
, WXDLLIMPEXP_ADV
)
501 // ---------------------------------------------------------
502 // wxDataViewColumnBase
503 // ---------------------------------------------------------
505 enum wxDataViewColumnFlags
507 wxDATAVIEW_COL_RESIZABLE
= 1,
508 wxDATAVIEW_COL_SORTABLE
= 2,
509 wxDATAVIEW_COL_REORDERABLE
= 4,
510 wxDATAVIEW_COL_HIDDEN
= 8
513 class WXDLLIMPEXP_ADV wxDataViewColumnBase
: public wxObject
516 wxDataViewColumnBase( const wxString
&title
, wxDataViewRenderer
*renderer
,
517 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
518 wxAlignment align
= wxALIGN_CENTER
,
519 int flags
= wxDATAVIEW_COL_RESIZABLE
);
520 wxDataViewColumnBase( const wxBitmap
&bitmap
, wxDataViewRenderer
*renderer
,
521 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
522 wxAlignment align
= wxALIGN_CENTER
,
523 int flags
= wxDATAVIEW_COL_RESIZABLE
);
524 virtual ~wxDataViewColumnBase();
528 virtual void SetTitle( const wxString
&title
) = 0;
529 virtual void SetAlignment( wxAlignment align
) = 0;
530 virtual void SetSortable( bool sortable
) = 0;
531 virtual void SetReorderable(bool reorderable
) = 0;
532 virtual void SetResizeable( bool resizeable
) = 0;
533 virtual void SetHidden( bool hidden
) = 0;
534 virtual void SetSortOrder( bool ascending
) = 0;
535 virtual void SetFlags( int flags
);
536 virtual void SetOwner( wxDataViewCtrl
*owner
)
538 virtual void SetBitmap( const wxBitmap
&bitmap
)
541 virtual void SetMinWidth( int minWidth
) = 0;
542 virtual void SetWidth( int width
) = 0;
547 virtual wxString
GetTitle() const = 0;
548 virtual wxAlignment
GetAlignment() const = 0;
549 virtual int GetWidth() const = 0;
550 virtual int GetMinWidth() const = 0;
552 virtual int GetFlags() const;
554 virtual bool IsHidden() const = 0;
555 virtual bool IsReorderable() const = 0;
556 virtual bool IsResizeable() const = 0;
557 virtual bool IsSortable() const = 0;
558 virtual bool IsSortOrderAscending() const = 0;
560 const wxBitmap
&GetBitmap() const { return m_bitmap
; }
561 unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column
); }
563 wxDataViewCtrl
*GetOwner() const { return m_owner
; }
564 wxDataViewRenderer
* GetRenderer() const { return m_renderer
; }
567 wxDataViewRenderer
*m_renderer
;
570 wxDataViewCtrl
*m_owner
;
573 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase
)
576 // ---------------------------------------------------------
577 // wxDataViewCtrlBase
578 // ---------------------------------------------------------
580 #define wxDV_SINGLE 0x0000 // for convenience
581 #define wxDV_MULTIPLE 0x0001 // can select multiple items
583 #define wxDV_NO_HEADER 0x0002 // column titles not visible
584 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
585 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
587 #define wxDV_ROW_LINES 0x0010 // alternating colour in rows
588 #define wxDV_VARIABLE_LINE_HEIGHT 0x0020 // variable line height
590 class WXDLLIMPEXP_ADV wxDataViewCtrlBase
: public wxControl
593 wxDataViewCtrlBase();
594 virtual ~wxDataViewCtrlBase();
596 virtual bool AssociateModel( wxDataViewModel
*model
);
597 wxDataViewModel
* GetModel();
598 const wxDataViewModel
* GetModel() const;
601 wxDataViewColumn
*PrependTextColumn( 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
*PrependIconTextColumn( const wxString
&label
, unsigned int model_column
,
606 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
607 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
608 int flags
= wxDATAVIEW_COL_RESIZABLE
);
609 wxDataViewColumn
*PrependToggleColumn( const wxString
&label
, unsigned int model_column
,
610 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
611 wxAlignment align
= wxALIGN_CENTER
,
612 int flags
= wxDATAVIEW_COL_RESIZABLE
);
613 wxDataViewColumn
*PrependProgressColumn( const wxString
&label
, unsigned int model_column
,
614 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
615 wxAlignment align
= wxALIGN_CENTER
,
616 int flags
= wxDATAVIEW_COL_RESIZABLE
);
617 wxDataViewColumn
*PrependDateColumn( const wxString
&label
, unsigned int model_column
,
618 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
619 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
620 int flags
= wxDATAVIEW_COL_RESIZABLE
);
621 wxDataViewColumn
*PrependBitmapColumn( const wxString
&label
, unsigned int model_column
,
622 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
623 wxAlignment align
= wxALIGN_CENTER
,
624 int flags
= wxDATAVIEW_COL_RESIZABLE
);
625 wxDataViewColumn
*PrependTextColumn( 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
*PrependIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
630 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
631 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
632 int flags
= wxDATAVIEW_COL_RESIZABLE
);
633 wxDataViewColumn
*PrependToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
634 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
635 wxAlignment align
= wxALIGN_CENTER
,
636 int flags
= wxDATAVIEW_COL_RESIZABLE
);
637 wxDataViewColumn
*PrependProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
638 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
639 wxAlignment align
= wxALIGN_CENTER
,
640 int flags
= wxDATAVIEW_COL_RESIZABLE
);
641 wxDataViewColumn
*PrependDateColumn( const wxBitmap
&label
, unsigned int model_column
,
642 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
643 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
644 int flags
= wxDATAVIEW_COL_RESIZABLE
);
645 wxDataViewColumn
*PrependBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
646 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
647 wxAlignment align
= wxALIGN_CENTER
,
648 int flags
= wxDATAVIEW_COL_RESIZABLE
);
650 wxDataViewColumn
*AppendTextColumn( 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
*AppendIconTextColumn( const wxString
&label
, unsigned int model_column
,
655 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
656 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
657 int flags
= wxDATAVIEW_COL_RESIZABLE
);
658 wxDataViewColumn
*AppendToggleColumn( const wxString
&label
, unsigned int model_column
,
659 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
660 wxAlignment align
= wxALIGN_CENTER
,
661 int flags
= wxDATAVIEW_COL_RESIZABLE
);
662 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
, unsigned int model_column
,
663 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
664 wxAlignment align
= wxALIGN_CENTER
,
665 int flags
= wxDATAVIEW_COL_RESIZABLE
);
666 wxDataViewColumn
*AppendDateColumn( const wxString
&label
, unsigned int model_column
,
667 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
668 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
669 int flags
= wxDATAVIEW_COL_RESIZABLE
);
670 wxDataViewColumn
*AppendBitmapColumn( const wxString
&label
, unsigned int model_column
,
671 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
672 wxAlignment align
= wxALIGN_CENTER
,
673 int flags
= wxDATAVIEW_COL_RESIZABLE
);
674 wxDataViewColumn
*AppendTextColumn( 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
*AppendIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
679 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
680 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
681 int flags
= wxDATAVIEW_COL_RESIZABLE
);
682 wxDataViewColumn
*AppendToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
683 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
684 wxAlignment align
= wxALIGN_CENTER
,
685 int flags
= wxDATAVIEW_COL_RESIZABLE
);
686 wxDataViewColumn
*AppendProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
687 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
688 wxAlignment align
= wxALIGN_CENTER
,
689 int flags
= wxDATAVIEW_COL_RESIZABLE
);
690 wxDataViewColumn
*AppendDateColumn( const wxBitmap
&label
, unsigned int model_column
,
691 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
692 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
693 int flags
= wxDATAVIEW_COL_RESIZABLE
);
694 wxDataViewColumn
*AppendBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
695 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
696 wxAlignment align
= wxALIGN_CENTER
,
697 int flags
= wxDATAVIEW_COL_RESIZABLE
);
700 virtual bool PrependColumn( wxDataViewColumn
*col
);
701 virtual bool AppendColumn( wxDataViewColumn
*col
);
703 virtual unsigned int GetColumnCount() const = 0;
704 virtual wxDataViewColumn
* GetColumn( unsigned int pos
) const = 0;
705 virtual int GetColumnPosition( const wxDataViewColumn
*column
) const = 0;
707 virtual bool DeleteColumn( wxDataViewColumn
*column
) = 0;
708 virtual bool ClearColumns() = 0;
710 void SetExpanderColumn( wxDataViewColumn
*col
)
711 { m_expander_column
= col
; DoSetExpanderColumn(); }
712 wxDataViewColumn
*GetExpanderColumn() const
713 { return m_expander_column
; }
715 virtual wxDataViewColumn
*GetSortingColumn() const = 0;
717 void SetIndent( int indent
)
718 { m_indent
= indent
; DoSetIndent(); }
719 int GetIndent() const
722 virtual wxDataViewItem
GetSelection() const = 0;
723 virtual int GetSelections( wxDataViewItemArray
& sel
) const = 0;
724 virtual void SetSelections( const wxDataViewItemArray
& sel
) = 0;
725 virtual void Select( const wxDataViewItem
& item
) = 0;
726 virtual void Unselect( const wxDataViewItem
& item
) = 0;
727 virtual bool IsSelected( const wxDataViewItem
& item
) const = 0;
729 virtual void SelectAll() = 0;
730 virtual void UnselectAll() = 0;
732 virtual void Expand( const wxDataViewItem
& item
) = 0;
733 virtual void Collapse( const wxDataViewItem
& item
) = 0;
735 virtual void EnsureVisible( const wxDataViewItem
& item
,
736 const wxDataViewColumn
*column
= NULL
) = 0;
737 virtual void HitTest( const wxPoint
& point
, wxDataViewItem
&item
, wxDataViewColumn
* &column
) const = 0;
738 virtual wxRect
GetItemRect( const wxDataViewItem
& item
, const wxDataViewColumn
*column
= NULL
) const = 0;
741 virtual void DoSetExpanderColumn() = 0 ;
742 virtual void DoSetIndent() = 0;
745 wxDataViewModel
*m_model
;
746 wxDataViewColumn
*m_expander_column
;
750 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase
)
753 // ----------------------------------------------------------------------------
754 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
755 // ----------------------------------------------------------------------------
757 class WXDLLIMPEXP_ADV wxDataViewEvent
: public wxNotifyEvent
760 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
761 : wxNotifyEvent(commandType
, winid
),
765 m_value(wxNullVariant
),
770 wxDataViewEvent(const wxDataViewEvent
& event
)
771 : wxNotifyEvent(event
),
772 m_item(event
.m_item
),
774 m_model(event
.m_model
),
775 m_value(event
.m_value
),
776 m_column(event
.m_column
),
780 wxDataViewItem
GetItem() const { return m_item
; }
781 void SetItem( const wxDataViewItem
&item
) { m_item
= item
; }
783 int GetColumn() const { return m_col
; }
784 void SetColumn( int col
) { m_col
= col
; }
786 wxDataViewModel
* GetModel() const { return m_model
; }
787 void SetModel( wxDataViewModel
*model
) { m_model
= model
; }
789 const wxVariant
&GetValue() const { return m_value
; }
790 void SetValue( const wxVariant
&value
) { m_value
= value
; }
792 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
793 void SetDataViewColumn( wxDataViewColumn
*col
) { m_column
= col
; }
794 wxDataViewColumn
*GetDataViewColumn() const { return m_column
; }
796 // for wxEVT_DATAVIEW_CONTEXT_MENU only
797 wxPoint
GetPosition() const { return m_pos
; }
798 void SetPosition( int x
, int y
) { m_pos
.x
= x
; m_pos
.y
= y
; }
800 virtual wxEvent
*Clone() const { return new wxDataViewEvent(*this); }
803 wxDataViewItem m_item
;
805 wxDataViewModel
*m_model
;
807 wxDataViewColumn
*m_column
;
811 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent
)
814 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED
;
816 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED
;
817 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED
;
818 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED
;
819 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING
;
820 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING
;
821 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED
;
822 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE
;
823 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED
;
825 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU
;
827 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
;
828 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
;
829 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED
;
830 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED
;
832 typedef void (wxEvtHandler::*wxDataViewEventFunction
)(wxDataViewEvent
&);
834 #define wxDataViewEventHandler(func) \
835 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
837 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
838 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
840 #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
842 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
843 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
844 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
845 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
846 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
847 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
848 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
849 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
851 #define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn)
853 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
854 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
855 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
856 #define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn)
858 #if defined(wxUSE_GENERICDATAVIEWCTRL)
859 #include "wx/generic/dataview.h"
860 #elif defined(__WXGTK20__)
861 #include "wx/gtk/dataview.h"
862 #elif defined(__WXMAC__)
863 #include "wx/mac/dataview.h"
865 #include "wx/generic/dataview.h"
868 // -------------------------------------
869 // wxDataViewSpinRenderer
870 // -------------------------------------
872 class WXDLLIMPEXP_ADV wxDataViewSpinRenderer
: public wxDataViewCustomRenderer
875 wxDataViewSpinRenderer( int min
, int max
,
876 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
877 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
878 virtual bool HasEditorCtrl() { return true; }
879 virtual wxControl
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
, const wxVariant
&value
);
880 virtual bool GetValueFromEditorCtrl( wxControl
* editor
, wxVariant
&value
);
881 virtual bool Render( wxRect rect
, wxDC
*dc
, int state
);
882 virtual wxSize
GetSize() const;
883 virtual bool SetValue( const wxVariant
&value
);
884 virtual bool GetValue( wxVariant
&value
) const;
891 //-----------------------------------------------------------------------------
892 // wxDataViewTreeStore
893 //-----------------------------------------------------------------------------
895 class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode
898 wxDataViewTreeStoreNode( wxDataViewTreeStoreNode
*parent
,
899 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
900 virtual ~wxDataViewTreeStoreNode();
902 void SetText( const wxString
&text
)
904 wxString
GetText() const
906 void SetIcon( const wxIcon
&icon
)
908 const wxIcon
&GetIcon() const
910 void SetData( wxClientData
*data
)
911 { if (m_data
) delete m_data
; m_data
= data
; }
912 wxClientData
*GetData() const
915 wxDataViewItem
GetItem() const
916 { return wxDataViewItem( (void*) this ); }
918 virtual bool IsContainer()
921 wxDataViewTreeStoreNode
*GetParent()
925 wxDataViewTreeStoreNode
*m_parent
;
928 wxClientData
*m_data
;
931 WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode
, wxDataViewTreeStoreNodeList
,
932 class WXDLLIMPEXP_ADV
);
934 class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode
: public wxDataViewTreeStoreNode
937 wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode
*parent
,
938 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
939 wxClientData
*data
= NULL
);
940 virtual ~wxDataViewTreeStoreContainerNode();
942 const wxDataViewTreeStoreNodeList
&GetChildren() const
943 { return m_children
; }
944 wxDataViewTreeStoreNodeList
&GetChildren()
945 { return m_children
; }
947 void SetExpandedIcon( const wxIcon
&icon
)
948 { m_iconExpanded
= icon
; }
949 const wxIcon
&GetExpandedIcon() const
950 { return m_iconExpanded
; }
952 void SetExpanded( bool expanded
= true )
953 { m_isExpanded
= expanded
; }
954 bool IsExpanded() const
955 { return m_isExpanded
; }
957 virtual bool IsContainer()
961 wxDataViewTreeStoreNodeList m_children
;
962 wxIcon m_iconExpanded
;
966 //-----------------------------------------------------------------------------
968 class WXDLLIMPEXP_ADV wxDataViewTreeStore
: public wxDataViewModel
971 wxDataViewTreeStore();
972 ~wxDataViewTreeStore();
974 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
975 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
976 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
977 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
978 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
979 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
981 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
982 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
983 wxClientData
*data
= NULL
);
984 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
985 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
986 wxClientData
*data
= NULL
);
987 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
988 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
989 wxClientData
*data
= NULL
);
991 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const;
992 int GetChildCount( const wxDataViewItem
& parent
) const;
994 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
);
995 wxString
GetItemText( const wxDataViewItem
& item
) const;
996 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
997 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const;
998 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
999 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const;
1000 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
);
1001 wxClientData
*GetItemData( const wxDataViewItem
& item
) const;
1003 void DeleteItem( const wxDataViewItem
& item
);
1004 void DeleteChildren( const wxDataViewItem
& item
);
1005 void DeleteAllItems();
1007 // implement base methods
1009 virtual void GetValue( wxVariant
&variant
,
1010 const wxDataViewItem
&item
, unsigned int col
) const;
1011 virtual bool SetValue( const wxVariant
&variant
,
1012 const wxDataViewItem
&item
, unsigned int col
);
1013 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
1014 virtual bool IsContainer( const wxDataViewItem
&item
) const;
1015 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
1017 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
1018 unsigned int column
, bool ascending
);
1020 virtual bool HasDefaultCompare() const
1022 virtual unsigned int GetColumnCount() const
1024 virtual wxString
GetColumnType( unsigned int WXUNUSED(col
) ) const
1025 { return wxT("wxDataViewIconText"); }
1027 wxDataViewTreeStoreNode
*FindNode( const wxDataViewItem
&item
) const;
1028 wxDataViewTreeStoreContainerNode
*FindContainerNode( const wxDataViewItem
&item
) const;
1029 wxDataViewTreeStoreNode
*GetRoot() const { return m_root
; }
1032 wxDataViewTreeStoreNode
*m_root
;
1035 class WXDLLIMPEXP_ADV wxDataViewTreeCtrl
: public wxDataViewCtrl
1038 wxDataViewTreeCtrl();
1039 wxDataViewTreeCtrl( wxWindow
*parent
, wxWindowID id
,
1040 const wxPoint
& pos
= wxDefaultPosition
,
1041 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
1042 const wxValidator
& validator
= wxDefaultValidator
);
1043 ~wxDataViewTreeCtrl();
1045 bool Create( wxWindow
*parent
, wxWindowID id
,
1046 const wxPoint
& pos
= wxDefaultPosition
,
1047 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
1048 const wxValidator
& validator
= wxDefaultValidator
);
1050 wxDataViewTreeStore
*GetStore()
1051 { return (wxDataViewTreeStore
*) GetModel(); }
1052 const wxDataViewTreeStore
*GetStore() const
1053 { return (const wxDataViewTreeStore
*) GetModel(); }
1055 void SetImageList( wxImageList
*imagelist
);
1056 wxImageList
* GetImageList() { return m_imageList
; }
1058 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
1059 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1060 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
1061 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1062 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
1063 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1065 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
1066 const wxString
&text
, int icon
= -1, int expanded
= -1,
1067 wxClientData
*data
= NULL
);
1068 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
1069 const wxString
&text
, int icon
= -1, int expanded
= -1,
1070 wxClientData
*data
= NULL
);
1071 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
1072 const wxString
&text
, int icon
= -1, int expanded
= -1,
1073 wxClientData
*data
= NULL
);
1075 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const
1076 { return GetStore()->GetNthChild(parent
, pos
); }
1077 int GetChildCount( const wxDataViewItem
& parent
) const
1078 { return GetStore()->GetChildCount(parent
); }
1080 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
)
1081 { GetStore()->SetItemText(item
,text
); }
1082 wxString
GetItemText( const wxDataViewItem
& item
) const
1083 { return GetStore()->GetItemText(item
); }
1084 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1085 { GetStore()->SetItemIcon(item
,icon
); }
1086 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const
1087 { return GetStore()->GetItemIcon(item
); }
1088 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1089 { GetStore()->SetItemExpandedIcon(item
,icon
); }
1090 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const
1091 { return GetStore()->GetItemExpandedIcon(item
); }
1092 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
)
1093 { GetStore()->SetItemData(item
,data
); }
1094 wxClientData
*GetItemData( const wxDataViewItem
& item
) const
1095 { return GetStore()->GetItemData(item
); }
1097 void DeleteItem( const wxDataViewItem
& item
)
1098 { GetStore()->DeleteItem(item
); }
1099 void DeleteChildren( const wxDataViewItem
& item
)
1100 { GetStore()->DeleteChildren(item
); }
1101 void DeleteAllItems()
1102 { GetStore()->DeleteAllItems(); }
1104 void OnExpanded( wxDataViewEvent
&event
);
1105 void OnCollapsed( wxDataViewEvent
&event
);
1106 void OnSize( wxSizeEvent
&event
);
1109 wxImageList
*m_imageList
;
1112 DECLARE_EVENT_TABLE()
1113 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl
)
1116 #endif // wxUSE_DATAVIEWCTRL
1119 // _WX_DATAVIEW_H_BASE_