]>
Commit | Line | Data |
---|---|---|
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" |
239eaa41 | 23 | |
4ed7af08 RR |
24 | |
25 | #if defined(__WXGTK20__) | |
26 | // for testing | |
31fb32e1 | 27 | // #define wxUSE_GENERICDATAVIEWCTRL 1 |
4ed7af08 RR |
28 | #elif defined(__WXMAC__) |
29 | #define wxUSE_GENERICDATAVIEWCTRL 1 | |
30 | #else | |
31 | #define wxUSE_GENERICDATAVIEWCTRL 1 | |
32 | #endif | |
33 | ||
bcd846ea | 34 | // ---------------------------------------------------------------------------- |
f554a14b | 35 | // wxDataViewCtrl flags |
bcd846ea RR |
36 | // ---------------------------------------------------------------------------- |
37 | ||
239eaa41 RR |
38 | // ---------------------------------------------------------------------------- |
39 | // wxDataViewCtrl globals | |
40 | // ---------------------------------------------------------------------------- | |
bcd846ea | 41 | |
f460c29d RD |
42 | class WXDLLIMPEXP_ADV wxDataViewModel; |
43 | class WXDLLIMPEXP_ADV wxDataViewListModel; | |
44 | class WXDLLIMPEXP_ADV wxDataViewCtrl; | |
45 | class WXDLLIMPEXP_ADV wxDataViewColumn; | |
baa9ebc4 | 46 | class WXDLLIMPEXP_ADV wxDataViewRenderer; |
fa28826d | 47 | |
f460c29d | 48 | extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxDataViewCtrlNameStr[]; |
bcd846ea | 49 | |
f554a14b | 50 | // --------------------------------------------------------- |
239eaa41 | 51 | // wxDataViewModel |
f554a14b | 52 | // --------------------------------------------------------- |
239eaa41 | 53 | |
f460c29d | 54 | class WXDLLIMPEXP_ADV wxDataViewModel: public wxObject |
239eaa41 RR |
55 | { |
56 | public: | |
57 | wxDataViewModel() { } | |
58 | virtual ~wxDataViewModel() { } | |
f554a14b | 59 | |
239eaa41 | 60 | protected: |
260b9be7 | 61 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewModel) |
239eaa41 RR |
62 | }; |
63 | ||
f554a14b | 64 | // --------------------------------------------------------- |
239eaa41 | 65 | // wxDataViewListModelNotifier |
f554a14b | 66 | // --------------------------------------------------------- |
239eaa41 | 67 | |
8f850e28 | 68 | |
f460c29d | 69 | class WXDLLIMPEXP_ADV wxDataViewListModelNotifier: public wxObject |
239eaa41 RR |
70 | { |
71 | public: | |
72 | wxDataViewListModelNotifier() { } | |
73 | virtual ~wxDataViewListModelNotifier() { } | |
f554a14b | 74 | |
239eaa41 RR |
75 | virtual bool RowAppended() = 0; |
76 | virtual bool RowPrepended() = 0; | |
0a71f9e9 RR |
77 | virtual bool RowInserted( unsigned int before ) = 0; |
78 | virtual bool RowDeleted( unsigned int row ) = 0; | |
79 | virtual bool RowChanged( unsigned int row ) = 0; | |
80 | virtual bool ValueChanged( unsigned int col, unsigned int row ) = 0; | |
81 | virtual bool RowsReordered( unsigned int *new_order ) = 0; | |
239eaa41 | 82 | virtual bool Cleared() = 0; |
f554a14b | 83 | |
8f850e28 RR |
84 | void SetOwner( wxDataViewListModel *owner ) { m_owner = owner; } |
85 | wxDataViewListModel *GetOwner() { return m_owner; } | |
f554a14b | 86 | |
8f850e28 RR |
87 | private: |
88 | wxDataViewListModel *m_owner; | |
64ffb888 | 89 | }; |
239eaa41 | 90 | |
f554a14b | 91 | // --------------------------------------------------------- |
239eaa41 | 92 | // wxDataViewListModel |
f554a14b | 93 | // --------------------------------------------------------- |
239eaa41 | 94 | |
f460c29d | 95 | class WXDLLIMPEXP_ADV wxDataViewViewingColumn: public wxObject |
8f850e28 RR |
96 | { |
97 | public: | |
0a71f9e9 | 98 | wxDataViewViewingColumn( wxDataViewColumn *view_column, unsigned int model_column ) |
8f850e28 RR |
99 | { |
100 | m_viewColumn = view_column; | |
101 | m_modelColumn = model_column; | |
102 | } | |
f554a14b | 103 | |
8f850e28 | 104 | wxDataViewColumn *m_viewColumn; |
6ff7eee7 | 105 | unsigned int m_modelColumn; |
8f850e28 RR |
106 | }; |
107 | ||
f460c29d | 108 | class WXDLLIMPEXP_ADV wxDataViewListModel: public wxDataViewModel |
239eaa41 RR |
109 | { |
110 | public: | |
111 | wxDataViewListModel(); | |
112 | virtual ~wxDataViewListModel(); | |
113 | ||
0a71f9e9 RR |
114 | virtual unsigned int GetNumberOfRows() = 0; |
115 | virtual unsigned int GetNumberOfCols() = 0; | |
a7f61f76 | 116 | // return type as reported by wxVariant |
0a71f9e9 | 117 | virtual wxString GetColType( unsigned int col ) = 0; |
a7f61f76 | 118 | // get value into a wxVariant |
0a71f9e9 | 119 | virtual void GetValue( wxVariant &variant, unsigned int col, unsigned int row ) = 0; |
a7f61f76 | 120 | // set value, call ValueChanged() afterwards! |
0a71f9e9 | 121 | virtual bool SetValue( wxVariant &variant, unsigned int col, unsigned int row ) = 0; |
239eaa41 RR |
122 | |
123 | // delegated notifiers | |
8981608c RR |
124 | virtual bool RowAppended(); |
125 | virtual bool RowPrepended(); | |
0a71f9e9 RR |
126 | virtual bool RowInserted( unsigned int before ); |
127 | virtual bool RowDeleted( unsigned int row ); | |
128 | virtual bool RowChanged( unsigned int row ); | |
129 | virtual bool ValueChanged( unsigned int col, unsigned int row ); | |
130 | virtual bool RowsReordered( unsigned int *new_order ); | |
8981608c | 131 | virtual bool Cleared(); |
b5d777c7 | 132 | |
f554a14b | 133 | // Used internally |
0a71f9e9 | 134 | virtual void AddViewingColumn( wxDataViewColumn *view_column, unsigned int model_column ); |
8981608c | 135 | virtual void RemoveViewingColumn( wxDataViewColumn *column ); |
f554a14b | 136 | |
8f850e28 RR |
137 | virtual void AddNotifier( wxDataViewListModelNotifier *notifier ); |
138 | virtual void RemoveNotifier( wxDataViewListModelNotifier *notifier ); | |
f554a14b | 139 | |
8f850e28 RR |
140 | wxList m_notifiers; |
141 | wxList m_viewingColumns; | |
239eaa41 RR |
142 | |
143 | protected: | |
260b9be7 | 144 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewListModel) |
239eaa41 RR |
145 | }; |
146 | ||
f554a14b | 147 | // --------------------------------------------------------- |
8981608c | 148 | // wxDataViewSortedListModel |
f554a14b | 149 | // --------------------------------------------------------- |
8981608c RR |
150 | |
151 | typedef int (wxCALLBACK *wxDataViewListModelCompare) | |
0a71f9e9 | 152 | (unsigned int row1, unsigned int row2, unsigned int col, wxDataViewListModel* model ); |
8981608c | 153 | |
0a71f9e9 | 154 | WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_SIZE_T(unsigned int, wxDataViewSortedIndexArray, WXDLLIMPEXP_ADV); |
8981608c | 155 | |
f460c29d | 156 | class WXDLLIMPEXP_ADV wxDataViewSortedListModel: public wxDataViewListModel |
8981608c RR |
157 | { |
158 | public: | |
159 | wxDataViewSortedListModel( wxDataViewListModel *child ); | |
160 | virtual ~wxDataViewSortedListModel(); | |
161 | ||
31fb32e1 RR |
162 | void SetAscending( bool ascending ) { m_ascending = ascending; } |
163 | bool GetAscending() { return m_ascending; } | |
164 | ||
0a71f9e9 RR |
165 | virtual unsigned int GetNumberOfRows(); |
166 | virtual unsigned int GetNumberOfCols(); | |
8981608c | 167 | // return type as reported by wxVariant |
0a71f9e9 | 168 | virtual wxString GetColType( unsigned int col ); |
8981608c | 169 | // get value into a wxVariant |
0a71f9e9 | 170 | virtual void GetValue( wxVariant &variant, unsigned int col, unsigned int row ); |
8981608c | 171 | // set value, call ValueChanged() afterwards! |
0a71f9e9 | 172 | virtual bool SetValue( wxVariant &variant, unsigned int col, unsigned int row ); |
8981608c | 173 | |
4627af27 | 174 | // called from user |
8981608c RR |
175 | virtual bool RowAppended(); |
176 | virtual bool RowPrepended(); | |
0a71f9e9 RR |
177 | virtual bool RowInserted( unsigned int before ); |
178 | virtual bool RowDeleted( unsigned int row ); | |
179 | virtual bool RowChanged( unsigned int row ); | |
180 | virtual bool ValueChanged( unsigned int col, unsigned int row ); | |
181 | virtual bool RowsReordered( unsigned int *new_order ); | |
8981608c RR |
182 | virtual bool Cleared(); |
183 | ||
4627af27 RR |
184 | // called if child's notifiers are called |
185 | bool ChildRowAppended(); | |
186 | bool ChildRowPrepended(); | |
0a71f9e9 RR |
187 | bool ChildRowInserted( unsigned int before ); |
188 | bool ChildRowDeleted( unsigned int row ); | |
189 | bool ChildRowChanged( unsigned int row ); | |
190 | bool ChildValueChanged( unsigned int col, unsigned int row ); | |
191 | bool ChildRowsReordered( unsigned int *new_order ); | |
4627af27 | 192 | bool ChildCleared(); |
4eccd3a1 | 193 | |
8f850e28 RR |
194 | virtual void Resort(); |
195 | ||
8981608c | 196 | private: |
31fb32e1 | 197 | bool m_ascending; |
8981608c RR |
198 | wxDataViewListModel *m_child; |
199 | wxDataViewSortedIndexArray m_array; | |
4eccd3a1 | 200 | wxDataViewListModelNotifier *m_notifierOnChild; |
31fb32e1 RR |
201 | |
202 | void InitStatics(); // BAD | |
8981608c RR |
203 | |
204 | protected: | |
205 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewSortedListModel) | |
206 | }; | |
207 | ||
f554a14b | 208 | // --------------------------------------------------------- |
baa9ebc4 | 209 | // wxDataViewRendererBase |
f554a14b | 210 | // --------------------------------------------------------- |
fa28826d | 211 | |
6842a71a | 212 | enum wxDataViewCellMode |
fa28826d | 213 | { |
6842a71a RR |
214 | wxDATAVIEW_CELL_INERT, |
215 | wxDATAVIEW_CELL_ACTIVATABLE, | |
216 | wxDATAVIEW_CELL_EDITABLE | |
fa28826d RR |
217 | }; |
218 | ||
6842a71a RR |
219 | enum wxDataViewCellRenderState |
220 | { | |
221 | wxDATAVIEW_CELL_SELECTED = 1, | |
222 | wxDATAVIEW_CELL_PRELIT = 2, | |
223 | wxDATAVIEW_CELL_INSENSITIVE = 4, | |
224 | wxDATAVIEW_CELL_FOCUSED = 8 | |
225 | }; | |
226 | ||
baa9ebc4 | 227 | class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject |
6842a71a RR |
228 | { |
229 | public: | |
baa9ebc4 | 230 | wxDataViewRendererBase( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); |
6842a71a | 231 | |
f554a14b WS |
232 | virtual bool SetValue( const wxVariant& WXUNUSED(value) ) { return true; } |
233 | virtual bool GetValue( wxVariant& WXUNUSED(value) ) { return true; } | |
234 | virtual bool Validate( wxVariant& WXUNUSED(value) ) { return true; } | |
235 | ||
0fdc2321 RR |
236 | wxString GetVariantType() { return m_variantType; } |
237 | wxDataViewCellMode GetMode() { return m_mode; } | |
f554a14b | 238 | |
6842a71a RR |
239 | void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; } |
240 | wxDataViewColumn* GetOwner() { return m_owner; } | |
f554a14b | 241 | |
a7f61f76 | 242 | protected: |
6842a71a RR |
243 | wxDataViewCellMode m_mode; |
244 | wxString m_variantType; | |
245 | wxDataViewColumn *m_owner; | |
246 | ||
247 | protected: | |
baa9ebc4 | 248 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase) |
6842a71a RR |
249 | }; |
250 | ||
f554a14b | 251 | // --------------------------------------------------------- |
6842a71a | 252 | // wxDataViewColumnBase |
f554a14b | 253 | // --------------------------------------------------------- |
6842a71a | 254 | |
fa28826d RR |
255 | enum wxDataViewColumnFlags |
256 | { | |
257 | wxDATAVIEW_COL_RESIZABLE = 1, | |
258 | wxDATAVIEW_COL_SORTABLE = 2, | |
259 | wxDATAVIEW_COL_HIDDEN = 4 | |
260 | }; | |
261 | ||
f460c29d | 262 | class WXDLLIMPEXP_ADV wxDataViewColumnBase: public wxObject |
fa28826d RR |
263 | { |
264 | public: | |
baa9ebc4 | 265 | wxDataViewColumnBase( const wxString &title, wxDataViewRenderer *renderer, unsigned int model_column, |
008b5a66 | 266 | int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); |
07a84e7b RR |
267 | wxDataViewColumnBase( const wxBitmap &bitmap, wxDataViewRenderer *renderer, unsigned int model_column, |
268 | int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE ); | |
d3c7fc99 | 269 | virtual ~wxDataViewColumnBase(); |
fa28826d RR |
270 | |
271 | virtual void SetTitle( const wxString &title ); | |
272 | virtual wxString GetTitle(); | |
07b6378f | 273 | |
07a84e7b RR |
274 | virtual void SetBitmap( const wxBitmap &bitmap ); |
275 | virtual const wxBitmap &GetBitmap(); | |
47cef10f RR |
276 | |
277 | virtual void SetAlignment( wxAlignment align ) = 0; | |
31fb32e1 RR |
278 | |
279 | virtual void SetSortable( bool sortable ) = 0; | |
280 | virtual bool GetSortable() = 0; | |
47cef10f | 281 | virtual void SetSortOrder( bool ascending ) = 0; |
31fb32e1 | 282 | virtual bool IsSortOrderAscending() = 0; |
07a84e7b | 283 | |
baa9ebc4 | 284 | wxDataViewRenderer* GetRenderer() { return m_renderer; } |
f554a14b | 285 | |
baa9ebc4 | 286 | unsigned int GetModelColumn() { return m_model_column; } |
f554a14b | 287 | |
6842a71a RR |
288 | void SetOwner( wxDataViewCtrl *owner ) { m_owner = owner; } |
289 | wxDataViewCtrl *GetOwner() { return m_owner; } | |
07b6378f | 290 | |
533544f2 | 291 | virtual int GetWidth() = 0; |
07b6378f | 292 | |
fa28826d RR |
293 | private: |
294 | wxDataViewCtrl *m_ctrl; | |
baa9ebc4 | 295 | wxDataViewRenderer *m_renderer; |
6842a71a | 296 | int m_model_column; |
fa28826d RR |
297 | int m_flags; |
298 | wxString m_title; | |
07a84e7b | 299 | wxBitmap m_bitmap; |
6842a71a | 300 | wxDataViewCtrl *m_owner; |
fa28826d RR |
301 | |
302 | protected: | |
303 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase) | |
304 | }; | |
305 | ||
f554a14b | 306 | // --------------------------------------------------------- |
239eaa41 | 307 | // wxDataViewCtrlBase |
f554a14b | 308 | // --------------------------------------------------------- |
239eaa41 | 309 | |
c21f7aa1 RR |
310 | #define wxDV_SINGLE 0x0000 // for convenience |
311 | #define wxDV_MULTIPLE 0x0020 // can select multiple items | |
312 | ||
f460c29d | 313 | class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl |
239eaa41 RR |
314 | { |
315 | public: | |
316 | wxDataViewCtrlBase(); | |
d3c7fc99 | 317 | virtual ~wxDataViewCtrlBase(); |
f554a14b | 318 | |
6e2e590f RR |
319 | virtual bool AssociateModel( wxDataViewListModel *model ); |
320 | wxDataViewListModel* GetModel(); | |
f554a14b | 321 | |
07a84e7b | 322 | // short cuts |
0a71f9e9 RR |
323 | virtual bool AppendTextColumn( const wxString &label, unsigned int model_column ); |
324 | virtual bool AppendToggleColumn( const wxString &label, unsigned int model_column ); | |
325 | virtual bool AppendProgressColumn( const wxString &label, unsigned int model_column ); | |
326 | virtual bool AppendDateColumn( const wxString &label, unsigned int model_column ); | |
07a84e7b RR |
327 | virtual bool AppendBitmapColumn( const wxString &label, unsigned int model_column ); |
328 | virtual bool AppendTextColumn( const wxBitmap &label, unsigned int model_column ); | |
329 | virtual bool AppendToggleColumn( const wxBitmap &label, unsigned int model_column ); | |
330 | virtual bool AppendProgressColumn( const wxBitmap &label, unsigned int model_column ); | |
331 | virtual bool AppendDateColumn( const wxBitmap &label, unsigned int model_column ); | |
332 | virtual bool AppendBitmapColumn( const wxBitmap &label, unsigned int model_column ); | |
333 | ||
f554a14b | 334 | virtual bool AppendColumn( wxDataViewColumn *col ); |
0a71f9e9 RR |
335 | virtual unsigned int GetNumberOfColumns(); |
336 | virtual bool DeleteColumn( unsigned int pos ); | |
fa28826d | 337 | virtual bool ClearColumns(); |
0a71f9e9 | 338 | virtual wxDataViewColumn* GetColumn( unsigned int pos ); |
f554a14b | 339 | |
6ff7eee7 RR |
340 | virtual void SetSelection( int row ) = 0; // -1 for unselect |
341 | inline void ClearSelection() { SetSelection( -1 ); } | |
fc211fe5 | 342 | virtual void Unselect( unsigned int row ) = 0; |
6ff7eee7 RR |
343 | virtual void SetSelectionRange( unsigned int from, unsigned int to ) = 0; |
344 | virtual void SetSelections( const wxArrayInt& aSelections) = 0; | |
345 | ||
346 | virtual bool IsSelected( unsigned int row ) const = 0; | |
347 | virtual int GetSelection() const = 0; | |
348 | virtual int GetSelections(wxArrayInt& aSelections) const = 0; | |
349 | ||
239eaa41 | 350 | private: |
6e2e590f | 351 | wxDataViewListModel *m_model; |
fa28826d | 352 | wxList m_cols; |
bcd846ea | 353 | |
239eaa41 | 354 | protected: |
260b9be7 | 355 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase) |
239eaa41 | 356 | }; |
bcd846ea | 357 | |
eb7f97f8 RR |
358 | |
359 | // ---------------------------------------------------------------------------- | |
360 | // wxDataViewEvent - the event class for the wxDataViewCtrl notifications | |
361 | // ---------------------------------------------------------------------------- | |
362 | ||
2f799ae8 | 363 | class WXDLLIMPEXP_ADV wxDataViewEvent : public wxNotifyEvent |
eb7f97f8 RR |
364 | { |
365 | public: | |
366 | wxDataViewEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) | |
367 | : wxNotifyEvent(commandType, winid), | |
368 | m_col(-1), | |
369 | m_row(-1), | |
370 | m_model(NULL), | |
371 | m_value(wxNullVariant), | |
31fb32e1 RR |
372 | m_editCancelled(false), |
373 | m_column(NULL) | |
eb7f97f8 RR |
374 | { } |
375 | ||
376 | wxDataViewEvent(const wxDataViewEvent& event) | |
377 | : wxNotifyEvent(event), | |
378 | m_col(event.m_col), | |
379 | m_row(event.m_col), | |
380 | m_model(event.m_model), | |
381 | m_value(event.m_value), | |
31fb32e1 RR |
382 | m_editCancelled(event.m_editCancelled), |
383 | m_column(event.m_column) | |
eb7f97f8 RR |
384 | { } |
385 | ||
386 | int GetColumn() const { return m_col; } | |
387 | void SetColumn( int col ) { m_col = col; } | |
388 | int GetRow() const { return m_row; } | |
389 | void SetRow( int row ) { m_row = row; } | |
390 | wxDataViewModel* GetModel() const { return m_model; } | |
391 | void SetModel( wxDataViewModel *model ) { m_model = model; } | |
392 | const wxVariant &GetValue() const { return m_value; } | |
393 | void SetValue( const wxVariant &value ) { m_value = value; } | |
394 | ||
31fb32e1 RR |
395 | // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only |
396 | void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; } | |
397 | wxDataViewColumn *GetDataViewColumn() { return m_column; } | |
398 | ||
eb7f97f8 RR |
399 | // was label editing canceled? (for wxEVT_COMMAND_DATVIEW_END_LABEL_EDIT only) |
400 | bool IsEditCancelled() const { return m_editCancelled; } | |
401 | void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } | |
402 | ||
403 | virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); } | |
404 | ||
405 | protected: | |
406 | int m_col; | |
407 | int m_row; | |
408 | wxDataViewModel *m_model; | |
409 | wxVariant m_value; | |
410 | bool m_editCancelled; | |
31fb32e1 | 411 | wxDataViewColumn *m_column; |
eb7f97f8 RR |
412 | |
413 | private: | |
414 | DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent) | |
415 | }; | |
416 | ||
417 | BEGIN_DECLARE_EVENT_TYPES() | |
418 | DECLARE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ROW_SELECTED, -1) | |
f828871d | 419 | DECLARE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ROW_ACTIVATED, -1) |
31fb32e1 RR |
420 | DECLARE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, -1) |
421 | DECLARE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, -1) | |
eb7f97f8 RR |
422 | END_DECLARE_EVENT_TYPES() |
423 | ||
424 | typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&); | |
425 | ||
426 | #define wxDataViewEventHandler(func) \ | |
427 | (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func) | |
428 | ||
429 | #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \ | |
430 | wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn)) | |
431 | ||
432 | #define EVT_DATAVIEW_ROW_SELECTED(id, fn) wx__DECLARE_DATAVIEWEVT(ROW_SELECTED, id, fn) | |
f828871d | 433 | #define EVT_DATAVIEW_ROW_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ROW_ACTIVATED, id, fn) |
31fb32e1 RR |
434 | #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn) |
435 | #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn) | |
eb7f97f8 RR |
436 | |
437 | ||
4ed7af08 RR |
438 | #if defined(wxUSE_GENERICDATAVIEWCTRL) |
439 | #include "wx/generic/dataview.h" | |
440 | #elif defined(__WXGTK20__) | |
bcd846ea RR |
441 | #include "wx/gtk/dataview.h" |
442 | #elif defined(__WXMAC__) | |
07b6378f WS |
443 | // TODO |
444 | // #include "wx/mac/dataview.h" | |
bcd846ea RR |
445 | #else |
446 | #include "wx/generic/dataview.h" | |
447 | #endif | |
448 | ||
449 | #endif // wxUSE_DATAVIEWCTRL | |
450 | ||
451 | #endif | |
452 | // _WX_DATAVIEW_H_BASE_ |