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