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 bool Activate( wxRect cell
, wxDataViewModel
*model
, const wxDataViewItem
& item
,
105 wxSize
GetSize() const;
111 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer
)
114 // ---------------------------------------------------------
115 // wxDataViewProgressRenderer
116 // ---------------------------------------------------------
118 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer
: public wxDataViewRenderer
121 wxDataViewProgressRenderer( const wxString
&label
= wxEmptyString
,
122 const wxString
&varianttype
= wxT("long"),
123 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
124 int align
= wxDVR_DEFAULT_ALIGNMENT
);
126 bool SetValue( const wxVariant
&value
);
127 bool GetValue( wxVariant
& value
) const;
129 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
130 virtual wxSize
GetSize() const;
137 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer
)
140 // ---------------------------------------------------------
141 // wxDataViewIconTextRenderer
142 // ---------------------------------------------------------
144 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer
: public wxDataViewRenderer
147 wxDataViewIconTextRenderer( const wxString
&varianttype
= wxT("wxDataViewIconText"),
148 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
149 int align
= wxDVR_DEFAULT_ALIGNMENT
);
151 bool SetValue( const wxVariant
&value
);
152 bool GetValue( wxVariant
&value
) const;
154 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
155 virtual wxSize
GetSize() const;
157 virtual bool HasEditorCtrl() const { return true; }
158 virtual wxControl
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
,
159 const wxVariant
&value
);
160 virtual bool GetValueFromEditorCtrl( wxControl
* editor
, wxVariant
&value
);
163 wxDataViewIconText m_value
;
166 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer
)
169 // ---------------------------------------------------------
170 // wxDataViewDateRenderer
171 // ---------------------------------------------------------
173 class WXDLLIMPEXP_ADV wxDataViewDateRenderer
: public wxDataViewRenderer
176 wxDataViewDateRenderer( const wxString
&varianttype
= wxT("datetime"),
177 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
178 int align
= wxDVR_DEFAULT_ALIGNMENT
);
180 bool SetValue( const wxVariant
&value
);
181 bool GetValue( wxVariant
& value
) const;
183 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
184 virtual wxSize
GetSize() const;
185 virtual bool Activate( wxRect cell
,
186 wxDataViewModel
*model
,
187 const wxDataViewItem
& item
,
194 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer
)
198 #endif // _WX_GENERIC_DVRENDERERS_H_