]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/dvrenderers.h
Add functor-taking overload of CallAfter().
[wxWidgets.git] / include / wx / generic / dvrenderers.h
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
19 class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
20 {
21 public:
22 wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"),
23 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
24 int align = wxDVR_DEFAULT_ALIGNMENT );
25
26
27 // see the explanation of the following WXOnXXX() methods in wx/generic/dvrenderer.h
28
29 virtual bool WXActivateCell(const wxRect& cell,
30 wxDataViewModel *model,
31 const wxDataViewItem& item,
32 unsigned int col,
33 const wxMouseEvent *mouseEvent)
34 {
35 return ActivateCell(cell, model, item, col, mouseEvent);
36 }
37
38 private:
39 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
40 };
41
42
43 // ---------------------------------------------------------
44 // wxDataViewTextRenderer
45 // ---------------------------------------------------------
46
47 class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
48 {
49 public:
50 wxDataViewTextRenderer( const wxString &varianttype = wxT("string"),
51 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
52 int align = wxDVR_DEFAULT_ALIGNMENT );
53
54 bool SetValue( const wxVariant &value );
55 bool GetValue( wxVariant &value ) const;
56
57 virtual bool Render(wxRect cell, wxDC *dc, int state);
58 virtual wxSize GetSize() const;
59
60 // in-place editing
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 );
65
66 protected:
67 wxString m_text;
68
69 protected:
70 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
71 };
72
73 // ---------------------------------------------------------
74 // wxDataViewBitmapRenderer
75 // ---------------------------------------------------------
76
77 class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
78 {
79 public:
80 wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"),
81 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
82 int align = wxDVR_DEFAULT_ALIGNMENT );
83
84 bool SetValue( const wxVariant &value );
85 bool GetValue( wxVariant &value ) const;
86
87 bool Render( wxRect cell, wxDC *dc, int state );
88 wxSize GetSize() const;
89
90 private:
91 wxIcon m_icon;
92 wxBitmap m_bitmap;
93
94 protected:
95 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
96 };
97
98 // ---------------------------------------------------------
99 // wxDataViewToggleRenderer
100 // ---------------------------------------------------------
101
102 class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
103 {
104 public:
105 wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"),
106 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
107 int align = wxDVR_DEFAULT_ALIGNMENT );
108
109 bool SetValue( const wxVariant &value );
110 bool GetValue( wxVariant &value ) const;
111
112 bool Render( wxRect cell, wxDC *dc, int state );
113 wxSize GetSize() const;
114
115 // Implementation only, don't use nor override
116 virtual bool WXActivateCell(const wxRect& cell,
117 wxDataViewModel *model,
118 const wxDataViewItem& item,
119 unsigned int col,
120 const wxMouseEvent *mouseEvent);
121 private:
122 bool m_toggle;
123
124 protected:
125 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
126 };
127
128 // ---------------------------------------------------------
129 // wxDataViewProgressRenderer
130 // ---------------------------------------------------------
131
132 class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
133 {
134 public:
135 wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
136 const wxString &varianttype = wxT("long"),
137 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
138 int align = wxDVR_DEFAULT_ALIGNMENT );
139
140 bool SetValue( const wxVariant &value );
141 bool GetValue( wxVariant& value ) const;
142
143 virtual bool Render(wxRect cell, wxDC *dc, int state);
144 virtual wxSize GetSize() const;
145
146 private:
147 wxString m_label;
148 int m_value;
149
150 protected:
151 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
152 };
153
154 // ---------------------------------------------------------
155 // wxDataViewIconTextRenderer
156 // ---------------------------------------------------------
157
158 class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
159 {
160 public:
161 wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"),
162 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
163 int align = wxDVR_DEFAULT_ALIGNMENT );
164
165 bool SetValue( const wxVariant &value );
166 bool GetValue( wxVariant &value ) const;
167
168 virtual bool Render(wxRect cell, wxDC *dc, int state);
169 virtual wxSize GetSize() const;
170
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 );
175
176 private:
177 wxDataViewIconText m_value;
178
179 protected:
180 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
181 };
182
183 #endif // _WX_GENERIC_DVRENDERERS_H_
184