]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/dvrenderer.h
Enable variadic macros for VC9 and later.
[wxWidgets.git] / include / wx / osx / dvrenderer.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/dvrenderer.h
3 // Purpose: wxDataViewRenderer for OS X wxDataViewCtrl implementations
4 // Author: Vadim Zeitlin
5 // Created: 2009-11-07 (extracted from wx/osx/dataview.h)
6 // RCS-ID: $Id$
7 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_OSX_DVRENDERER_H_
12 #define _WX_OSX_DVRENDERER_H_
13
14 class wxDataViewRendererNativeData;
15
16 // ----------------------------------------------------------------------------
17 // wxDataViewRenderer
18 // ----------------------------------------------------------------------------
19
20 class WXDLLIMPEXP_ADV wxDataViewRenderer : public wxDataViewRendererBase
21 {
22 public:
23 // constructors / destructor
24 // -------------------------
25
26 wxDataViewRenderer(const wxString& varianttype,
27 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
28 int align = wxDVR_DEFAULT_ALIGNMENT);
29
30 virtual ~wxDataViewRenderer();
31
32 // inherited methods from wxDataViewRendererBase
33 // ---------------------------------------------
34
35 virtual int GetAlignment() const
36 {
37 return m_alignment;
38 }
39 virtual wxDataViewCellMode GetMode() const
40 {
41 return m_mode;
42 }
43 virtual bool GetValue(wxVariant& value) const
44 {
45 value = m_value;
46 return true;
47 }
48
49 // NB: in Carbon this is always identical to the header alignment
50 virtual void SetAlignment(int align);
51 virtual void SetMode(wxDataViewCellMode mode);
52 virtual bool SetValue(const wxVariant& newValue)
53 {
54 m_value = newValue;
55 return true;
56 }
57
58 virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
59 virtual wxEllipsizeMode GetEllipsizeMode() const;
60
61 // implementation
62 // --------------
63
64 const wxVariant& GetValue() const
65 {
66 return m_value;
67 }
68
69 wxDataViewRendererNativeData* GetNativeData() const
70 {
71 return m_NativeDataPtr;
72 }
73
74 // a call to the native data browser function to render the data;
75 // returns true if the data value could be rendered, false otherwise
76 virtual bool MacRender() = 0;
77
78 void SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr);
79
80
81 #if wxOSX_USE_COCOA
82 // called when a value was edited by user
83 virtual void OSXOnCellChanged(NSObject *value,
84 const wxDataViewItem& item,
85 unsigned col);
86
87 // called to ensure that the given attribute will be used for rendering the
88 // next cell (which had been already associated with this renderer before)
89 virtual void OSXApplyAttr(const wxDataViewItemAttr& attr);
90
91 // called to set the state of the next cell to be rendered
92 virtual void OSXApplyEnabled(bool enabled);
93 #endif // Cocoa
94
95 private:
96 // contains the alignment flags
97 int m_alignment;
98
99 // storing the mode that determines how the cell is going to be shown
100 wxDataViewCellMode m_mode;
101
102 // data used by implementation of the native renderer
103 wxDataViewRendererNativeData* m_NativeDataPtr;
104
105 // value that is going to be rendered
106 wxVariant m_value;
107
108 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
109 };
110
111 #endif // _WX_OSX_DVRENDERER_H_
112