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