Added (yet unfunctional) skeleton files fir
[wxWidgets.git] / include / wx / generic / dataview.h
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
18 // ---------------------------------------------------------
19 // classes
20 // ---------------------------------------------------------
21
22 class WXDLLIMPEXP_CORE wxDataViewCtrl;
23
24 // ---------------------------------------------------------
25 // wxDataViewCell
26 // ---------------------------------------------------------
27
28 class wxDataViewCell: public wxDataViewCellBase
29 {
30 public:
31 wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
32
33 protected:
34 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
35 };
36
37 // ---------------------------------------------------------
38 // wxDataViewTextCell
39 // ---------------------------------------------------------
40
41 class wxDataViewTextCell: public wxDataViewCell
42 {
43 public:
44 wxDataViewTextCell( const wxString &varianttype = wxT("string"),
45 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
46
47 bool SetValue( const wxVariant &value );
48 bool GetValue( wxVariant &value );
49
50 protected:
51 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
52 };
53
54 // ---------------------------------------------------------
55 // wxDataViewToggleCell
56 // ---------------------------------------------------------
57
58 class wxDataViewToggleCell: public wxDataViewCell
59 {
60 public:
61 wxDataViewToggleCell( const wxString &varianttype = wxT("bool"),
62 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
63
64 bool SetValue( const wxVariant &value );
65 bool GetValue( wxVariant &value );
66
67 protected:
68 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
69 };
70
71 // ---------------------------------------------------------
72 // wxDataViewCustomCell
73 // ---------------------------------------------------------
74
75 class wxDataViewCustomCell: public wxDataViewCell
76 {
77 public:
78 wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
79 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT )
80 ~wxDataViewCustomCell();
81 bool Init();
82
83 virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
84 virtual wxSize GetSize() = 0;
85
86 virtual bool Activate( wxRect cell,
87 wxDataViewListModel *model, size_t col, size_t row )
88 { return false; }
89
90 virtual bool LeftClick( wxPoint cursor, wxRect cell,
91 wxDataViewListModel *model, size_t col, size_t row )
92 { return false; }
93 virtual bool RightClick( wxPoint cursor, wxRect cell,
94 wxDataViewListModel *model, size_t col, size_t row )
95 { return false; }
96 virtual bool StartDrag( wxPoint cursor, wxRect cell,
97 wxDataViewListModel *model, size_t col, size_t row )
98 { return false; }
99
100 // Create DC on request
101 virtual wxDC *GetDC();
102
103 private:
104 wxDC *m_dc;
105
106 protected:
107 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
108 };
109
110 // ---------------------------------------------------------
111 // wxDataViewProgressCell
112 // ---------------------------------------------------------
113
114 class wxDataViewProgressCell: public wxDataViewCustomCell
115 {
116 public:
117 wxDataViewProgressCell( const wxString &label = wxEmptyString,
118 const wxString &varianttype = wxT("long"),
119 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
120 ~wxDataViewProgressCell();
121
122 bool SetValue( const wxVariant &value );
123
124 virtual bool Render( wxRect cell, wxDC *dc, int state );
125 virtual wxSize GetSize();
126
127 private:
128 wxString m_label;
129 int m_value;
130
131 protected:
132 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell)
133 };
134
135 // ---------------------------------------------------------
136 // wxDataViewDateCell
137 // ---------------------------------------------------------
138
139 class wxDataViewDateCell: public wxDataViewCustomCell
140 {
141 public:
142 wxDataViewDateCell( const wxString &varianttype = wxT("datetime"),
143 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE );
144
145 bool SetValue( const wxVariant &value );
146
147 virtual bool Render( wxRect cell, wxDC *dc, int state );
148 virtual wxSize GetSize();
149 virtual bool Activate( wxRect cell,
150 wxDataViewListModel *model, size_t col, size_t row );
151
152 private:
153 wxDateTime m_date;
154
155 protected:
156 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell)
157 };
158
159 // ---------------------------------------------------------
160 // wxDataViewColumn
161 // ---------------------------------------------------------
162
163 class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase
164 {
165 public:
166 wxDataViewColumn( const wxString &title, wxDataViewCell *cell, size_t model_column, int flags = 0 );
167 virtual ~wxDataViewColumn();
168
169 virtual void SetTitle( const wxString &title );
170
171 private:
172
173 protected:
174 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
175 };
176
177 // ---------------------------------------------------------
178 // wxDataViewCtrl
179 // ---------------------------------------------------------
180
181 class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase,
182 public wxScrollHelperNative
183 {
184 public:
185 wxDataViewCtrl() : wxScrollHelperNative(this)
186 {
187 Init();
188 }
189
190 wxDataViewCtrl( wxWindow *parent, wxWindowID id,
191 const wxPoint& pos = wxDefaultPosition,
192 const wxSize& size = wxDefaultSize, long style = 0,
193 const wxValidator& validator = wxDefaultValidator ) :
194 wxScrollHelperNative(this)
195 {
196 Create(parent, id, pos, size, style, validator );
197 }
198
199 virtual ~wxDataViewCtrl();
200
201 void Init();
202
203 bool Create(wxWindow *parent, wxWindowID id,
204 const wxPoint& pos = wxDefaultPosition,
205 const wxSize& size = wxDefaultSize, long style = 0,
206 const wxValidator& validator = wxDefaultValidator );
207
208 virtual bool AssociateModel( wxDataViewListModel *model );
209 virtual bool AppendColumn( wxDataViewColumn *col );
210
211 private:
212 wxDataViewListModelNotifier *m_notifier;
213 wxWindow *m_clientArea;
214 wxWindow *m_headerArea;
215
216 private:
217 virtual void ScrollWindow( int dx, int dy, const wxRect *rect );
218
219 // we need to return a special WM_GETDLGCODE value to process just the
220 // arrows but let the other navigation characters through
221 #ifdef __WXMSW__
222 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
223 #endif // __WXMSW__
224
225 WX_FORWARD_TO_SCROLL_HELPER()
226
227 private:
228 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
229 DECLARE_NO_COPY_CLASS(wxDataViewCtrl)
230 };
231
232
233 #endif // __GENERICDATAVIEWCTRLH__