]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/dvrenderers.h
Fix wxWrapSizer minimal size calculation.
[wxWidgets.git] / include / wx / generic / dvrenderers.h
... / ...
CommitLineData
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$
7// Copyright: (c) 2006 Robert Roebling
8// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GENERIC_DVRENDERERS_H_
13#define _WX_GENERIC_DVRENDERERS_H_
14
15// ---------------------------------------------------------
16// wxDataViewCustomRenderer
17// ---------------------------------------------------------
18
19class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
20{
21public:
22 wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"),
23 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
24 int align = wxDVR_DEFAULT_ALIGNMENT );
25
26 virtual wxDataViewCustomRenderer *WXGetAsCustom() { return this; }
27
28private:
29 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
30};
31
32
33// ---------------------------------------------------------
34// wxDataViewTextRenderer
35// ---------------------------------------------------------
36
37class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
38{
39public:
40 wxDataViewTextRenderer( const wxString &varianttype = wxT("string"),
41 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
42 int align = wxDVR_DEFAULT_ALIGNMENT );
43
44 bool SetValue( const wxVariant &value );
45 bool GetValue( wxVariant &value ) const;
46
47 virtual bool Render(wxRect cell, wxDC *dc, int state);
48 virtual wxSize GetSize() const;
49
50 // in-place editing
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 );
55
56protected:
57 wxString m_text;
58
59protected:
60 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
61};
62
63// ---------------------------------------------------------
64// wxDataViewBitmapRenderer
65// ---------------------------------------------------------
66
67class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
68{
69public:
70 wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"),
71 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
72 int align = wxDVR_DEFAULT_ALIGNMENT );
73
74 bool SetValue( const wxVariant &value );
75 bool GetValue( wxVariant &value ) const;
76
77 bool Render( wxRect cell, wxDC *dc, int state );
78 wxSize GetSize() const;
79
80private:
81 wxIcon m_icon;
82 wxBitmap m_bitmap;
83
84protected:
85 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
86};
87
88// ---------------------------------------------------------
89// wxDataViewToggleRenderer
90// ---------------------------------------------------------
91
92class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
93{
94public:
95 wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"),
96 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
97 int align = wxDVR_DEFAULT_ALIGNMENT );
98
99 bool SetValue( const wxVariant &value );
100 bool GetValue( wxVariant &value ) const;
101
102 bool Render( wxRect cell, wxDC *dc, int state );
103 wxSize GetSize() const;
104
105 // Implementation only, don't use nor override
106 virtual void WXOnActivate(wxDataViewModel *model,
107 const wxVariant& valueOld,
108 const wxDataViewItem& item,
109 unsigned int col);
110private:
111 bool m_toggle;
112
113protected:
114 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
115};
116
117// ---------------------------------------------------------
118// wxDataViewProgressRenderer
119// ---------------------------------------------------------
120
121class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
122{
123public:
124 wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
125 const wxString &varianttype = wxT("long"),
126 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
127 int align = wxDVR_DEFAULT_ALIGNMENT );
128
129 bool SetValue( const wxVariant &value );
130 bool GetValue( wxVariant& value ) const;
131
132 virtual bool Render(wxRect cell, wxDC *dc, int state);
133 virtual wxSize GetSize() const;
134
135private:
136 wxString m_label;
137 int m_value;
138
139protected:
140 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
141};
142
143// ---------------------------------------------------------
144// wxDataViewIconTextRenderer
145// ---------------------------------------------------------
146
147class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
148{
149public:
150 wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"),
151 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
152 int align = wxDVR_DEFAULT_ALIGNMENT );
153
154 bool SetValue( const wxVariant &value );
155 bool GetValue( wxVariant &value ) const;
156
157 virtual bool Render(wxRect cell, wxDC *dc, int state);
158 virtual wxSize GetSize() const;
159
160 virtual bool HasEditorCtrl() const { return true; }
161 virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
162 const wxVariant &value );
163 virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
164
165private:
166 wxDataViewIconText m_value;
167
168protected:
169 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
170};
171
172// ---------------------------------------------------------
173// wxDataViewDateRenderer
174// ---------------------------------------------------------
175
176class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
177{
178public:
179 wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"),
180 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
181 int align = wxDVR_DEFAULT_ALIGNMENT );
182
183 bool SetValue( const wxVariant &value );
184 bool GetValue( wxVariant& value ) const;
185
186 virtual bool Render( wxRect cell, wxDC *dc, int state );
187 virtual wxSize GetSize() const;
188
189 // Implementation only, don't use nor override
190 virtual void WXOnActivate(wxDataViewModel *model,
191 const wxVariant& valueOld,
192 const wxDataViewItem& item,
193 unsigned int col);
194
195private:
196 wxDateTime m_date;
197
198protected:
199 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
200};
201
202
203#endif // _WX_GENERIC_DVRENDERERS_H_
204