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/listctrl.h"
24 #include "wx/dynarray.h"
27 #if defined(__WXGTK20__)
29 // #define wxUSE_GENERICDATAVIEWCTRL 1
30 #elif defined(__WXMAC__)
32 #define wxUSE_GENERICDATAVIEWCTRL 1
35 // ----------------------------------------------------------------------------
36 // wxDataViewCtrl flags
37 // ----------------------------------------------------------------------------
39 // ----------------------------------------------------------------------------
40 // wxDataViewCtrl globals
41 // ----------------------------------------------------------------------------
43 class WXDLLIMPEXP_FWD_ADV wxDataViewItem
;
44 class WXDLLIMPEXP_FWD_ADV wxDataViewModel
;
45 class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl
;
46 class WXDLLIMPEXP_FWD_ADV wxDataViewColumn
;
47 class WXDLLIMPEXP_FWD_ADV wxDataViewRenderer
;
48 class WXDLLIMPEXP_FWD_ADV wxDataViewModelNotifier
;
50 extern WXDLLIMPEXP_DATA_ADV(const wxChar
) wxDataViewCtrlNameStr
[];
52 // the default width of new (text) columns:
53 #define wxDVC_DEFAULT_WIDTH 80
55 // the default width of new toggle columns:
56 #define wxDVC_TOGGLE_DEFAULT_WIDTH 30
58 // the default minimal width of the columns:
59 #define wxDVC_DEFAULT_MINWIDTH 30
61 // the default alignment of wxDataViewRenderers:
62 #define wxDVR_DEFAULT_ALIGNMENT (wxALIGN_LEFT|wxALIGN_TOP)
65 // ---------------------------------------------------------
67 // ---------------------------------------------------------
69 class WXDLLIMPEXP_ADV wxDataViewItem
72 wxDataViewItem( void* id
= NULL
)
74 wxDataViewItem( const wxDataViewItem
&item
)
76 bool IsOk() const { return m_id
!= NULL
; }
77 void* GetID() const { return m_id
; }
78 operator const void* () const { return m_id
; }
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() { }
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() { return m_owner
; }
113 wxDataViewModel
*m_owner
;
117 // ---------------------------------------------------------
119 // ---------------------------------------------------------
121 WX_DECLARE_LIST(wxDataViewModelNotifier
, wxDataViewModelNotifiers
);
123 class WXDLLIMPEXP_ADV wxDataViewModel
: public wxObjectRefData
128 virtual unsigned int GetColumnCount() const = 0;
130 // return type as reported by wxVariant
131 virtual wxString
GetColumnType( unsigned int col
) const = 0;
133 // get value into a wxVariant
134 virtual void GetValue( wxVariant
&variant
,
135 const wxDataViewItem
&item
, unsigned int col
) const = 0;
137 // set value, call ValueChanged() afterwards!
138 virtual bool SetValue( const wxVariant
&variant
,
139 const wxDataViewItem
&item
, unsigned int col
) = 0;
142 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const = 0;
143 virtual bool IsContainer( const wxDataViewItem
&item
) const = 0;
144 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const = 0;
146 // delegated notifiers
147 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
148 virtual bool ItemsAdded( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
149 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
150 virtual bool ItemsDeleted( const wxDataViewItem
&parent
, const wxDataViewItemArray
&items
);
151 virtual bool ItemChanged( const wxDataViewItem
&item
);
152 virtual bool ItemsChanged( const wxDataViewItemArray
&items
);
153 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
);
154 virtual bool Cleared();
157 virtual void Resort();
159 void AddNotifier( wxDataViewModelNotifier
*notifier
);
160 void RemoveNotifier( wxDataViewModelNotifier
*notifier
);
162 // default compare function
163 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
164 unsigned int column
, bool ascending
);
165 virtual bool HasDefaultCompare() const { return false; }
168 // the user should not delete this class directly: he should use DecRef() instead!
169 virtual ~wxDataViewModel() { }
171 wxDataViewModelNotifiers m_notifiers
;
174 // ---------------------------------------------------------
175 // wxDataViewIndexListModel
176 // ---------------------------------------------------------
178 class wxDataViewIndexListModel
: public wxDataViewModel
181 wxDataViewIndexListModel( unsigned int initial_size
= 0 );
182 ~wxDataViewIndexListModel();
184 virtual unsigned int GetRowCount() = 0;
186 virtual void GetValue( wxVariant
&variant
,
187 unsigned int row
, unsigned int col
) const = 0;
189 virtual bool SetValue( const wxVariant
&variant
,
190 unsigned int row
, unsigned int col
) = 0;
193 void RowInserted( unsigned int before
);
195 void RowDeleted( unsigned int row
);
196 void RowChanged( unsigned int row
);
197 void RowValueChanged( unsigned int row
, unsigned int col
);
199 // convert to/from row/wxDataViewItem
201 unsigned int GetRow( const wxDataViewItem
&item
) const;
202 wxDataViewItem
GetItem( unsigned int row
) const;
204 // compare based on index
206 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
207 unsigned int column
, bool ascending
);
208 virtual bool HasDefaultCompare() const { return true; }
210 // implement base methods
212 virtual void GetValue( wxVariant
&variant
,
213 const wxDataViewItem
&item
, unsigned int col
) const;
214 virtual bool SetValue( const wxVariant
&variant
,
215 const wxDataViewItem
&item
, unsigned int col
);
216 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
217 virtual bool IsContainer( const wxDataViewItem
&item
) const;
218 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
221 wxDataViewItemArray m_hash
;
222 unsigned int m_lastIndex
;
225 //-----------------------------------------------------------------------------
226 // wxDataViewEditorCtrlEvtHandler
227 //-----------------------------------------------------------------------------
229 class wxDataViewEditorCtrlEvtHandler
: public wxEvtHandler
232 wxDataViewEditorCtrlEvtHandler( wxControl
*editor
, wxDataViewRenderer
*owner
);
234 void AcceptChangesAndFinish();
235 void SetFocusOnIdle( bool focus
= true ) { m_focusOnIdle
= focus
; }
238 void OnChar( wxKeyEvent
&event
);
239 void OnKillFocus( wxFocusEvent
&event
);
240 void OnIdle( wxIdleEvent
&event
);
243 wxDataViewRenderer
*m_owner
;
244 wxControl
*m_editorCtrl
;
249 DECLARE_EVENT_TABLE()
252 // ---------------------------------------------------------
253 // wxDataViewRendererBase
254 // ---------------------------------------------------------
256 enum wxDataViewCellMode
258 wxDATAVIEW_CELL_INERT
,
259 wxDATAVIEW_CELL_ACTIVATABLE
,
260 wxDATAVIEW_CELL_EDITABLE
263 enum wxDataViewCellRenderState
265 wxDATAVIEW_CELL_SELECTED
= 1,
266 wxDATAVIEW_CELL_PRELIT
= 2,
267 wxDATAVIEW_CELL_INSENSITIVE
= 4,
268 wxDATAVIEW_CELL_FOCUSED
= 8
271 class WXDLLIMPEXP_ADV wxDataViewRendererBase
: public wxObject
274 wxDataViewRendererBase( const wxString
&varianttype
,
275 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
276 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
278 virtual bool Validate( wxVariant
& WXUNUSED(value
) )
281 void SetOwner( wxDataViewColumn
*owner
) { m_owner
= owner
; }
282 wxDataViewColumn
* GetOwner() { return m_owner
; }
284 // renderer properties:
286 virtual bool SetValue( const wxVariant
& WXUNUSED(value
) ) = 0;
287 virtual bool GetValue( wxVariant
& WXUNUSED(value
) ) const = 0;
289 wxString
GetVariantType() const { return m_variantType
; }
291 virtual void SetMode( wxDataViewCellMode mode
) = 0;
292 virtual wxDataViewCellMode
GetMode() const = 0;
294 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
295 // rather an "int"; that's because for rendering cells it's allowed
296 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
297 virtual void SetAlignment( int align
) = 0;
298 virtual int GetAlignment() const = 0;
301 virtual bool HasEditorCtrl()
303 virtual wxControl
* CreateEditorCtrl(wxWindow
* WXUNUSED(parent
),
304 wxRect
WXUNUSED(labelRect
),
305 const wxVariant
& WXUNUSED(value
))
307 virtual bool GetValueFromEditorCtrl(wxControl
* WXUNUSED(editor
),
308 wxVariant
& WXUNUSED(value
))
311 virtual bool StartEditing( const wxDataViewItem
&item
, wxRect labelRect
);
312 virtual void CancelEditing();
313 virtual bool FinishEditing();
315 wxControl
*GetEditorCtrl() { return m_editorCtrl
; }
318 wxString m_variantType
;
319 wxDataViewColumn
*m_owner
;
320 wxControl
*m_editorCtrl
;
321 wxDataViewItem m_item
; // for m_editorCtrl
324 const wxDataViewCtrl
* GetView() const;
327 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase
)
330 //-----------------------------------------------------------------------------
331 // wxDataViewIconText
332 //-----------------------------------------------------------------------------
334 class wxDataViewIconText
: public wxObject
337 wxDataViewIconText( const wxString
&text
= wxEmptyString
, const wxIcon
& icon
= wxNullIcon
)
338 { m_icon
= icon
; m_text
= text
; }
339 wxDataViewIconText( const wxDataViewIconText
&other
)
340 { m_icon
= other
.m_icon
; m_text
= other
.m_text
; }
342 void SetText( const wxString
&text
) { m_text
= text
; }
343 wxString
GetText() const { return m_text
; }
344 void SetIcon( const wxIcon
&icon
) { m_icon
= icon
; }
345 const wxIcon
&GetIcon() const { return m_icon
; }
352 DECLARE_DYNAMIC_CLASS(wxDataViewIconText
)
355 bool operator == (const wxDataViewIconText
&one
, const wxDataViewIconText
&two
);
357 DECLARE_VARIANT_OBJECT(wxDataViewIconText
)
359 // ---------------------------------------------------------
360 // wxDataViewColumnBase
361 // ---------------------------------------------------------
363 enum wxDataViewColumnFlags
365 wxDATAVIEW_COL_RESIZABLE
= 1,
366 wxDATAVIEW_COL_SORTABLE
= 2,
367 wxDATAVIEW_COL_HIDDEN
= 4
370 class WXDLLIMPEXP_ADV wxDataViewColumnBase
: public wxObject
373 wxDataViewColumnBase( const wxString
&title
, wxDataViewRenderer
*renderer
,
374 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
375 wxAlignment align
= wxALIGN_CENTER
,
376 int flags
= wxDATAVIEW_COL_RESIZABLE
);
377 wxDataViewColumnBase( const wxBitmap
&bitmap
, wxDataViewRenderer
*renderer
,
378 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
379 wxAlignment align
= wxALIGN_CENTER
,
380 int flags
= wxDATAVIEW_COL_RESIZABLE
);
381 virtual ~wxDataViewColumnBase();
385 virtual void SetTitle( const wxString
&title
) = 0;
386 virtual void SetAlignment( wxAlignment align
) = 0;
387 virtual void SetSortable( bool sortable
) = 0;
388 virtual void SetResizeable( bool resizeable
) = 0;
389 virtual void SetHidden( bool hidden
) = 0;
390 virtual void SetSortOrder( bool ascending
) = 0;
391 virtual void SetFlags( int flags
);
392 virtual void SetOwner( wxDataViewCtrl
*owner
)
394 virtual void SetBitmap( const wxBitmap
&bitmap
)
397 virtual void SetMinWidth( int minWidth
) = 0;
398 virtual void SetWidth( int width
) = 0;
403 virtual wxString
GetTitle() const = 0;
404 virtual wxAlignment
GetAlignment() const = 0;
405 virtual int GetWidth() const = 0;
406 virtual int GetMinWidth() const = 0;
408 virtual int GetFlags() const;
410 virtual bool IsSortable() const = 0;
411 virtual bool IsResizeable() const = 0;
412 virtual bool IsHidden() const = 0;
413 virtual bool IsSortOrderAscending() const = 0;
415 const wxBitmap
&GetBitmap() const { return m_bitmap
; }
416 unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column
); }
418 wxDataViewCtrl
*GetOwner() { return m_owner
; }
419 wxDataViewRenderer
* GetRenderer() { return m_renderer
; }
422 wxDataViewRenderer
*m_renderer
;
425 wxDataViewCtrl
*m_owner
;
428 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase
)
431 // ---------------------------------------------------------
432 // wxDataViewCtrlBase
433 // ---------------------------------------------------------
435 #define wxDV_SINGLE 0x0000 // for convenience
436 #define wxDV_MULTIPLE 0x0001 // can select multiple items
438 #define wxDV_NO_HEADER 0x0002 // column titles not visible
439 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
440 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
442 class WXDLLIMPEXP_ADV wxDataViewCtrlBase
: public wxControl
445 wxDataViewCtrlBase();
446 virtual ~wxDataViewCtrlBase();
448 virtual bool AssociateModel( wxDataViewModel
*model
);
449 wxDataViewModel
* GetModel();
452 wxDataViewColumn
*AppendTextColumn( const wxString
&label
, unsigned int model_column
,
453 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
454 wxAlignment align
= wxALIGN_CENTER
,
455 int flags
= wxDATAVIEW_COL_RESIZABLE
);
456 wxDataViewColumn
*AppendIconTextColumn( const wxString
&label
, unsigned int model_column
,
457 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
458 wxAlignment align
= wxALIGN_CENTER
,
459 int flags
= wxDATAVIEW_COL_RESIZABLE
);
460 wxDataViewColumn
*AppendToggleColumn( const wxString
&label
, unsigned int model_column
,
461 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
462 wxAlignment align
= wxALIGN_CENTER
,
463 int flags
= wxDATAVIEW_COL_RESIZABLE
);
464 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
, unsigned int model_column
,
465 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
466 wxAlignment align
= wxALIGN_CENTER
,
467 int flags
= wxDATAVIEW_COL_RESIZABLE
);
468 wxDataViewColumn
*AppendDateColumn( const wxString
&label
, unsigned int model_column
,
469 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
470 wxAlignment align
= wxALIGN_CENTER
,
471 int flags
= wxDATAVIEW_COL_RESIZABLE
);
472 wxDataViewColumn
*AppendBitmapColumn( const wxString
&label
, unsigned int model_column
,
473 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
474 wxAlignment align
= wxALIGN_CENTER
,
475 int flags
= wxDATAVIEW_COL_RESIZABLE
);
476 wxDataViewColumn
*AppendTextColumn( const wxBitmap
&label
, unsigned int model_column
,
477 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
478 wxAlignment align
= wxALIGN_CENTER
,
479 int flags
= wxDATAVIEW_COL_RESIZABLE
);
480 wxDataViewColumn
*AppendIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
481 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
482 wxAlignment align
= wxALIGN_CENTER
,
483 int flags
= wxDATAVIEW_COL_RESIZABLE
);
484 wxDataViewColumn
*AppendToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
485 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
486 wxAlignment align
= wxALIGN_CENTER
,
487 int flags
= wxDATAVIEW_COL_RESIZABLE
);
488 wxDataViewColumn
*AppendProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
489 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
490 wxAlignment align
= wxALIGN_CENTER
,
491 int flags
= wxDATAVIEW_COL_RESIZABLE
);
492 wxDataViewColumn
*AppendDateColumn( const wxBitmap
&label
, unsigned int model_column
,
493 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
494 wxAlignment align
= wxALIGN_CENTER
,
495 int flags
= wxDATAVIEW_COL_RESIZABLE
);
497 wxDataViewColumn
*AppendBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
498 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
499 wxAlignment align
= wxALIGN_CENTER
,
500 int flags
= wxDATAVIEW_COL_RESIZABLE
);
502 virtual bool AppendColumn( wxDataViewColumn
*col
);
504 virtual unsigned int GetColumnCount() const = 0;
505 virtual wxDataViewColumn
* GetColumn( unsigned int pos
) const = 0;
506 virtual int GetColumnPosition( const wxDataViewColumn
*column
) const = 0;
508 virtual bool DeleteColumn( wxDataViewColumn
*column
) = 0;
509 virtual bool ClearColumns() = 0;
511 void SetExpanderColumn( wxDataViewColumn
*col
)
512 { m_expander_column
= col
; DoSetExpanderColumn(); }
513 wxDataViewColumn
*GetExpanderColumn() const
514 { return m_expander_column
; }
516 virtual wxDataViewColumn
*GetSortingColumn() const = 0;
518 void SetIndent( int indent
)
519 { m_indent
= indent
; DoSetIndent(); }
520 int GetIndent() const
523 virtual wxDataViewItem
GetSelection() const = 0;
524 virtual int GetSelections( wxDataViewItemArray
& sel
) const = 0;
525 virtual void SetSelections( const wxDataViewItemArray
& sel
) = 0;
526 virtual void Select( const wxDataViewItem
& item
) = 0;
527 virtual void Unselect( const wxDataViewItem
& item
) = 0;
528 virtual bool IsSelected( const wxDataViewItem
& item
) const = 0;
530 virtual void SelectAll() = 0;
531 virtual void UnselectAll() = 0;
533 virtual void Expand( const wxDataViewItem
& item
) = 0;
534 virtual void Collapse( const wxDataViewItem
& item
) = 0;
536 virtual void EnsureVisible( const wxDataViewItem
& item
,
537 const wxDataViewColumn
*column
= NULL
) = 0;
538 virtual void HitTest( const wxPoint
& point
, wxDataViewItem
&item
, wxDataViewColumn
* &column
) const = 0;
539 virtual wxRect
GetItemRect( const wxDataViewItem
& item
, const wxDataViewColumn
*column
= NULL
) const = 0;
542 virtual void DoSetExpanderColumn() = 0 ;
543 virtual void DoSetIndent() = 0;
546 wxDataViewModel
*m_model
;
547 wxDataViewColumn
*m_expander_column
;
551 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase
)
554 // ----------------------------------------------------------------------------
555 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
556 // ----------------------------------------------------------------------------
558 class WXDLLIMPEXP_ADV wxDataViewEvent
: public wxNotifyEvent
561 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
562 : wxNotifyEvent(commandType
, winid
),
566 m_value(wxNullVariant
),
570 wxDataViewEvent(const wxDataViewEvent
& event
)
571 : wxNotifyEvent(event
),
572 m_item(event
.m_item
),
574 m_model(event
.m_model
),
575 m_value(event
.m_value
),
576 m_column(event
.m_column
)
579 wxDataViewItem
GetItem() const { return m_item
; }
580 void SetItem( const wxDataViewItem
&item
) { m_item
= item
; }
582 int GetColumn() const { return m_col
; }
583 void SetColumn( int col
) { m_col
= col
; }
585 wxDataViewModel
* GetModel() const { return m_model
; }
586 void SetModel( wxDataViewModel
*model
) { m_model
= model
; }
588 const wxVariant
&GetValue() const { return m_value
; }
589 void SetValue( const wxVariant
&value
) { m_value
= value
; }
591 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
592 void SetDataViewColumn( wxDataViewColumn
*col
) { m_column
= col
; }
593 wxDataViewColumn
*GetDataViewColumn() const { return m_column
; }
595 virtual wxEvent
*Clone() const { return new wxDataViewEvent(*this); }
598 wxDataViewItem m_item
;
600 wxDataViewModel
*m_model
;
602 wxDataViewColumn
*m_column
;
605 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent
)
608 BEGIN_DECLARE_EVENT_TYPES()
609 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED
, -1)
611 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED
, -1)
612 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED
, -1)
613 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED
, -1)
614 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING
, -1)
615 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING
, -1)
616 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED
, -1)
617 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE
, -1)
618 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED
, -1)
620 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
, -1)
621 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
, -1)
622 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED
, -1)
623 END_DECLARE_EVENT_TYPES()
625 typedef void (wxEvtHandler::*wxDataViewEventFunction
)(wxDataViewEvent
&);
627 #define wxDataViewEventHandler(func) \
628 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
630 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
631 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
633 #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn)
635 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
636 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
637 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
638 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
639 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
640 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
641 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
642 #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn)
644 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
645 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
646 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
648 #if defined(wxUSE_GENERICDATAVIEWCTRL)
649 #include "wx/generic/dataview.h"
650 #elif defined(__WXGTK20__)
651 #include "wx/gtk/dataview.h"
652 #elif defined(__WXMAC__)
653 #include "wx/mac/dataview.h"
655 #include "wx/generic/dataview.h"
658 #endif // wxUSE_DATAVIEWCTRL
661 // _WX_DATAVIEW_H_BASE_