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)
7 // Copyright: (c) 2006 Robert Roebling
8 // (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GENERIC_DVRENDERERS_H_
13 #define _WX_GENERIC_DVRENDERERS_H_
15 // ---------------------------------------------------------
16 // wxDataViewCustomRenderer
17 // ---------------------------------------------------------
19 class WXDLLIMPEXP_ADV wxDataViewCustomRenderer
: public wxDataViewRenderer
22 wxDataViewCustomRenderer( const wxString
&varianttype
= wxT("string"),
23 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
24 int align
= wxDVR_DEFAULT_ALIGNMENT
);
26 virtual wxDataViewCustomRenderer
*WXGetAsCustom() { return this; }
29 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer
)
33 // ---------------------------------------------------------
34 // wxDataViewTextRenderer
35 // ---------------------------------------------------------
37 class WXDLLIMPEXP_ADV wxDataViewTextRenderer
: public wxDataViewRenderer
40 wxDataViewTextRenderer( const wxString
&varianttype
= wxT("string"),
41 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
42 int align
= wxDVR_DEFAULT_ALIGNMENT
);
44 bool SetValue( const wxVariant
&value
);
45 bool GetValue( wxVariant
&value
) const;
47 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
48 virtual wxSize
GetSize() const;
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
);
60 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer
)
63 // ---------------------------------------------------------
64 // wxDataViewBitmapRenderer
65 // ---------------------------------------------------------
67 class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer
: public wxDataViewRenderer
70 wxDataViewBitmapRenderer( const wxString
&varianttype
= wxT("wxBitmap"),
71 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
72 int align
= wxDVR_DEFAULT_ALIGNMENT
);
74 bool SetValue( const wxVariant
&value
);
75 bool GetValue( wxVariant
&value
) const;
77 bool Render( wxRect cell
, wxDC
*dc
, int state
);
78 wxSize
GetSize() const;
85 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer
)
88 // ---------------------------------------------------------
89 // wxDataViewToggleRenderer
90 // ---------------------------------------------------------
92 class WXDLLIMPEXP_ADV wxDataViewToggleRenderer
: public wxDataViewRenderer
95 wxDataViewToggleRenderer( const wxString
&varianttype
= wxT("bool"),
96 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
97 int align
= wxDVR_DEFAULT_ALIGNMENT
);
99 bool SetValue( const wxVariant
&value
);
100 bool GetValue( wxVariant
&value
) const;
102 bool Render( wxRect cell
, wxDC
*dc
, int state
);
103 wxSize
GetSize() const;
105 // Implementation only, don't use nor override
106 virtual void WXOnActivate(wxDataViewModel
*model
,
107 const wxVariant
& valueOld
,
108 const wxDataViewItem
& item
,
114 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer
)
117 // ---------------------------------------------------------
118 // wxDataViewProgressRenderer
119 // ---------------------------------------------------------
121 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer
: public wxDataViewRenderer
124 wxDataViewProgressRenderer( const wxString
&label
= wxEmptyString
,
125 const wxString
&varianttype
= wxT("long"),
126 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
127 int align
= wxDVR_DEFAULT_ALIGNMENT
);
129 bool SetValue( const wxVariant
&value
);
130 bool GetValue( wxVariant
& value
) const;
132 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
133 virtual wxSize
GetSize() const;
140 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer
)
143 // ---------------------------------------------------------
144 // wxDataViewIconTextRenderer
145 // ---------------------------------------------------------
147 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer
: public wxDataViewRenderer
150 wxDataViewIconTextRenderer( const wxString
&varianttype
= wxT("wxDataViewIconText"),
151 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
152 int align
= wxDVR_DEFAULT_ALIGNMENT
);
154 bool SetValue( const wxVariant
&value
);
155 bool GetValue( wxVariant
&value
) const;
157 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
158 virtual wxSize
GetSize() const;
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
);
166 wxDataViewIconText m_value
;
169 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer
)
172 // ---------------------------------------------------------
173 // wxDataViewDateRenderer
174 // ---------------------------------------------------------
176 class WXDLLIMPEXP_ADV wxDataViewDateRenderer
: public wxDataViewRenderer
179 wxDataViewDateRenderer( const wxString
&varianttype
= wxT("datetime"),
180 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
181 int align
= wxDVR_DEFAULT_ALIGNMENT
);
183 bool SetValue( const wxVariant
&value
);
184 bool GetValue( wxVariant
& value
) const;
186 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
187 virtual wxSize
GetSize() const;
189 // Implementation only, don't use nor override
190 virtual void WXOnActivate(wxDataViewModel
*model
,
191 const wxVariant
& valueOld
,
192 const wxDataViewItem
& item
,
199 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer
)
203 #endif // _WX_GENERIC_DVRENDERERS_H_