]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/dvrenderers.h
wxOSX/Carbon compilation fix after wxListBoxBase changes.
[wxWidgets.git] / include / wx / generic / dvrenderers.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/dvrenderers.h
3 // Purpose: All generic wxDataViewCtrl renderer classes
4 // Author: Robert Roebling, Vadim Zeitlin
5 // Created: 2009-11-07 (extracted from wx/generic/dataview.h)
6 // RCS-ID: $Id$
7 // Copyright: (c) 2006 Robert Roebling
8 // (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GENERIC_DVRENDERERS_H_
13 #define _WX_GENERIC_DVRENDERERS_H_
14
15 // ---------------------------------------------------------
16 // wxDataViewCustomRenderer
17 // ---------------------------------------------------------
18
19 class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
20 {
21 public:
22 wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"),
23 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
24 int align = wxDVR_DEFAULT_ALIGNMENT );
25
26 virtual wxDataViewCustomRenderer *WXGetAsCustom() { return this; }
27
28 private:
29 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
30 };
31
32
33 // ---------------------------------------------------------
34 // wxDataViewTextRenderer
35 // ---------------------------------------------------------
36
37 class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
38 {
39 public:
40 wxDataViewTextRenderer( const wxString &varianttype = wxT("string"),
41 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
42 int align = wxDVR_DEFAULT_ALIGNMENT );
43
44 bool SetValue( const wxVariant &value );
45 bool GetValue( wxVariant &value ) const;
46
47 virtual bool Render(wxRect cell, wxDC *dc, int state);
48 virtual wxSize GetSize() const;
49
50 // in-place editing
51 virtual bool HasEditorCtrl() const;
52 virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
53 const wxVariant &value );
54 virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
55
56 protected:
57 wxString m_text;
58
59 protected:
60 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
61 };
62
63 // ---------------------------------------------------------
64 // wxDataViewBitmapRenderer
65 // ---------------------------------------------------------
66
67 class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
68 {
69 public:
70 wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"),
71 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
72 int align = wxDVR_DEFAULT_ALIGNMENT );
73
74 bool SetValue( const wxVariant &value );
75 bool GetValue( wxVariant &value ) const;
76
77 bool Render( wxRect cell, wxDC *dc, int state );
78 wxSize GetSize() const;
79
80 private:
81 wxIcon m_icon;
82 wxBitmap m_bitmap;
83
84 protected:
85 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
86 };
87
88 // ---------------------------------------------------------
89 // wxDataViewToggleRenderer
90 // ---------------------------------------------------------
91
92 class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
93 {
94 public:
95 wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"),
96 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
97 int align = wxDVR_DEFAULT_ALIGNMENT );
98
99 bool SetValue( const wxVariant &value );
100 bool GetValue( wxVariant &value ) const;
101
102 bool Render( wxRect cell, wxDC *dc, int state );
103 wxSize GetSize() const;
104
105 // Implementation only, don't use nor override
106 virtual void WXOnActivate(wxDataViewModel *model,
107 const wxVariant& valueOld,
108 const wxDataViewItem& item,
109 unsigned int col);
110 private:
111 bool m_toggle;
112
113 protected:
114 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
115 };
116
117 // ---------------------------------------------------------
118 // wxDataViewProgressRenderer
119 // ---------------------------------------------------------
120
121 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
122 {
123 public:
124 wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
125 const wxString &varianttype = wxT("long"),
126 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
127 int align = wxDVR_DEFAULT_ALIGNMENT );
128
129 bool SetValue( const wxVariant &value );
130 bool GetValue( wxVariant& value ) const;
131
132 virtual bool Render(wxRect cell, wxDC *dc, int state);
133 virtual wxSize GetSize() const;
134
135 private:
136 wxString m_label;
137 int m_value;
138
139 protected:
140 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
141 };
142
143 // ---------------------------------------------------------
144 // wxDataViewIconTextRenderer
145 // ---------------------------------------------------------
146
147 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
148 {
149 public:
150 wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"),
151 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
152 int align = wxDVR_DEFAULT_ALIGNMENT );
153
154 bool SetValue( const wxVariant &value );
155 bool GetValue( wxVariant &value ) const;
156
157 virtual bool Render(wxRect cell, wxDC *dc, int state);
158 virtual wxSize GetSize() const;
159
160 virtual bool HasEditorCtrl() const { return true; }
161 virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
162 const wxVariant &value );
163 virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
164
165 private:
166 wxDataViewIconText m_value;
167
168 protected:
169 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
170 };
171
172 // ---------------------------------------------------------
173 // wxDataViewDateRenderer
174 // ---------------------------------------------------------
175
176 class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
177 {
178 public:
179 wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"),
180 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
181 int align = wxDVR_DEFAULT_ALIGNMENT );
182
183 bool SetValue( const wxVariant &value );
184 bool GetValue( wxVariant& value ) const;
185
186 virtual bool Render( wxRect cell, wxDC *dc, int state );
187 virtual wxSize GetSize() const;
188
189 // Implementation only, don't use nor override
190 virtual void WXOnActivate(wxDataViewModel *model,
191 const wxVariant& valueOld,
192 const wxDataViewItem& item,
193 unsigned int col);
194
195 private:
196 wxDateTime m_date;
197
198 protected:
199 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
200 };
201
202
203 #endif // _WX_GENERIC_DVRENDERERS_H_
204