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 // ----------------------------------------------------------------------------
31 // wxDataViewCtrl flags
32 // ----------------------------------------------------------------------------
34 // ----------------------------------------------------------------------------
35 // wxDataViewCtrl globals
36 // ----------------------------------------------------------------------------
38 class WXDLLIMPEXP_FWD_ADV wxDataViewItem
;
39 class WXDLLIMPEXP_FWD_ADV wxDataViewModel
;
40 class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl
;
41 class WXDLLIMPEXP_FWD_ADV wxDataViewColumn
;
42 class WXDLLIMPEXP_FWD_ADV wxDataViewRenderer
;
43 class WXDLLIMPEXP_FWD_ADV wxDataViewModelNotifier
;
45 extern WXDLLIMPEXP_DATA_ADV(const wxChar
) wxDataViewCtrlNameStr
[];
47 // the default width of new (text) columns:
48 #define wxDVC_DEFAULT_WIDTH 80
50 // the default width of new toggle columns:
51 #define wxDVC_TOGGLE_DEFAULT_WIDTH 30
53 // the default minimal width of the columns:
54 #define wxDVC_DEFAULT_MINWIDTH 30
56 // The default alignment of wxDataViewRenderers is to take
57 // the alignment from the column it owns.
58 #define wxDVR_DEFAULT_ALIGNMENT -1
61 // ---------------------------------------------------------
63 // ---------------------------------------------------------
65 class WXDLLIMPEXP_ADV wxDataViewItem
68 wxDataViewItem( void* id
= NULL
)
70 wxDataViewItem( const wxDataViewItem
&item
)
72 bool IsOk() const { return m_id
!= NULL
; }
73 void* GetID() const { return m_id
; }
74 operator const void* () const { return m_id
; }
77 void Print( const wxString
&text
) const;
84 bool operator == (const wxDataViewItem
&left
, const wxDataViewItem
&right
);
86 WX_DEFINE_ARRAY(wxDataViewItem
, wxDataViewItemArray
);
88 // ---------------------------------------------------------
89 // wxDataViewModelNotifier
90 // ---------------------------------------------------------
92 class WXDLLIMPEXP_ADV wxDataViewModelNotifier
95 wxDataViewModelNotifier() { m_owner
= NULL
; }
96 virtual ~wxDataViewModelNotifier() { m_owner
= NULL
; }
98 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
) = 0;
99 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
) = 0;
100 virtual bool ItemChanged( const wxDataViewItem
&item
) = 0;
101 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
102 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
103 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
104 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
) = 0;
105 virtual bool Cleared() = 0;
107 virtual void Resort() = 0;
109 void SetOwner( wxDataViewModel
*owner
) { m_owner
= owner
; }
110 wxDataViewModel
*GetOwner() const { return m_owner
; }
113 wxDataViewModel
*m_owner
;
118 // ----------------------------------------------------------------------------
119 // wxDataViewItemAttr: a structure containing the visual attributes of an item
120 // ----------------------------------------------------------------------------
122 // TODO: this should be renamed to wxItemAttr or something general like this
124 class WXDLLIMPEXP_ADV wxDataViewItemAttr
135 void SetColour(const wxColour
& colour
) { m_colour
= colour
; }
136 void SetBold( bool set
) { m_bold
= set
; }
137 void SetItalic( bool set
) { m_italic
= set
; }
140 bool HasColour() const { return m_colour
.Ok(); }
141 const wxColour
& GetColour() const { return m_colour
; }
143 bool GetBold() const { return m_bold
; }
144 bool GetItalic() const { return m_italic
; }
153 // ---------------------------------------------------------
155 // ---------------------------------------------------------
157 WX_DECLARE_LIST_WITH_DECL(wxDataViewModelNotifier
, wxDataViewModelNotifiers
,
158 class WXDLLIMPEXP_ADV
);
160 class WXDLLIMPEXP_ADV wxDataViewModel
: public wxObjectRefData
165 virtual unsigned int GetColumnCount() const = 0;
167 // return type as reported by wxVariant
168 virtual wxString
GetColumnType( unsigned int col
) const = 0;
170 // get value into a wxVariant
171 virtual void GetValue( wxVariant
&variant
,
172 const wxDataViewItem
&item
, unsigned int col
) const = 0;
174 // set value, call ValueChanged() afterwards!
175 virtual bool SetValue( const wxVariant
&variant
,
176 const wxDataViewItem
&item
, unsigned int col
) = 0;
178 // Get text attribute, return false of default attributes should be used
179 virtual bool GetAttr( const wxDataViewItem
&WXUNUSED(item
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
183 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const = 0;
184 virtual bool IsContainer( const wxDataViewItem
&item
) const = 0;
185 // Is the container just a header or an item with all columns
186 virtual bool HasContainerColumns(const wxDataViewItem
& WXUNUSED(item
)) const
188 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const = 0;
190 // define DnD capabilities
191 virtual bool IsDraggable( const wxDataViewItem
&WXUNUSED(item
) )
193 virtual size_t GetDragDataSize( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
) )
195 virtual bool GetDragData( const wxDataViewItem
&WXUNUSED(item
), const wxDataFormat
&WXUNUSED(format
),
196 void* WXUNUSED(data
), size_t WXUNUSED(size
) )
199 // delegated notifiers
200 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
201 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
202 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
203 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
204 virtual bool ItemChanged( const wxDataViewItem
&item
);
205 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
206 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
);
207 virtual bool Cleared();
210 virtual void Resort();
212 void AddNotifier( wxDataViewModelNotifier
*notifier
);
213 void RemoveNotifier( wxDataViewModelNotifier
*notifier
);
215 // default compare function
216 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
217 unsigned int column
, bool ascending
);
218 virtual bool HasDefaultCompare() const { return false; }
221 virtual bool IsVirtualListModel() const { return false; }
224 // the user should not delete this class directly: he should use DecRef() instead!
225 virtual ~wxDataViewModel() { }
227 wxDataViewModelNotifiers m_notifiers
;
230 // ---------------------------------------------------------
231 // wxDataViewIndexListModel
232 // ---------------------------------------------------------
234 class WXDLLIMPEXP_ADV wxDataViewIndexListModel
: public wxDataViewModel
237 wxDataViewIndexListModel( unsigned int initial_size
= 0 );
238 ~wxDataViewIndexListModel();
240 virtual void GetValue( wxVariant
&variant
,
241 unsigned int row
, unsigned int col
) const = 0;
243 virtual bool SetValue( const wxVariant
&variant
,
244 unsigned int row
, unsigned int col
) = 0;
246 virtual bool GetAttr( unsigned int WXUNUSED(row
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
250 void RowInserted( unsigned int before
);
252 void RowDeleted( unsigned int row
);
253 void RowsDeleted( const wxArrayInt
&rows
);
254 void RowChanged( unsigned int row
);
255 void RowValueChanged( unsigned int row
, unsigned int col
);
256 void Reset( unsigned int new_size
);
258 // convert to/from row/wxDataViewItem
260 unsigned int GetRow( const wxDataViewItem
&item
) const;
261 wxDataViewItem
GetItem( unsigned int row
) const;
263 // compare based on index
265 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
266 unsigned int column
, bool ascending
);
267 virtual bool HasDefaultCompare() const;
269 // implement base methods
271 virtual void GetValue( wxVariant
&variant
,
272 const wxDataViewItem
&item
, unsigned int col
) const;
273 virtual bool SetValue( const wxVariant
&variant
,
274 const wxDataViewItem
&item
, unsigned int col
);
275 virtual bool GetAttr( const wxDataViewItem
&item
, unsigned int col
, wxDataViewItemAttr
&attr
);
276 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
277 virtual bool IsContainer( const wxDataViewItem
&item
) const;
278 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
281 virtual bool IsVirtualListModel() const { return false; }
282 unsigned int GetLastIndex() const { return m_lastIndex
; }
285 wxDataViewItemArray m_hash
;
286 unsigned int m_lastIndex
;
290 // ---------------------------------------------------------
291 // wxDataViewVirtualListModel
292 // ---------------------------------------------------------
295 // better than nothing
296 typedef wxDataViewIndexListModel wxDataViewVirtualListModel
;
299 class WXDLLIMPEXP_ADV wxDataViewVirtualListModel
: public wxDataViewModel
302 wxDataViewVirtualListModel( unsigned int initial_size
= 0 );
303 ~wxDataViewVirtualListModel();
305 virtual void GetValue( wxVariant
&variant
,
306 unsigned int row
, unsigned int col
) const = 0;
308 virtual bool SetValue( const wxVariant
&variant
,
309 unsigned int row
, unsigned int col
) = 0;
311 virtual bool GetAttr( unsigned int WXUNUSED(row
), unsigned int WXUNUSED(col
), wxDataViewItemAttr
&WXUNUSED(attr
) )
315 void RowInserted( unsigned int before
);
317 void RowDeleted( unsigned int row
);
318 void RowsDeleted( const wxArrayInt
&rows
);
319 void RowChanged( unsigned int row
);
320 void RowValueChanged( unsigned int row
, unsigned int col
);
321 void Reset( unsigned int new_size
);
323 // convert to/from row/wxDataViewItem
325 unsigned int GetRow( const wxDataViewItem
&item
) const;
326 wxDataViewItem
GetItem( unsigned int row
) const;
328 // compare based on index
330 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
331 unsigned int column
, bool ascending
);
332 virtual bool HasDefaultCompare() const;
334 // implement base methods
336 virtual void GetValue( wxVariant
&variant
,
337 const wxDataViewItem
&item
, unsigned int col
) const;
338 virtual bool SetValue( const wxVariant
&variant
,
339 const wxDataViewItem
&item
, unsigned int col
);
340 virtual bool GetAttr( const wxDataViewItem
&item
, unsigned int col
, wxDataViewItemAttr
&attr
);
341 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
342 virtual bool IsContainer( const wxDataViewItem
&item
) const;
343 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
346 virtual bool IsVirtualListModel() const { return true; }
347 unsigned int GetLastIndex() const { return m_lastIndex
; }
350 wxDataViewItemArray m_hash
;
351 unsigned int m_lastIndex
;
356 //-----------------------------------------------------------------------------
357 // wxDataViewEditorCtrlEvtHandler
358 //-----------------------------------------------------------------------------
360 class wxDataViewEditorCtrlEvtHandler
: public wxEvtHandler
363 wxDataViewEditorCtrlEvtHandler( wxControl
*editor
, wxDataViewRenderer
*owner
);
365 void AcceptChangesAndFinish();
366 void SetFocusOnIdle( bool focus
= true ) { m_focusOnIdle
= focus
; }
369 void OnChar( wxKeyEvent
&event
);
370 void OnKillFocus( wxFocusEvent
&event
);
371 void OnIdle( wxIdleEvent
&event
);
374 wxDataViewRenderer
*m_owner
;
375 wxControl
*m_editorCtrl
;
380 DECLARE_EVENT_TABLE()
383 // ---------------------------------------------------------
384 // wxDataViewRendererBase
385 // ---------------------------------------------------------
387 enum wxDataViewCellMode
389 wxDATAVIEW_CELL_INERT
,
390 wxDATAVIEW_CELL_ACTIVATABLE
,
391 wxDATAVIEW_CELL_EDITABLE
394 enum wxDataViewCellRenderState
396 wxDATAVIEW_CELL_SELECTED
= 1,
397 wxDATAVIEW_CELL_PRELIT
= 2,
398 wxDATAVIEW_CELL_INSENSITIVE
= 4,
399 wxDATAVIEW_CELL_FOCUSED
= 8
402 class WXDLLIMPEXP_ADV wxDataViewRendererBase
: public wxObject
405 wxDataViewRendererBase( const wxString
&varianttype
,
406 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
407 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
408 ~wxDataViewRendererBase();
410 virtual bool Validate( wxVariant
& WXUNUSED(value
) )
413 void SetOwner( wxDataViewColumn
*owner
) { m_owner
= owner
; }
414 wxDataViewColumn
* GetOwner() const { return m_owner
; }
416 // renderer properties:
418 virtual bool SetValue( const wxVariant
& WXUNUSED(value
) ) = 0;
419 virtual bool GetValue( wxVariant
& WXUNUSED(value
) ) const = 0;
421 wxString
GetVariantType() const { return m_variantType
; }
423 virtual void SetMode( wxDataViewCellMode mode
) = 0;
424 virtual wxDataViewCellMode
GetMode() const = 0;
426 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
427 // rather an "int"; that's because for rendering cells it's allowed
428 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
429 virtual void SetAlignment( int align
) = 0;
430 virtual int GetAlignment() const = 0;
433 virtual bool HasEditorCtrl()
435 virtual wxControl
* CreateEditorCtrl(wxWindow
* WXUNUSED(parent
),
436 wxRect
WXUNUSED(labelRect
),
437 const wxVariant
& WXUNUSED(value
))
439 virtual bool GetValueFromEditorCtrl(wxControl
* WXUNUSED(editor
),
440 wxVariant
& WXUNUSED(value
))
443 virtual bool StartEditing( const wxDataViewItem
&item
, wxRect labelRect
);
444 virtual void CancelEditing();
445 virtual bool FinishEditing();
447 wxControl
*GetEditorCtrl() { return m_editorCtrl
; }
450 wxString m_variantType
;
451 wxDataViewColumn
*m_owner
;
452 wxWeakRef
<wxControl
> m_editorCtrl
;
453 wxDataViewItem m_item
; // for m_editorCtrl
456 const wxDataViewCtrl
* GetView() const;
459 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase
)
462 //-----------------------------------------------------------------------------
463 // wxDataViewIconText
464 //-----------------------------------------------------------------------------
466 class WXDLLIMPEXP_ADV wxDataViewIconText
: public wxObject
469 wxDataViewIconText( const wxString
&text
= wxEmptyString
, const wxIcon
& icon
= wxNullIcon
)
470 : m_text(text
), m_icon(icon
)
472 wxDataViewIconText( const wxDataViewIconText
&other
)
474 { m_icon
= other
.m_icon
; m_text
= other
.m_text
; }
476 void SetText( const wxString
&text
) { m_text
= text
; }
477 wxString
GetText() const { return m_text
; }
478 void SetIcon( const wxIcon
&icon
) { m_icon
= icon
; }
479 const wxIcon
&GetIcon() const { return m_icon
; }
486 DECLARE_DYNAMIC_CLASS(wxDataViewIconText
)
489 bool operator == (const wxDataViewIconText
&one
, const wxDataViewIconText
&two
);
491 DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText
, WXDLLIMPEXP_ADV
)
493 // ---------------------------------------------------------
494 // wxDataViewColumnBase
495 // ---------------------------------------------------------
497 enum wxDataViewColumnFlags
499 wxDATAVIEW_COL_RESIZABLE
= 1,
500 wxDATAVIEW_COL_SORTABLE
= 2,
501 wxDATAVIEW_COL_REORDERABLE
= 4,
502 wxDATAVIEW_COL_HIDDEN
= 8
505 class WXDLLIMPEXP_ADV wxDataViewColumnBase
: public wxObject
508 wxDataViewColumnBase( const wxString
&title
, wxDataViewRenderer
*renderer
,
509 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
510 wxAlignment align
= wxALIGN_CENTER
,
511 int flags
= wxDATAVIEW_COL_RESIZABLE
);
512 wxDataViewColumnBase( const wxBitmap
&bitmap
, wxDataViewRenderer
*renderer
,
513 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
514 wxAlignment align
= wxALIGN_CENTER
,
515 int flags
= wxDATAVIEW_COL_RESIZABLE
);
516 virtual ~wxDataViewColumnBase();
520 virtual void SetTitle( const wxString
&title
) = 0;
521 virtual void SetAlignment( wxAlignment align
) = 0;
522 virtual void SetSortable( bool sortable
) = 0;
523 virtual void SetReorderable(bool reorderable
) = 0;
524 virtual void SetResizeable( bool resizeable
) = 0;
525 virtual void SetHidden( bool hidden
) = 0;
526 virtual void SetSortOrder( bool ascending
) = 0;
527 virtual void SetFlags( int flags
);
528 virtual void SetOwner( wxDataViewCtrl
*owner
)
530 virtual void SetBitmap( const wxBitmap
&bitmap
)
533 virtual void SetMinWidth( int minWidth
) = 0;
534 virtual void SetWidth( int width
) = 0;
539 virtual wxString
GetTitle() const = 0;
540 virtual wxAlignment
GetAlignment() const = 0;
541 virtual int GetWidth() const = 0;
542 virtual int GetMinWidth() const = 0;
544 virtual int GetFlags() const;
546 virtual bool IsHidden() const = 0;
547 virtual bool IsReorderable() const = 0;
548 virtual bool IsResizeable() const = 0;
549 virtual bool IsSortable() const = 0;
550 virtual bool IsSortOrderAscending() const = 0;
552 const wxBitmap
&GetBitmap() const { return m_bitmap
; }
553 unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column
); }
555 wxDataViewCtrl
*GetOwner() const { return m_owner
; }
556 wxDataViewRenderer
* GetRenderer() const { return m_renderer
; }
559 wxDataViewRenderer
*m_renderer
;
562 wxDataViewCtrl
*m_owner
;
565 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase
)
568 // ---------------------------------------------------------
569 // wxDataViewCtrlBase
570 // ---------------------------------------------------------
572 #define wxDV_SINGLE 0x0000 // for convenience
573 #define wxDV_MULTIPLE 0x0001 // can select multiple items
575 #define wxDV_NO_HEADER 0x0002 // column titles not visible
576 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
577 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
579 #define wxDV_ROW_LINES 0x0010 // alternating colour in rows
580 #define wxDV_VARIABLE_LINE_HEIGHT 0x0020 // variable line height
582 class WXDLLIMPEXP_ADV wxDataViewCtrlBase
: public wxControl
585 wxDataViewCtrlBase();
586 virtual ~wxDataViewCtrlBase();
588 virtual bool AssociateModel( wxDataViewModel
*model
);
589 wxDataViewModel
* GetModel();
590 const wxDataViewModel
* GetModel() const;
593 wxDataViewColumn
*PrependTextColumn( const wxString
&label
, unsigned int model_column
,
594 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
595 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
596 int flags
= wxDATAVIEW_COL_RESIZABLE
);
597 wxDataViewColumn
*PrependIconTextColumn( 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
*PrependToggleColumn( const wxString
&label
, unsigned int model_column
,
602 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
603 wxAlignment align
= wxALIGN_CENTER
,
604 int flags
= wxDATAVIEW_COL_RESIZABLE
);
605 wxDataViewColumn
*PrependProgressColumn( const wxString
&label
, unsigned int model_column
,
606 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
607 wxAlignment align
= wxALIGN_CENTER
,
608 int flags
= wxDATAVIEW_COL_RESIZABLE
);
609 wxDataViewColumn
*PrependDateColumn( const wxString
&label
, unsigned int model_column
,
610 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
611 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
612 int flags
= wxDATAVIEW_COL_RESIZABLE
);
613 wxDataViewColumn
*PrependBitmapColumn( const wxString
&label
, unsigned int model_column
,
614 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
615 wxAlignment align
= wxALIGN_CENTER
,
616 int flags
= wxDATAVIEW_COL_RESIZABLE
);
617 wxDataViewColumn
*PrependTextColumn( const wxBitmap
&label
, unsigned int model_column
,
618 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
619 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
620 int flags
= wxDATAVIEW_COL_RESIZABLE
);
621 wxDataViewColumn
*PrependIconTextColumn( 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
*PrependToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
626 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
627 wxAlignment align
= wxALIGN_CENTER
,
628 int flags
= wxDATAVIEW_COL_RESIZABLE
);
629 wxDataViewColumn
*PrependProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
630 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
631 wxAlignment align
= wxALIGN_CENTER
,
632 int flags
= wxDATAVIEW_COL_RESIZABLE
);
633 wxDataViewColumn
*PrependDateColumn( const wxBitmap
&label
, unsigned int model_column
,
634 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
635 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
636 int flags
= wxDATAVIEW_COL_RESIZABLE
);
637 wxDataViewColumn
*PrependBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
638 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
639 wxAlignment align
= wxALIGN_CENTER
,
640 int flags
= wxDATAVIEW_COL_RESIZABLE
);
642 wxDataViewColumn
*AppendTextColumn( const wxString
&label
, unsigned int model_column
,
643 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
644 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
645 int flags
= wxDATAVIEW_COL_RESIZABLE
);
646 wxDataViewColumn
*AppendIconTextColumn( 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
*AppendToggleColumn( const wxString
&label
, unsigned int model_column
,
651 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
652 wxAlignment align
= wxALIGN_CENTER
,
653 int flags
= wxDATAVIEW_COL_RESIZABLE
);
654 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
, unsigned int model_column
,
655 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
656 wxAlignment align
= wxALIGN_CENTER
,
657 int flags
= wxDATAVIEW_COL_RESIZABLE
);
658 wxDataViewColumn
*AppendDateColumn( const wxString
&label
, unsigned int model_column
,
659 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
660 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
661 int flags
= wxDATAVIEW_COL_RESIZABLE
);
662 wxDataViewColumn
*AppendBitmapColumn( const wxString
&label
, unsigned int model_column
,
663 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
664 wxAlignment align
= wxALIGN_CENTER
,
665 int flags
= wxDATAVIEW_COL_RESIZABLE
);
666 wxDataViewColumn
*AppendTextColumn( const wxBitmap
&label
, unsigned int model_column
,
667 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
668 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
669 int flags
= wxDATAVIEW_COL_RESIZABLE
);
670 wxDataViewColumn
*AppendIconTextColumn( 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
*AppendToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
675 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
676 wxAlignment align
= wxALIGN_CENTER
,
677 int flags
= wxDATAVIEW_COL_RESIZABLE
);
678 wxDataViewColumn
*AppendProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
679 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
680 wxAlignment align
= wxALIGN_CENTER
,
681 int flags
= wxDATAVIEW_COL_RESIZABLE
);
682 wxDataViewColumn
*AppendDateColumn( const wxBitmap
&label
, unsigned int model_column
,
683 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
684 wxAlignment align
= (wxAlignment
)(wxALIGN_LEFT
|wxALIGN_CENTRE_VERTICAL
),
685 int flags
= wxDATAVIEW_COL_RESIZABLE
);
686 wxDataViewColumn
*AppendBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
687 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
688 wxAlignment align
= wxALIGN_CENTER
,
689 int flags
= wxDATAVIEW_COL_RESIZABLE
);
692 virtual bool PrependColumn( wxDataViewColumn
*col
);
693 virtual bool InsertColumn( unsigned int pos
, wxDataViewColumn
*col
);
694 virtual bool AppendColumn( wxDataViewColumn
*col
);
696 virtual unsigned int GetColumnCount() const = 0;
697 virtual wxDataViewColumn
* GetColumn( unsigned int pos
) const = 0;
698 virtual int GetColumnPosition( const wxDataViewColumn
*column
) const = 0;
700 virtual bool DeleteColumn( wxDataViewColumn
*column
) = 0;
701 virtual bool ClearColumns() = 0;
703 void SetExpanderColumn( wxDataViewColumn
*col
)
704 { m_expander_column
= col
; DoSetExpanderColumn(); }
705 wxDataViewColumn
*GetExpanderColumn() const
706 { return m_expander_column
; }
708 virtual wxDataViewColumn
*GetSortingColumn() const = 0;
710 void SetIndent( int indent
)
711 { m_indent
= indent
; DoSetIndent(); }
712 int GetIndent() const
715 virtual wxDataViewItem
GetSelection() const = 0;
716 virtual int GetSelections( wxDataViewItemArray
& sel
) const = 0;
717 virtual void SetSelections( const wxDataViewItemArray
& sel
) = 0;
718 virtual void Select( const wxDataViewItem
& item
) = 0;
719 virtual void Unselect( const wxDataViewItem
& item
) = 0;
720 virtual bool IsSelected( const wxDataViewItem
& item
) const = 0;
722 virtual void SelectAll() = 0;
723 virtual void UnselectAll() = 0;
725 virtual void Expand( const wxDataViewItem
& item
) = 0;
726 virtual void Collapse( const wxDataViewItem
& item
) = 0;
728 virtual void EnsureVisible( const wxDataViewItem
& item
,
729 const wxDataViewColumn
*column
= NULL
) = 0;
730 virtual void HitTest( const wxPoint
& point
, wxDataViewItem
&item
, wxDataViewColumn
* &column
) const = 0;
731 virtual wxRect
GetItemRect( const wxDataViewItem
& item
, const wxDataViewColumn
*column
= NULL
) const = 0;
734 virtual void DoSetExpanderColumn() = 0 ;
735 virtual void DoSetIndent() = 0;
738 wxDataViewModel
*m_model
;
739 wxDataViewColumn
*m_expander_column
;
743 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase
)
746 // ----------------------------------------------------------------------------
747 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
748 // ----------------------------------------------------------------------------
750 class WXDLLIMPEXP_ADV wxDataViewEvent
: public wxNotifyEvent
753 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
754 : wxNotifyEvent(commandType
, winid
),
758 m_value(wxNullVariant
),
763 wxDataViewEvent(const wxDataViewEvent
& event
)
764 : wxNotifyEvent(event
),
765 m_item(event
.m_item
),
767 m_model(event
.m_model
),
768 m_value(event
.m_value
),
769 m_column(event
.m_column
),
773 wxDataViewItem
GetItem() const { return m_item
; }
774 void SetItem( const wxDataViewItem
&item
) { m_item
= item
; }
776 int GetColumn() const { return m_col
; }
777 void SetColumn( int col
) { m_col
= col
; }
779 wxDataViewModel
* GetModel() const { return m_model
; }
780 void SetModel( wxDataViewModel
*model
) { m_model
= model
; }
782 const wxVariant
&GetValue() const { return m_value
; }
783 void SetValue( const wxVariant
&value
) { m_value
= value
; }
785 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
786 void SetDataViewColumn( wxDataViewColumn
*col
) { m_column
= col
; }
787 wxDataViewColumn
*GetDataViewColumn() const { return m_column
; }
789 // for wxEVT_DATAVIEW_CONTEXT_MENU only
790 wxPoint
GetPosition() const { return m_pos
; }
791 void SetPosition( int x
, int y
) { m_pos
.x
= x
; m_pos
.y
= y
; }
793 virtual wxEvent
*Clone() const { return new wxDataViewEvent(*this); }
796 wxDataViewItem m_item
;
798 wxDataViewModel
*m_model
;
800 wxDataViewColumn
*m_column
;
804 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent
)
807 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED
;
809 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED
;
810 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED
;
811 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED
;
812 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING
;
813 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING
;
814 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED
;
815 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE
;
816 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED
;
818 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU
;
820 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
;
821 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
;
822 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED
;
823 extern WXDLLIMPEXP_ADV
const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED
;
825 typedef void (wxEvtHandler::*wxDataViewEventFunction
)(wxDataViewEvent
&);
827 #define wxDataViewEventHandler(func) \
828 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
830 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
831 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
833 #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
835 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
836 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
837 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
838 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
839 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
840 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
841 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
842 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
844 #define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn)
846 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
847 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
848 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
849 #define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn)
852 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
853 #include "wx/gtk/dataview.h"
854 #elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__)
855 #include "wx/osx/dataview.h"
857 #define wxUSE_GENERICDATAVIEWCTRL
858 #include "wx/generic/dataview.h"
861 // -------------------------------------
862 // wxDataViewSpinRenderer
863 // -------------------------------------
865 class WXDLLIMPEXP_ADV wxDataViewSpinRenderer
: public wxDataViewCustomRenderer
868 wxDataViewSpinRenderer( int min
, int max
,
869 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
870 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
871 virtual bool HasEditorCtrl() { return true; }
872 virtual wxControl
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
, const wxVariant
&value
);
873 virtual bool GetValueFromEditorCtrl( wxControl
* editor
, wxVariant
&value
);
874 virtual bool Render( wxRect rect
, wxDC
*dc
, int state
);
875 virtual wxSize
GetSize() const;
876 virtual bool SetValue( const wxVariant
&value
);
877 virtual bool GetValue( wxVariant
&value
) const;
884 //-----------------------------------------------------------------------------
885 // wxDataViewTreeStore
886 //-----------------------------------------------------------------------------
888 class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode
891 wxDataViewTreeStoreNode( wxDataViewTreeStoreNode
*parent
,
892 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
893 virtual ~wxDataViewTreeStoreNode();
895 void SetText( const wxString
&text
)
897 wxString
GetText() const
899 void SetIcon( const wxIcon
&icon
)
901 const wxIcon
&GetIcon() const
903 void SetData( wxClientData
*data
)
904 { if (m_data
) delete m_data
; m_data
= data
; }
905 wxClientData
*GetData() const
908 wxDataViewItem
GetItem() const
909 { return wxDataViewItem( (void*) this ); }
911 virtual bool IsContainer()
914 wxDataViewTreeStoreNode
*GetParent()
918 wxDataViewTreeStoreNode
*m_parent
;
921 wxClientData
*m_data
;
924 WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode
, wxDataViewTreeStoreNodeList
,
925 class WXDLLIMPEXP_ADV
);
927 class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode
: public wxDataViewTreeStoreNode
930 wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode
*parent
,
931 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
932 wxClientData
*data
= NULL
);
933 virtual ~wxDataViewTreeStoreContainerNode();
935 const wxDataViewTreeStoreNodeList
&GetChildren() const
936 { return m_children
; }
937 wxDataViewTreeStoreNodeList
&GetChildren()
938 { return m_children
; }
940 void SetExpandedIcon( const wxIcon
&icon
)
941 { m_iconExpanded
= icon
; }
942 const wxIcon
&GetExpandedIcon() const
943 { return m_iconExpanded
; }
945 void SetExpanded( bool expanded
= true )
946 { m_isExpanded
= expanded
; }
947 bool IsExpanded() const
948 { return m_isExpanded
; }
950 virtual bool IsContainer()
954 wxDataViewTreeStoreNodeList m_children
;
955 wxIcon m_iconExpanded
;
959 //-----------------------------------------------------------------------------
961 class WXDLLIMPEXP_ADV wxDataViewTreeStore
: public wxDataViewModel
964 wxDataViewTreeStore();
965 ~wxDataViewTreeStore();
967 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
968 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
969 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
970 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
971 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
972 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, wxClientData
*data
= NULL
);
974 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
975 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
976 wxClientData
*data
= NULL
);
977 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
978 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
979 wxClientData
*data
= NULL
);
980 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
981 const wxString
&text
, const wxIcon
&icon
= wxNullIcon
, const wxIcon
&expanded
= wxNullIcon
,
982 wxClientData
*data
= NULL
);
984 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const;
985 int GetChildCount( const wxDataViewItem
& parent
) const;
987 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
);
988 wxString
GetItemText( const wxDataViewItem
& item
) const;
989 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
990 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const;
991 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
);
992 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const;
993 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
);
994 wxClientData
*GetItemData( const wxDataViewItem
& item
) const;
996 void DeleteItem( const wxDataViewItem
& item
);
997 void DeleteChildren( const wxDataViewItem
& item
);
998 void DeleteAllItems();
1000 // implement base methods
1002 virtual void GetValue( wxVariant
&variant
,
1003 const wxDataViewItem
&item
, unsigned int col
) const;
1004 virtual bool SetValue( const wxVariant
&variant
,
1005 const wxDataViewItem
&item
, unsigned int col
);
1006 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
1007 virtual bool IsContainer( const wxDataViewItem
&item
) const;
1008 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
1010 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
1011 unsigned int column
, bool ascending
);
1013 virtual bool HasDefaultCompare() const
1015 virtual unsigned int GetColumnCount() const
1017 virtual wxString
GetColumnType( unsigned int WXUNUSED(col
) ) const
1018 { return wxT("wxDataViewIconText"); }
1020 wxDataViewTreeStoreNode
*FindNode( const wxDataViewItem
&item
) const;
1021 wxDataViewTreeStoreContainerNode
*FindContainerNode( const wxDataViewItem
&item
) const;
1022 wxDataViewTreeStoreNode
*GetRoot() const { return m_root
; }
1025 wxDataViewTreeStoreNode
*m_root
;
1028 class WXDLLIMPEXP_ADV wxDataViewTreeCtrl
: public wxDataViewCtrl
1031 wxDataViewTreeCtrl();
1032 wxDataViewTreeCtrl( wxWindow
*parent
, wxWindowID id
,
1033 const wxPoint
& pos
= wxDefaultPosition
,
1034 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
1035 const wxValidator
& validator
= wxDefaultValidator
);
1036 ~wxDataViewTreeCtrl();
1038 bool Create( wxWindow
*parent
, wxWindowID id
,
1039 const wxPoint
& pos
= wxDefaultPosition
,
1040 const wxSize
& size
= wxDefaultSize
, long style
= wxDV_NO_HEADER
| wxDV_ROW_LINES
,
1041 const wxValidator
& validator
= wxDefaultValidator
);
1043 wxDataViewTreeStore
*GetStore()
1044 { return (wxDataViewTreeStore
*) GetModel(); }
1045 const wxDataViewTreeStore
*GetStore() const
1046 { return (const wxDataViewTreeStore
*) GetModel(); }
1048 void SetImageList( wxImageList
*imagelist
);
1049 wxImageList
* GetImageList() { return m_imageList
; }
1051 wxDataViewItem
AppendItem( const wxDataViewItem
& parent
,
1052 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1053 wxDataViewItem
PrependItem( const wxDataViewItem
& parent
,
1054 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1055 wxDataViewItem
InsertItem( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
1056 const wxString
&text
, int icon
= -1, wxClientData
*data
= NULL
);
1058 wxDataViewItem
PrependContainer( const wxDataViewItem
& parent
,
1059 const wxString
&text
, int icon
= -1, int expanded
= -1,
1060 wxClientData
*data
= NULL
);
1061 wxDataViewItem
AppendContainer( const wxDataViewItem
& parent
,
1062 const wxString
&text
, int icon
= -1, int expanded
= -1,
1063 wxClientData
*data
= NULL
);
1064 wxDataViewItem
InsertContainer( const wxDataViewItem
& parent
, const wxDataViewItem
& previous
,
1065 const wxString
&text
, int icon
= -1, int expanded
= -1,
1066 wxClientData
*data
= NULL
);
1068 wxDataViewItem
GetNthChild( const wxDataViewItem
& parent
, unsigned int pos
) const
1069 { return GetStore()->GetNthChild(parent
, pos
); }
1070 int GetChildCount( const wxDataViewItem
& parent
) const
1071 { return GetStore()->GetChildCount(parent
); }
1073 void SetItemText( const wxDataViewItem
& item
, const wxString
&text
)
1074 { GetStore()->SetItemText(item
,text
); }
1075 wxString
GetItemText( const wxDataViewItem
& item
) const
1076 { return GetStore()->GetItemText(item
); }
1077 void SetItemIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1078 { GetStore()->SetItemIcon(item
,icon
); }
1079 const wxIcon
&GetItemIcon( const wxDataViewItem
& item
) const
1080 { return GetStore()->GetItemIcon(item
); }
1081 void SetItemExpandedIcon( const wxDataViewItem
& item
, const wxIcon
&icon
)
1082 { GetStore()->SetItemExpandedIcon(item
,icon
); }
1083 const wxIcon
&GetItemExpandedIcon( const wxDataViewItem
& item
) const
1084 { return GetStore()->GetItemExpandedIcon(item
); }
1085 void SetItemData( const wxDataViewItem
& item
, wxClientData
*data
)
1086 { GetStore()->SetItemData(item
,data
); }
1087 wxClientData
*GetItemData( const wxDataViewItem
& item
) const
1088 { return GetStore()->GetItemData(item
); }
1090 void DeleteItem( const wxDataViewItem
& item
)
1091 { GetStore()->DeleteItem(item
); }
1092 void DeleteChildren( const wxDataViewItem
& item
)
1093 { GetStore()->DeleteChildren(item
); }
1094 void DeleteAllItems()
1095 { GetStore()->DeleteAllItems(); }
1097 void OnExpanded( wxDataViewEvent
&event
);
1098 void OnCollapsed( wxDataViewEvent
&event
);
1099 void OnSize( wxSizeEvent
&event
);
1102 wxImageList
*m_imageList
;
1105 DECLARE_EVENT_TABLE()
1106 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl
)
1109 #endif // wxUSE_DATAVIEWCTRL
1112 // _WX_DATAVIEW_H_BASE_