]>
Commit | Line | Data |
---|---|---|
c0a66d92 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/mac/carbon/dataview.h | |
3 | // Purpose: wxDataViewCtrl native implementation header | |
4 | // Author: | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 2007 | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
34b1fdeb PC |
10 | #ifndef _WX_MACCARBONDATAVIEWCTRL_H_ |
11 | #define _WX_MACCARBONDATAVIEWCTRL_H_ | |
c0a66d92 | 12 | |
34b1fdeb | 13 | typedef void* DataBrowserItemDataRef; |
f53c8638 | 14 | typedef unsigned long WXDataBrowserPropertyType; |
34b1fdeb | 15 | typedef wxUint32 WXDataBrowserPropertyID; |
c0a66d92 RR |
16 | |
17 | // --------------------------------------------------------- | |
18 | // wxDataViewRenderer | |
19 | // --------------------------------------------------------- | |
20 | ||
21 | class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase | |
22 | { | |
23 | public: | |
24 | // | |
25 | // constructors / destructor | |
26 | // | |
27 | wxDataViewRenderer(wxString const& varianttype, wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); | |
28 | ||
29 | // | |
30 | // inherited methods from wxDataViewRendererBase | |
31 | // | |
32 | virtual int GetAlignment(void) const | |
33 | { | |
34 | return this->m_alignment; | |
35 | } | |
36 | virtual wxDataViewCellMode GetMode(void) const | |
37 | { | |
38 | return this->m_mode; | |
39 | } | |
40 | virtual bool GetValue(wxVariant& value) const | |
41 | { | |
42 | value = this->m_value; | |
43 | return true; | |
44 | } | |
45 | ||
46 | virtual void SetAlignment(int WXUNUSED(align)) // is always identical to the header alignment | |
47 | { | |
48 | } | |
49 | virtual void SetMode(wxDataViewCellMode mode); | |
50 | virtual bool SetValue(wxVariant const& newValue) | |
51 | { | |
52 | this->m_value = newValue; | |
53 | return true; | |
54 | } | |
55 | ||
56 | // | |
57 | // implementation | |
58 | // | |
59 | DataBrowserItemDataRef GetDataReference(void) const | |
60 | { | |
61 | return this->m_dataReference; | |
62 | } | |
63 | wxVariant const& GetValue(void) const | |
64 | { | |
65 | return this->m_value; | |
66 | } | |
67 | ||
34b1fdeb | 68 | virtual WXDataBrowserPropertyType GetPropertyType() const = 0; |
c0a66d92 RR |
69 | |
70 | virtual bool Render(void) = 0; // a call to the appropriate data browser function filling the data reference with the stored datum; | |
71 | // returns 'true' if the data value could be rendered, 'false' otherwise | |
72 | ||
73 | void SetDataReference(DataBrowserItemDataRef const& newDataReference) | |
74 | { | |
75 | this->m_dataReference = newDataReference; | |
76 | } | |
77 | ||
78 | private: | |
79 | // | |
80 | // variables | |
81 | // | |
82 | DataBrowserItemDataRef m_dataReference; // data reference of the data browser; the data will be assigned to this reference during rendering | |
83 | ||
84 | int m_alignment; // contains the alignment flags | |
85 | ||
86 | wxDataViewCellMode m_mode; // storing the mode that determines how the cell is going to be shown | |
87 | ||
88 | wxVariant m_value; // value that is going to be rendered | |
89 | ||
90 | // | |
91 | // wxWidget internal stuff | |
92 | // | |
93 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) | |
94 | }; | |
95 | ||
96 | // --------------------------------------------------------- | |
97 | // wxDataViewCustomRenderer | |
98 | // --------------------------------------------------------- | |
99 | ||
100 | class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer | |
101 | { | |
102 | public: | |
103 | // | |
104 | // constructors / destructor | |
105 | // | |
106 | wxDataViewCustomRenderer(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); | |
107 | ||
108 | virtual ~wxDataViewCustomRenderer(void); | |
109 | ||
52e750fc RR |
110 | void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state ); |
111 | ||
c0a66d92 RR |
112 | // |
113 | // methods handling render space | |
114 | // | |
115 | virtual wxSize GetSize() const = 0; | |
116 | ||
117 | // | |
118 | // methods handling user actions | |
119 | // | |
120 | virtual bool Render(wxRect cell, wxDC* dc, int state) = 0; | |
121 | ||
194027ac | 122 | virtual bool Activate(wxRect WXUNUSED(cell), wxDataViewModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row)) |
c0a66d92 RR |
123 | { |
124 | return false; | |
125 | } | |
126 | ||
194027ac | 127 | virtual bool LeftClick(wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row)) |
c0a66d92 RR |
128 | { |
129 | return false; | |
130 | } | |
131 | ||
194027ac | 132 | virtual bool RightClick(wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row)) |
c0a66d92 RR |
133 | { |
134 | return false; | |
135 | } | |
136 | ||
194027ac | 137 | virtual bool StartDrag(wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell), wxDataViewModel *WXUNUSED(model), unsigned int WXUNUSED(col), unsigned int WXUNUSED(row)) |
c0a66d92 RR |
138 | { |
139 | return false; | |
140 | } | |
141 | ||
142 | // | |
143 | // in-place editing | |
144 | // | |
145 | virtual void CancelEditing() | |
146 | { | |
147 | } | |
148 | ||
149 | virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent), wxRect WXUNUSED(labelRect), const wxVariant& WXUNUSED(value)) | |
150 | { | |
151 | return NULL; | |
152 | } | |
153 | ||
154 | virtual bool FinishEditing() | |
155 | { | |
156 | return false; | |
157 | } | |
158 | ||
159 | wxControl* GetEditorCtrl(void) const | |
160 | { | |
161 | return this->m_editorCtrlPtr; | |
162 | } | |
163 | virtual bool GetValueFromEditorCtrl(wxControl* WXUNUSED(editor), wxVariant& WXUNUSED(value)) | |
164 | { | |
165 | return false; | |
166 | } | |
167 | ||
168 | virtual bool HasEditorCtrl(void) | |
169 | { | |
170 | return false; | |
171 | } | |
172 | ||
6d9ecc87 | 173 | virtual bool StartEditing(wxDataViewItem const& WXUNUSED(item), wxRect WXUNUSED(labelRect)) |
c0a66d92 RR |
174 | { |
175 | return false; | |
176 | } | |
177 | ||
178 | // | |
179 | // device context handling | |
180 | // | |
181 | virtual wxDC* GetDC(void); // creates a device context and keeps it | |
182 | ||
183 | // | |
184 | // implementation | |
185 | // | |
186 | virtual bool Render(void); // declared in wxDataViewRenderer but will not be used here, therefore calling this function will | |
c17b2e31 | 187 | // return 'true' without having done anything |
c0a66d92 | 188 | |
34b1fdeb | 189 | virtual WXDataBrowserPropertyType GetPropertyType() const; |
c0a66d92 RR |
190 | |
191 | void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer | |
192 | ||
193 | protected: | |
194 | private: | |
195 | // | |
196 | // variables | |
197 | // | |
198 | wxControl* m_editorCtrlPtr; // pointer to an in-place editor control | |
199 | ||
200 | wxDC* m_DCPtr; | |
201 | ||
202 | // | |
203 | // wxWidget internal stuff | |
204 | // | |
205 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) | |
206 | }; | |
207 | ||
208 | // --------------------------------------------------------- | |
209 | // wxDataViewTextRenderer | |
210 | // --------------------------------------------------------- | |
211 | ||
212 | class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer | |
213 | { | |
214 | public: | |
215 | // | |
216 | // constructors / destructor | |
217 | // | |
218 | wxDataViewTextRenderer(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); | |
219 | ||
220 | // | |
221 | // inherited functions from wxDataViewRenderer | |
222 | // | |
223 | virtual bool Render(void); | |
224 | ||
225 | // | |
226 | // implementation | |
227 | // | |
34b1fdeb | 228 | virtual WXDataBrowserPropertyType GetPropertyType() const; |
c0a66d92 RR |
229 | |
230 | protected: | |
231 | private: | |
232 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) | |
233 | }; | |
234 | ||
4264606e RR |
235 | // --------------------------------------------------------- |
236 | // wxDataViewTextRendererAttr | |
237 | // --------------------------------------------------------- | |
238 | ||
239 | class WXDLLIMPEXP_ADV wxDataViewTextRendererAttr: public wxDataViewTextRenderer | |
240 | { | |
241 | public: | |
242 | // | |
243 | // constructors / destructor | |
244 | // | |
245 | wxDataViewTextRendererAttr(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); | |
246 | ||
247 | private: | |
248 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRendererAttr) | |
249 | }; | |
250 | ||
c0a66d92 RR |
251 | // --------------------------------------------------------- |
252 | // wxDataViewBitmapRenderer | |
253 | // --------------------------------------------------------- | |
254 | ||
255 | class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer | |
256 | { | |
257 | public: | |
258 | // | |
259 | // constructors / destructor | |
260 | // | |
261 | wxDataViewBitmapRenderer(wxString const& varianttype=wxT("wxBitmap"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); | |
262 | ||
263 | // | |
264 | // inherited functions from wxDataViewRenderer | |
265 | // | |
266 | virtual bool Render(void); | |
267 | ||
268 | // | |
269 | // implementation | |
270 | // | |
34b1fdeb | 271 | virtual WXDataBrowserPropertyType GetPropertyType() const; |
c0a66d92 RR |
272 | |
273 | protected: | |
274 | private: | |
275 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) | |
276 | }; | |
277 | ||
278 | // --------------------------------------------------------- | |
279 | // wxDataViewToggleRenderer | |
280 | // --------------------------------------------------------- | |
281 | ||
c17b2e31 RR |
282 | class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer |
283 | { | |
284 | public: | |
285 | wxDataViewIconTextRenderer(wxString const& varianttype = wxT("wxDataViewIconText"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); | |
286 | ||
287 | // | |
288 | // inherited functions from wxDataViewRenderer | |
289 | // | |
290 | virtual bool Render(void); | |
291 | ||
292 | // | |
293 | // implementation | |
294 | // | |
34b1fdeb | 295 | virtual WXDataBrowserPropertyType GetPropertyType() const; |
c17b2e31 RR |
296 | |
297 | protected: | |
298 | private: | |
299 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) | |
300 | }; | |
301 | ||
302 | // --------------------------------------------------------- | |
303 | // wxDataViewToggleRenderer | |
304 | // --------------------------------------------------------- | |
305 | ||
c0a66d92 RR |
306 | class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer |
307 | { | |
308 | public: | |
309 | wxDataViewToggleRenderer(wxString const& varianttype = wxT("bool"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); | |
310 | ||
311 | // | |
312 | // inherited functions from wxDataViewRenderer | |
313 | // | |
314 | virtual bool Render(void); | |
315 | ||
316 | // | |
317 | // implementation | |
318 | // | |
34b1fdeb | 319 | virtual WXDataBrowserPropertyType GetPropertyType() const; |
c0a66d92 RR |
320 | |
321 | protected: | |
322 | private: | |
323 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) | |
324 | }; | |
325 | ||
326 | // --------------------------------------------------------- | |
327 | // wxDataViewProgressRenderer | |
328 | // --------------------------------------------------------- | |
329 | ||
330 | class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer | |
331 | { | |
332 | public: | |
333 | wxDataViewProgressRenderer(wxString const& label = wxEmptyString, wxString const& varianttype=wxT("long"), | |
334 | wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); | |
335 | ||
336 | // | |
337 | // inherited functions from wxDataViewRenderer | |
338 | // | |
339 | virtual bool Render(void); | |
340 | ||
341 | // | |
342 | // implementation | |
343 | // | |
34b1fdeb | 344 | virtual WXDataBrowserPropertyType GetPropertyType() const; |
c0a66d92 RR |
345 | |
346 | protected: | |
347 | private: | |
348 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) | |
349 | }; | |
350 | ||
351 | // --------------------------------------------------------- | |
352 | // wxDataViewDateRenderer | |
353 | // --------------------------------------------------------- | |
354 | ||
355 | class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer | |
356 | { | |
357 | public: | |
358 | wxDataViewDateRenderer(wxString const& varianttype=wxT("datetime"), wxDataViewCellMode mode=wxDATAVIEW_CELL_ACTIVATABLE, int align=wxDVR_DEFAULT_ALIGNMENT); | |
359 | ||
360 | // | |
361 | // inherited functions from wxDataViewRenderer | |
362 | // | |
363 | virtual bool Render(void); | |
364 | ||
365 | // | |
366 | // implementation | |
367 | // | |
34b1fdeb | 368 | virtual WXDataBrowserPropertyType GetPropertyType() const; |
c0a66d92 RR |
369 | |
370 | protected: | |
371 | private: | |
372 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) | |
373 | }; | |
374 | ||
375 | // --------------------------------------------------------- | |
376 | // wxDataViewColumn | |
377 | // --------------------------------------------------------- | |
378 | ||
379 | class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase | |
380 | { | |
381 | public: | |
382 | // | |
383 | // constructors / destructor | |
384 | // | |
385 | wxDataViewColumn(wxString const& title, wxDataViewRenderer* renderer, unsigned int model_column, int width=80, wxAlignment align=wxALIGN_CENTER, | |
386 | int flags=wxDATAVIEW_COL_RESIZABLE); | |
387 | wxDataViewColumn(wxBitmap const& bitmap, wxDataViewRenderer* renderer, unsigned int model_column, int width=80, wxAlignment align=wxALIGN_CENTER, | |
388 | int flags=wxDATAVIEW_COL_RESIZABLE); | |
389 | ||
390 | // | |
391 | // inherited methods from wxDataViewColumnBase | |
392 | // | |
393 | virtual wxAlignment GetAlignment(void) const | |
394 | { | |
395 | return this->m_alignment; | |
396 | } | |
397 | virtual int GetFlags(void) const | |
398 | { | |
399 | return this->m_flags; | |
400 | } | |
401 | virtual int GetMaxWidth(void) const | |
402 | { | |
403 | return this->m_maxWidth; | |
404 | } | |
405 | virtual int GetMinWidth(void) const | |
406 | { | |
407 | return this->m_minWidth; | |
408 | } | |
409 | virtual wxString GetTitle(void) const | |
410 | { | |
411 | return this->m_title; | |
412 | } | |
413 | virtual int GetWidth(void) const | |
414 | { | |
415 | return this->m_width; | |
416 | } | |
417 | ||
418 | virtual bool IsHidden(void) const | |
419 | { | |
420 | return false; // not implemented | |
421 | } | |
422 | virtual bool IsResizeable(void) const | |
423 | { | |
424 | return ((this->m_flags & wxDATAVIEW_COL_RESIZABLE) != 0); | |
425 | } | |
426 | virtual bool IsSortable(void) const | |
427 | { | |
428 | return ((this->m_flags & wxDATAVIEW_COL_SORTABLE) != 0); | |
429 | } | |
430 | virtual bool IsSortOrderAscending(void) const | |
431 | { | |
432 | return this->m_ascending; | |
433 | } | |
434 | ||
435 | virtual void SetAlignment(wxAlignment align); | |
436 | virtual void SetBitmap (wxBitmap const& bitmap); | |
437 | virtual void SetFlags (int flags); | |
438 | virtual void SetHidden(bool WXUNUSED(hidden)) | |
439 | { | |
440 | } | |
441 | virtual void SetMaxWidth (int maxWidth); | |
442 | virtual void SetMinWidth (int minWidth); | |
443 | virtual void SetResizeable(bool resizeable); | |
444 | virtual void SetSortable (bool sortable); | |
445 | virtual void SetSortOrder (bool ascending); | |
446 | virtual void SetTitle (wxString const& title); | |
447 | virtual void SetWidth (int width); | |
448 | ||
449 | // | |
450 | // implementation | |
451 | // | |
34b1fdeb | 452 | WXDataBrowserPropertyID GetPropertyID() const |
c0a66d92 RR |
453 | { |
454 | return this->m_propertyID; | |
455 | } | |
456 | ||
34b1fdeb | 457 | void SetPropertyID(WXDataBrowserPropertyID newID) |
c0a66d92 RR |
458 | { |
459 | this->m_propertyID = newID; | |
460 | } | |
6d9ecc87 RR |
461 | void SetWidthVariable(int NewWidth) |
462 | { | |
463 | this->m_width = NewWidth; | |
464 | } | |
c0a66d92 RR |
465 | |
466 | protected: | |
467 | private: | |
468 | // | |
469 | // variables | |
470 | // | |
471 | bool m_ascending; // sorting order | |
472 | ||
34b1fdeb | 473 | WXDataBrowserPropertyID m_propertyID; // each column is identified by its unique property ID (NOT by the column index) |
c0a66d92 RR |
474 | |
475 | int m_flags; // flags for the column | |
476 | int m_maxWidth; // maximum width for the column | |
477 | int m_minWidth; // minimum width for the column | |
478 | int m_width; // column width | |
479 | ||
480 | wxAlignment m_alignment; // column header alignment | |
481 | ||
482 | wxString m_title; // column title | |
483 | ||
484 | // wxWidget internal stuff: | |
485 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn) | |
486 | }; | |
487 | ||
488 | // --------------------------------------------------------- | |
489 | // wxDataViewCtrl | |
490 | // --------------------------------------------------------- | |
c0a66d92 RR |
491 | class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase |
492 | { | |
493 | public: | |
494 | // Constructors / destructor: | |
194027ac RR |
495 | wxDataViewCtrl() |
496 | { | |
497 | this->Init(); | |
498 | } | |
499 | wxDataViewCtrl(wxWindow *parent, wxWindowID id, wxPoint const& pos = wxDefaultPosition, wxSize const& size = wxDefaultSize, long style = 0, | |
500 | wxValidator const& validator = wxDefaultValidator) | |
501 | { | |
502 | this->Init(); | |
503 | this->Create(parent, id, pos, size, style, validator ); | |
504 | } | |
505 | ||
506 | // explicit control creation | |
507 | bool Create(wxWindow *parent, wxWindowID id, wxPoint const& pos=wxDefaultPosition, wxSize const& size=wxDefaultSize, long style=0, | |
508 | wxValidator const& validator=wxDefaultValidator); | |
509 | ||
194027ac RR |
510 | virtual wxControl* GetMainWindow(void) // should disappear as it is not of any use for the native implementation |
511 | { | |
512 | return this; | |
513 | } | |
514 | ||
c17b2e31 RR |
515 | // inherited methods from 'wxDataViewCtrlBase': |
516 | virtual bool AssociateModel(wxDataViewModel* model); | |
517 | ||
518 | virtual bool AppendColumn(wxDataViewColumn* columnPtr); | |
519 | virtual bool ClearColumns(void); | |
520 | virtual bool DeleteColumn(wxDataViewColumn* columnPtr); | |
521 | virtual wxDataViewColumn* GetColumn(unsigned int pos) const; | |
522 | virtual unsigned int GetColumnCount(void) const; | |
6d9ecc87 | 523 | virtual int GetColumnPosition(wxDataViewColumn const* columnPtr) const; |
21f47fb9 | 524 | |
c17b2e31 | 525 | virtual void Collapse(wxDataViewItem const& item); |
07c51ff1 | 526 | virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr=NULL); |
c17b2e31 | 527 | virtual void Expand(wxDataViewItem const& item); |
07c51ff1 | 528 | |
6d9ecc87 RR |
529 | virtual wxDataViewColumn* GetSortingColumn(void) const; |
530 | ||
b741dd40 | 531 | virtual unsigned int GetCount(void) const; |
07c51ff1 RR |
532 | virtual wxRect GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const; |
533 | virtual wxDataViewItem GetSelection(void) const; | |
534 | virtual int GetSelections(wxDataViewItemArray& sel) const; | |
535 | ||
536 | virtual void HitTest(wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const; | |
537 | ||
538 | virtual bool IsSelected(wxDataViewItem const& item) const; | |
539 | ||
540 | virtual void SelectAll(void); | |
541 | virtual void Select(wxDataViewItem const& item); | |
542 | virtual void SetSelections(wxDataViewItemArray const& sel); | |
c0a66d92 | 543 | |
07c51ff1 RR |
544 | virtual void Unselect(wxDataViewItem const& item); |
545 | virtual void UnselectAll(void); | |
c17b2e31 | 546 | |
c0a66d92 RR |
547 | // |
548 | // implementation | |
549 | // | |
550 | ||
07c51ff1 | 551 | // adds all children of the passed parent to the control; if 'parentItem' is invalid the root(s) is/are added: |
194027ac RR |
552 | void AddChildrenLevel(wxDataViewItem const& parentItem); |
553 | ||
c17b2e31 RR |
554 | // returns a pointer to a column; |
555 | // in case the pointer cannot be found NULL is returned: | |
34b1fdeb | 556 | wxDataViewColumn* GetColumnPtr(WXDataBrowserPropertyID propertyID) const; |
c17b2e31 | 557 | |
07c51ff1 RR |
558 | // checks if currently a delete process is running: |
559 | bool IsDeleting(void) const | |
560 | { | |
561 | return this->m_Deleting; | |
562 | } | |
563 | ||
c0a66d92 RR |
564 | // with CG, we need to get the context from an kEventControlDraw event |
565 | // unfortunately, the DataBrowser callbacks don't provide the context | |
566 | // and we need it, so we need to set/remove it before and after draw | |
567 | // events so we can access it in the callbacks. | |
568 | void MacSetDrawingContext(void* context) | |
569 | { | |
570 | this->m_cgContext = context; | |
571 | } | |
572 | void* MacGetDrawingContext(void) const | |
573 | { | |
574 | return this->m_cgContext; | |
575 | } | |
576 | ||
07c51ff1 RR |
577 | /// sets the flag indicating a deletion process: |
578 | void SetDeleting(bool deleting) | |
579 | { | |
580 | this->m_Deleting = deleting; | |
581 | } | |
582 | ||
c0a66d92 | 583 | protected: |
194027ac RR |
584 | // inherited methods from wxDataViewCtrlBase: |
585 | virtual void DoSetExpanderColumn(void); | |
586 | virtual void DoSetIndent(void); | |
587 | ||
c0a66d92 RR |
588 | // event handling: |
589 | void OnSize(wxSizeEvent &event); | |
590 | ||
591 | private: | |
c17b2e31 | 592 | // type definitions: |
34b1fdeb | 593 | WX_DECLARE_HASH_MAP(WXDataBrowserPropertyID,wxDataViewColumn*,wxIntegerHash,wxIntegerEqual,ColumnPointerHashMapType); |
c17b2e31 | 594 | |
c0a66d92 RR |
595 | // initializing of local variables: |
596 | void Init(void); | |
597 | ||
598 | /// | |
599 | // variables | |
600 | // | |
601 | ||
07c51ff1 RR |
602 | bool m_Deleting; // flag indicating if a delete process is running; this flag is necessary because the notifier indicating an item deletion in the model may be called |
603 | // after the actual deletion of the item; then, the callback function "wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc" may | |
604 | // try to update data into variables that are already deleted; this flag will ignore all variable update requests during item deletion | |
c0a66d92 RR |
605 | |
606 | void* m_cgContext; // pointer to core graphics context | |
07c51ff1 | 607 | |
c17b2e31 | 608 | ColumnPointerHashMapType m_ColumnPointers; // all column pointers are stored in a hash map with the property ID as a key |
c0a66d92 RR |
609 | |
610 | // wxWidget internal stuff: | |
611 | DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) | |
612 | DECLARE_NO_COPY_CLASS(wxDataViewCtrl) | |
613 | DECLARE_EVENT_TABLE() | |
614 | }; | |
615 | ||
616 | ||
34b1fdeb | 617 | #endif // _WX_MACCARBONDATAVIEWCTRL_H_ |