]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dataview.h
fix Watcom compilation: removed templates for wxFileSelector() compatibility with...
[wxWidgets.git] / include / wx / dataview.h
CommitLineData
bcd846ea
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/dataview.h
3// Purpose: wxDataViewCtrl base classes
4// Author: Robert Roebling
5// Modified by:
6// Created: 08.01.06
7// RCS-ID: $Id$
8// Copyright: (c) Robert Roebling
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_DATAVIEW_H_BASE_
13#define _WX_DATAVIEW_H_BASE_
14
15#include "wx/defs.h"
16
17#if wxUSE_DATAVIEWCTRL
18
239eaa41
RR
19#include "wx/control.h"
20#include "wx/textctrl.h"
21#include "wx/bitmap.h"
64ffb888 22#include "wx/variant.h"
b9b8b59c 23#include "wx/listctrl.h"
4ed7af08
RR
24
25#if defined(__WXGTK20__)
26 // for testing
30715fa1 27 // #define wxUSE_GENERICDATAVIEWCTRL 1
4ed7af08 28#elif defined(__WXMAC__)
4ed7af08
RR
29#else
30 #define wxUSE_GENERICDATAVIEWCTRL 1
31#endif
32
bcd846ea 33// ----------------------------------------------------------------------------
f554a14b 34// wxDataViewCtrl flags
bcd846ea
RR
35// ----------------------------------------------------------------------------
36
239eaa41
RR
37// ----------------------------------------------------------------------------
38// wxDataViewCtrl globals
39// ----------------------------------------------------------------------------
bcd846ea 40
e0062c04 41class WXDLLIMPEXP_ADV wxDataViewItem;
f460c29d 42class WXDLLIMPEXP_ADV wxDataViewModel;
f460c29d
RD
43class WXDLLIMPEXP_ADV wxDataViewCtrl;
44class WXDLLIMPEXP_ADV wxDataViewColumn;
baa9ebc4 45class WXDLLIMPEXP_ADV wxDataViewRenderer;
e0062c04
RR
46class WXDLLIMPEXP_ADV wxDataViewModelNotifier;
47class wxDataViewEventModelNotifier;
fa28826d 48
f460c29d 49extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxDataViewCtrlNameStr[];
bcd846ea 50
87f0efe2
RR
51// the default width of new (text) columns:
52#define wxDVC_DEFAULT_WIDTH 80
53
54// the default width of new toggle columns:
55#define wxDVC_TOGGLE_DEFAULT_WIDTH 30
56
9861f022
RR
57// the default minimal width of the columns:
58#define wxDVC_DEFAULT_MINWIDTH 30
59
60// the default alignment of wxDataViewRenderers:
61#define wxDVR_DEFAULT_ALIGNMENT (wxALIGN_LEFT|wxALIGN_TOP)
62
87f0efe2 63
f554a14b 64// ---------------------------------------------------------
e0062c04 65// wxDataViewItem
f554a14b 66// ---------------------------------------------------------
239eaa41 67
e0062c04 68class WXDLLIMPEXP_ADV wxDataViewItem
239eaa41
RR
69{
70public:
e0062c04
RR
71 wxDataViewItem( wxUint32 id = 0 )
72 { m_id = id; m_reserved1 = 0; m_reserved2 = NULL; }
73 wxDataViewItem( const wxDataViewItem &item )
74 { m_id = item.m_id; m_reserved1 = item.m_reserved1; m_reserved2 = item.m_reserved2; }
75 bool IsOk() const { return m_id != 0; }
76 wxUint32 GetID() const { return m_id; }
77
239eaa41 78public:
e0062c04
RR
79 wxUint32 m_reserved1;
80 void* m_reserved2;
81
8f850e28 82private:
e0062c04 83 wxUint32 m_id;
64ffb888 84};
239eaa41 85
f554a14b 86// ---------------------------------------------------------
e0062c04 87// wxDataViewModel
f554a14b 88// ---------------------------------------------------------
239eaa41 89
e0062c04 90class WXDLLIMPEXP_ADV wxDataViewModel: public wxObjectRefData
239eaa41
RR
91{
92public:
e0062c04 93 wxDataViewModel();
239eaa41 94
9861f022 95 virtual unsigned int GetColumnCount() const = 0;
87f0efe2 96
a7f61f76 97 // return type as reported by wxVariant
9861f022 98 virtual wxString GetColumnType( unsigned int col ) const = 0;
87f0efe2 99
a7f61f76 100 // get value into a wxVariant
e0062c04
RR
101 virtual void GetValue( wxVariant &variant,
102 const wxDataViewItem &item, unsigned int col ) const = 0;
87f0efe2 103
a7f61f76 104 // set value, call ValueChanged() afterwards!
e0062c04
RR
105 virtual bool SetValue( const wxVariant &variant,
106 const wxDataViewItem &item, unsigned int col ) = 0;
239eaa41 107
e0062c04
RR
108 // define hierachy
109 virtual bool HasChildren( const wxDataViewItem &item ) const = 0;
110 virtual int GetChildCount( const wxDataViewItem &item ) const = 0;
111 virtual wxDataViewItem GetParent( const wxDataViewItem &child ) const = 0;
112 virtual wxDataViewItem GetFirstChild( const wxDataViewItem &parent ) const = 0;
113 virtual wxDataViewItem GetNextSibling( const wxDataViewItem &item ) const = 0;
114 virtual wxDataViewItem GetNthChild( const wxDataViewItem &parent, unsigned int n ) const = 0;
b9b8b59c 115
239eaa41 116 // delegated notifiers
e0062c04
RR
117 virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item );
118 virtual bool ItemDeleted( const wxDataViewItem &item );
119 virtual bool ItemChanged( const wxDataViewItem &item );
120 virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col );
8981608c 121 virtual bool Cleared();
b5d777c7 122
e0062c04
RR
123 void AddNotifier( wxDataViewModelNotifier *notifier );
124 void RemoveNotifier( wxDataViewModelNotifier *notifier );
63415a42 125
87f0efe2
RR
126protected:
127 // the user should not delete this class directly: he should use DecRef() instead!
5debbdcf 128 virtual ~wxDataViewModel() { }
87f0efe2 129
1821abd1 130 wxList m_notifiers;
239eaa41
RR
131};
132
f554a14b 133// ---------------------------------------------------------
e0062c04 134// wxDataViewModelNotifier
f554a14b 135// ---------------------------------------------------------
8981608c 136
e0062c04 137class WXDLLIMPEXP_ADV wxDataViewModelNotifier: public wxObject
8981608c
RR
138{
139public:
e0062c04
RR
140 wxDataViewModelNotifier() { }
141 virtual ~wxDataViewModelNotifier() { m_owner = NULL; }
9861f022 142
e0062c04
RR
143 virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0;
144 virtual bool ItemDeleted( const wxDataViewItem &item ) = 0;
145 virtual bool ItemChanged( const wxDataViewItem &item ) = 0;
146 virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ) = 0;
147 virtual bool Cleared() = 0;
8981608c 148
e0062c04
RR
149 void SetOwner( wxDataViewModel *owner ) { m_owner = owner; }
150 wxDataViewModel *GetOwner() { return m_owner; }
8f850e28 151
8981608c 152private:
e0062c04 153 wxDataViewModel *m_owner;
8981608c
RR
154};
155
e0062c04 156
1e510b1e
RR
157//-----------------------------------------------------------------------------
158// wxDataViewEditorCtrlEvtHandler
159//-----------------------------------------------------------------------------
160
161class wxDataViewEditorCtrlEvtHandler: public wxEvtHandler
162{
163public:
164 wxDataViewEditorCtrlEvtHandler( wxControl *editor, wxDataViewRenderer *owner );
165
166 void AcceptChangesAndFinish();
30715fa1 167 void SetFocusOnIdle( bool focus = true ) { m_focusOnIdle = focus; }
1e510b1e
RR
168
169protected:
170 void OnChar( wxKeyEvent &event );
171 void OnKillFocus( wxFocusEvent &event );
30715fa1 172 void OnIdle( wxIdleEvent &event );
1e510b1e
RR
173
174private:
175 wxDataViewRenderer *m_owner;
176 wxControl *m_editorCtrl;
177 bool m_finished;
30715fa1 178 bool m_focusOnIdle;
1e510b1e
RR
179
180private:
181 DECLARE_EVENT_TABLE()
182};
183
f554a14b 184// ---------------------------------------------------------
baa9ebc4 185// wxDataViewRendererBase
f554a14b 186// ---------------------------------------------------------
fa28826d 187
6842a71a 188enum wxDataViewCellMode
fa28826d 189{
6842a71a
RR
190 wxDATAVIEW_CELL_INERT,
191 wxDATAVIEW_CELL_ACTIVATABLE,
192 wxDATAVIEW_CELL_EDITABLE
fa28826d
RR
193};
194
6842a71a
RR
195enum wxDataViewCellRenderState
196{
197 wxDATAVIEW_CELL_SELECTED = 1,
198 wxDATAVIEW_CELL_PRELIT = 2,
199 wxDATAVIEW_CELL_INSENSITIVE = 4,
200 wxDATAVIEW_CELL_FOCUSED = 8
201};
202
baa9ebc4 203class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject
6842a71a
RR
204{
205public:
9861f022
RR
206 wxDataViewRendererBase( const wxString &varianttype,
207 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
208 int alignment = wxDVR_DEFAULT_ALIGNMENT );
6842a71a 209
9861f022
RR
210 virtual bool Validate( wxVariant& WXUNUSED(value) )
211 { return true; }
f554a14b 212
6842a71a
RR
213 void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
214 wxDataViewColumn* GetOwner() { return m_owner; }
f554a14b 215
9861f022
RR
216 // renderer properties:
217
218 virtual bool SetValue( const wxVariant& WXUNUSED(value) ) = 0;
219 virtual bool GetValue( wxVariant& WXUNUSED(value) ) const = 0;
220
221 wxString GetVariantType() const { return m_variantType; }
222
223 virtual void SetMode( wxDataViewCellMode mode ) = 0;
224 virtual wxDataViewCellMode GetMode() const = 0;
225
226 // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
227 // rather an "int"; that's because for rendering cells it's allowed
228 // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
229 virtual void SetAlignment( int align ) = 0;
230 virtual int GetAlignment() const = 0;
99d471a5 231
1e510b1e
RR
232 // in-place editing
233 virtual bool HasEditorCtrl()
234 { return false; }
96c2a0dd
VZ
235 virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
236 wxRect WXUNUSED(labelRect),
237 const wxVariant& WXUNUSED(value))
1e510b1e 238 { return NULL; }
96c2a0dd
VZ
239 virtual bool GetValueFromEditorCtrl(wxControl * WXUNUSED(editor),
240 wxVariant& WXUNUSED(value))
1e510b1e
RR
241 { return false; }
242
e0062c04 243 virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect );
1e510b1e
RR
244 virtual void CancelEditing();
245 virtual bool FinishEditing();
246
247 wxControl *GetEditorCtrl() { return m_editorCtrl; }
248
a7f61f76 249protected:
6842a71a
RR
250 wxString m_variantType;
251 wxDataViewColumn *m_owner;
1e510b1e 252 wxControl *m_editorCtrl;
e0062c04 253 wxDataViewItem m_item; // for m_editorCtrl
6842a71a 254
9861f022
RR
255 // internal utility:
256 const wxDataViewCtrl* GetView() const;
257
6842a71a 258protected:
baa9ebc4 259 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase)
6842a71a
RR
260};
261
f554a14b 262// ---------------------------------------------------------
6842a71a 263// wxDataViewColumnBase
f554a14b 264// ---------------------------------------------------------
6842a71a 265
fa28826d
RR
266enum wxDataViewColumnFlags
267{
268 wxDATAVIEW_COL_RESIZABLE = 1,
269 wxDATAVIEW_COL_SORTABLE = 2,
270 wxDATAVIEW_COL_HIDDEN = 4
271};
272
f460c29d 273class WXDLLIMPEXP_ADV wxDataViewColumnBase: public wxObject
fa28826d
RR
274{
275public:
87f0efe2
RR
276 wxDataViewColumnBase( const wxString &title, wxDataViewRenderer *renderer,
277 unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
278 wxAlignment align = wxALIGN_CENTER,
279 int flags = wxDATAVIEW_COL_RESIZABLE );
280 wxDataViewColumnBase( const wxBitmap &bitmap, wxDataViewRenderer *renderer,
281 unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
282 wxAlignment align = wxALIGN_CENTER,
283 int flags = wxDATAVIEW_COL_RESIZABLE );
d3c7fc99 284 virtual ~wxDataViewColumnBase();
fa28826d 285
9861f022 286 // setters:
07b6378f 287
9861f022 288 virtual void SetTitle( const wxString &title ) = 0;
47cef10f 289 virtual void SetAlignment( wxAlignment align ) = 0;
31fb32e1 290 virtual void SetSortable( bool sortable ) = 0;
9861f022
RR
291 virtual void SetResizeable( bool resizeable ) = 0;
292 virtual void SetHidden( bool hidden ) = 0;
47cef10f 293 virtual void SetSortOrder( bool ascending ) = 0;
9861f022
RR
294 virtual void SetFlags( int flags );
295 virtual void SetOwner( wxDataViewCtrl *owner )
296 { m_owner = owner; }
297 virtual void SetBitmap( const wxBitmap &bitmap )
298 { m_bitmap=bitmap; }
07a84e7b 299
9861f022
RR
300 virtual void SetMinWidth( int minWidth ) = 0;
301 virtual void SetWidth( int width ) = 0;
f554a14b 302
f554a14b 303
9861f022 304 // getters:
07b6378f 305
9861f022
RR
306 virtual wxString GetTitle() const = 0;
307 virtual wxAlignment GetAlignment() const = 0;
87f0efe2 308 virtual int GetWidth() const = 0;
9861f022 309 virtual int GetMinWidth() const = 0;
07b6378f 310
9861f022
RR
311 virtual int GetFlags() const;
312
313 virtual bool IsSortable() const = 0;
314 virtual bool IsResizeable() const = 0;
315 virtual bool IsHidden() const = 0;
316 virtual bool IsSortOrderAscending() const = 0;
317
318 const wxBitmap &GetBitmap() const { return m_bitmap; }
319 unsigned int GetModelColumn() const { return m_model_column; }
320
321 wxDataViewCtrl *GetOwner() { return m_owner; }
322 wxDataViewRenderer* GetRenderer() { return m_renderer; }
323
324protected:
baa9ebc4 325 wxDataViewRenderer *m_renderer;
6842a71a 326 int m_model_column;
07a84e7b 327 wxBitmap m_bitmap;
6842a71a 328 wxDataViewCtrl *m_owner;
fa28826d
RR
329
330protected:
331 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase)
332};
333
f554a14b 334// ---------------------------------------------------------
239eaa41 335// wxDataViewCtrlBase
f554a14b 336// ---------------------------------------------------------
239eaa41 337
c21f7aa1 338#define wxDV_SINGLE 0x0000 // for convenience
9861f022
RR
339#define wxDV_MULTIPLE 0x0001 // can select multiple items
340
341#define wxDV_NO_HEADER 0x0002 // column titles not visible
342#define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows
343#define wxDV_VERT_RULES 0x0008 // light vertical rules between columns
c21f7aa1 344
f460c29d 345class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl
239eaa41
RR
346{
347public:
348 wxDataViewCtrlBase();
d3c7fc99 349 virtual ~wxDataViewCtrlBase();
f554a14b 350
e0062c04
RR
351 virtual bool AssociateModel( wxDataViewModel *model );
352 wxDataViewModel* GetModel();
f554a14b 353
07a84e7b 354 // short cuts
1286b7ba 355 bool AppendTextColumn( const wxString &label, unsigned int model_column,
87f0efe2
RR
356 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
357 wxAlignment align = wxALIGN_CENTER,
358 int flags = wxDATAVIEW_COL_RESIZABLE );
1286b7ba 359 bool AppendToggleColumn( const wxString &label, unsigned int model_column,
87f0efe2
RR
360 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
361 wxAlignment align = wxALIGN_CENTER,
362 int flags = wxDATAVIEW_COL_RESIZABLE );
1286b7ba 363 bool AppendProgressColumn( const wxString &label, unsigned int model_column,
87f0efe2
RR
364 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
365 wxAlignment align = wxALIGN_CENTER,
366 int flags = wxDATAVIEW_COL_RESIZABLE );
1286b7ba 367 bool AppendDateColumn( const wxString &label, unsigned int model_column,
87f0efe2
RR
368 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
369 wxAlignment align = wxALIGN_CENTER,
370 int flags = wxDATAVIEW_COL_RESIZABLE );
1286b7ba 371 bool AppendBitmapColumn( const wxString &label, unsigned int model_column,
87f0efe2
RR
372 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
373 wxAlignment align = wxALIGN_CENTER,
374 int flags = wxDATAVIEW_COL_RESIZABLE );
1286b7ba 375 bool AppendTextColumn( const wxBitmap &label, unsigned int model_column,
87f0efe2
RR
376 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
377 wxAlignment align = wxALIGN_CENTER,
378 int flags = wxDATAVIEW_COL_RESIZABLE );
1286b7ba 379 bool AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
87f0efe2
RR
380 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH,
381 wxAlignment align = wxALIGN_CENTER,
382 int flags = wxDATAVIEW_COL_RESIZABLE );
1286b7ba 383 bool AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
87f0efe2
RR
384 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH,
385 wxAlignment align = wxALIGN_CENTER,
386 int flags = wxDATAVIEW_COL_RESIZABLE );
1286b7ba 387 bool AppendDateColumn( const wxBitmap &label, unsigned int model_column,
87f0efe2
RR
388 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1,
389 wxAlignment align = wxALIGN_CENTER,
390 int flags = wxDATAVIEW_COL_RESIZABLE );
1286b7ba 391 bool AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
87f0efe2
RR
392 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1,
393 wxAlignment align = wxALIGN_CENTER,
394 int flags = wxDATAVIEW_COL_RESIZABLE );
07a84e7b 395
f554a14b 396 virtual bool AppendColumn( wxDataViewColumn *col );
9861f022
RR
397
398 virtual unsigned int GetColumnCount() const;
399
0a71f9e9 400 virtual bool DeleteColumn( unsigned int pos );
fa28826d 401 virtual bool ClearColumns();
0a71f9e9 402 virtual wxDataViewColumn* GetColumn( unsigned int pos );
f554a14b 403
e0062c04 404 // TODO selection code
6ff7eee7 405
239eaa41 406private:
e0062c04 407 wxDataViewModel *m_model;
fa28826d 408 wxList m_cols;
e0062c04 409 wxDataViewEventModelNotifier *m_eventNotifier;
30715fa1 410
239eaa41 411protected:
260b9be7 412 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase)
239eaa41 413};
bcd846ea 414
eb7f97f8
RR
415// ----------------------------------------------------------------------------
416// wxDataViewEvent - the event class for the wxDataViewCtrl notifications
417// ----------------------------------------------------------------------------
418
2f799ae8 419class WXDLLIMPEXP_ADV wxDataViewEvent : public wxNotifyEvent
eb7f97f8
RR
420{
421public:
422 wxDataViewEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
423 : wxNotifyEvent(commandType, winid),
e0062c04 424 m_item(0),
eb7f97f8 425 m_col(-1),
eb7f97f8
RR
426 m_model(NULL),
427 m_value(wxNullVariant),
31fb32e1 428 m_column(NULL)
eb7f97f8
RR
429 { }
430
431 wxDataViewEvent(const wxDataViewEvent& event)
432 : wxNotifyEvent(event),
e0062c04 433 m_item(event.m_item),
eb7f97f8 434 m_col(event.m_col),
eb7f97f8
RR
435 m_model(event.m_model),
436 m_value(event.m_value),
31fb32e1 437 m_column(event.m_column)
eb7f97f8
RR
438 { }
439
e0062c04
RR
440 wxDataViewItem GetItem() const { return m_item; }
441 void SetItem( const wxDataViewItem &item ) { m_item = item; }
442
eb7f97f8
RR
443 int GetColumn() const { return m_col; }
444 void SetColumn( int col ) { m_col = col; }
9861f022 445
eb7f97f8
RR
446 wxDataViewModel* GetModel() const { return m_model; }
447 void SetModel( wxDataViewModel *model ) { m_model = model; }
9861f022 448
eb7f97f8
RR
449 const wxVariant &GetValue() const { return m_value; }
450 void SetValue( const wxVariant &value ) { m_value = value; }
451
31fb32e1
RR
452 // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only
453 void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; }
9861f022 454 wxDataViewColumn *GetDataViewColumn() const { return m_column; }
31fb32e1 455
eb7f97f8
RR
456 virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); }
457
458protected:
e0062c04 459 wxDataViewItem m_item;
eb7f97f8 460 int m_col;
eb7f97f8
RR
461 wxDataViewModel *m_model;
462 wxVariant m_value;
31fb32e1 463 wxDataViewColumn *m_column;
eb7f97f8
RR
464
465private:
466 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent)
467};
468
469BEGIN_DECLARE_EVENT_TYPES()
e0062c04
RR
470 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_SELECTED, -1)
471 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, -1)
e07c1146
PC
472 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1)
473 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1)
c0a66d92 474 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, -1)
1821abd1 475 // notifications from the model to the control
e0062c04
RR
476 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED, -1)
477 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED, -1)
478 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_CHANGED, -1)
1821abd1 479 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_VALUE_CHANGED, -1)
1821abd1 480 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_MODEL_CLEARED, -1)
eb7f97f8
RR
481END_DECLARE_EVENT_TYPES()
482
483typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
484
485#define wxDataViewEventHandler(func) \
486 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func)
487
488#define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \
489 wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn))
490
e0062c04
RR
491#define EVT_DATAVIEW_ITEM_SELECTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_SELECTED, id, fn)
492#define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn)
31fb32e1
RR
493#define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn)
494#define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
c0a66d92 495#define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
eb7f97f8 496
e0062c04
RR
497#define EVT_DATAVIEW_MODEL_ITEM_ADDED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_APPENDED, id, fn)
498#define EVT_DATAVIEW_MODEL_ITEM_DELETED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_DELETED, id, fn)
499#define EVT_DATAVIEW_MODEL_ITEM_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_ITEM_CHANGED, id, fn)
1821abd1 500#define EVT_DATAVIEW_MODEL_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_VALUE_CHANGED, id, fn)
1821abd1
RR
501#define EVT_DATAVIEW_MODEL_CLEARED(id, fn) wx__DECLARE_DATAVIEWEVT(MODEL_CLEARED, id, fn)
502
eb7f97f8 503
4ed7af08
RR
504#if defined(wxUSE_GENERICDATAVIEWCTRL)
505 #include "wx/generic/dataview.h"
506#elif defined(__WXGTK20__)
bcd846ea
RR
507 #include "wx/gtk/dataview.h"
508#elif defined(__WXMAC__)
c0a66d92 509 #include "wx/mac/dataview.h"
bcd846ea
RR
510#else
511 #include "wx/generic/dataview.h"
512#endif
513
514#endif // wxUSE_DATAVIEWCTRL
515
516#endif
517 // _WX_DATAVIEW_H_BASE_