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 // Copyright: (c) 2006 Robert Roebling
7 // (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GENERIC_DVRENDERERS_H_
12 #define _WX_GENERIC_DVRENDERERS_H_
14 // ---------------------------------------------------------
15 // wxDataViewCustomRenderer
16 // ---------------------------------------------------------
18 class WXDLLIMPEXP_ADV wxDataViewCustomRenderer
: public wxDataViewRenderer
21 wxDataViewCustomRenderer( const wxString
&varianttype
= wxT("string"),
22 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
23 int align
= wxDVR_DEFAULT_ALIGNMENT
);
26 // see the explanation of the following WXOnXXX() methods in wx/generic/dvrenderer.h
28 virtual bool WXActivateCell(const wxRect
& cell
,
29 wxDataViewModel
*model
,
30 const wxDataViewItem
& item
,
32 const wxMouseEvent
*mouseEvent
)
34 return ActivateCell(cell
, model
, item
, col
, mouseEvent
);
38 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer
)
42 // ---------------------------------------------------------
43 // wxDataViewTextRenderer
44 // ---------------------------------------------------------
46 class WXDLLIMPEXP_ADV wxDataViewTextRenderer
: public wxDataViewRenderer
49 wxDataViewTextRenderer( const wxString
&varianttype
= wxT("string"),
50 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
51 int align
= wxDVR_DEFAULT_ALIGNMENT
);
53 bool SetValue( const wxVariant
&value
);
54 bool GetValue( wxVariant
&value
) const;
56 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
57 virtual wxSize
GetSize() const;
60 virtual bool HasEditorCtrl() const;
61 virtual wxWindow
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
,
62 const wxVariant
&value
);
63 virtual bool GetValueFromEditorCtrl( wxWindow
* 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 wxSize
GetSize() const;
114 // Implementation only, don't use nor override
115 virtual bool WXActivateCell(const wxRect
& cell
,
116 wxDataViewModel
*model
,
117 const wxDataViewItem
& item
,
119 const wxMouseEvent
*mouseEvent
);
124 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer
)
127 // ---------------------------------------------------------
128 // wxDataViewProgressRenderer
129 // ---------------------------------------------------------
131 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer
: public wxDataViewRenderer
134 wxDataViewProgressRenderer( const wxString
&label
= wxEmptyString
,
135 const wxString
&varianttype
= wxT("long"),
136 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
137 int align
= wxDVR_DEFAULT_ALIGNMENT
);
139 bool SetValue( const wxVariant
&value
);
140 bool GetValue( wxVariant
& value
) const;
142 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
143 virtual wxSize
GetSize() const;
150 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer
)
153 // ---------------------------------------------------------
154 // wxDataViewIconTextRenderer
155 // ---------------------------------------------------------
157 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer
: public wxDataViewRenderer
160 wxDataViewIconTextRenderer( const wxString
&varianttype
= wxT("wxDataViewIconText"),
161 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
162 int align
= wxDVR_DEFAULT_ALIGNMENT
);
164 bool SetValue( const wxVariant
&value
);
165 bool GetValue( wxVariant
&value
) const;
167 virtual bool Render(wxRect cell
, wxDC
*dc
, int state
);
168 virtual wxSize
GetSize() const;
170 virtual bool HasEditorCtrl() const { return true; }
171 virtual wxWindow
* CreateEditorCtrl( wxWindow
*parent
, wxRect labelRect
,
172 const wxVariant
&value
);
173 virtual bool GetValueFromEditorCtrl( wxWindow
* editor
, wxVariant
&value
);
176 wxDataViewIconText m_value
;
179 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer
)
182 #endif // _WX_GENERIC_DVRENDERERS_H_