]>
Commit | Line | Data |
---|---|---|
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 | // RCS-ID: $Id$ | |
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 | ||
18 | class WXDLLIMPEXP_ADV wxDataViewCustomRenderer : public wxDataViewCustomRendererBase | |
19 | { | |
20 | public: | |
21 | wxDataViewCustomRenderer(const wxString& varianttype = "string", | |
22 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
23 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
24 | ||
25 | virtual ~wxDataViewCustomRenderer(); | |
26 | ||
27 | ||
28 | // implementation only | |
29 | // ------------------- | |
30 | ||
31 | virtual bool MacRender(); | |
32 | ||
33 | #if wxOSX_USE_COCOA | |
34 | virtual void OSXApplyAttr(const wxDataViewItemAttr& attr); | |
35 | #endif // Cocoa | |
36 | ||
37 | virtual wxDC* GetDC(); // creates a device context and keeps it | |
38 | void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer | |
39 | ||
40 | private: | |
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 | ||
52 | class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer | |
53 | { | |
54 | public: | |
55 | wxDataViewTextRenderer(const wxString& varianttype = "string", | |
56 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
57 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
58 | ||
59 | virtual bool MacRender(); | |
60 | ||
61 | #if wxOSX_USE_COCOA | |
62 | virtual void OSXOnCellChanged(NSObject *value, | |
63 | const wxDataViewItem& item, | |
64 | unsigned col); | |
65 | #endif // Cocoa | |
66 | ||
67 | private: | |
68 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) | |
69 | }; | |
70 | ||
71 | // --------------------------------------------------------- | |
72 | // wxDataViewBitmapRenderer | |
73 | // --------------------------------------------------------- | |
74 | ||
75 | class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer | |
76 | { | |
77 | public: | |
78 | wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap", | |
79 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
80 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
81 | ||
82 | virtual bool MacRender(); | |
83 | ||
84 | private: | |
85 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) | |
86 | }; | |
87 | ||
88 | #if wxOSX_USE_COCOA | |
89 | ||
90 | // ------------------------------------- | |
91 | // wxDataViewChoiceRenderer | |
92 | // ------------------------------------- | |
93 | ||
94 | class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewRenderer | |
95 | { | |
96 | public: | |
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 | ||
106 | #if wxOSX_USE_COCOA | |
107 | virtual void OSXOnCellChanged(NSObject *value, | |
108 | const wxDataViewItem& item, | |
109 | unsigned col); | |
110 | #endif // Cocoa | |
111 | ||
112 | private: | |
113 | wxArrayString m_choices; | |
114 | ||
115 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer) | |
116 | }; | |
117 | ||
118 | #endif // wxOSX_USE_COCOA | |
119 | ||
120 | // --------------------------------------------------------- | |
121 | // wxDataViewIconTextRenderer | |
122 | // --------------------------------------------------------- | |
123 | class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer | |
124 | { | |
125 | public: | |
126 | wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText", | |
127 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
128 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
129 | ||
130 | virtual bool MacRender(); | |
131 | ||
132 | #if wxOSX_USE_COCOA | |
133 | virtual void OSXOnCellChanged(NSObject *value, | |
134 | const wxDataViewItem& item, | |
135 | unsigned col); | |
136 | #endif // Cocoa | |
137 | ||
138 | private: | |
139 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) | |
140 | }; | |
141 | ||
142 | // --------------------------------------------------------- | |
143 | // wxDataViewToggleRenderer | |
144 | // --------------------------------------------------------- | |
145 | ||
146 | class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer | |
147 | { | |
148 | public: | |
149 | wxDataViewToggleRenderer(const wxString& varianttype = "bool", | |
150 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
151 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
152 | ||
153 | virtual bool MacRender(); | |
154 | ||
155 | #if wxOSX_USE_COCOA | |
156 | virtual void OSXOnCellChanged(NSObject *value, | |
157 | const wxDataViewItem& item, | |
158 | unsigned col); | |
159 | #endif // Cocoa | |
160 | ||
161 | private: | |
162 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) | |
163 | }; | |
164 | ||
165 | // --------------------------------------------------------- | |
166 | // wxDataViewProgressRenderer | |
167 | // --------------------------------------------------------- | |
168 | ||
169 | class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer | |
170 | { | |
171 | public: | |
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 | ||
179 | #if wxOSX_USE_COCOA | |
180 | virtual void OSXOnCellChanged(NSObject *value, | |
181 | const wxDataViewItem& item, | |
182 | unsigned col); | |
183 | #endif // Cocoa | |
184 | ||
185 | private: | |
186 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) | |
187 | }; | |
188 | ||
189 | // --------------------------------------------------------- | |
190 | // wxDataViewDateRenderer | |
191 | // --------------------------------------------------------- | |
192 | ||
193 | class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer | |
194 | { | |
195 | public: | |
196 | wxDataViewDateRenderer(const wxString& varianttype = "datetime", | |
197 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
198 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
199 | ||
200 | virtual bool MacRender(); | |
201 | ||
202 | #if wxOSX_USE_COCOA | |
203 | virtual void OSXOnCellChanged(NSObject *value, | |
204 | const wxDataViewItem& item, | |
205 | unsigned col); | |
206 | #endif // Cocoa | |
207 | ||
208 | private: | |
209 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) | |
210 | }; | |
211 | ||
212 | #endif // _WX_OSX_DVRENDERERS_H_ | |
213 |