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
);
27 // see the explanation of the following WXOnXXX() methods in wx/generic/dvrenderer.h
29 virtual bool WXOnActivate(const wxRect
& cell
,
30 wxDataViewModel
*model
,
31 const wxDataViewItem
& item
,
34 return Activate(cell
, model
, item
, col
);
37 virtual bool WXOnLeftClick(const wxPoint
& cursor
,
39 wxDataViewModel
*model
,
40 const wxDataViewItem
&item
,
43 return LeftClick(cursor
, cell
, model
, item
, col
);
47 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer
)
51 // ---------------------------------------------------------
52 // wxDataViewTextRenderer
53 // ---------------------------------------------------------
55 class WXDLLIMPEXP_ADV wxDataViewTextRenderer
: public wxDataViewRenderer
58 wxDataViewTextRenderer( const wxString
&varianttype
= wxT("string"),
59 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
60 int align
= wxDVR_DEFAULT_ALIGNMENT
);
62 bool SetValue( const wxVariant
&value
);
63 bool GetValue( wxVariant
&value
) const;
65 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
66 virtual wxSize
GetSize() const;
69 virtual bool HasEditorCtrl() const;
70 virtual wxWindow
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
,
71 const wxVariant
&value
);
72 virtual bool GetValueFromEditorCtrl( wxWindow
* editor
, wxVariant
&value
);
78 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer
)
81 // ---------------------------------------------------------
82 // wxDataViewBitmapRenderer
83 // ---------------------------------------------------------
85 class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer
: public wxDataViewRenderer
88 wxDataViewBitmapRenderer( const wxString
&varianttype
= wxT("wxBitmap"),
89 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
90 int align
= wxDVR_DEFAULT_ALIGNMENT
);
92 bool SetValue( const wxVariant
&value
);
93 bool GetValue( wxVariant
&value
) const;
95 bool Render( wxRect cell
, wxDC
*dc
, int state
);
96 wxSize
GetSize() const;
103 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer
)
106 // ---------------------------------------------------------
107 // wxDataViewToggleRenderer
108 // ---------------------------------------------------------
110 class WXDLLIMPEXP_ADV wxDataViewToggleRenderer
: public wxDataViewRenderer
113 wxDataViewToggleRenderer( const wxString
&varianttype
= wxT("bool"),
114 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
115 int align
= wxDVR_DEFAULT_ALIGNMENT
);
117 bool SetValue( const wxVariant
&value
);
118 bool GetValue( wxVariant
&value
) const;
120 bool Render( wxRect cell
, wxDC
*dc
, int state
);
121 wxSize
GetSize() const;
123 // Implementation only, don't use nor override
124 virtual bool WXOnLeftClick(const wxPoint
& cursor
,
126 wxDataViewModel
*model
,
127 const wxDataViewItem
& item
,
133 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer
)
136 // ---------------------------------------------------------
137 // wxDataViewProgressRenderer
138 // ---------------------------------------------------------
140 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer
: public wxDataViewRenderer
143 wxDataViewProgressRenderer( const wxString
&label
= wxEmptyString
,
144 const wxString
&varianttype
= wxT("long"),
145 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
146 int align
= wxDVR_DEFAULT_ALIGNMENT
);
148 bool SetValue( const wxVariant
&value
);
149 bool GetValue( wxVariant
& value
) const;
151 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
152 virtual wxSize
GetSize() const;
159 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer
)
162 // ---------------------------------------------------------
163 // wxDataViewIconTextRenderer
164 // ---------------------------------------------------------
166 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer
: public wxDataViewRenderer
169 wxDataViewIconTextRenderer( const wxString
&varianttype
= wxT("wxDataViewIconText"),
170 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
171 int align
= wxDVR_DEFAULT_ALIGNMENT
);
173 bool SetValue( const wxVariant
&value
);
174 bool GetValue( wxVariant
&value
) const;
176 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
177 virtual wxSize
GetSize() const;
179 virtual bool HasEditorCtrl() const { return true; }
180 virtual wxWindow
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
,
181 const wxVariant
&value
);
182 virtual bool GetValueFromEditorCtrl( wxWindow
* editor
, wxVariant
&value
);
185 wxDataViewIconText m_value
;
188 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer
)
191 // ---------------------------------------------------------
192 // wxDataViewDateRenderer
193 // ---------------------------------------------------------
195 class WXDLLIMPEXP_ADV wxDataViewDateRenderer
: public wxDataViewRenderer
198 wxDataViewDateRenderer( const wxString
&varianttype
= wxT("datetime"),
199 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
,
200 int align
= wxDVR_DEFAULT_ALIGNMENT
);
202 bool SetValue( const wxVariant
&value
);
203 bool GetValue( wxVariant
& value
) const;
205 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
206 virtual wxSize
GetSize() const;
208 // Implementation only, don't use nor override
209 virtual bool WXOnActivate(const wxRect
& cell
,
210 wxDataViewModel
*model
,
211 const wxDataViewItem
& item
,
218 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer
)
222 #endif // _WX_GENERIC_DVRENDERERS_H_