]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/dvrenderers.h
Harmonize wxDataViewCtrl::GetSelection() behaviour in all ports.
[wxWidgets.git] / include / wx / osx / dvrenderers.h
CommitLineData
6eec70b9
VZ
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)
b1153ed6 6// RCS-ID: $Id$
6eec70b9
VZ
7// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_OSX_DVRENDERERS_H_
12#define _WX_OSX_DVRENDERERS_H_
13
14// ---------------------------------------------------------
15// wxDataViewCustomRenderer
16// ---------------------------------------------------------
17
18class WXDLLIMPEXP_ADV wxDataViewCustomRenderer : public wxDataViewCustomRendererBase
19{
20public:
21 wxDataViewCustomRenderer(const wxString& varianttype = "string",
22 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
23 int align = wxDVR_DEFAULT_ALIGNMENT);
24
25 virtual ~wxDataViewCustomRenderer();
26
6eec70b9
VZ
27
28 // implementation only
29 // -------------------
30
31 virtual bool MacRender();
32
061a5c21 33#if wxOSX_USE_COCOA
b0607dd2 34 virtual void OSXApplyAttr(const wxDataViewItemAttr& attr);
061a5c21 35#endif // Cocoa
b0607dd2 36
6eec70b9
VZ
37 virtual wxDC* GetDC(); // creates a device context and keeps it
38 void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer
39
40private:
41 wxControl* m_editorCtrlPtr; // pointer to an in-place editor control
42
43 wxDC* m_DCPtr;
44
45 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
46};
47
48// ---------------------------------------------------------
49// wxDataViewTextRenderer
50// ---------------------------------------------------------
51
52class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
53{
54public:
55 wxDataViewTextRenderer(const wxString& varianttype = "string",
56 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
57 int align = wxDVR_DEFAULT_ALIGNMENT);
58
59 virtual bool MacRender();
60
aaedb44c 61#if wxOSX_USE_COCOA
6eec70b9
VZ
62 virtual void OSXOnCellChanged(NSObject *value,
63 const wxDataViewItem& item,
64 unsigned col);
aaedb44c 65#endif // Cocoa
6eec70b9
VZ
66
67private:
68 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
69};
70
71// ---------------------------------------------------------
72// wxDataViewBitmapRenderer
73// ---------------------------------------------------------
74
75class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
76{
77public:
78 wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap",
79 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
80 int align = wxDVR_DEFAULT_ALIGNMENT);
81
82 virtual bool MacRender();
83
84private:
85 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
86};
87
aaedb44c
VZ
88#if wxOSX_USE_COCOA
89
6eec70b9
VZ
90// -------------------------------------
91// wxDataViewChoiceRenderer
92// -------------------------------------
93
94class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewRenderer
95{
96public:
97 wxDataViewChoiceRenderer(const wxArrayString& choices,
98 wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
99 int alignment = wxDVR_DEFAULT_ALIGNMENT );
100
101 virtual bool MacRender();
102
103 wxString GetChoice(size_t index) const { return m_choices[index]; }
104 const wxArrayString& GetChoices() const { return m_choices; }
105
106private:
107 wxArrayString m_choices;
108
109 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer)
110};
111
aaedb44c
VZ
112#endif // wxOSX_USE_COCOA
113
6eec70b9
VZ
114// ---------------------------------------------------------
115// wxDataViewIconTextRenderer
116// ---------------------------------------------------------
117class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
118{
119public:
120 wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText",
121 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
122 int align = wxDVR_DEFAULT_ALIGNMENT);
123
124 virtual bool MacRender();
125
aaedb44c 126#if wxOSX_USE_COCOA
6eec70b9
VZ
127 virtual void OSXOnCellChanged(NSObject *value,
128 const wxDataViewItem& item,
129 unsigned col);
aaedb44c 130#endif // Cocoa
6eec70b9
VZ
131
132private:
133 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
134};
135
136// ---------------------------------------------------------
137// wxDataViewToggleRenderer
138// ---------------------------------------------------------
139
140class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
141{
142public:
143 wxDataViewToggleRenderer(const wxString& varianttype = "bool",
144 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
145 int align = wxDVR_DEFAULT_ALIGNMENT);
146
147 virtual bool MacRender();
148
aaedb44c 149#if wxOSX_USE_COCOA
6eec70b9
VZ
150 virtual void OSXOnCellChanged(NSObject *value,
151 const wxDataViewItem& item,
152 unsigned col);
aaedb44c 153#endif // Cocoa
6eec70b9
VZ
154
155private:
156 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
157};
158
159// ---------------------------------------------------------
160// wxDataViewProgressRenderer
161// ---------------------------------------------------------
162
163class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
164{
165public:
166 wxDataViewProgressRenderer(const wxString& label = wxEmptyString,
167 const wxString& varianttype = "long",
168 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
169 int align = wxDVR_DEFAULT_ALIGNMENT);
170
171 virtual bool MacRender();
172
aaedb44c 173#if wxOSX_USE_COCOA
6eec70b9
VZ
174 virtual void OSXOnCellChanged(NSObject *value,
175 const wxDataViewItem& item,
176 unsigned col);
aaedb44c 177#endif // Cocoa
6eec70b9
VZ
178
179private:
180 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
181};
182
183// ---------------------------------------------------------
184// wxDataViewDateRenderer
185// ---------------------------------------------------------
186
187class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
188{
189public:
190 wxDataViewDateRenderer(const wxString& varianttype = "datetime",
191 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
192 int align = wxDVR_DEFAULT_ALIGNMENT);
193
194 virtual bool MacRender();
195
aaedb44c 196#if wxOSX_USE_COCOA
6eec70b9
VZ
197 virtual void OSXOnCellChanged(NSObject *value,
198 const wxDataViewItem& item,
199 unsigned col);
aaedb44c 200#endif // Cocoa
6eec70b9
VZ
201
202private:
203 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
204};
205
206#endif // _WX_OSX_DVRENDERERS_H_
207