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 wxDataViewItem
GetFirstChild( const wxDataViewItem
&parent
) const = 0;
142 virtual wxDataViewItem
GetNextSibling( const wxDataViewItem
&item
) const = 0;
144 // delegated notifiers
145 virtual bool ItemAdded( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
146 virtual bool ItemDeleted( const wxDataViewItem
&parent
, const wxDataViewItem
&item
);
147 virtual bool ItemChanged( const wxDataViewItem
&item
);
148 virtual bool ValueChanged( const wxDataViewItem
&item
, unsigned int col
);
149 virtual bool Cleared();
152 virtual void Resort();
154 void AddNotifier( wxDataViewModelNotifier
*notifier
);
155 void RemoveNotifier( wxDataViewModelNotifier
*notifier
);
157 // default compare function
158 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
159 unsigned int column
, bool ascending
);
160 virtual bool HasDefaultCompare() { return false; }
163 // the user should not delete this class directly: he should use DecRef() instead!
164 virtual ~wxDataViewModel() { }
166 wxDataViewModelNotifiers m_notifiers
;
169 // ---------------------------------------------------------
170 // wxDataViewIndexListModel
171 // ---------------------------------------------------------
173 class wxDataViewIndexListModel
: public wxDataViewModel
176 wxDataViewIndexListModel( unsigned int initial_size
= 0 );
177 ~wxDataViewIndexListModel();
179 virtual unsigned int GetRowCount() = 0;
181 virtual void GetValue( wxVariant
&variant
,
182 unsigned int row
, unsigned int col
) const = 0;
184 virtual bool SetValue( const wxVariant
&variant
,
185 unsigned int row
, unsigned int col
) = 0;
188 void RowInserted( unsigned int before
);
190 void RowDeleted( unsigned int row
);
191 void RowChanged( unsigned int row
);
192 void RowValueChanged( unsigned int row
, unsigned int col
);
194 // convert to/from row/wxDataViewItem
196 unsigned int GetRow( const wxDataViewItem
&item
) const;
197 wxDataViewItem
GetItem( unsigned int row
) const;
199 // compare based on index
201 virtual int Compare( const wxDataViewItem
&item1
, const wxDataViewItem
&item2
,
202 unsigned int column
, bool ascending
);
203 virtual bool HasDefaultCompare() { return true; }
205 // implement base methods
207 virtual void GetValue( wxVariant
&variant
,
208 const wxDataViewItem
&item
, unsigned int col
) const;
209 virtual bool SetValue( const wxVariant
&variant
,
210 const wxDataViewItem
&item
, unsigned int col
);
211 virtual wxDataViewItem
GetParent( const wxDataViewItem
&item
) const;
212 virtual bool IsContainer( const wxDataViewItem
&item
) const;
213 virtual wxDataViewItem
GetFirstChild( const wxDataViewItem
&parent
) const;
214 virtual wxDataViewItem
GetNextSibling( const wxDataViewItem
&item
) const;
217 wxDataViewItemArray m_hash
;
218 unsigned int m_lastIndex
;
221 //-----------------------------------------------------------------------------
222 // wxDataViewEditorCtrlEvtHandler
223 //-----------------------------------------------------------------------------
225 class wxDataViewEditorCtrlEvtHandler
: public wxEvtHandler
228 wxDataViewEditorCtrlEvtHandler( wxControl
*editor
, wxDataViewRenderer
*owner
);
230 void AcceptChangesAndFinish();
231 void SetFocusOnIdle( bool focus
= true ) { m_focusOnIdle
= focus
; }
234 void OnChar( wxKeyEvent
&event
);
235 void OnKillFocus( wxFocusEvent
&event
);
236 void OnIdle( wxIdleEvent
&event
);
239 wxDataViewRenderer
*m_owner
;
240 wxControl
*m_editorCtrl
;
245 DECLARE_EVENT_TABLE()
248 // ---------------------------------------------------------
249 // wxDataViewRendererBase
250 // ---------------------------------------------------------
252 enum wxDataViewCellMode
254 wxDATAVIEW_CELL_INERT
,
255 wxDATAVIEW_CELL_ACTIVATABLE
,
256 wxDATAVIEW_CELL_EDITABLE
259 enum wxDataViewCellRenderState
261 wxDATAVIEW_CELL_SELECTED
= 1,
262 wxDATAVIEW_CELL_PRELIT
= 2,
263 wxDATAVIEW_CELL_INSENSITIVE
= 4,
264 wxDATAVIEW_CELL_FOCUSED
= 8
267 class WXDLLIMPEXP_ADV wxDataViewRendererBase
: public wxObject
270 wxDataViewRendererBase( const wxString
&varianttype
,
271 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
272 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
274 virtual bool Validate( wxVariant
& WXUNUSED(value
) )
277 void SetOwner( wxDataViewColumn
*owner
) { m_owner
= owner
; }
278 wxDataViewColumn
* GetOwner() { return m_owner
; }
280 // renderer properties:
282 virtual bool SetValue( const wxVariant
& WXUNUSED(value
) ) = 0;
283 virtual bool GetValue( wxVariant
& WXUNUSED(value
) ) const = 0;
285 wxString
GetVariantType() const { return m_variantType
; }
287 virtual void SetMode( wxDataViewCellMode mode
) = 0;
288 virtual wxDataViewCellMode
GetMode() const = 0;
290 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
291 // rather an "int"; that's because for rendering cells it's allowed
292 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
293 virtual void SetAlignment( int align
) = 0;
294 virtual int GetAlignment() const = 0;
297 virtual bool HasEditorCtrl()
299 virtual wxControl
* CreateEditorCtrl(wxWindow
* WXUNUSED(parent
),
300 wxRect
WXUNUSED(labelRect
),
301 const wxVariant
& WXUNUSED(value
))
303 virtual bool GetValueFromEditorCtrl(wxControl
* WXUNUSED(editor
),
304 wxVariant
& WXUNUSED(value
))
307 virtual bool StartEditing( const wxDataViewItem
&item
, wxRect labelRect
);
308 virtual void CancelEditing();
309 virtual bool FinishEditing();
311 wxControl
*GetEditorCtrl() { return m_editorCtrl
; }
314 wxString m_variantType
;
315 wxDataViewColumn
*m_owner
;
316 wxControl
*m_editorCtrl
;
317 wxDataViewItem m_item
; // for m_editorCtrl
320 const wxDataViewCtrl
* GetView() const;
323 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase
)
326 //-----------------------------------------------------------------------------
327 // wxDataViewIconText
328 //-----------------------------------------------------------------------------
330 class wxDataViewIconText
: public wxObject
333 wxDataViewIconText( const wxString
&text
= wxEmptyString
, const wxIcon
& icon
= wxNullIcon
)
334 { m_icon
= icon
; m_text
= text
; }
335 wxDataViewIconText( const wxDataViewIconText
&other
)
336 { m_icon
= other
.m_icon
; m_text
= other
.m_text
; }
338 void SetText( const wxString
&text
) { m_text
= text
; }
339 wxString
GetText() const { return m_text
; }
340 void SetIcon( const wxIcon
&icon
) { m_icon
= icon
; }
341 const wxIcon
&GetIcon() const { return m_icon
; }
348 DECLARE_DYNAMIC_CLASS(wxDataViewIconText
)
351 bool operator == (const wxDataViewIconText
&one
, const wxDataViewIconText
&two
);
353 DECLARE_VARIANT_OBJECT(wxDataViewIconText
)
355 // ---------------------------------------------------------
356 // wxDataViewColumnBase
357 // ---------------------------------------------------------
359 enum wxDataViewColumnFlags
361 wxDATAVIEW_COL_RESIZABLE
= 1,
362 wxDATAVIEW_COL_SORTABLE
= 2,
363 wxDATAVIEW_COL_HIDDEN
= 4
366 class WXDLLIMPEXP_ADV wxDataViewColumnBase
: public wxObject
369 wxDataViewColumnBase( const wxString
&title
, wxDataViewRenderer
*renderer
,
370 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
371 wxAlignment align
= wxALIGN_CENTER
,
372 int flags
= wxDATAVIEW_COL_RESIZABLE
);
373 wxDataViewColumnBase( const wxBitmap
&bitmap
, wxDataViewRenderer
*renderer
,
374 unsigned int model_column
, int width
= wxDVC_DEFAULT_WIDTH
,
375 wxAlignment align
= wxALIGN_CENTER
,
376 int flags
= wxDATAVIEW_COL_RESIZABLE
);
377 virtual ~wxDataViewColumnBase();
381 virtual void SetTitle( const wxString
&title
) = 0;
382 virtual void SetAlignment( wxAlignment align
) = 0;
383 virtual void SetSortable( bool sortable
) = 0;
384 virtual void SetResizeable( bool resizeable
) = 0;
385 virtual void SetHidden( bool hidden
) = 0;
386 virtual void SetSortOrder( bool ascending
) = 0;
387 virtual void SetFlags( int flags
);
388 virtual void SetOwner( wxDataViewCtrl
*owner
)
390 virtual void SetBitmap( const wxBitmap
&bitmap
)
393 virtual void SetMinWidth( int minWidth
) = 0;
394 virtual void SetWidth( int width
) = 0;
399 virtual wxString
GetTitle() const = 0;
400 virtual wxAlignment
GetAlignment() const = 0;
401 virtual int GetWidth() const = 0;
402 virtual int GetMinWidth() const = 0;
404 virtual int GetFlags() const;
406 virtual bool IsSortable() const = 0;
407 virtual bool IsResizeable() const = 0;
408 virtual bool IsHidden() const = 0;
409 virtual bool IsSortOrderAscending() const = 0;
411 const wxBitmap
&GetBitmap() const { return m_bitmap
; }
412 unsigned int GetModelColumn() const { return m_model_column
; }
414 wxDataViewCtrl
*GetOwner() { return m_owner
; }
415 wxDataViewRenderer
* GetRenderer() { return m_renderer
; }
418 wxDataViewRenderer
*m_renderer
;
421 wxDataViewCtrl
*m_owner
;
424 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase
)
427 // ---------------------------------------------------------
428 // wxDataViewCtrlBase
429 // ---------------------------------------------------------
431 #define wxDV_SINGLE 0x0000 // for convenience
432 #define wxDV_MULTIPLE 0x0001 // can select multiple items
434 #define wxDV_NO_HEADER 0x0002 // column titles not visible
435 #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
436 #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
438 class WXDLLIMPEXP_ADV wxDataViewCtrlBase
: public wxControl
441 wxDataViewCtrlBase();
442 virtual ~wxDataViewCtrlBase();
444 virtual bool AssociateModel( wxDataViewModel
*model
);
445 wxDataViewModel
* GetModel();
448 wxDataViewColumn
*AppendTextColumn( const wxString
&label
, unsigned int model_column
,
449 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
450 wxAlignment align
= wxALIGN_CENTER
,
451 int flags
= wxDATAVIEW_COL_RESIZABLE
);
452 wxDataViewColumn
*AppendIconTextColumn( 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
*AppendToggleColumn( const wxString
&label
, unsigned int model_column
,
457 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
458 wxAlignment align
= wxALIGN_CENTER
,
459 int flags
= wxDATAVIEW_COL_RESIZABLE
);
460 wxDataViewColumn
*AppendProgressColumn( const wxString
&label
, unsigned int model_column
,
461 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
462 wxAlignment align
= wxALIGN_CENTER
,
463 int flags
= wxDATAVIEW_COL_RESIZABLE
);
464 wxDataViewColumn
*AppendDateColumn( const wxString
&label
, unsigned int model_column
,
465 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
466 wxAlignment align
= wxALIGN_CENTER
,
467 int flags
= wxDATAVIEW_COL_RESIZABLE
);
468 wxDataViewColumn
*AppendBitmapColumn( const wxString
&label
, unsigned int model_column
,
469 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
470 wxAlignment align
= wxALIGN_CENTER
,
471 int flags
= wxDATAVIEW_COL_RESIZABLE
);
472 wxDataViewColumn
*AppendTextColumn( const wxBitmap
&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
*AppendIconTextColumn( 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
*AppendToggleColumn( const wxBitmap
&label
, unsigned int model_column
,
481 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_TOGGLE_DEFAULT_WIDTH
,
482 wxAlignment align
= wxALIGN_CENTER
,
483 int flags
= wxDATAVIEW_COL_RESIZABLE
);
484 wxDataViewColumn
*AppendProgressColumn( const wxBitmap
&label
, unsigned int model_column
,
485 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= wxDVC_DEFAULT_WIDTH
,
486 wxAlignment align
= wxALIGN_CENTER
,
487 int flags
= wxDATAVIEW_COL_RESIZABLE
);
488 wxDataViewColumn
*AppendDateColumn( const wxBitmap
&label
, unsigned int model_column
,
489 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
, int width
= -1,
490 wxAlignment align
= wxALIGN_CENTER
,
491 int flags
= wxDATAVIEW_COL_RESIZABLE
);
493 wxDataViewColumn
*AppendBitmapColumn( const wxBitmap
&label
, unsigned int model_column
,
494 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
, int width
= -1,
495 wxAlignment align
= wxALIGN_CENTER
,
496 int flags
= wxDATAVIEW_COL_RESIZABLE
);
498 virtual bool AppendColumn( wxDataViewColumn
*col
);
500 virtual unsigned int GetColumnCount() const = 0;
501 virtual wxDataViewColumn
* GetColumn( unsigned int pos
) const = 0;
503 virtual bool DeleteColumn( wxDataViewColumn
*column
) = 0;
504 virtual bool ClearColumns() = 0;
506 void SetExpanderColumn( wxDataViewColumn
*col
)
507 { m_expander_column
= col
; DoSetExpanderColumn(); }
508 wxDataViewColumn
*GetExpanderColumn() const
509 { return m_expander_column
; }
511 void SetIndent( int indent
)
512 { m_indent
= indent
; DoSetIndent(); }
513 int GetIndent() const
516 virtual wxDataViewItem
GetSelection() const = 0;
517 virtual int GetSelections( wxDataViewItemArray
& sel
) const = 0;
518 virtual void SetSelections( const wxDataViewItemArray
& sel
) = 0;
519 virtual void Select( const wxDataViewItem
& item
) = 0;
520 virtual void Unselect( const wxDataViewItem
& item
) = 0;
521 virtual bool IsSelected( const wxDataViewItem
& item
) const = 0;
523 virtual void SelectAll() = 0;
524 virtual void UnselectAll() = 0;
526 virtual void Expand( const wxDataViewItem
& item
) = 0;
527 virtual void Collapse( const wxDataViewItem
& item
) = 0;
529 virtual void EnsureVisible( const wxDataViewItem
& item
,
530 const wxDataViewColumn
*column
= NULL
) = 0;
531 virtual void HitTest( const wxPoint
& point
, wxDataViewItem
&item
, wxDataViewColumn
* &column
) const = 0;
532 virtual wxRect
GetItemRect( const wxDataViewItem
& item
, const wxDataViewColumn
*column
= NULL
) const = 0;
535 virtual void DoSetExpanderColumn() = 0 ;
536 virtual void DoSetIndent() = 0;
539 wxDataViewModel
*m_model
;
540 wxDataViewColumn
*m_expander_column
;
544 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase
)
547 // ----------------------------------------------------------------------------
548 // wxDataViewEvent - the event class for the wxDataViewCtrl notifications
549 // ----------------------------------------------------------------------------
551 class WXDLLIMPEXP_ADV wxDataViewEvent
: public wxNotifyEvent
554 wxDataViewEvent(wxEventType commandType
= wxEVT_NULL
, int winid
= 0)
555 : wxNotifyEvent(commandType
, winid
),
559 m_value(wxNullVariant
),
563 wxDataViewEvent(const wxDataViewEvent
& event
)
564 : wxNotifyEvent(event
),
565 m_item(event
.m_item
),
567 m_model(event
.m_model
),
568 m_value(event
.m_value
),
569 m_column(event
.m_column
)
572 wxDataViewItem
GetItem() const { return m_item
; }
573 void SetItem( const wxDataViewItem
&item
) { m_item
= item
; }
575 int GetColumn() const { return m_col
; }
576 void SetColumn( int col
) { m_col
= col
; }
578 wxDataViewModel
* GetModel() const { return m_model
; }
579 void SetModel( wxDataViewModel
*model
) { m_model
= model
; }
581 const wxVariant
&GetValue() const { return m_value
; }
582 void SetValue( const wxVariant
&value
) { m_value
= value
; }
584 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
585 void SetDataViewColumn( wxDataViewColumn
*col
) { m_column
= col
; }
586 wxDataViewColumn
*GetDataViewColumn() const { return m_column
; }
588 virtual wxEvent
*Clone() const { return new wxDataViewEvent(*this); }
591 wxDataViewItem m_item
;
593 wxDataViewModel
*m_model
;
595 wxDataViewColumn
*m_column
;
598 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent
)
601 BEGIN_DECLARE_EVENT_TYPES()
602 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_SELECTED
, -1)
603 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_DESELECTED
, -1)
604 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED
, -1)
605 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED
, -1)
606 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED
, -1)
607 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING
, -1)
608 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING
, -1)
609 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED
, -1)
610 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE
, -1)
612 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK
, -1)
613 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
, -1)
614 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED
, -1)
616 // notifications from the model to the control
617 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED
, -1)
618 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED
, -1)
619 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_CHANGED
, -1)
620 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED
, -1)
621 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED
, -1)
622 END_DECLARE_EVENT_TYPES()
624 typedef void (wxEvtHandler::*wxDataViewEventFunction
)(wxDataViewEvent
&);
626 #define wxDataViewEventHandler(func) \
627 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
629 #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
630 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
632 #define EVT_DATAVIEW_ITEM_SELECTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_SELECTED, id, fn)
633 #define EVT_DATAVIEW_ITEM_DESELECTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DESELECTED, id, fn)
634 #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
635 #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn)
636 #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn)
637 #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn)
638 #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn)
639 #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn)
640 #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn)
642 #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
643 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
644 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
646 #define EVT_DATAVIEW_MODEL_ITEM_ADDED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_ADDED, id, fn)
647 #define EVT_DATAVIEW_MODEL_ITEM_DELETED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_DELETED, id, fn)
648 #define EVT_DATAVIEW_MODEL_ITEM_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_CHANGED, id, fn)
649 #define EVT_DATAVIEW_MODEL_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_VALUE_CHANGED, id, fn)
650 #define EVT_DATAVIEW_MODEL_CLEARED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_CLEARED, id, fn)
653 #if defined(wxUSE_GENERICDATAVIEWCTRL)
654 #include "wx/generic/dataview.h"
655 #elif defined(__WXGTK20__)
656 #include "wx/gtk/dataview.h"
657 #elif defined(__WXMAC__)
658 #include "wx/mac/dataview.h"
660 #include "wx/generic/dataview.h"
663 #endif // wxUSE_DATAVIEWCTRL
666 // _WX_DATAVIEW_H_BASE_