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 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_OSX_DVRENDERER_H_
11 #define _WX_OSX_DVRENDERER_H_
13 class wxDataViewRendererNativeData
;
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 class WXDLLIMPEXP_ADV wxDataViewRenderer
: public wxDataViewRendererBase
22 // constructors / destructor
23 // -------------------------
25 wxDataViewRenderer(const wxString
& varianttype
,
26 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
27 int align
= wxDVR_DEFAULT_ALIGNMENT
);
29 virtual ~wxDataViewRenderer();
31 // inherited methods from wxDataViewRendererBase
32 // ---------------------------------------------
34 virtual int GetAlignment() const
38 virtual wxDataViewCellMode
GetMode() const
42 virtual bool GetValue(wxVariant
& value
) const
48 // NB: in Carbon this is always identical to the header alignment
49 virtual void SetAlignment(int align
);
50 virtual void SetMode(wxDataViewCellMode mode
);
51 virtual bool SetValue(const wxVariant
& newValue
)
57 virtual void EnableEllipsize(wxEllipsizeMode mode
= wxELLIPSIZE_MIDDLE
);
58 virtual wxEllipsizeMode
GetEllipsizeMode() const;
63 const wxVariant
& GetValue() const
68 wxDataViewRendererNativeData
* GetNativeData() const
70 return m_NativeDataPtr
;
73 // a call to the native data browser function to render the data;
74 // returns true if the data value could be rendered, false otherwise
75 virtual bool MacRender() = 0;
77 void SetNativeData(wxDataViewRendererNativeData
* newNativeDataPtr
);
81 // called when a value was edited by user
82 virtual void OSXOnCellChanged(NSObject
*value
,
83 const wxDataViewItem
& item
,
86 // called to ensure that the given attribute will be used for rendering the
87 // next cell (which had been already associated with this renderer before)
88 virtual void OSXApplyAttr(const wxDataViewItemAttr
& attr
);
90 // called to set the state of the next cell to be rendered
91 virtual void OSXApplyEnabled(bool enabled
);
95 // contains the alignment flags
98 // storing the mode that determines how the cell is going to be shown
99 wxDataViewCellMode m_mode
;
101 // data used by implementation of the native renderer
102 wxDataViewRendererNativeData
* m_NativeDataPtr
;
104 // value that is going to be rendered
107 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer
)
110 #endif // _WX_OSX_DVRENDERER_H_