]>
Commit | Line | Data |
---|---|---|
6eec70b9 VZ |
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) | |
6eec70b9 VZ |
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 | ||
dbc3aec1 VS |
25 | |
26 | // see the explanation of the following WXOnXXX() methods in wx/generic/dvrenderer.h | |
27 | ||
dc73d7f5 VS |
28 | virtual bool WXActivateCell(const wxRect& cell, |
29 | wxDataViewModel *model, | |
30 | const wxDataViewItem& item, | |
31 | unsigned int col, | |
32 | const wxMouseEvent *mouseEvent) | |
dbc3aec1 | 33 | { |
dc73d7f5 | 34 | return ActivateCell(cell, model, item, col, mouseEvent); |
dbc3aec1 | 35 | } |
6eec70b9 VZ |
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 | ||
62265c2c VZ |
56 | virtual bool Render(wxRect cell, wxDC *dc, int state); |
57 | virtual wxSize GetSize() const; | |
6eec70b9 VZ |
58 | |
59 | // in-place editing | |
60 | virtual bool HasEditorCtrl() const; | |
64c70359 VS |
61 | virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, |
62 | const wxVariant &value ); | |
63 | virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ); | |
6eec70b9 VZ |
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 ); | |
6eec70b9 VZ |
112 | wxSize GetSize() const; |
113 | ||
62186006 | 114 | // Implementation only, don't use nor override |
dc73d7f5 VS |
115 | virtual bool WXActivateCell(const wxRect& cell, |
116 | wxDataViewModel *model, | |
117 | const wxDataViewItem& item, | |
118 | unsigned int col, | |
119 | const wxMouseEvent *mouseEvent); | |
6eec70b9 VZ |
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 | ||
62265c2c | 142 | virtual bool Render(wxRect cell, wxDC *dc, int state); |
6eec70b9 VZ |
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 | ||
62265c2c | 167 | virtual bool Render(wxRect cell, wxDC *dc, int state); |
6eec70b9 VZ |
168 | virtual wxSize GetSize() const; |
169 | ||
170 | virtual bool HasEditorCtrl() const { return true; } | |
64c70359 VS |
171 | virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, |
172 | const wxVariant &value ); | |
173 | virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ); | |
6eec70b9 VZ |
174 | |
175 | private: | |
176 | wxDataViewIconText m_value; | |
177 | ||
178 | protected: | |
179 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) | |
180 | }; | |
181 | ||
6eec70b9 VZ |
182 | #endif // _WX_GENERIC_DVRENDERERS_H_ |
183 |