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 ValueChanged( const wxDataViewItem
&item
, unsigned int col
) = 0;
102 virtual bool Cleared() = 0;
104 virtual void Resort() = 0;
106 void SetOwner( wxDataViewModel
*owner
) { m_owner
= owner
; }
107 wxDataViewModel
*GetOwner() { return m_owner
; }
110 wxDataViewModel
*m_owner
;
114 // ---------------------------------------------------------
116 // ---------------------------------------------------------
118 WX_DECLARE_LIST(wxDataViewModelNotifier
, wxDataViewModelNotifiers
);
120 class WXDLLIMPEXP_ADV wxDataViewModel
: public wxObjectRefData
125 virtual unsigned int GetColumnCount() const = 0;
127 // return type as reported by wxVariant
128 virtual wxString
GetColumnType( unsigned int col
) const = 0;
130 // get value into a wxVariant
131 virtual void GetValue( wxVariant
&variant
,
132 const wxDataViewItem
&item
, unsigned int col
) const = 0;
134 // set value, call ValueChanged() afterwards!
135 virtual bool SetValue( const wxVariant
&variant
,
136 const wxDataViewItem
&item
, unsigned int col
) = 0;
139 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const = 0;
140 virtual bool IsContainer( const wxDataViewItem
&item
) const = 0;
141 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const = 0;
143 // delegated notifiers
144 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
145 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
146 virtual bool ItemChanged( const wxDataViewItem
&item
);
147 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
);
148 virtual bool Cleared();
151 virtual void Resort();
153 void AddNotifier( wxDataViewModelNotifier
*notifier
);
154 void RemoveNotifier( wxDataViewModelNotifier
*notifier
);
156 // default compare function
157 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
158 unsigned int column
, bool ascending
);
159 virtual bool HasDefaultCompare() const { return false; }
162 // the user should not delete this class directly: he should use DecRef() instead!
163 virtual ~wxDataViewModel() { }
165 wxDataViewModelNotifiers m_notifiers
;
168 // ---------------------------------------------------------
169 // wxDataViewIndexListModel
170 // ---------------------------------------------------------
172 class wxDataViewIndexListModel
: public wxDataViewModel
175 wxDataViewIndexListModel( unsigned int initial_size
= 0 );
176 ~wxDataViewIndexListModel();
178 virtual unsigned int GetRowCount() = 0;
180 virtual void GetValue( wxVariant
&variant
,
181 unsigned int row
, unsigned int col
) const = 0;
183 virtual bool SetValue( const wxVariant
&variant
,
184 unsigned int row
, unsigned int col
) = 0;
187 void RowInserted( unsigned int before
);
189 void RowDeleted( unsigned int row
);
190 void RowChanged( unsigned int row
);
191 void RowValueChanged( unsigned int row
, unsigned int col
);
193 // convert to/from row/wxDataViewItem
195 unsigned int GetRow( const wxDataViewItem
&item
) const;
196 wxDataViewItem
GetItem( unsigned int row
) const;
198 // compare based on index
200 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
201 unsigned int column
, bool ascending
);
202 virtual bool HasDefaultCompare() const { return true; }
204 // implement base methods
206 virtual void GetValue( wxVariant
&variant
,
207 const wxDataViewItem
&item
, unsigned int col
) const;
208 virtual bool SetValue( const wxVariant
&variant
,
209 const wxDataViewItem
&item
, unsigned int col
);
210 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
211 virtual bool IsContainer( const wxDataViewItem
&item
) const;
212 virtual unsigned int GetChildren( const wxDataViewItem
&item
, wxDataViewItemArray
&children
) const;
215 wxDataViewItemArray m_hash
;
216 unsigned int m_lastIndex
;
219 //-----------------------------------------------------------------------------
220 // wxDataViewEditorCtrlEvtHandler
221 //-----------------------------------------------------------------------------
223 class wxDataViewEditorCtrlEvtHandler
: public wxEvtHandler
226 wxDataViewEditorCtrlEvtHandler( wxControl
*editor
, wxDataViewRenderer
*owner
);
228 void AcceptChangesAndFinish();
229 void SetFocusOnIdle( bool focus
= true ) { m_focusOnIdle
= focus
; }
232 void OnChar( wxKeyEvent
&event
);
233 void OnKillFocus( wxFocusEvent
&event
);
234 void OnIdle( wxIdleEvent
&event
);
237 wxDataViewRenderer
*m_owner
;
238 wxControl
*m_editorCtrl
;
243 DECLARE_EVENT_TABLE()
246 // ---------------------------------------------------------
247 // wxDataViewRendererBase
248 // ---------------------------------------------------------
250 enum wxDataViewCellMode
252 wxDATAVIEW_CELL_INERT
,
253 wxDATAVIEW_CELL_ACTIVATABLE
,
254 wxDATAVIEW_CELL_EDITABLE
257 enum wxDataViewCellRenderState
259 wxDATAVIEW_CELL_SELECTED
= 1,
260 wxDATAVIEW_CELL_PRELIT
= 2,
261 wxDATAVIEW_CELL_INSENSITIVE
= 4,
262 wxDATAVIEW_CELL_FOCUSED
= 8
265 class WXDLLIMPEXP_ADV wxDataViewRendererBase
: public wxObject
268 wxDataViewRendererBase( const wxString
&varianttype
,
269 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
270 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
272 virtual bool Validate( wxVariant
& WXUNUSED(value
) )
275 void SetOwner( wxDataViewColumn
*owner
) { m_owner
= owner
; }
276 wxDataViewColumn
* GetOwner() { return m_owner
; }
278 // renderer properties:
280 virtual bool SetValue( const wxVariant
& WXUNUSED(value
) ) = 0;
281 virtual bool GetValue( wxVariant
& WXUNUSED(value
) ) const = 0;
283 wxString
GetVariantType() const { return m_variantType
; }
285 virtual void SetMode( wxDataViewCellMode mode
) = 0;
286 virtual wxDataViewCellMode
GetMode() const = 0;
288 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
289 // rather an "int"; that's because for rendering cells it's allowed
290 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
291 virtual void SetAlignment( int align
) = 0;
292 virtual int GetAlignment() const = 0;
295 virtual bool HasEditorCtrl()
297 virtual wxControl
* CreateEditorCtrl(wxWindow
* WXUNUSED(parent
),
298 wxRect
WXUNUSED(labelRect
),
299 const wxVariant
& WXUNUSED(value
))
301 virtual bool GetValueFromEditorCtrl(wxControl
* WXUNUSED(editor
),
302 wxVariant
& WXUNUSED(value
))
305 virtual bool StartEditing( const wxDataViewItem
&item
, wxRect labelRect
);
306 virtual void CancelEditing();
307 virtual bool FinishEditing();
309 wxControl
*GetEditorCtrl() { return m_editorCtrl
; }
312 wxString m_variantType
;
313 wxDataViewColumn
*m_owner
;
314 wxControl
*m_editorCtrl
;
315 wxDataViewItem m_item
; // for m_editorCtrl
318 const wxDataViewCtrl
* GetView() const;
321 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase
)
324 //-----------------------------------------------------------------------------
325 // wxDataViewIconText
326 //-----------------------------------------------------------------------------
328 class wxDataViewIconText
: public wxObject
331 wxDataViewIconText( const wxString
&text
= wxEmptyString
, const wxIcon
& icon
= wxNullIcon
)
332 { m_icon
= icon
; m_text
= text
; }
333 wxDataViewIconText( const wxDataViewIconText
&other
)
334 { m_icon
= other
.m_icon
; m_text
= other
.m_text
; }
336 void SetText( const wxString
&text
) { m_text
= text
; }
337 wxString
GetText() const { return m_text
; }
338 void SetIcon( const wxIcon
&icon
) { m_icon
= icon
; }
339 const wxIcon
&GetIcon() const { return m_icon
; }
346 DECLARE_DYNAMIC_CLASS(wxDataViewIconText
)
349 bool operator == (const wxDataViewIconText
&one
, const wxDataViewIconText
&two
);
351 DECLARE_VARIANT_OBJECT(wxDataViewIconText
)
353 // ---------------------------------------------------------
354 // wxDataViewColumnBase
355 // ---------------------------------------------------------
357 enum wxDataViewColumnFlags
359 wxDATAVIEW_COL_RESIZABLE
= 1,
360 wxDATAVIEW_COL_SORTABLE
= 2,
361 wxDATAVIEW_COL_HIDDEN
= 4
364 class WXDLLIMPEXP_ADV wxDataViewColumnBase
: public wxObject
367 wxDataViewColumnBase( const wxString
&title
, wxDataViewRenderer
*renderer
,
368 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
369 wxAlignment align
= wxALIGN_CENTER
,
370 int flags
= wxDATAVIEW_COL_RESIZABLE
);
371 wxDataViewColumnBase( const wxBitmap
&bitmap
, wxDataViewRenderer
*renderer
,
372 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
373 wxAlignment align
= wxALIGN_CENTER
,
374 int flags
= wxDATAVIEW_COL_RESIZABLE
);
375 virtual ~wxDataViewColumnBase();
379 virtual void SetTitle( const wxString
&title
) = 0;
380 virtual void SetAlignment( wxAlignment align
) = 0;
381 virtual void SetSortable( bool sortable
) = 0;
382 virtual void SetResizeable( bool resizeable
) = 0;
383 virtual void SetHidden( bool hidden
) = 0;
384 virtual void SetSortOrder( bool ascending
) = 0;
385 virtual void SetFlags( int flags
);
386 virtual void SetOwner( wxDataViewCtrl
*owner
)
388 virtual void SetBitmap( const wxBitmap
&bitmap
)
391 virtual void SetMinWidth( int minWidth
) = 0;
392 virtual void SetWidth( int width
) = 0;
397 virtual wxString
GetTitle() const = 0;
398 virtual wxAlignment
GetAlignment() const = 0;
399 virtual int GetWidth() const = 0;
400 virtual int GetMinWidth() const = 0;
402 virtual int GetFlags() const;
404 virtual bool IsSortable() const = 0;
405 virtual bool IsResizeable() const = 0;
406 virtual bool IsHidden() const = 0;
407 virtual bool IsSortOrderAscending() const = 0;
409 const wxBitmap
&GetBitmap() const { return m_bitmap
; }
410 unsigned int GetModelColumn() const { return m_model_column
; }
412 wxDataViewCtrl
*GetOwner() { return m_owner
; }
413 wxDataViewRenderer
* GetRenderer() { return m_renderer
; }
416 wxDataViewRenderer
*m_renderer
;
419 wxDataViewCtrl
*m_owner
;
422 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase
)
425 // ---------------------------------------------------------
426 // wxDataViewCtrlBase
427 // ---------------------------------------------------------
429 #define wxDV_SINGLE 0x0000 // for convenience
430 #define wxDV_MULTIPLE 0x0001 // can select multiple items
432 #define wxDV_NO_HEADER 0x0002 // column titles not visible
433 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
434 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
436 class WXDLLIMPEXP_ADV wxDataViewCtrlBase
: public wxControl
439 wxDataViewCtrlBase();
440 virtual ~wxDataViewCtrlBase();
442 virtual bool AssociateModel( wxDataViewModel
*model
);
443 wxDataViewModel
* GetModel();
446 wxDataViewColumn
*AppendTextColumn( const wxString
&label
, unsigned int model_column
,
447 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
448 wxAlignment align
= wxALIGN_CENTER
,
449 int flags
= wxDATAVIEW_COL_RESIZABLE
);
450 wxDataViewColumn
*AppendIconTextColumn( const wxString
&label
, unsigned int model_column
,
451 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
452 wxAlignment align
= wxALIGN_CENTER
,
453 int flags
= wxDATAVIEW_COL_RESIZABLE
);
454 wxDataViewColumn
*AppendToggleColumn( const wxString
&label
, unsigned int model_column
,
455 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
456 wxAlignment align
= wxALIGN_CENTER
,
457 int flags
= wxDATAVIEW_COL_RESIZABLE
);
458 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
, unsigned int model_column
,
459 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
460 wxAlignment align
= wxALIGN_CENTER
,
461 int flags
= wxDATAVIEW_COL_RESIZABLE
);
462 wxDataViewColumn
*AppendDateColumn( const wxString
&label
, unsigned int model_column
,
463 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
464 wxAlignment align
= wxALIGN_CENTER
,
465 int flags
= wxDATAVIEW_COL_RESIZABLE
);
466 wxDataViewColumn
*AppendBitmapColumn( const wxString
&label
, unsigned int model_column
,
467 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
468 wxAlignment align
= wxALIGN_CENTER
,
469 int flags
= wxDATAVIEW_COL_RESIZABLE
);
470 wxDataViewColumn
*AppendTextColumn( const wxBitmap
&label
, unsigned int model_column
,
471 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
472 wxAlignment align
= wxALIGN_CENTER
,
473 int flags
= wxDATAVIEW_COL_RESIZABLE
);
474 wxDataViewColumn
*AppendIconTextColumn( const wxBitmap
&label
, unsigned int model_column
,
475 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
476 wxAlignment align
= wxALIGN_CENTER
,
477 int flags
= wxDATAVIEW_COL_RESIZABLE
);
478 wxDataViewColumn
*AppendToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
479 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
480 wxAlignment align
= wxALIGN_CENTER
,
481 int flags
= wxDATAVIEW_COL_RESIZABLE
);
482 wxDataViewColumn
*AppendProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
483 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
484 wxAlignment align
= wxALIGN_CENTER
,
485 int flags
= wxDATAVIEW_COL_RESIZABLE
);
486 wxDataViewColumn
*AppendDateColumn( const wxBitmap
&label
, unsigned int model_column
,
487 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
488 wxAlignment align
= wxALIGN_CENTER
,
489 int flags
= wxDATAVIEW_COL_RESIZABLE
);
491 wxDataViewColumn
*AppendBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
492 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
493 wxAlignment align
= wxALIGN_CENTER
,
494 int flags
= wxDATAVIEW_COL_RESIZABLE
);
496 virtual bool AppendColumn( wxDataViewColumn
*col
);
498 virtual unsigned int GetColumnCount() const = 0;
499 virtual wxDataViewColumn
* GetColumn( unsigned int pos
) const = 0;
500 virtual int GetColumnPosition( const wxDataViewColumn
*column
) const = 0;
502 virtual bool DeleteColumn( wxDataViewColumn
*column
) = 0;
503 virtual bool ClearColumns() = 0;
505 void SetExpanderColumn( wxDataViewColumn
*col
)
506 { m_expander_column
= col
; DoSetExpanderColumn(); }
507 wxDataViewColumn
*GetExpanderColumn() const
508 { return m_expander_column
; }
510 virtual wxDataViewColumn
*GetSortingColumn() const = 0;
512 void SetIndent( int indent
)
513 { m_indent
= indent
; DoSetIndent(); }
514 int GetIndent() const
517 virtual wxDataViewItem
GetSelection() const = 0;
518 virtual int GetSelections( wxDataViewItemArray
& sel
) const = 0;
519 virtual void SetSelections( const wxDataViewItemArray
& sel
) = 0;
520 virtual void Select( const wxDataViewItem
& item
) = 0;
521 virtual void Unselect( const wxDataViewItem
& item
) = 0;
522 virtual bool IsSelected( const wxDataViewItem
& item
) const = 0;
524 virtual void SelectAll() = 0;
525 virtual void UnselectAll() = 0;
527 virtual void Expand( const wxDataViewItem
& item
) = 0;
528 virtual void Collapse( const wxDataViewItem
& item
) = 0;
530 virtual void EnsureVisible( const wxDataViewItem
& item
,
531 const wxDataViewColumn
*column
= NULL
) = 0;
532 virtual void HitTest( const wxPoint
& point
, wxDataViewItem
&item
, wxDataViewColumn
* &column
) const = 0;
533 virtual wxRect
GetItemRect( const wxDataViewItem
& item
, const wxDataViewColumn
*column
= NULL
) const = 0;
536 virtual void DoSetExpanderColumn() = 0 ;
537 virtual void DoSetIndent() = 0;
540 wxDataViewModel
*m_model
;
541 wxDataViewColumn
*m_expander_column
;
545 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase
)
548 // ----------------------------------------------------------------------------
549 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
550 // ----------------------------------------------------------------------------
552 class WXDLLIMPEXP_ADV wxDataViewEvent
: public wxNotifyEvent
555 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
556 : wxNotifyEvent(commandType
, winid
),
560 m_value(wxNullVariant
),
564 wxDataViewEvent(const wxDataViewEvent
& event
)
565 : wxNotifyEvent(event
),
566 m_item(event
.m_item
),
568 m_model(event
.m_model
),
569 m_value(event
.m_value
),
570 m_column(event
.m_column
)
573 wxDataViewItem
GetItem() const { return m_item
; }
574 void SetItem( const wxDataViewItem
&item
) { m_item
= item
; }
576 int GetColumn() const { return m_col
; }
577 void SetColumn( int col
) { m_col
= col
; }
579 wxDataViewModel
* GetModel() const { return m_model
; }
580 void SetModel( wxDataViewModel
*model
) { m_model
= model
; }
582 const wxVariant
&GetValue() const { return m_value
; }
583 void SetValue( const wxVariant
&value
) { m_value
= value
; }
585 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
586 void SetDataViewColumn( wxDataViewColumn
*col
) { m_column
= col
; }
587 wxDataViewColumn
*GetDataViewColumn() const { return m_column
; }
589 virtual wxEvent
*Clone() const { return new wxDataViewEvent(*this); }
592 wxDataViewItem m_item
;
594 wxDataViewModel
*m_model
;
596 wxDataViewColumn
*m_column
;
599 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent
)
602 BEGIN_DECLARE_EVENT_TYPES()
603 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_SELECTED
, -1)
604 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_DESELECTED
, -1)
605 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED
, -1)
606 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED
, -1)
607 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED
, -1)
608 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING
, -1)
609 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING
, -1)
610 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED
, -1)
611 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE
, -1)
613 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
, -1)
614 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
, -1)
615 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED
, -1)
617 // notifications from the model to the control
618 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED
, -1)
619 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED
, -1)
620 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_CHANGED
, -1)
621 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED
, -1)
622 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED
, -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_ITEM_SELECTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_SELECTED, id, fn)
634 #define EVT_DATAVIEW_ITEM_DESELECTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DESELECTED, 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)
643 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
644 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
645 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
647 #define EVT_DATAVIEW_MODEL_ITEM_ADDED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_ADDED, id, fn)
648 #define EVT_DATAVIEW_MODEL_ITEM_DELETED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_DELETED, id, fn)
649 #define EVT_DATAVIEW_MODEL_ITEM_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_CHANGED, id, fn)
650 #define EVT_DATAVIEW_MODEL_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_VALUE_CHANGED, id, fn)
651 #define EVT_DATAVIEW_MODEL_CLEARED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_CLEARED, id, fn)
654 #if defined(wxUSE_GENERICDATAVIEWCTRL)
655 #include "wx/generic/dataview.h"
656 #elif defined(__WXGTK20__)
657 #include "wx/gtk/dataview.h"
658 #elif defined(__WXMAC__)
659 #include "wx/mac/dataview.h"
661 #include "wx/generic/dataview.h"
664 #endif // wxUSE_DATAVIEWCTRL
667 // _WX_DATAVIEW_H_BASE_