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)
7 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_OSX_DVRENDERER_H_
12 #define _WX_OSX_DVRENDERER_H_
14 class wxDataViewRendererNativeData
;
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 class WXDLLIMPEXP_ADV wxDataViewRenderer
: public wxDataViewRendererBase
23 // constructors / destructor
24 // -------------------------
26 wxDataViewRenderer(const wxString
& varianttype
,
27 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
28 int align
= wxDVR_DEFAULT_ALIGNMENT
);
30 virtual ~wxDataViewRenderer();
32 // inherited methods from wxDataViewRendererBase
33 // ---------------------------------------------
35 virtual int GetAlignment() const
39 virtual wxDataViewCellMode
GetMode() const
43 virtual bool GetValue(wxVariant
& value
) const
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
)
58 virtual void EnableEllipsize(wxEllipsizeMode mode
= wxELLIPSIZE_MIDDLE
);
59 virtual wxEllipsizeMode
GetEllipsizeMode() const;
64 const wxVariant
& GetValue() const
69 wxDataViewRendererNativeData
* GetNativeData() const
71 return m_NativeDataPtr
;
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;
78 void SetNativeData(wxDataViewRendererNativeData
* newNativeDataPtr
);
82 // called when a value was edited by user
83 virtual void OSXOnCellChanged(NSObject
*value
,
84 const wxDataViewItem
& item
,
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
);
93 // contains the alignment flags
96 // storing the mode that determines how the cell is going to be shown
97 wxDataViewCellMode m_mode
;
99 // data used by implementation of the native renderer
100 wxDataViewRendererNativeData
* m_NativeDataPtr
;
102 // value that is going to be rendered
105 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer
)
108 #endif // _WX_OSX_DVRENDERER_H_