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