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