]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/dataview.h | |
3 | // Purpose: wxDataViewCtrl base classes | |
4 | // Author: Robert Roebling | |
5 | // Modified by: Bo Yang | |
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 | ||
19 | #include "wx/textctrl.h" | |
20 | #include "wx/headercol.h" | |
21 | #include "wx/variant.h" | |
22 | #include "wx/dynarray.h" | |
23 | #include "wx/icon.h" | |
24 | #include "wx/weakref.h" | |
25 | #include "wx/vector.h" | |
26 | #include "wx/dataobj.h" | |
27 | ||
28 | class WXDLLIMPEXP_FWD_CORE wxImageList; | |
29 | ||
30 | #if !(defined(__WXGTK20__) || defined(__WXOSX_CARBON__)) || defined(__WXUNIVERSAL__) | |
31 | // #if !(defined(__WXMAC__)) || defined(__WXUNIVERSAL__) | |
32 | #define wxHAS_GENERIC_DATAVIEWCTRL | |
33 | #endif | |
34 | ||
35 | // ---------------------------------------------------------------------------- | |
36 | // wxDataViewCtrl flags | |
37 | // ---------------------------------------------------------------------------- | |
38 | ||
39 | // ---------------------------------------------------------------------------- | |
40 | // wxDataViewCtrl globals | |
41 | // ---------------------------------------------------------------------------- | |
42 | ||
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; | |
49 | ||
50 | extern WXDLLIMPEXP_DATA_ADV(const char) wxDataViewCtrlNameStr[]; | |
51 | ||
52 | // the default width of new (text) columns: | |
53 | #define wxDVC_DEFAULT_WIDTH 80 | |
54 | ||
55 | // the default width of new toggle columns: | |
56 | #define wxDVC_TOGGLE_DEFAULT_WIDTH 30 | |
57 | ||
58 | // the default minimal width of the columns: | |
59 | #define wxDVC_DEFAULT_MINWIDTH 30 | |
60 | ||
61 | // The default alignment of wxDataViewRenderers is to take | |
62 | // the alignment from the column it owns. | |
63 | #define wxDVR_DEFAULT_ALIGNMENT -1 | |
64 | ||
65 | ||
66 | // --------------------------------------------------------- | |
67 | // wxDataViewItem | |
68 | // --------------------------------------------------------- | |
69 | ||
70 | class WXDLLIMPEXP_ADV wxDataViewItem | |
71 | { | |
72 | public: | |
73 | wxDataViewItem( void* id = NULL ) | |
74 | { m_id = id; } | |
75 | wxDataViewItem( const wxDataViewItem &item ) | |
76 | { m_id = item.m_id; } | |
77 | bool IsOk() const { return m_id != NULL; } | |
78 | void* GetID() const { return m_id; } | |
79 | operator const void* () const { return m_id; } | |
80 | ||
81 | #ifdef __WXDEBUG__ | |
82 | void Print( const wxString &text ) const; | |
83 | #endif | |
84 | ||
85 | private: | |
86 | void* m_id; | |
87 | }; | |
88 | ||
89 | bool operator == (const wxDataViewItem &left, const wxDataViewItem &right); | |
90 | ||
91 | WX_DEFINE_ARRAY(wxDataViewItem, wxDataViewItemArray); | |
92 | ||
93 | // --------------------------------------------------------- | |
94 | // wxDataViewModelNotifier | |
95 | // --------------------------------------------------------- | |
96 | ||
97 | class WXDLLIMPEXP_ADV wxDataViewModelNotifier | |
98 | { | |
99 | public: | |
100 | wxDataViewModelNotifier() { m_owner = NULL; } | |
101 | virtual ~wxDataViewModelNotifier() { m_owner = NULL; } | |
102 | ||
103 | virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0; | |
104 | virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0; | |
105 | virtual bool ItemChanged( const wxDataViewItem &item ) = 0; | |
106 | virtual bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items ); | |
107 | virtual bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items ); | |
108 | virtual bool ItemsChanged( const wxDataViewItemArray &items ); | |
109 | virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ) = 0; | |
110 | virtual bool Cleared() = 0; | |
111 | ||
112 | virtual void Resort() = 0; | |
113 | ||
114 | void SetOwner( wxDataViewModel *owner ) { m_owner = owner; } | |
115 | wxDataViewModel *GetOwner() const { return m_owner; } | |
116 | ||
117 | private: | |
118 | wxDataViewModel *m_owner; | |
119 | }; | |
120 | ||
121 | ||
122 | ||
123 | // ---------------------------------------------------------------------------- | |
124 | // wxDataViewItemAttr: a structure containing the visual attributes of an item | |
125 | // ---------------------------------------------------------------------------- | |
126 | ||
127 | // TODO: this should be renamed to wxItemAttr or something general like this | |
128 | ||
129 | class WXDLLIMPEXP_ADV wxDataViewItemAttr | |
130 | { | |
131 | public: | |
132 | // ctors | |
133 | wxDataViewItemAttr() | |
134 | { | |
135 | m_bold = false; | |
136 | m_italic = false; | |
137 | } | |
138 | ||
139 | // setters | |
140 | void SetColour(const wxColour& colour) { m_colour = colour; } | |
141 | void SetBold( bool set ) { m_bold = set; } | |
142 | void SetItalic( bool set ) { m_italic = set; } | |
143 | ||
144 | // accessors | |
145 | bool HasColour() const { return m_colour.Ok(); } | |
146 | const wxColour& GetColour() const { return m_colour; } | |
147 | ||
148 | bool GetBold() const { return m_bold; } | |
149 | bool GetItalic() const { return m_italic; } | |
150 | ||
151 | private: | |
152 | wxColour m_colour; | |
153 | bool m_bold; | |
154 | bool m_italic; | |
155 | }; | |
156 | ||
157 | ||
158 | // --------------------------------------------------------- | |
159 | // wxDataViewModel | |
160 | // --------------------------------------------------------- | |
161 | ||
162 | WX_DECLARE_LIST_WITH_DECL(wxDataViewModelNotifier, wxDataViewModelNotifiers, | |
163 | class WXDLLIMPEXP_ADV); | |
164 | ||
165 | class WXDLLIMPEXP_ADV wxDataViewModel: public wxObjectRefData | |
166 | { | |
167 | public: | |
168 | wxDataViewModel(); | |
169 | ||
170 | virtual unsigned int GetColumnCount() const = 0; | |
171 | ||
172 | // return type as reported by wxVariant | |
173 | virtual wxString GetColumnType( unsigned int col ) const = 0; | |
174 | ||
175 | // get value into a wxVariant | |
176 | virtual void GetValue( wxVariant &variant, | |
177 | const wxDataViewItem &item, unsigned int col ) const = 0; | |
178 | ||
179 | // set value, call ValueChanged() afterwards! | |
180 | virtual bool SetValue( const wxVariant &variant, | |
181 | const wxDataViewItem &item, unsigned int col ) = 0; | |
182 | ||
183 | // Get text attribute, return false of default attributes should be used | |
184 | virtual bool GetAttr( const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) ) | |
185 | { return false; } | |
186 | ||
187 | // define hierachy | |
188 | virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const = 0; | |
189 | virtual bool IsContainer( const wxDataViewItem &item ) const = 0; | |
190 | // Is the container just a header or an item with all columns | |
191 | virtual bool HasContainerColumns(const wxDataViewItem& WXUNUSED(item)) const | |
192 | { return false; } | |
193 | virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const = 0; | |
194 | ||
195 | // delegated notifiers | |
196 | virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ); | |
197 | virtual bool ItemsAdded( const wxDataViewItem &parent, const wxDataViewItemArray &items ); | |
198 | virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ); | |
199 | virtual bool ItemsDeleted( const wxDataViewItem &parent, const wxDataViewItemArray &items ); | |
200 | virtual bool ItemChanged( const wxDataViewItem &item ); | |
201 | virtual bool ItemsChanged( const wxDataViewItemArray &items ); | |
202 | virtual bool ValueChanged( const wxDataViewItem &item, unsigned int col ); | |
203 | virtual bool Cleared(); | |
204 | ||
205 | // delegatd action | |
206 | virtual void Resort(); | |
207 | ||
208 | void AddNotifier( wxDataViewModelNotifier *notifier ); | |
209 | void RemoveNotifier( wxDataViewModelNotifier *notifier ); | |
210 | ||
211 | // default compare function | |
212 | virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, | |
213 | unsigned int column, bool ascending ); | |
214 | virtual bool HasDefaultCompare() const { return false; } | |
215 | ||
216 | // internal | |
217 | virtual bool IsVirtualListModel() const { return false; } | |
218 | ||
219 | protected: | |
220 | // the user should not delete this class directly: he should use DecRef() instead! | |
221 | virtual ~wxDataViewModel() { } | |
222 | ||
223 | wxDataViewModelNotifiers m_notifiers; | |
224 | }; | |
225 | ||
226 | // --------------------------------------------------------- | |
227 | // wxDataViewIndexListModel | |
228 | // --------------------------------------------------------- | |
229 | ||
230 | class WXDLLIMPEXP_ADV wxDataViewIndexListModel: public wxDataViewModel | |
231 | { | |
232 | public: | |
233 | wxDataViewIndexListModel( unsigned int initial_size = 0 ); | |
234 | ~wxDataViewIndexListModel(); | |
235 | ||
236 | virtual void GetValueByRow( wxVariant &variant, | |
237 | unsigned int row, unsigned int col ) const = 0; | |
238 | ||
239 | virtual bool SetValueByRow( const wxVariant &variant, | |
240 | unsigned int row, unsigned int col ) = 0; | |
241 | ||
242 | virtual bool GetAttrByRow( unsigned int WXUNUSED(row), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) ) | |
243 | { return false; } | |
244 | ||
245 | void RowPrepended(); | |
246 | void RowInserted( unsigned int before ); | |
247 | void RowAppended(); | |
248 | void RowDeleted( unsigned int row ); | |
249 | void RowsDeleted( const wxArrayInt &rows ); | |
250 | void RowChanged( unsigned int row ); | |
251 | void RowValueChanged( unsigned int row, unsigned int col ); | |
252 | void Reset( unsigned int new_size ); | |
253 | ||
254 | // convert to/from row/wxDataViewItem | |
255 | ||
256 | unsigned int GetRow( const wxDataViewItem &item ) const; | |
257 | wxDataViewItem GetItem( unsigned int row ) const; | |
258 | ||
259 | // compare based on index | |
260 | ||
261 | virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, | |
262 | unsigned int column, bool ascending ); | |
263 | virtual bool HasDefaultCompare() const; | |
264 | ||
265 | // implement base methods | |
266 | ||
267 | virtual void GetValue( wxVariant &variant, | |
268 | const wxDataViewItem &item, unsigned int col ) const; | |
269 | virtual bool SetValue( const wxVariant &variant, | |
270 | const wxDataViewItem &item, unsigned int col ); | |
271 | virtual bool GetAttr( const wxDataViewItem &item, unsigned int col, wxDataViewItemAttr &attr ); | |
272 | virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const; | |
273 | virtual bool IsContainer( const wxDataViewItem &item ) const; | |
274 | virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; | |
275 | ||
276 | // internal | |
277 | virtual bool IsVirtualListModel() const { return false; } | |
278 | unsigned int GetLastIndex() const { return m_lastIndex; } | |
279 | ||
280 | private: | |
281 | wxDataViewItemArray m_hash; | |
282 | unsigned int m_lastIndex; | |
283 | bool m_ordered; | |
284 | }; | |
285 | ||
286 | // --------------------------------------------------------- | |
287 | // wxDataViewVirtualListModel | |
288 | // --------------------------------------------------------- | |
289 | ||
290 | #ifdef __WXMAC__ | |
291 | // better than nothing | |
292 | typedef wxDataViewIndexListModel wxDataViewVirtualListModel; | |
293 | #else | |
294 | ||
295 | class WXDLLIMPEXP_ADV wxDataViewVirtualListModel: public wxDataViewModel | |
296 | { | |
297 | public: | |
298 | wxDataViewVirtualListModel( unsigned int initial_size = 0 ); | |
299 | ~wxDataViewVirtualListModel(); | |
300 | ||
301 | virtual void GetValueByRow( wxVariant &variant, | |
302 | unsigned int row, unsigned int col ) const = 0; | |
303 | ||
304 | virtual bool SetValueByRow( const wxVariant &variant, | |
305 | unsigned int row, unsigned int col ) = 0; | |
306 | ||
307 | virtual bool GetAttrByRow( unsigned int WXUNUSED(row), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) ) | |
308 | { return false; } | |
309 | ||
310 | void RowPrepended(); | |
311 | void RowInserted( unsigned int before ); | |
312 | void RowAppended(); | |
313 | void RowDeleted( unsigned int row ); | |
314 | void RowsDeleted( const wxArrayInt &rows ); | |
315 | void RowChanged( unsigned int row ); | |
316 | void RowValueChanged( unsigned int row, unsigned int col ); | |
317 | void Reset( unsigned int new_size ); | |
318 | ||
319 | // convert to/from row/wxDataViewItem | |
320 | ||
321 | unsigned int GetRow( const wxDataViewItem &item ) const; | |
322 | wxDataViewItem GetItem( unsigned int row ) const; | |
323 | ||
324 | // compare based on index | |
325 | ||
326 | virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, | |
327 | unsigned int column, bool ascending ); | |
328 | virtual bool HasDefaultCompare() const; | |
329 | ||
330 | // implement base methods | |
331 | ||
332 | virtual void GetValue( wxVariant &variant, | |
333 | const wxDataViewItem &item, unsigned int col ) const; | |
334 | virtual bool SetValue( const wxVariant &variant, | |
335 | const wxDataViewItem &item, unsigned int col ); | |
336 | virtual bool GetAttr( const wxDataViewItem &item, unsigned int col, wxDataViewItemAttr &attr ); | |
337 | virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const; | |
338 | virtual bool IsContainer( const wxDataViewItem &item ) const; | |
339 | virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; | |
340 | ||
341 | // internal | |
342 | virtual bool IsVirtualListModel() const { return true; } | |
343 | unsigned int GetLastIndex() const { return m_lastIndex; } | |
344 | ||
345 | private: | |
346 | wxDataViewItemArray m_hash; | |
347 | unsigned int m_lastIndex; | |
348 | bool m_ordered; | |
349 | }; | |
350 | #endif | |
351 | ||
352 | //----------------------------------------------------------------------------- | |
353 | // wxDataViewEditorCtrlEvtHandler | |
354 | //----------------------------------------------------------------------------- | |
355 | ||
356 | class wxDataViewEditorCtrlEvtHandler: public wxEvtHandler | |
357 | { | |
358 | public: | |
359 | wxDataViewEditorCtrlEvtHandler( wxControl *editor, wxDataViewRenderer *owner ); | |
360 | ||
361 | void AcceptChangesAndFinish(); | |
362 | void SetFocusOnIdle( bool focus = true ) { m_focusOnIdle = focus; } | |
363 | ||
364 | protected: | |
365 | void OnChar( wxKeyEvent &event ); | |
366 | void OnTextEnter( wxCommandEvent &event ); | |
367 | void OnKillFocus( wxFocusEvent &event ); | |
368 | void OnIdle( wxIdleEvent &event ); | |
369 | ||
370 | private: | |
371 | wxDataViewRenderer *m_owner; | |
372 | wxControl *m_editorCtrl; | |
373 | bool m_finished; | |
374 | bool m_focusOnIdle; | |
375 | ||
376 | private: | |
377 | DECLARE_EVENT_TABLE() | |
378 | }; | |
379 | ||
380 | // --------------------------------------------------------- | |
381 | // wxDataViewRendererBase | |
382 | // --------------------------------------------------------- | |
383 | ||
384 | enum wxDataViewCellMode | |
385 | { | |
386 | wxDATAVIEW_CELL_INERT, | |
387 | wxDATAVIEW_CELL_ACTIVATABLE, | |
388 | wxDATAVIEW_CELL_EDITABLE | |
389 | }; | |
390 | ||
391 | enum wxDataViewCellRenderState | |
392 | { | |
393 | wxDATAVIEW_CELL_SELECTED = 1, | |
394 | wxDATAVIEW_CELL_PRELIT = 2, | |
395 | wxDATAVIEW_CELL_INSENSITIVE = 4, | |
396 | wxDATAVIEW_CELL_FOCUSED = 8 | |
397 | }; | |
398 | ||
399 | class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject | |
400 | { | |
401 | public: | |
402 | wxDataViewRendererBase( const wxString &varianttype, | |
403 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
404 | int alignment = wxDVR_DEFAULT_ALIGNMENT ); | |
405 | ~wxDataViewRendererBase(); | |
406 | ||
407 | virtual bool Validate( wxVariant& WXUNUSED(value) ) | |
408 | { return true; } | |
409 | ||
410 | void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; } | |
411 | wxDataViewColumn* GetOwner() const { return m_owner; } | |
412 | ||
413 | // renderer properties: | |
414 | ||
415 | virtual bool SetValue( const wxVariant& WXUNUSED(value) ) = 0; | |
416 | virtual bool GetValue( wxVariant& WXUNUSED(value) ) const = 0; | |
417 | ||
418 | wxString GetVariantType() const { return m_variantType; } | |
419 | ||
420 | virtual void SetMode( wxDataViewCellMode mode ) = 0; | |
421 | virtual wxDataViewCellMode GetMode() const = 0; | |
422 | ||
423 | // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but | |
424 | // rather an "int"; that's because for rendering cells it's allowed | |
425 | // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM) | |
426 | virtual void SetAlignment( int align ) = 0; | |
427 | virtual int GetAlignment() const = 0; | |
428 | ||
429 | // in-place editing | |
430 | virtual bool HasEditorCtrl() const | |
431 | { return false; } | |
432 | virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent), | |
433 | wxRect WXUNUSED(labelRect), | |
434 | const wxVariant& WXUNUSED(value)) | |
435 | { return NULL; } | |
436 | virtual bool GetValueFromEditorCtrl(wxControl * WXUNUSED(editor), | |
437 | wxVariant& WXUNUSED(value)) | |
438 | { return false; } | |
439 | ||
440 | virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect ); | |
441 | virtual void CancelEditing(); | |
442 | virtual bool FinishEditing(); | |
443 | ||
444 | wxControl *GetEditorCtrl() { return m_editorCtrl; } | |
445 | ||
446 | protected: | |
447 | wxString m_variantType; | |
448 | wxDataViewColumn *m_owner; | |
449 | wxWeakRef<wxControl> m_editorCtrl; | |
450 | wxDataViewItem m_item; // for m_editorCtrl | |
451 | ||
452 | // internal utility: | |
453 | const wxDataViewCtrl* GetView() const; | |
454 | ||
455 | protected: | |
456 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase) | |
457 | }; | |
458 | ||
459 | //----------------------------------------------------------------------------- | |
460 | // wxDataViewIconText | |
461 | //----------------------------------------------------------------------------- | |
462 | ||
463 | class WXDLLIMPEXP_ADV wxDataViewIconText: public wxObject | |
464 | { | |
465 | public: | |
466 | wxDataViewIconText( const wxString &text = wxEmptyString, const wxIcon& icon = wxNullIcon ) | |
467 | : m_text(text), m_icon(icon) | |
468 | { } | |
469 | wxDataViewIconText( const wxDataViewIconText &other ) | |
470 | : wxObject() | |
471 | { m_icon = other.m_icon; m_text = other.m_text; } | |
472 | ||
473 | void SetText( const wxString &text ) { m_text = text; } | |
474 | wxString GetText() const { return m_text; } | |
475 | void SetIcon( const wxIcon &icon ) { m_icon = icon; } | |
476 | const wxIcon &GetIcon() const { return m_icon; } | |
477 | ||
478 | private: | |
479 | wxString m_text; | |
480 | wxIcon m_icon; | |
481 | ||
482 | private: | |
483 | DECLARE_DYNAMIC_CLASS(wxDataViewIconText) | |
484 | }; | |
485 | ||
486 | bool operator == (const wxDataViewIconText &one, const wxDataViewIconText &two); | |
487 | ||
488 | DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV) | |
489 | ||
490 | // --------------------------------------------------------- | |
491 | // wxDataViewColumnBase | |
492 | // --------------------------------------------------------- | |
493 | ||
494 | // for compatibility only, do not use | |
495 | enum wxDataViewColumnFlags | |
496 | { | |
497 | wxDATAVIEW_COL_RESIZABLE = wxCOL_RESIZABLE, | |
498 | wxDATAVIEW_COL_SORTABLE = wxCOL_SORTABLE, | |
499 | wxDATAVIEW_COL_REORDERABLE = wxCOL_REORDERABLE, | |
500 | wxDATAVIEW_COL_HIDDEN = wxCOL_HIDDEN | |
501 | }; | |
502 | ||
503 | class WXDLLIMPEXP_ADV wxDataViewColumnBase : public wxSettableHeaderColumn | |
504 | { | |
505 | public: | |
506 | // ctor for the text columns: takes ownership of renderer | |
507 | wxDataViewColumnBase(wxDataViewRenderer *renderer, | |
508 | unsigned int model_column) | |
509 | { | |
510 | Init(renderer, model_column); | |
511 | } | |
512 | ||
513 | // ctor for the bitmap columns | |
514 | wxDataViewColumnBase(const wxBitmap& bitmap, | |
515 | wxDataViewRenderer *renderer, | |
516 | unsigned int model_column) | |
517 | : m_bitmap(bitmap) | |
518 | { | |
519 | Init(renderer, model_column); | |
520 | } | |
521 | ||
522 | virtual ~wxDataViewColumnBase(); | |
523 | ||
524 | // setters: | |
525 | virtual void SetOwner( wxDataViewCtrl *owner ) | |
526 | { m_owner = owner; } | |
527 | ||
528 | // getters: | |
529 | unsigned int GetModelColumn() const { return static_cast<unsigned int>(m_model_column); } | |
530 | wxDataViewCtrl *GetOwner() const { return m_owner; } | |
531 | wxDataViewRenderer* GetRenderer() const { return m_renderer; } | |
532 | ||
533 | // implement some of base class pure virtuals (the rest is port-dependent | |
534 | // and done differently in generic and native versions) | |
535 | virtual void SetBitmap( const wxBitmap& bitmap ) { m_bitmap = bitmap; } | |
536 | virtual wxBitmap GetBitmap() const { return m_bitmap; } | |
537 | ||
538 | protected: | |
539 | wxDataViewRenderer *m_renderer; | |
540 | int m_model_column; | |
541 | wxBitmap m_bitmap; | |
542 | wxDataViewCtrl *m_owner; | |
543 | ||
544 | private: | |
545 | // common part of all ctors | |
546 | void Init(wxDataViewRenderer *renderer, unsigned int model_column); | |
547 | }; | |
548 | ||
549 | // --------------------------------------------------------- | |
550 | // wxDataViewCtrlBase | |
551 | // --------------------------------------------------------- | |
552 | ||
553 | #define wxDV_SINGLE 0x0000 // for convenience | |
554 | #define wxDV_MULTIPLE 0x0001 // can select multiple items | |
555 | ||
556 | #define wxDV_NO_HEADER 0x0002 // column titles not visible | |
557 | #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows | |
558 | #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns | |
559 | ||
560 | #define wxDV_ROW_LINES 0x0010 // alternating colour in rows | |
561 | #define wxDV_VARIABLE_LINE_HEIGHT 0x0020 // variable line height | |
562 | ||
563 | class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl | |
564 | { | |
565 | public: | |
566 | wxDataViewCtrlBase(); | |
567 | virtual ~wxDataViewCtrlBase(); | |
568 | ||
569 | virtual bool AssociateModel( wxDataViewModel *model ); | |
570 | wxDataViewModel* GetModel(); | |
571 | const wxDataViewModel* GetModel() const; | |
572 | ||
573 | // short cuts | |
574 | wxDataViewColumn *PrependTextColumn( const wxString &label, unsigned int model_column, | |
575 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
576 | wxAlignment align = wxALIGN_NOT, | |
577 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
578 | wxDataViewColumn *PrependIconTextColumn( const wxString &label, unsigned int model_column, | |
579 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
580 | wxAlignment align = wxALIGN_NOT, | |
581 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
582 | wxDataViewColumn *PrependToggleColumn( const wxString &label, unsigned int model_column, | |
583 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH, | |
584 | wxAlignment align = wxALIGN_CENTER, | |
585 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
586 | wxDataViewColumn *PrependProgressColumn( const wxString &label, unsigned int model_column, | |
587 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH, | |
588 | wxAlignment align = wxALIGN_CENTER, | |
589 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
590 | wxDataViewColumn *PrependDateColumn( const wxString &label, unsigned int model_column, | |
591 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1, | |
592 | wxAlignment align = wxALIGN_NOT, | |
593 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
594 | wxDataViewColumn *PrependBitmapColumn( const wxString &label, unsigned int model_column, | |
595 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
596 | wxAlignment align = wxALIGN_CENTER, | |
597 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
598 | wxDataViewColumn *PrependTextColumn( const wxBitmap &label, unsigned int model_column, | |
599 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
600 | wxAlignment align = wxALIGN_NOT, | |
601 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
602 | wxDataViewColumn *PrependIconTextColumn( const wxBitmap &label, unsigned int model_column, | |
603 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
604 | wxAlignment align = wxALIGN_NOT, | |
605 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
606 | wxDataViewColumn *PrependToggleColumn( const wxBitmap &label, unsigned int model_column, | |
607 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH, | |
608 | wxAlignment align = wxALIGN_CENTER, | |
609 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
610 | wxDataViewColumn *PrependProgressColumn( const wxBitmap &label, unsigned int model_column, | |
611 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH, | |
612 | wxAlignment align = wxALIGN_CENTER, | |
613 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
614 | wxDataViewColumn *PrependDateColumn( const wxBitmap &label, unsigned int model_column, | |
615 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1, | |
616 | wxAlignment align = wxALIGN_NOT, | |
617 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
618 | wxDataViewColumn *PrependBitmapColumn( const wxBitmap &label, unsigned int model_column, | |
619 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
620 | wxAlignment align = wxALIGN_CENTER, | |
621 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
622 | ||
623 | wxDataViewColumn *AppendTextColumn( const wxString &label, unsigned int model_column, | |
624 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
625 | wxAlignment align = wxALIGN_NOT, | |
626 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
627 | wxDataViewColumn *AppendIconTextColumn( const wxString &label, unsigned int model_column, | |
628 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
629 | wxAlignment align = wxALIGN_NOT, | |
630 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
631 | wxDataViewColumn *AppendToggleColumn( const wxString &label, unsigned int model_column, | |
632 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH, | |
633 | wxAlignment align = wxALIGN_CENTER, | |
634 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
635 | wxDataViewColumn *AppendProgressColumn( const wxString &label, unsigned int model_column, | |
636 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH, | |
637 | wxAlignment align = wxALIGN_CENTER, | |
638 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
639 | wxDataViewColumn *AppendDateColumn( const wxString &label, unsigned int model_column, | |
640 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1, | |
641 | wxAlignment align = wxALIGN_NOT, | |
642 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
643 | wxDataViewColumn *AppendBitmapColumn( const wxString &label, unsigned int model_column, | |
644 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
645 | wxAlignment align = wxALIGN_CENTER, | |
646 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
647 | wxDataViewColumn *AppendTextColumn( const wxBitmap &label, unsigned int model_column, | |
648 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
649 | wxAlignment align = wxALIGN_NOT, | |
650 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
651 | wxDataViewColumn *AppendIconTextColumn( const wxBitmap &label, unsigned int model_column, | |
652 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
653 | wxAlignment align = wxALIGN_NOT, | |
654 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
655 | wxDataViewColumn *AppendToggleColumn( const wxBitmap &label, unsigned int model_column, | |
656 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_TOGGLE_DEFAULT_WIDTH, | |
657 | wxAlignment align = wxALIGN_CENTER, | |
658 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
659 | wxDataViewColumn *AppendProgressColumn( const wxBitmap &label, unsigned int model_column, | |
660 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = wxDVC_DEFAULT_WIDTH, | |
661 | wxAlignment align = wxALIGN_CENTER, | |
662 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
663 | wxDataViewColumn *AppendDateColumn( const wxBitmap &label, unsigned int model_column, | |
664 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int width = -1, | |
665 | wxAlignment align = wxALIGN_NOT, | |
666 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
667 | wxDataViewColumn *AppendBitmapColumn( const wxBitmap &label, unsigned int model_column, | |
668 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, | |
669 | wxAlignment align = wxALIGN_CENTER, | |
670 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
671 | ||
672 | ||
673 | virtual bool PrependColumn( wxDataViewColumn *col ); | |
674 | virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ); | |
675 | virtual bool AppendColumn( wxDataViewColumn *col ); | |
676 | ||
677 | virtual unsigned int GetColumnCount() const = 0; | |
678 | virtual wxDataViewColumn* GetColumn( unsigned int pos ) const = 0; | |
679 | virtual int GetColumnPosition( const wxDataViewColumn *column ) const = 0; | |
680 | ||
681 | virtual bool DeleteColumn( wxDataViewColumn *column ) = 0; | |
682 | virtual bool ClearColumns() = 0; | |
683 | ||
684 | void SetExpanderColumn( wxDataViewColumn *col ) | |
685 | { m_expander_column = col ; DoSetExpanderColumn(); } | |
686 | wxDataViewColumn *GetExpanderColumn() const | |
687 | { return m_expander_column; } | |
688 | ||
689 | virtual wxDataViewColumn *GetSortingColumn() const = 0; | |
690 | ||
691 | void SetIndent( int indent ) | |
692 | { m_indent = indent ; DoSetIndent(); } | |
693 | int GetIndent() const | |
694 | { return m_indent; } | |
695 | ||
696 | virtual wxDataViewItem GetSelection() const = 0; | |
697 | virtual int GetSelections( wxDataViewItemArray & sel ) const = 0; | |
698 | virtual void SetSelections( const wxDataViewItemArray & sel ) = 0; | |
699 | virtual void Select( const wxDataViewItem & item ) = 0; | |
700 | virtual void Unselect( const wxDataViewItem & item ) = 0; | |
701 | virtual bool IsSelected( const wxDataViewItem & item ) const = 0; | |
702 | ||
703 | virtual void SelectAll() = 0; | |
704 | virtual void UnselectAll() = 0; | |
705 | ||
706 | virtual void Expand( const wxDataViewItem & item ) = 0; | |
707 | virtual void ExpandAncestors( const wxDataViewItem & item ); | |
708 | virtual void Collapse( const wxDataViewItem & item ) = 0; | |
709 | virtual bool IsExpanded( const wxDataViewItem & item ) const = 0; | |
710 | ||
711 | virtual void EnsureVisible( const wxDataViewItem & item, | |
712 | const wxDataViewColumn *column = NULL ) = 0; | |
713 | virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0; | |
714 | virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0; | |
715 | ||
716 | #if wxUSE_DRAG_AND_DROP | |
717 | virtual bool EnableDragSource(const wxDataFormat& WXUNUSED(format)) | |
718 | { return false; } | |
719 | virtual bool EnableDropTarget(const wxDataFormat& WXUNUSED(format)) | |
720 | { return false; } | |
721 | #endif // wxUSE_DRAG_AND_DROP | |
722 | ||
723 | protected: | |
724 | virtual void DoSetExpanderColumn() = 0 ; | |
725 | virtual void DoSetIndent() = 0; | |
726 | ||
727 | private: | |
728 | wxDataViewModel *m_model; | |
729 | wxDataViewColumn *m_expander_column; | |
730 | int m_indent ; | |
731 | ||
732 | protected: | |
733 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase) | |
734 | }; | |
735 | ||
736 | // ---------------------------------------------------------------------------- | |
737 | // wxDataViewEvent - the event class for the wxDataViewCtrl notifications | |
738 | // ---------------------------------------------------------------------------- | |
739 | ||
740 | class WXDLLIMPEXP_ADV wxDataViewEvent : public wxNotifyEvent | |
741 | { | |
742 | public: | |
743 | wxDataViewEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) | |
744 | : wxNotifyEvent(commandType, winid), | |
745 | m_item(0), | |
746 | m_col(-1), | |
747 | m_model(NULL), | |
748 | m_value(wxNullVariant), | |
749 | m_column(NULL), | |
750 | m_pos(-1,-1) | |
751 | #if wxUSE_DRAG_AND_DROP | |
752 | , m_dataObject(NULL), | |
753 | m_dataBuffer(NULL), | |
754 | m_dataSize(0) | |
755 | #endif | |
756 | { } | |
757 | ||
758 | wxDataViewEvent(const wxDataViewEvent& event) | |
759 | : wxNotifyEvent(event), | |
760 | m_item(event.m_item), | |
761 | m_col(event.m_col), | |
762 | m_model(event.m_model), | |
763 | m_value(event.m_value), | |
764 | m_column(event.m_column), | |
765 | m_pos(m_pos) | |
766 | #if wxUSE_DRAG_AND_DROP | |
767 | , m_dataObject(event.m_dataObject), | |
768 | m_dataFormat(event.m_dataFormat), | |
769 | m_dataBuffer(event.m_dataBuffer), | |
770 | m_dataSize(event.m_dataSize) | |
771 | #endif | |
772 | { } | |
773 | ||
774 | wxDataViewItem GetItem() const { return m_item; } | |
775 | void SetItem( const wxDataViewItem &item ) { m_item = item; } | |
776 | ||
777 | int GetColumn() const { return m_col; } | |
778 | void SetColumn( int col ) { m_col = col; } | |
779 | ||
780 | wxDataViewModel* GetModel() const { return m_model; } | |
781 | void SetModel( wxDataViewModel *model ) { m_model = model; } | |
782 | ||
783 | const wxVariant &GetValue() const { return m_value; } | |
784 | void SetValue( const wxVariant &value ) { m_value = value; } | |
785 | ||
786 | // for wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only | |
787 | void SetDataViewColumn( wxDataViewColumn *col ) { m_column = col; } | |
788 | wxDataViewColumn *GetDataViewColumn() const { return m_column; } | |
789 | ||
790 | // for wxEVT_DATAVIEW_CONTEXT_MENU only | |
791 | wxPoint GetPosition() const { return m_pos; } | |
792 | void SetPosition( int x, int y ) { m_pos.x = x; m_pos.y = y; } | |
793 | ||
794 | #if wxUSE_DRAG_AND_DROP | |
795 | // For drag operations | |
796 | void SetDataObject( wxDataObject *obj ) { m_dataObject = obj; } | |
797 | wxDataObject *GetDataObject() const { return m_dataObject; } | |
798 | ||
799 | // For drop operations | |
800 | void SetDataFormat( const wxDataFormat &format ) { m_dataFormat = format; } | |
801 | wxDataFormat GetDataFormat() const { return m_dataFormat; } | |
802 | void SetDataSize( size_t size ) { m_dataSize = size; } | |
803 | size_t GetDataSize() const { return m_dataSize; } | |
804 | void SetDataBuffer( void* buf ) { m_dataBuffer = buf;} | |
805 | void *GetDataBuffer() const { return m_dataBuffer; } | |
806 | #endif // wxUSE_DRAG_AND_DROP | |
807 | ||
808 | virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); } | |
809 | ||
810 | protected: | |
811 | wxDataViewItem m_item; | |
812 | int m_col; | |
813 | wxDataViewModel *m_model; | |
814 | wxVariant m_value; | |
815 | wxDataViewColumn *m_column; | |
816 | wxPoint m_pos; | |
817 | ||
818 | #if wxUSE_DRAG_AND_DROP | |
819 | wxDataObject *m_dataObject; | |
820 | ||
821 | wxDataFormat m_dataFormat; | |
822 | void* m_dataBuffer; | |
823 | size_t m_dataSize; | |
824 | #endif // wxUSE_DRAG_AND_DROP | |
825 | ||
826 | private: | |
827 | DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent) | |
828 | }; | |
829 | ||
830 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEvent ); | |
831 | ||
832 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEvent ); | |
833 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED, wxDataViewEvent ); | |
834 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED, wxDataViewEvent ); | |
835 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING, wxDataViewEvent ); | |
836 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, wxDataViewEvent ); | |
837 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, wxDataViewEvent ); | |
838 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, wxDataViewEvent ); | |
839 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEvent ); | |
840 | ||
841 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEvent ); | |
842 | ||
843 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, wxDataViewEvent ); | |
844 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, wxDataViewEvent ); | |
845 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, wxDataViewEvent ); | |
846 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED, wxDataViewEvent ); | |
847 | ||
848 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG, wxDataViewEvent ); | |
849 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEvent ); | |
850 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_DROP, wxDataViewEvent ); | |
851 | ||
852 | typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&); | |
853 | ||
854 | #define wxDataViewEventHandler(func) \ | |
855 | wxEVENT_HANDLER_CAST(wxDataViewEventFunction, func) | |
856 | ||
857 | #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \ | |
858 | wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn)) | |
859 | ||
860 | #define EVT_DATAVIEW_SELECTION_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(SELECTION_CHANGED, id, fn) | |
861 | ||
862 | #define EVT_DATAVIEW_ITEM_ACTIVATED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_ACTIVATED, id, fn) | |
863 | #define EVT_DATAVIEW_ITEM_COLLAPSING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSING, id, fn) | |
864 | #define EVT_DATAVIEW_ITEM_COLLAPSED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_COLLAPSED, id, fn) | |
865 | #define EVT_DATAVIEW_ITEM_EXPANDING(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDING, id, fn) | |
866 | #define EVT_DATAVIEW_ITEM_EXPANDED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EXPANDED, id, fn) | |
867 | #define EVT_DATAVIEW_ITEM_EDITING_STARTED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_STARTED, id, fn) | |
868 | #define EVT_DATAVIEW_ITEM_EDITING_DONE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_EDITING_DONE, id, fn) | |
869 | #define EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_VALUE_CHANGED, id, fn) | |
870 | ||
871 | #define EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_CONTEXT_MENU, id, fn) | |
872 | ||
873 | #define EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_CLICK, id, fn) | |
874 | #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn) | |
875 | #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn) | |
876 | #define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn) | |
877 | ||
878 | #define EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_BEGIN_DRAG, id, fn) | |
879 | #define EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DROP_POSSIBLE, id, fn) | |
880 | #define EVT_DATAVIEW_ITEM_DROP(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DROP, id, fn) | |
881 | ||
882 | #ifdef wxHAS_GENERIC_DATAVIEWCTRL | |
883 | // this symbol doesn't follow the convention for wxUSE_XXX symbols which | |
884 | // are normally always defined as either 0 or 1, so its use is deprecated | |
885 | // and it only exists for backwards compatibility, don't use it any more | |
886 | // and use wxHAS_GENERIC_DATAVIEWCTRL instead | |
887 | #define wxUSE_GENERICDATAVIEWCTRL | |
888 | ||
889 | #include "wx/generic/dataview.h" | |
890 | #elif defined(__WXGTK20__) | |
891 | #include "wx/gtk/dataview.h" | |
892 | #elif defined(__WXMAC__) | |
893 | #include "wx/osx/dataview.h" | |
894 | #else | |
895 | #error "unknown native wxDataViewCtrl implementation" | |
896 | #endif | |
897 | ||
898 | // ------------------------------------- | |
899 | // wxDataViewSpinRenderer | |
900 | // ------------------------------------- | |
901 | ||
902 | class WXDLLIMPEXP_ADV wxDataViewSpinRenderer: public wxDataViewCustomRenderer | |
903 | { | |
904 | public: | |
905 | wxDataViewSpinRenderer( int min, int max, | |
906 | wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, | |
907 | int alignment = wxDVR_DEFAULT_ALIGNMENT ); | |
908 | virtual bool HasEditorCtrl() const { return true; } | |
909 | virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); | |
910 | virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); | |
911 | virtual bool Render( wxRect rect, wxDC *dc, int state ); | |
912 | virtual wxSize GetSize() const; | |
913 | virtual bool SetValue( const wxVariant &value ); | |
914 | virtual bool GetValue( wxVariant &value ) const; | |
915 | ||
916 | private: | |
917 | long m_data; | |
918 | long m_min,m_max; | |
919 | }; | |
920 | ||
921 | #if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXMAC__) | |
922 | ||
923 | // ------------------------------------- | |
924 | // wxDataViewChoiceRenderer | |
925 | // ------------------------------------- | |
926 | ||
927 | class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer | |
928 | { | |
929 | public: | |
930 | wxDataViewChoiceRenderer( const wxArrayString &choices, | |
931 | wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, | |
932 | int alignment = wxDVR_DEFAULT_ALIGNMENT ); | |
933 | virtual bool HasEditorCtrl() const { return true; } | |
934 | virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); | |
935 | virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); | |
936 | virtual bool Render( wxRect rect, wxDC *dc, int state ); | |
937 | virtual wxSize GetSize() const; | |
938 | virtual bool SetValue( const wxVariant &value ); | |
939 | virtual bool GetValue( wxVariant &value ) const; | |
940 | ||
941 | private: | |
942 | wxArrayString m_choices; | |
943 | wxString m_data; | |
944 | }; | |
945 | ||
946 | #endif | |
947 | ||
948 | //----------------------------------------------------------------------------- | |
949 | // wxDataViewListStore | |
950 | //----------------------------------------------------------------------------- | |
951 | ||
952 | class WXDLLIMPEXP_ADV wxDataViewListStoreLine | |
953 | { | |
954 | public: | |
955 | wxDataViewListStoreLine( wxClientData *data = NULL ) | |
956 | { | |
957 | m_data = data; | |
958 | } | |
959 | virtual ~wxDataViewListStoreLine() | |
960 | { | |
961 | delete m_data; | |
962 | } | |
963 | ||
964 | void SetData( wxClientData *data ) | |
965 | { if (m_data) delete m_data; m_data = data; } | |
966 | wxClientData *GetData() const | |
967 | { return m_data; } | |
968 | ||
969 | wxVector<wxVariant> m_values; | |
970 | ||
971 | private: | |
972 | wxClientData *m_data; | |
973 | }; | |
974 | ||
975 | ||
976 | class WXDLLIMPEXP_ADV wxDataViewListStore: public wxDataViewIndexListModel | |
977 | { | |
978 | public: | |
979 | wxDataViewListStore(); | |
980 | ~wxDataViewListStore(); | |
981 | ||
982 | void PrependColumn( const wxString &varianttype ); | |
983 | void InsertColumn( unsigned int pos, const wxString &varianttype ); | |
984 | void AppendColumn( const wxString &varianttype ); | |
985 | ||
986 | void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
987 | void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
988 | void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
989 | void DeleteItem( unsigned int pos ); | |
990 | void DeleteAllItems(); | |
991 | ||
992 | // override base virtuals | |
993 | ||
994 | virtual unsigned int GetColumnCount() const; | |
995 | ||
996 | virtual wxString GetColumnType( unsigned int col ) const; | |
997 | ||
998 | virtual void GetValueByRow( wxVariant &value, | |
999 | unsigned int row, unsigned int col ) const; | |
1000 | ||
1001 | virtual bool SetValueByRow( const wxVariant &value, | |
1002 | unsigned int row, unsigned int col ); | |
1003 | ||
1004 | ||
1005 | public: | |
1006 | wxVector<wxDataViewListStoreLine*> m_data; | |
1007 | wxArrayString m_cols; | |
1008 | }; | |
1009 | ||
1010 | //----------------------------------------------------------------------------- | |
1011 | ||
1012 | class WXDLLIMPEXP_ADV wxDataViewListCtrl: public wxDataViewCtrl | |
1013 | { | |
1014 | public: | |
1015 | wxDataViewListCtrl(); | |
1016 | wxDataViewListCtrl( wxWindow *parent, wxWindowID id, | |
1017 | const wxPoint& pos = wxDefaultPosition, | |
1018 | const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES, | |
1019 | const wxValidator& validator = wxDefaultValidator ); | |
1020 | ~wxDataViewListCtrl(); | |
1021 | ||
1022 | bool Create( wxWindow *parent, wxWindowID id, | |
1023 | const wxPoint& pos = wxDefaultPosition, | |
1024 | const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES, | |
1025 | const wxValidator& validator = wxDefaultValidator ); | |
1026 | ||
1027 | wxDataViewListStore *GetStore() | |
1028 | { return (wxDataViewListStore*) GetModel(); } | |
1029 | const wxDataViewListStore *GetStore() const | |
1030 | { return (const wxDataViewListStore*) GetModel(); } | |
1031 | ||
1032 | bool AppendColumn( wxDataViewColumn *column, const wxString &varianttype ); | |
1033 | bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); | |
1034 | bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); | |
1035 | ||
1036 | // overridden from base class | |
1037 | virtual bool PrependColumn( wxDataViewColumn *col ); | |
1038 | virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ); | |
1039 | virtual bool AppendColumn( wxDataViewColumn *col ); | |
1040 | ||
1041 | wxDataViewColumn *AppendTextColumn( const wxString &label, | |
1042 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
1043 | int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); | |
1044 | wxDataViewColumn *AppendToggleColumn( const wxString &label, | |
1045 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
1046 | int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); | |
1047 | wxDataViewColumn *AppendProgressColumn( const wxString &label, | |
1048 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
1049 | int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); | |
1050 | wxDataViewColumn *AppendIconTextColumn( const wxString &label, | |
1051 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
1052 | int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); | |
1053 | ||
1054 | void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ) | |
1055 | { GetStore()->AppendItem( values, data ); } | |
1056 | void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ) | |
1057 | { GetStore()->PrependItem( values, data ); } | |
1058 | void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL ) | |
1059 | { GetStore()->InsertItem( row, values, data ); } | |
1060 | void DeleteItem( unsigned row ) | |
1061 | { GetStore()->DeleteItem( row ); } | |
1062 | void DeleteAllItems() | |
1063 | { GetStore()->DeleteAllItems(); } | |
1064 | ||
1065 | void SetValue( const wxVariant &value, unsigned int row, unsigned int col ) | |
1066 | { GetStore()->SetValueByRow( value, row, col ); | |
1067 | GetStore()->RowValueChanged( row, col); } | |
1068 | void GetValue( wxVariant &value, unsigned int row, unsigned int col ) | |
1069 | { GetStore()->GetValueByRow( value, row, col ); } | |
1070 | ||
1071 | void SetTextValue( const wxString &value, unsigned int row, unsigned int col ) | |
1072 | { GetStore()->SetValueByRow( value, row, col ); | |
1073 | GetStore()->RowValueChanged( row, col); } | |
1074 | wxString GetTextValue( unsigned int row, unsigned int col ) const | |
1075 | { wxVariant value; GetStore()->GetValueByRow( value, row, col ); return value.GetString(); } | |
1076 | ||
1077 | void SetToggleValue( bool value, unsigned int row, unsigned int col ) | |
1078 | { GetStore()->SetValueByRow( value, row, col ); | |
1079 | GetStore()->RowValueChanged( row, col); } | |
1080 | bool GetToggleValue( unsigned int row, unsigned int col ) const | |
1081 | { wxVariant value; GetStore()->GetValueByRow( value, row, col ); return value.GetBool(); } | |
1082 | ||
1083 | void OnSize( wxSizeEvent &event ); | |
1084 | ||
1085 | private: | |
1086 | DECLARE_EVENT_TABLE() | |
1087 | DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewListCtrl) | |
1088 | }; | |
1089 | ||
1090 | //----------------------------------------------------------------------------- | |
1091 | // wxDataViewTreeStore | |
1092 | //----------------------------------------------------------------------------- | |
1093 | ||
1094 | class WXDLLIMPEXP_ADV wxDataViewTreeStoreNode | |
1095 | { | |
1096 | public: | |
1097 | wxDataViewTreeStoreNode( wxDataViewTreeStoreNode *parent, | |
1098 | const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL ); | |
1099 | virtual ~wxDataViewTreeStoreNode(); | |
1100 | ||
1101 | void SetText( const wxString &text ) | |
1102 | { m_text = text; } | |
1103 | wxString GetText() const | |
1104 | { return m_text; } | |
1105 | void SetIcon( const wxIcon &icon ) | |
1106 | { m_icon = icon; } | |
1107 | const wxIcon &GetIcon() const | |
1108 | { return m_icon; } | |
1109 | void SetData( wxClientData *data ) | |
1110 | { if (m_data) delete m_data; m_data = data; } | |
1111 | wxClientData *GetData() const | |
1112 | { return m_data; } | |
1113 | ||
1114 | wxDataViewItem GetItem() const | |
1115 | { return wxDataViewItem( (void*) this ); } | |
1116 | ||
1117 | virtual bool IsContainer() | |
1118 | { return false; } | |
1119 | ||
1120 | wxDataViewTreeStoreNode *GetParent() | |
1121 | { return m_parent; } | |
1122 | ||
1123 | private: | |
1124 | wxDataViewTreeStoreNode *m_parent; | |
1125 | wxString m_text; | |
1126 | wxIcon m_icon; | |
1127 | wxClientData *m_data; | |
1128 | }; | |
1129 | ||
1130 | WX_DECLARE_LIST_WITH_DECL(wxDataViewTreeStoreNode, wxDataViewTreeStoreNodeList, | |
1131 | class WXDLLIMPEXP_ADV); | |
1132 | ||
1133 | class WXDLLIMPEXP_ADV wxDataViewTreeStoreContainerNode: public wxDataViewTreeStoreNode | |
1134 | { | |
1135 | public: | |
1136 | wxDataViewTreeStoreContainerNode( wxDataViewTreeStoreNode *parent, | |
1137 | const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon, | |
1138 | wxClientData *data = NULL ); | |
1139 | virtual ~wxDataViewTreeStoreContainerNode(); | |
1140 | ||
1141 | const wxDataViewTreeStoreNodeList &GetChildren() const | |
1142 | { return m_children; } | |
1143 | wxDataViewTreeStoreNodeList &GetChildren() | |
1144 | { return m_children; } | |
1145 | ||
1146 | void SetExpandedIcon( const wxIcon &icon ) | |
1147 | { m_iconExpanded = icon; } | |
1148 | const wxIcon &GetExpandedIcon() const | |
1149 | { return m_iconExpanded; } | |
1150 | ||
1151 | void SetExpanded( bool expanded = true ) | |
1152 | { m_isExpanded = expanded; } | |
1153 | bool IsExpanded() const | |
1154 | { return m_isExpanded; } | |
1155 | ||
1156 | virtual bool IsContainer() | |
1157 | { return true; } | |
1158 | ||
1159 | private: | |
1160 | wxDataViewTreeStoreNodeList m_children; | |
1161 | wxIcon m_iconExpanded; | |
1162 | bool m_isExpanded; | |
1163 | }; | |
1164 | ||
1165 | //----------------------------------------------------------------------------- | |
1166 | ||
1167 | class WXDLLIMPEXP_ADV wxDataViewTreeStore: public wxDataViewModel | |
1168 | { | |
1169 | public: | |
1170 | wxDataViewTreeStore(); | |
1171 | ~wxDataViewTreeStore(); | |
1172 | ||
1173 | wxDataViewItem AppendItem( const wxDataViewItem& parent, | |
1174 | const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL ); | |
1175 | wxDataViewItem PrependItem( const wxDataViewItem& parent, | |
1176 | const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL ); | |
1177 | wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous, | |
1178 | const wxString &text, const wxIcon &icon = wxNullIcon, wxClientData *data = NULL ); | |
1179 | ||
1180 | wxDataViewItem PrependContainer( const wxDataViewItem& parent, | |
1181 | const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon, | |
1182 | wxClientData *data = NULL ); | |
1183 | wxDataViewItem AppendContainer( const wxDataViewItem& parent, | |
1184 | const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon, | |
1185 | wxClientData *data = NULL ); | |
1186 | wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous, | |
1187 | const wxString &text, const wxIcon &icon = wxNullIcon, const wxIcon &expanded = wxNullIcon, | |
1188 | wxClientData *data = NULL ); | |
1189 | ||
1190 | wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const; | |
1191 | int GetChildCount( const wxDataViewItem& parent ) const; | |
1192 | ||
1193 | void SetItemText( const wxDataViewItem& item, const wxString &text ); | |
1194 | wxString GetItemText( const wxDataViewItem& item ) const; | |
1195 | void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon ); | |
1196 | const wxIcon &GetItemIcon( const wxDataViewItem& item ) const; | |
1197 | void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon ); | |
1198 | const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const; | |
1199 | void SetItemData( const wxDataViewItem& item, wxClientData *data ); | |
1200 | wxClientData *GetItemData( const wxDataViewItem& item ) const; | |
1201 | ||
1202 | void DeleteItem( const wxDataViewItem& item ); | |
1203 | void DeleteChildren( const wxDataViewItem& item ); | |
1204 | void DeleteAllItems(); | |
1205 | ||
1206 | // implement base methods | |
1207 | ||
1208 | virtual void GetValue( wxVariant &variant, | |
1209 | const wxDataViewItem &item, unsigned int col ) const; | |
1210 | virtual bool SetValue( const wxVariant &variant, | |
1211 | const wxDataViewItem &item, unsigned int col ); | |
1212 | virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const; | |
1213 | virtual bool IsContainer( const wxDataViewItem &item ) const; | |
1214 | virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; | |
1215 | ||
1216 | virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, | |
1217 | unsigned int column, bool ascending ); | |
1218 | ||
1219 | virtual bool HasDefaultCompare() const | |
1220 | { return true; } | |
1221 | virtual unsigned int GetColumnCount() const | |
1222 | { return 1; }; | |
1223 | virtual wxString GetColumnType( unsigned int WXUNUSED(col) ) const | |
1224 | { return wxT("wxDataViewIconText"); } | |
1225 | ||
1226 | wxDataViewTreeStoreNode *FindNode( const wxDataViewItem &item ) const; | |
1227 | wxDataViewTreeStoreContainerNode *FindContainerNode( const wxDataViewItem &item ) const; | |
1228 | wxDataViewTreeStoreNode *GetRoot() const { return m_root; } | |
1229 | ||
1230 | public: | |
1231 | wxDataViewTreeStoreNode *m_root; | |
1232 | }; | |
1233 | ||
1234 | //----------------------------------------------------------------------------- | |
1235 | ||
1236 | class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl | |
1237 | { | |
1238 | public: | |
1239 | wxDataViewTreeCtrl(); | |
1240 | wxDataViewTreeCtrl( wxWindow *parent, wxWindowID id, | |
1241 | const wxPoint& pos = wxDefaultPosition, | |
1242 | const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER | wxDV_ROW_LINES, | |
1243 | const wxValidator& validator = wxDefaultValidator ); | |
1244 | ~wxDataViewTreeCtrl(); | |
1245 | ||
1246 | bool Create( wxWindow *parent, wxWindowID id, | |
1247 | const wxPoint& pos = wxDefaultPosition, | |
1248 | const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER | wxDV_ROW_LINES, | |
1249 | const wxValidator& validator = wxDefaultValidator ); | |
1250 | ||
1251 | wxDataViewTreeStore *GetStore() | |
1252 | { return (wxDataViewTreeStore*) GetModel(); } | |
1253 | const wxDataViewTreeStore *GetStore() const | |
1254 | { return (const wxDataViewTreeStore*) GetModel(); } | |
1255 | ||
1256 | void SetImageList( wxImageList *imagelist ); | |
1257 | wxImageList* GetImageList() { return m_imageList; } | |
1258 | ||
1259 | wxDataViewItem AppendItem( const wxDataViewItem& parent, | |
1260 | const wxString &text, int icon = -1, wxClientData *data = NULL ); | |
1261 | wxDataViewItem PrependItem( const wxDataViewItem& parent, | |
1262 | const wxString &text, int icon = -1, wxClientData *data = NULL ); | |
1263 | wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous, | |
1264 | const wxString &text, int icon = -1, wxClientData *data = NULL ); | |
1265 | ||
1266 | wxDataViewItem PrependContainer( const wxDataViewItem& parent, | |
1267 | const wxString &text, int icon = -1, int expanded = -1, | |
1268 | wxClientData *data = NULL ); | |
1269 | wxDataViewItem AppendContainer( const wxDataViewItem& parent, | |
1270 | const wxString &text, int icon = -1, int expanded = -1, | |
1271 | wxClientData *data = NULL ); | |
1272 | wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous, | |
1273 | const wxString &text, int icon = -1, int expanded = -1, | |
1274 | wxClientData *data = NULL ); | |
1275 | ||
1276 | wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const | |
1277 | { return GetStore()->GetNthChild(parent, pos); } | |
1278 | int GetChildCount( const wxDataViewItem& parent ) const | |
1279 | { return GetStore()->GetChildCount(parent); } | |
1280 | ||
1281 | void SetItemText( const wxDataViewItem& item, const wxString &text ); | |
1282 | wxString GetItemText( const wxDataViewItem& item ) const | |
1283 | { return GetStore()->GetItemText(item); } | |
1284 | void SetItemIcon( const wxDataViewItem& item, const wxIcon &icon ); | |
1285 | const wxIcon &GetItemIcon( const wxDataViewItem& item ) const | |
1286 | { return GetStore()->GetItemIcon(item); } | |
1287 | void SetItemExpandedIcon( const wxDataViewItem& item, const wxIcon &icon ); | |
1288 | const wxIcon &GetItemExpandedIcon( const wxDataViewItem& item ) const | |
1289 | { return GetStore()->GetItemExpandedIcon(item); } | |
1290 | void SetItemData( const wxDataViewItem& item, wxClientData *data ) | |
1291 | { GetStore()->SetItemData(item,data); } | |
1292 | wxClientData *GetItemData( const wxDataViewItem& item ) const | |
1293 | { return GetStore()->GetItemData(item); } | |
1294 | ||
1295 | void DeleteItem( const wxDataViewItem& item ); | |
1296 | void DeleteChildren( const wxDataViewItem& item ); | |
1297 | void DeleteAllItems(); | |
1298 | ||
1299 | void OnExpanded( wxDataViewEvent &event ); | |
1300 | void OnCollapsed( wxDataViewEvent &event ); | |
1301 | void OnSize( wxSizeEvent &event ); | |
1302 | ||
1303 | private: | |
1304 | wxImageList *m_imageList; | |
1305 | ||
1306 | private: | |
1307 | DECLARE_EVENT_TABLE() | |
1308 | DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl) | |
1309 | }; | |
1310 | ||
1311 | #endif // wxUSE_DATAVIEWCTRL | |
1312 | ||
1313 | #endif | |
1314 | // _WX_DATAVIEW_H_BASE_ |