1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/dataview.h
3 // Purpose: wxDataViewCtrl generic implementation header
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef __GENERICDATAVIEWCTRLH__
11 #define __GENERICDATAVIEWCTRLH__
14 #include "wx/object.h"
16 #include "wx/control.h"
17 #include "wx/scrolwin.h"
20 // ---------------------------------------------------------
22 // ---------------------------------------------------------
24 class WXDLLIMPEXP_ADV wxDataViewCtrl
;
25 class WXDLLIMPEXP_ADV wxDataViewMainWindow
;
26 class WXDLLIMPEXP_ADV wxDataViewHeaderWindow
;
28 // ---------------------------------------------------------
30 // ---------------------------------------------------------
32 class WXDLLIMPEXP_ADV wxDataViewCell
: public wxDataViewCellBase
35 wxDataViewCell( const wxString
&varianttype
, wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
36 virtual ~wxDataViewCell();
38 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
) = 0;
39 virtual wxSize
GetSize() = 0;
41 virtual bool Activate( wxRect
WXUNUSED(cell
),
42 wxDataViewListModel
*WXUNUSED(model
),
44 size_t WXUNUSED(row
) )
47 virtual bool LeftClick( wxPoint
WXUNUSED(cursor
),
48 wxRect
WXUNUSED(cell
),
49 wxDataViewListModel
*WXUNUSED(model
),
51 size_t WXUNUSED(row
) )
53 virtual bool RightClick( wxPoint
WXUNUSED(cursor
),
54 wxRect
WXUNUSED(cell
),
55 wxDataViewListModel
*WXUNUSED(model
),
57 size_t WXUNUSED(row
) )
59 virtual bool StartDrag( wxPoint
WXUNUSED(cursor
),
60 wxRect
WXUNUSED(cell
),
61 wxDataViewListModel
*WXUNUSED(model
),
63 size_t WXUNUSED(row
) )
66 // Create DC on request
67 virtual wxDC
*GetDC();
73 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell
)
76 // ---------------------------------------------------------
77 // wxDataViewCustomCell
78 // ---------------------------------------------------------
80 class WXDLLIMPEXP_ADV wxDataViewCustomCell
: public wxDataViewCell
83 wxDataViewCustomCell( const wxString
&varianttype
= wxT("string"),
84 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
87 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell
)
90 // ---------------------------------------------------------
92 // ---------------------------------------------------------
94 class WXDLLIMPEXP_ADV wxDataViewTextCell
: public wxDataViewCustomCell
97 wxDataViewTextCell( const wxString
&varianttype
= wxT("string"),
98 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
100 bool SetValue( const wxVariant
&value
);
101 bool GetValue( wxVariant
&value
);
103 bool Render( wxRect cell
, wxDC
*dc
, int state
);
110 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell
)
113 // ---------------------------------------------------------
114 // wxDataViewBitmapCell
115 // ---------------------------------------------------------
117 class WXDLLIMPEXP_ADV wxDataViewBitmapCell
: public wxDataViewCustomCell
120 wxDataViewBitmapCell( const wxString
&varianttype
= wxT("wxBitmap"),
121 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
123 bool SetValue( const wxVariant
&value
);
124 bool GetValue( wxVariant
&value
);
126 bool Render( wxRect cell
, wxDC
*dc
, int state
);
134 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapCell
)
137 // ---------------------------------------------------------
138 // wxDataViewToggleCell
139 // ---------------------------------------------------------
141 class WXDLLIMPEXP_ADV wxDataViewToggleCell
: public wxDataViewCustomCell
144 wxDataViewToggleCell( const wxString
&varianttype
= wxT("bool"),
145 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
147 bool SetValue( const wxVariant
&value
);
148 bool GetValue( wxVariant
&value
);
150 bool Render( wxRect cell
, wxDC
*dc
, int state
);
151 bool Activate( wxRect cell
, wxDataViewListModel
*model
, size_t col
, size_t row
);
158 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell
)
161 // ---------------------------------------------------------
162 // wxDataViewProgressCell
163 // ---------------------------------------------------------
165 class WXDLLIMPEXP_ADV wxDataViewProgressCell
: public wxDataViewCustomCell
168 wxDataViewProgressCell( const wxString
&label
= wxEmptyString
,
169 const wxString
&varianttype
= wxT("long"),
170 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
171 virtual ~wxDataViewProgressCell();
173 bool SetValue( const wxVariant
&value
);
175 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
176 virtual wxSize
GetSize();
183 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell
)
186 // ---------------------------------------------------------
187 // wxDataViewDateCell
188 // ---------------------------------------------------------
190 class WXDLLIMPEXP_ADV wxDataViewDateCell
: public wxDataViewCustomCell
193 wxDataViewDateCell( const wxString
&varianttype
= wxT("datetime"),
194 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
);
196 bool SetValue( const wxVariant
&value
);
198 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
199 virtual wxSize
GetSize();
200 virtual bool Activate( wxRect cell
,
201 wxDataViewListModel
*model
, size_t col
, size_t row
);
207 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell
)
210 // ---------------------------------------------------------
212 // ---------------------------------------------------------
214 class WXDLLIMPEXP_ADV wxDataViewColumn
: public wxDataViewColumnBase
217 wxDataViewColumn( const wxString
&title
, wxDataViewCell
*cell
, size_t model_column
,
218 int fixed_width
= 80, wxDataViewColumnSizing sizing
= wxDATAVIEW_COL_WIDTH_FIXED
, int flags
= 0 );
219 virtual ~wxDataViewColumn();
221 virtual void SetTitle( const wxString
&title
);
223 virtual int GetWidth();
225 virtual void SetFixedWidth( int width
);
226 virtual int GetFixedWidth();
230 wxDataViewColumnSizing m_sizing
;
234 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn
)
237 // ---------------------------------------------------------
239 // ---------------------------------------------------------
241 class WXDLLIMPEXP_ADV wxDataViewCtrl
: public wxDataViewCtrlBase
,
242 public wxScrollHelperNative
245 wxDataViewCtrl() : wxScrollHelperNative(this)
250 wxDataViewCtrl( wxWindow
*parent
, wxWindowID id
,
251 const wxPoint
& pos
= wxDefaultPosition
,
252 const wxSize
& size
= wxDefaultSize
, long style
= 0,
253 const wxValidator
& validator
= wxDefaultValidator
)
254 : wxScrollHelperNative(this)
256 Create(parent
, id
, pos
, size
, style
, validator
);
259 virtual ~wxDataViewCtrl();
263 bool Create(wxWindow
*parent
, wxWindowID id
,
264 const wxPoint
& pos
= wxDefaultPosition
,
265 const wxSize
& size
= wxDefaultSize
, long style
= 0,
266 const wxValidator
& validator
= wxDefaultValidator
);
268 virtual bool AssociateModel( wxDataViewListModel
*model
);
269 virtual bool AppendColumn( wxDataViewColumn
*col
);
272 friend class wxDataViewMainWindow
;
273 friend class wxDataViewHeaderWindow
;
274 wxDataViewListModelNotifier
*m_notifier
;
275 wxDataViewMainWindow
*m_clientArea
;
276 wxDataViewHeaderWindow
*m_headerArea
;
279 void OnSize( wxSizeEvent
&event
);
281 // we need to return a special WM_GETDLGCODE value to process just the
282 // arrows but let the other navigation characters through
284 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
287 WX_FORWARD_TO_SCROLL_HELPER()
290 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl
)
291 DECLARE_NO_COPY_CLASS(wxDataViewCtrl
)
292 DECLARE_EVENT_TABLE()
296 #endif // __GENERICDATAVIEWCTRLH__