]>
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 | private: | |
107 | wxArrayString m_choices; | |
108 | ||
109 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer) | |
110 | }; | |
111 | ||
112 | #endif // wxOSX_USE_COCOA | |
113 | ||
114 | // --------------------------------------------------------- | |
115 | // wxDataViewIconTextRenderer | |
116 | // --------------------------------------------------------- | |
117 | class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer | |
118 | { | |
119 | public: | |
120 | wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText", | |
121 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
122 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
123 | ||
124 | virtual bool MacRender(); | |
125 | ||
126 | #if wxOSX_USE_COCOA | |
127 | virtual void OSXOnCellChanged(NSObject *value, | |
128 | const wxDataViewItem& item, | |
129 | unsigned col); | |
130 | #endif // Cocoa | |
131 | ||
132 | private: | |
133 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) | |
134 | }; | |
135 | ||
136 | // --------------------------------------------------------- | |
137 | // wxDataViewToggleRenderer | |
138 | // --------------------------------------------------------- | |
139 | ||
140 | class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer | |
141 | { | |
142 | public: | |
143 | wxDataViewToggleRenderer(const wxString& varianttype = "bool", | |
144 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
145 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
146 | ||
147 | virtual bool MacRender(); | |
148 | ||
149 | #if wxOSX_USE_COCOA | |
150 | virtual void OSXOnCellChanged(NSObject *value, | |
151 | const wxDataViewItem& item, | |
152 | unsigned col); | |
153 | #endif // Cocoa | |
154 | ||
155 | private: | |
156 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) | |
157 | }; | |
158 | ||
159 | // --------------------------------------------------------- | |
160 | // wxDataViewProgressRenderer | |
161 | // --------------------------------------------------------- | |
162 | ||
163 | class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer | |
164 | { | |
165 | public: | |
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 | ||
173 | #if wxOSX_USE_COCOA | |
174 | virtual void OSXOnCellChanged(NSObject *value, | |
175 | const wxDataViewItem& item, | |
176 | unsigned col); | |
177 | #endif // Cocoa | |
178 | ||
179 | private: | |
180 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) | |
181 | }; | |
182 | ||
183 | // --------------------------------------------------------- | |
184 | // wxDataViewDateRenderer | |
185 | // --------------------------------------------------------- | |
186 | ||
187 | class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer | |
188 | { | |
189 | public: | |
190 | wxDataViewDateRenderer(const wxString& varianttype = "datetime", | |
191 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
192 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
193 | ||
194 | virtual bool MacRender(); | |
195 | ||
196 | #if wxOSX_USE_COCOA | |
197 | virtual void OSXOnCellChanged(NSObject *value, | |
198 | const wxDataViewItem& item, | |
199 | unsigned col); | |
200 | #endif // Cocoa | |
201 | ||
202 | private: | |
203 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) | |
204 | }; | |
205 | ||
206 | #endif // _WX_OSX_DVRENDERERS_H_ | |
207 |