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)
6 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_OSX_DVRENDERERS_H_
11 #define _WX_OSX_DVRENDERERS_H_
13 // ---------------------------------------------------------
14 // wxDataViewCustomRenderer
15 // ---------------------------------------------------------
17 class WXDLLIMPEXP_ADV wxDataViewCustomRenderer
: public wxDataViewCustomRendererBase
20 wxDataViewCustomRenderer(const wxString
& varianttype
= "string",
21 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
22 int align
= wxDVR_DEFAULT_ALIGNMENT
);
24 virtual ~wxDataViewCustomRenderer();
27 // implementation only
28 // -------------------
30 virtual bool MacRender();
33 virtual void OSXApplyAttr(const wxDataViewItemAttr
& attr
);
36 virtual wxDC
* GetDC(); // creates a device context and keeps it
37 void SetDC(wxDC
* newDCPtr
); // this method takes ownership of the pointer
40 wxControl
* m_editorCtrlPtr
; // pointer to an in-place editor control
44 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer
)
47 // ---------------------------------------------------------
48 // wxDataViewTextRenderer
49 // ---------------------------------------------------------
51 class WXDLLIMPEXP_ADV wxDataViewTextRenderer
: public wxDataViewRenderer
54 wxDataViewTextRenderer(const wxString
& varianttype
= "string",
55 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
56 int align
= wxDVR_DEFAULT_ALIGNMENT
);
58 virtual bool MacRender();
61 virtual void OSXOnCellChanged(NSObject
*value
,
62 const wxDataViewItem
& item
,
67 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer
)
70 // ---------------------------------------------------------
71 // wxDataViewBitmapRenderer
72 // ---------------------------------------------------------
74 class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer
: public wxDataViewRenderer
77 wxDataViewBitmapRenderer(const wxString
& varianttype
= "wxBitmap",
78 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
79 int align
= wxDVR_DEFAULT_ALIGNMENT
);
81 virtual bool MacRender();
84 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer
)
89 // -------------------------------------
90 // wxDataViewChoiceRenderer
91 // -------------------------------------
93 class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer
: public wxDataViewRenderer
96 wxDataViewChoiceRenderer(const wxArrayString
& choices
,
97 wxDataViewCellMode mode
= wxDATAVIEW_CELL_EDITABLE
,
98 int alignment
= wxDVR_DEFAULT_ALIGNMENT
);
100 virtual bool MacRender();
102 wxString
GetChoice(size_t index
) const { return m_choices
[index
]; }
103 const wxArrayString
& GetChoices() const { return m_choices
; }
106 virtual void OSXOnCellChanged(NSObject
*value
,
107 const wxDataViewItem
& item
,
112 wxArrayString m_choices
;
114 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer
)
117 #endif // wxOSX_USE_COCOA
119 // ---------------------------------------------------------
120 // wxDataViewIconTextRenderer
121 // ---------------------------------------------------------
122 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer
: public wxDataViewRenderer
125 wxDataViewIconTextRenderer(const wxString
& varianttype
= "wxDataViewIconText",
126 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
127 int align
= wxDVR_DEFAULT_ALIGNMENT
);
129 virtual bool MacRender();
132 virtual void OSXOnCellChanged(NSObject
*value
,
133 const wxDataViewItem
& item
,
138 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer
)
141 // ---------------------------------------------------------
142 // wxDataViewToggleRenderer
143 // ---------------------------------------------------------
145 class WXDLLIMPEXP_ADV wxDataViewToggleRenderer
: public wxDataViewRenderer
148 wxDataViewToggleRenderer(const wxString
& varianttype
= "bool",
149 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
150 int align
= wxDVR_DEFAULT_ALIGNMENT
);
152 virtual bool MacRender();
155 virtual void OSXOnCellChanged(NSObject
*value
,
156 const wxDataViewItem
& item
,
161 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer
)
164 // ---------------------------------------------------------
165 // wxDataViewProgressRenderer
166 // ---------------------------------------------------------
168 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer
: public wxDataViewRenderer
171 wxDataViewProgressRenderer(const wxString
& label
= wxEmptyString
,
172 const wxString
& varianttype
= "long",
173 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
174 int align
= wxDVR_DEFAULT_ALIGNMENT
);
176 virtual bool MacRender();
179 virtual void OSXOnCellChanged(NSObject
*value
,
180 const wxDataViewItem
& item
,
185 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer
)
188 // ---------------------------------------------------------
189 // wxDataViewDateRenderer
190 // ---------------------------------------------------------
192 class WXDLLIMPEXP_ADV wxDataViewDateRenderer
: public wxDataViewRenderer
195 wxDataViewDateRenderer(const wxString
& varianttype
= "datetime",
196 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
197 int align
= wxDVR_DEFAULT_ALIGNMENT
);
199 virtual bool MacRender();
202 virtual void OSXOnCellChanged(NSObject
*value
,
203 const wxDataViewItem
& item
,
208 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer
)
211 #endif // _WX_OSX_DVRENDERERS_H_