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