]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/dvrenderers.h
b25ca48e5a44103dc3c2cd4b512f9d16efbaa5b5
[wxWidgets.git] / include / wx / osx / dvrenderers.h
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: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
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 void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state );
28
29 virtual wxSize GetSize() const = 0;
30
31 virtual bool Render(wxRect cell, wxDC* dc, int state) = 0;
32
33
34 // implementation only
35 // -------------------
36
37 virtual bool MacRender();
38
39 virtual wxDC* GetDC(); // creates a device context and keeps it
40 void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer
41
42 private:
43 wxControl* m_editorCtrlPtr; // pointer to an in-place editor control
44
45 wxDC* m_DCPtr;
46
47 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
48 };
49
50 // ---------------------------------------------------------
51 // wxDataViewTextRenderer
52 // ---------------------------------------------------------
53
54 class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
55 {
56 public:
57 wxDataViewTextRenderer(const wxString& varianttype = "string",
58 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
59 int align = wxDVR_DEFAULT_ALIGNMENT);
60
61 virtual bool MacRender();
62
63 #if wxOSX_USE_COCOA
64 virtual void OSXOnCellChanged(NSObject *value,
65 const wxDataViewItem& item,
66 unsigned col);
67 #endif // Cocoa
68
69 private:
70 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
71 };
72
73 // ---------------------------------------------------------
74 // wxDataViewBitmapRenderer
75 // ---------------------------------------------------------
76
77 class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
78 {
79 public:
80 wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap",
81 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
82 int align = wxDVR_DEFAULT_ALIGNMENT);
83
84 virtual bool MacRender();
85
86 private:
87 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
88 };
89
90 #if wxOSX_USE_COCOA
91
92 // -------------------------------------
93 // wxDataViewChoiceRenderer
94 // -------------------------------------
95
96 class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewRenderer
97 {
98 public:
99 wxDataViewChoiceRenderer(const wxArrayString& choices,
100 wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
101 int alignment = wxDVR_DEFAULT_ALIGNMENT );
102
103 virtual bool MacRender();
104
105 wxString GetChoice(size_t index) const { return m_choices[index]; }
106 const wxArrayString& GetChoices() const { return m_choices; }
107
108 private:
109 wxArrayString m_choices;
110
111 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer)
112 };
113
114 #endif // wxOSX_USE_COCOA
115
116 // ---------------------------------------------------------
117 // wxDataViewIconTextRenderer
118 // ---------------------------------------------------------
119 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
120 {
121 public:
122 wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText",
123 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
124 int align = wxDVR_DEFAULT_ALIGNMENT);
125
126 virtual bool MacRender();
127
128 #if wxOSX_USE_COCOA
129 virtual void OSXOnCellChanged(NSObject *value,
130 const wxDataViewItem& item,
131 unsigned col);
132 #endif // Cocoa
133
134 private:
135 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
136 };
137
138 // ---------------------------------------------------------
139 // wxDataViewToggleRenderer
140 // ---------------------------------------------------------
141
142 class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
143 {
144 public:
145 wxDataViewToggleRenderer(const wxString& varianttype = "bool",
146 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
147 int align = wxDVR_DEFAULT_ALIGNMENT);
148
149 virtual bool MacRender();
150
151 #if wxOSX_USE_COCOA
152 virtual void OSXOnCellChanged(NSObject *value,
153 const wxDataViewItem& item,
154 unsigned col);
155 #endif // Cocoa
156
157 private:
158 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
159 };
160
161 // ---------------------------------------------------------
162 // wxDataViewProgressRenderer
163 // ---------------------------------------------------------
164
165 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
166 {
167 public:
168 wxDataViewProgressRenderer(const wxString& label = wxEmptyString,
169 const wxString& varianttype = "long",
170 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
171 int align = wxDVR_DEFAULT_ALIGNMENT);
172
173 virtual bool MacRender();
174
175 #if wxOSX_USE_COCOA
176 virtual void OSXOnCellChanged(NSObject *value,
177 const wxDataViewItem& item,
178 unsigned col);
179 #endif // Cocoa
180
181 private:
182 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
183 };
184
185 // ---------------------------------------------------------
186 // wxDataViewDateRenderer
187 // ---------------------------------------------------------
188
189 class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
190 {
191 public:
192 wxDataViewDateRenderer(const wxString& varianttype = "datetime",
193 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
194 int align = wxDVR_DEFAULT_ALIGNMENT);
195
196 virtual bool MacRender();
197
198 #if wxOSX_USE_COCOA
199 virtual void OSXOnCellChanged(NSObject *value,
200 const wxDataViewItem& item,
201 unsigned col);
202 #endif // Cocoa
203
204 private:
205 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
206 };
207
208 #endif // _WX_OSX_DVRENDERERS_H_
209