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 WXActivateCell(const wxRect
& cell
,
30 wxDataViewModel
*model
,
31 const wxDataViewItem
& item
,
33 const wxMouseEvent
*mouseEvent
)
35 return ActivateCell(cell
, model
, item
, col
, mouseEvent
);
39 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer
)
43 // ---------------------------------------------------------
44 // wxDataViewTextRenderer
45 // ---------------------------------------------------------
47 class WXDLLIMPEXP_ADV wxDataViewTextRenderer
: public wxDataViewRenderer
50 wxDataViewTextRenderer( const wxString
&varianttype
= wxT("string"),
51 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
52 int align
= wxDVR_DEFAULT_ALIGNMENT
);
54 bool SetValue( const wxVariant
&value
);
55 bool GetValue( wxVariant
&value
) const;
57 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
58 virtual wxSize
GetSize() const;
61 virtual bool HasEditorCtrl() const;
62 virtual wxWindow
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
,
63 const wxVariant
&value
);
64 virtual bool GetValueFromEditorCtrl( wxWindow
* editor
, wxVariant
&value
);
70 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer
)
73 // ---------------------------------------------------------
74 // wxDataViewBitmapRenderer
75 // ---------------------------------------------------------
77 class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer
: public wxDataViewRenderer
80 wxDataViewBitmapRenderer( const wxString
&varianttype
= wxT("wxBitmap"),
81 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
82 int align
= wxDVR_DEFAULT_ALIGNMENT
);
84 bool SetValue( const wxVariant
&value
);
85 bool GetValue( wxVariant
&value
) const;
87 bool Render( wxRect cell
, wxDC
*dc
, int state
);
88 wxSize
GetSize() const;
95 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer
)
98 // ---------------------------------------------------------
99 // wxDataViewToggleRenderer
100 // ---------------------------------------------------------
102 class WXDLLIMPEXP_ADV wxDataViewToggleRenderer
: public wxDataViewRenderer
105 wxDataViewToggleRenderer( const wxString
&varianttype
= wxT("bool"),
106 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
107 int align
= wxDVR_DEFAULT_ALIGNMENT
);
109 bool SetValue( const wxVariant
&value
);
110 bool GetValue( wxVariant
&value
) const;
112 bool Render( wxRect cell
, wxDC
*dc
, int state
);
113 wxSize
GetSize() const;
115 // Implementation only, don't use nor override
116 virtual bool WXActivateCell(const wxRect
& cell
,
117 wxDataViewModel
*model
,
118 const wxDataViewItem
& item
,
120 const wxMouseEvent
*mouseEvent
);
125 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer
)
128 // ---------------------------------------------------------
129 // wxDataViewProgressRenderer
130 // ---------------------------------------------------------
132 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer
: public wxDataViewRenderer
135 wxDataViewProgressRenderer( const wxString
&label
= wxEmptyString
,
136 const wxString
&varianttype
= wxT("long"),
137 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
138 int align
= wxDVR_DEFAULT_ALIGNMENT
);
140 bool SetValue( const wxVariant
&value
);
141 bool GetValue( wxVariant
& value
) const;
143 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
144 virtual wxSize
GetSize() const;
151 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer
)
154 // ---------------------------------------------------------
155 // wxDataViewIconTextRenderer
156 // ---------------------------------------------------------
158 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer
: public wxDataViewRenderer
161 wxDataViewIconTextRenderer( const wxString
&varianttype
= wxT("wxDataViewIconText"),
162 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
163 int align
= wxDVR_DEFAULT_ALIGNMENT
);
165 bool SetValue( const wxVariant
&value
);
166 bool GetValue( wxVariant
&value
) const;
168 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
169 virtual wxSize
GetSize() const;
171 virtual bool HasEditorCtrl() const { return true; }
172 virtual wxWindow
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
,
173 const wxVariant
&value
);
174 virtual bool GetValueFromEditorCtrl( wxWindow
* editor
, wxVariant
&value
);
177 wxDataViewIconText m_value
;
180 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer
)
183 #endif // _WX_GENERIC_DVRENDERERS_H_