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