1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/dvrenderers.h
3 // Purpose: All OS X wxDataViewCtrl renderer classes
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_DVRENDERERS_H_
12 #define _WX_OSX_DVRENDERERS_H_
14 // ---------------------------------------------------------
15 // wxDataViewCustomRenderer
16 // ---------------------------------------------------------
18 class WXDLLIMPEXP_ADV wxDataViewCustomRenderer
: public wxDataViewCustomRendererBase
21 wxDataViewCustomRenderer(const wxString
& varianttype
= "string",
22 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
23 int align
= wxDVR_DEFAULT_ALIGNMENT
);
25 virtual ~wxDataViewCustomRenderer();
28 // implementation only
29 // -------------------
31 virtual bool MacRender();
34 virtual void OSXApplyAttr(const wxDataViewItemAttr
& attr
);
37 virtual wxDC
* GetDC(); // creates a device context and keeps it
38 void SetDC(wxDC
* newDCPtr
); // this method takes ownership of the pointer
41 wxControl
* m_editorCtrlPtr
; // pointer to an in-place editor control
45 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer
)
48 // ---------------------------------------------------------
49 // wxDataViewTextRenderer
50 // ---------------------------------------------------------
52 class WXDLLIMPEXP_ADV wxDataViewTextRenderer
: public wxDataViewRenderer
55 wxDataViewTextRenderer(const wxString
& varianttype
= "string",
56 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
57 int align
= wxDVR_DEFAULT_ALIGNMENT
);
59 virtual bool MacRender();
62 virtual void OSXOnCellChanged(NSObject
*value
,
63 const wxDataViewItem
& item
,
68 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer
)
71 // ---------------------------------------------------------
72 // wxDataViewBitmapRenderer
73 // ---------------------------------------------------------
75 class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer
: public wxDataViewRenderer
78 wxDataViewBitmapRenderer(const wxString
& varianttype
= "wxBitmap",
79 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
80 int align
= wxDVR_DEFAULT_ALIGNMENT
);
82 virtual bool MacRender();
85 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer
)
90 // -------------------------------------
91 // wxDataViewChoiceRenderer
92 // -------------------------------------
94 class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer
: public wxDataViewRenderer
97 wxDataViewChoiceRenderer(const wxArrayString
& choices
,
98 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
99 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
101 virtual bool MacRender();
103 wxString
GetChoice(size_t index
) const { return m_choices
[index
]; }
104 const wxArrayString
& GetChoices() const { return m_choices
; }
107 virtual void OSXOnCellChanged(NSObject
*value
,
108 const wxDataViewItem
& item
,
113 wxArrayString m_choices
;
115 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer
)
118 #endif // wxOSX_USE_COCOA
120 // ---------------------------------------------------------
121 // wxDataViewIconTextRenderer
122 // ---------------------------------------------------------
123 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer
: public wxDataViewRenderer
126 wxDataViewIconTextRenderer(const wxString
& varianttype
= "wxDataViewIconText",
127 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
128 int align
= wxDVR_DEFAULT_ALIGNMENT
);
130 virtual bool MacRender();
133 virtual void OSXOnCellChanged(NSObject
*value
,
134 const wxDataViewItem
& item
,
139 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer
)
142 // ---------------------------------------------------------
143 // wxDataViewToggleRenderer
144 // ---------------------------------------------------------
146 class WXDLLIMPEXP_ADV wxDataViewToggleRenderer
: public wxDataViewRenderer
149 wxDataViewToggleRenderer(const wxString
& varianttype
= "bool",
150 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
151 int align
= wxDVR_DEFAULT_ALIGNMENT
);
153 virtual bool MacRender();
156 virtual void OSXOnCellChanged(NSObject
*value
,
157 const wxDataViewItem
& item
,
162 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer
)
165 // ---------------------------------------------------------
166 // wxDataViewProgressRenderer
167 // ---------------------------------------------------------
169 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer
: public wxDataViewRenderer
172 wxDataViewProgressRenderer(const wxString
& label
= wxEmptyString
,
173 const wxString
& varianttype
= "long",
174 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
175 int align
= wxDVR_DEFAULT_ALIGNMENT
);
177 virtual bool MacRender();
180 virtual void OSXOnCellChanged(NSObject
*value
,
181 const wxDataViewItem
& item
,
186 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer
)
189 // ---------------------------------------------------------
190 // wxDataViewDateRenderer
191 // ---------------------------------------------------------
193 class WXDLLIMPEXP_ADV wxDataViewDateRenderer
: public wxDataViewRenderer
196 wxDataViewDateRenderer(const wxString
& varianttype
= "datetime",
197 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
198 int align
= wxDVR_DEFAULT_ALIGNMENT
);
200 virtual bool MacRender();
203 virtual void OSXOnCellChanged(NSObject
*value
,
204 const wxDataViewItem
& item
,
209 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer
)
212 #endif // _WX_OSX_DVRENDERERS_H_