]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/dataview.h
Tinderbox build fix for wxUnivGTK build.
[wxWidgets.git] / include / wx / generic / dataview.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/dataview.h
3// Purpose: wxDataViewCtrl generic implementation header
4// Author: Robert Roebling
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef __GENERICDATAVIEWCTRLH__
11#define __GENERICDATAVIEWCTRLH__
12
13#include "wx/defs.h"
14#include "wx/object.h"
15#include "wx/list.h"
16#include "wx/control.h"
17#include "wx/scrolwin.h"
18
19// ---------------------------------------------------------
20// classes
21// ---------------------------------------------------------
22
23class WXDLLIMPEXP_CORE wxDataViewCtrl;
24class WXDLLIMPEXP_CORE wxDataViewMainWindow;
25class WXDLLIMPEXP_CORE wxDataViewHeaderWindow;
26
27// ---------------------------------------------------------
28// wxDataViewCell
29// ---------------------------------------------------------
30
31class wxDataViewCell: public wxDataViewCellBase
32{
33public:
34 wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
35 ~wxDataViewCell();
36
37 virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
38 virtual wxSize GetSize() = 0;
39
40 virtual bool Activate( wxRect WXUNUSED(cell),
41 wxDataViewListModel *WXUNUSED(model),
42 size_t WXUNUSED(col),
43 size_t WXUNUSED(row) )
44 { return false; }
45
46 virtual bool LeftClick( wxPoint WXUNUSED(cursor),
47 wxRect WXUNUSED(cell),
48 wxDataViewListModel *WXUNUSED(model),
49 size_t WXUNUSED(col),
50 size_t WXUNUSED(row) )
51 { return false; }
52 virtual bool RightClick( wxPoint WXUNUSED(cursor),
53 wxRect WXUNUSED(cell),
54 wxDataViewListModel *WXUNUSED(model),
55 size_t WXUNUSED(col),
56 size_t WXUNUSED(row) )
57 { return false; }
58 virtual bool StartDrag( wxPoint WXUNUSED(cursor),
59 wxRect WXUNUSED(cell),
60 wxDataViewListModel *WXUNUSED(model),
61 size_t WXUNUSED(col),
62 size_t WXUNUSED(row) )
63 { return false; }
64
65 // Create DC on request
66 virtual wxDC *GetDC();
67
68private:
69 wxDC *m_dc;
70
71protected:
72 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
73};
74
75// ---------------------------------------------------------
76// wxDataViewCustomCell
77// ---------------------------------------------------------
78
79class wxDataViewCustomCell: public wxDataViewCell
80{
81public:
82 wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
83 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
84
85protected:
86 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
87};
88
89// ---------------------------------------------------------
90// wxDataViewTextCell
91// ---------------------------------------------------------
92
93class wxDataViewTextCell: public wxDataViewCustomCell
94{
95public:
96 wxDataViewTextCell( const wxString &varianttype = wxT("string"),
97 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
98
99 bool SetValue( const wxVariant &value );
100 bool GetValue( wxVariant &value );
101
102 bool Render( wxRect cell, wxDC *dc, int state );
103 wxSize GetSize();
104
105private:
106 wxString m_text;
107
108protected:
109 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
110};
111
112// ---------------------------------------------------------
113// wxDataViewToggleCell
114// ---------------------------------------------------------
115
116class wxDataViewToggleCell: public wxDataViewCustomCell
117{
118public:
119 wxDataViewToggleCell( const wxString &varianttype = wxT("bool"),
120 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
121
122 bool SetValue( const wxVariant &value );
123 bool GetValue( wxVariant &value );
124
125 bool Render( wxRect cell, wxDC *dc, int state );
126 bool Activate( wxRect cell, wxDataViewListModel *model, size_t col, size_t row );
127 wxSize GetSize();
128
129private:
130 bool m_toggle;
131
132protected:
133 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
134};
135
136// ---------------------------------------------------------
137// wxDataViewProgressCell
138// ---------------------------------------------------------
139
140class wxDataViewProgressCell: public wxDataViewCustomCell
141{
142public:
143 wxDataViewProgressCell( const wxString &label = wxEmptyString,
144 const wxString &varianttype = wxT("long"),
145 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
146 ~wxDataViewProgressCell();
147
148 bool SetValue( const wxVariant &value );
149
150 virtual bool Render( wxRect cell, wxDC *dc, int state );
151 virtual wxSize GetSize();
152
153private:
154 wxString m_label;
155 int m_value;
156
157protected:
158 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell)
159};
160
161// ---------------------------------------------------------
162// wxDataViewDateCell
163// ---------------------------------------------------------
164
165class wxDataViewDateCell: public wxDataViewCustomCell
166{
167public:
168 wxDataViewDateCell( const wxString &varianttype = wxT("datetime"),
169 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE );
170
171 bool SetValue( const wxVariant &value );
172
173 virtual bool Render( wxRect cell, wxDC *dc, int state );
174 virtual wxSize GetSize();
175 virtual bool Activate( wxRect cell,
176 wxDataViewListModel *model, size_t col, size_t row );
177
178private:
179 wxDateTime m_date;
180
181protected:
182 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell)
183};
184
185// ---------------------------------------------------------
186// wxDataViewColumn
187// ---------------------------------------------------------
188
189class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase
190{
191public:
192 wxDataViewColumn( const wxString &title, wxDataViewCell *cell, size_t model_column,
193 int fixed_width = 80, wxDataViewColumnSizing sizing = wxDATAVIEW_COL_WIDTH_FIXED, int flags = 0 );
194 virtual ~wxDataViewColumn();
195
196 virtual void SetTitle( const wxString &title );
197
198 virtual int GetWidth();
199
200 virtual void SetFixedWidth( int width );
201 virtual int GetFixedWidth();
202
203private:
204 int m_width;
205 wxDataViewColumnSizing m_sizing;
206 int m_fixedWidth;
207
208protected:
209 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
210};
211
212// ---------------------------------------------------------
213// wxDataViewCtrl
214// ---------------------------------------------------------
215
216class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase,
217 public wxScrollHelperNative
218{
219public:
220 wxDataViewCtrl() : wxScrollHelperNative(this)
221 {
222 Init();
223 }
224
225 wxDataViewCtrl( wxWindow *parent, wxWindowID id,
226 const wxPoint& pos = wxDefaultPosition,
227 const wxSize& size = wxDefaultSize, long style = 0,
228 const wxValidator& validator = wxDefaultValidator )
229 : wxScrollHelperNative(this)
230 {
231 Create(parent, id, pos, size, style, validator );
232 }
233
234 virtual ~wxDataViewCtrl();
235
236 void Init();
237
238 bool Create(wxWindow *parent, wxWindowID id,
239 const wxPoint& pos = wxDefaultPosition,
240 const wxSize& size = wxDefaultSize, long style = 0,
241 const wxValidator& validator = wxDefaultValidator );
242
243 virtual bool AssociateModel( wxDataViewListModel *model );
244 virtual bool AppendColumn( wxDataViewColumn *col );
245
246private:
247 friend class wxDataViewMainWindow;
248 friend class wxDataViewHeaderWindow;
249 wxDataViewListModelNotifier *m_notifier;
250 wxDataViewMainWindow *m_clientArea;
251 wxDataViewHeaderWindow *m_headerArea;
252
253private:
254 void OnSize( wxSizeEvent &event );
255
256 // we need to return a special WM_GETDLGCODE value to process just the
257 // arrows but let the other navigation characters through
258#ifdef __WXMSW__
259 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
260#endif // __WXMSW__
261
262 WX_FORWARD_TO_SCROLL_HELPER()
263
264private:
265 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
266 DECLARE_NO_COPY_CLASS(wxDataViewCtrl)
267 DECLARE_EVENT_TABLE()
268};
269
270
271#endif // __GENERICDATAVIEWCTRLH__