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: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
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 RenderWithAttr(wxDC
& dc
,
50 const wxDataViewItemAttr
*attr
,
52 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
)
54 return DummyRender(cell
, dc
, state
);
57 wxSize
GetSize() const;
60 virtual bool HasEditorCtrl() const;
61 virtual wxControl
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
,
62 const wxVariant
&value
);
63 virtual bool GetValueFromEditorCtrl( wxControl
* editor
, wxVariant
&value
);
69 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer
)
72 // ---------------------------------------------------------
73 // wxDataViewBitmapRenderer
74 // ---------------------------------------------------------
76 class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer
: public wxDataViewRenderer
79 wxDataViewBitmapRenderer( const wxString
&varianttype
= wxT("wxBitmap"),
80 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
81 int align
= wxDVR_DEFAULT_ALIGNMENT
);
83 bool SetValue( const wxVariant
&value
);
84 bool GetValue( wxVariant
&value
) const;
86 bool Render( wxRect cell
, wxDC
*dc
, int state
);
87 wxSize
GetSize() const;
94 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer
)
97 // ---------------------------------------------------------
98 // wxDataViewToggleRenderer
99 // ---------------------------------------------------------
101 class WXDLLIMPEXP_ADV wxDataViewToggleRenderer
: public wxDataViewRenderer
104 wxDataViewToggleRenderer( const wxString
&varianttype
= wxT("bool"),
105 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
106 int align
= wxDVR_DEFAULT_ALIGNMENT
);
108 bool SetValue( const wxVariant
&value
);
109 bool GetValue( wxVariant
&value
) const;
111 bool Render( wxRect cell
, wxDC
*dc
, int state
);
112 bool Activate( wxRect cell
, wxDataViewModel
*model
, const wxDataViewItem
& item
,
114 wxSize
GetSize() const;
120 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer
)
123 // ---------------------------------------------------------
124 // wxDataViewProgressRenderer
125 // ---------------------------------------------------------
127 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer
: public wxDataViewRenderer
130 wxDataViewProgressRenderer( const wxString
&label
= wxEmptyString
,
131 const wxString
&varianttype
= wxT("long"),
132 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
133 int align
= wxDVR_DEFAULT_ALIGNMENT
);
135 bool SetValue( const wxVariant
&value
);
136 bool GetValue( wxVariant
& value
) const;
138 virtual bool RenderWithAttr(wxDC
& dc
,
141 const wxDataViewItemAttr
*attr
,
143 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
)
145 return DummyRender(cell
, dc
, state
);
147 virtual wxSize
GetSize() const;
154 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer
)
157 // ---------------------------------------------------------
158 // wxDataViewIconTextRenderer
159 // ---------------------------------------------------------
161 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer
: public wxDataViewRenderer
164 wxDataViewIconTextRenderer( const wxString
&varianttype
= wxT("wxDataViewIconText"),
165 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
166 int align
= wxDVR_DEFAULT_ALIGNMENT
);
168 bool SetValue( const wxVariant
&value
);
169 bool GetValue( wxVariant
&value
) const;
171 virtual bool RenderWithAttr(wxDC
& dc
,
174 const wxDataViewItemAttr
*attr
,
176 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
)
178 return DummyRender(cell
, dc
, state
);
180 virtual wxSize
GetSize() const;
182 virtual bool HasEditorCtrl() const { return true; }
183 virtual wxControl
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
,
184 const wxVariant
&value
);
185 virtual bool GetValueFromEditorCtrl( wxControl
* editor
, wxVariant
&value
);
188 wxDataViewIconText m_value
;
191 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer
)
194 // ---------------------------------------------------------
195 // wxDataViewDateRenderer
196 // ---------------------------------------------------------
198 class WXDLLIMPEXP_ADV wxDataViewDateRenderer
: public wxDataViewRenderer
201 wxDataViewDateRenderer( const wxString
&varianttype
= wxT("datetime"),
202 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
203 int align
= wxDVR_DEFAULT_ALIGNMENT
);
205 bool SetValue( const wxVariant
&value
);
206 bool GetValue( wxVariant
& value
) const;
208 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
209 virtual wxSize
GetSize() const;
210 virtual bool Activate( wxRect cell
,
211 wxDataViewModel
*model
,
212 const wxDataViewItem
& item
,
219 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer
)
223 #endif // _WX_GENERIC_DVRENDERERS_H_