]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/dvrenderers.h
Unselect all wxDataViewCtrl items when clicking outside of the item area.
[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
119e862c
VZ
106#if wxOSX_USE_COCOA
107 virtual void OSXOnCellChanged(NSObject *value,
108 const wxDataViewItem& item,
109 unsigned col);
110#endif // Cocoa
111
6eec70b9
VZ
112private:
113 wxArrayString m_choices;
114
115 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer)
116};
117
aaedb44c
VZ
118#endif // wxOSX_USE_COCOA
119
6eec70b9
VZ
120// ---------------------------------------------------------
121// wxDataViewIconTextRenderer
122// ---------------------------------------------------------
123class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
124{
125public:
126 wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText",
127 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
128 int align = wxDVR_DEFAULT_ALIGNMENT);
129
130 virtual bool MacRender();
131
aaedb44c 132#if wxOSX_USE_COCOA
6eec70b9
VZ
133 virtual void OSXOnCellChanged(NSObject *value,
134 const wxDataViewItem& item,
135 unsigned col);
aaedb44c 136#endif // Cocoa
6eec70b9
VZ
137
138private:
139 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
140};
141
142// ---------------------------------------------------------
143// wxDataViewToggleRenderer
144// ---------------------------------------------------------
145
146class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
147{
148public:
149 wxDataViewToggleRenderer(const wxString& varianttype = "bool",
150 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
151 int align = wxDVR_DEFAULT_ALIGNMENT);
152
153 virtual bool MacRender();
154
aaedb44c 155#if wxOSX_USE_COCOA
6eec70b9
VZ
156 virtual void OSXOnCellChanged(NSObject *value,
157 const wxDataViewItem& item,
158 unsigned col);
aaedb44c 159#endif // Cocoa
6eec70b9
VZ
160
161private:
162 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
163};
164
165// ---------------------------------------------------------
166// wxDataViewProgressRenderer
167// ---------------------------------------------------------
168
169class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
170{
171public:
172 wxDataViewProgressRenderer(const wxString& label = wxEmptyString,
173 const wxString& varianttype = "long",
174 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
175 int align = wxDVR_DEFAULT_ALIGNMENT);
176
177 virtual bool MacRender();
178
aaedb44c 179#if wxOSX_USE_COCOA
6eec70b9
VZ
180 virtual void OSXOnCellChanged(NSObject *value,
181 const wxDataViewItem& item,
182 unsigned col);
aaedb44c 183#endif // Cocoa
6eec70b9
VZ
184
185private:
186 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
187};
188
189// ---------------------------------------------------------
190// wxDataViewDateRenderer
191// ---------------------------------------------------------
192
193class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
194{
195public:
196 wxDataViewDateRenderer(const wxString& varianttype = "datetime",
197 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
198 int align = wxDVR_DEFAULT_ALIGNMENT);
199
200 virtual bool MacRender();
201
aaedb44c 202#if wxOSX_USE_COCOA
6eec70b9
VZ
203 virtual void OSXOnCellChanged(NSObject *value,
204 const wxDataViewItem& item,
205 unsigned col);
aaedb44c 206#endif // Cocoa
6eec70b9
VZ
207
208private:
209 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
210};
211
212#endif // _WX_OSX_DVRENDERERS_H_
213