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"
19 // ---------------------------------------------------------
21 // ---------------------------------------------------------
23 class WXDLLIMPEXP_ADV wxDataViewCtrl
;
24 class WXDLLIMPEXP_ADV wxDataViewMainWindow
;
25 class WXDLLIMPEXP_ADV wxDataViewHeaderWindow
;
27 // ---------------------------------------------------------
29 // ---------------------------------------------------------
31 class WXDLLIMPEXP_ADV wxDataViewCell
: public wxDataViewCellBase
34 wxDataViewCell( const wxString
&varianttype
, wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
37 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
) = 0;
38 virtual wxSize
GetSize() = 0;
40 virtual bool Activate( wxRect
WXUNUSED(cell
),
41 wxDataViewListModel
*WXUNUSED(model
),
43 size_t WXUNUSED(row
) )
46 virtual bool LeftClick( wxPoint
WXUNUSED(cursor
),
47 wxRect
WXUNUSED(cell
),
48 wxDataViewListModel
*WXUNUSED(model
),
50 size_t WXUNUSED(row
) )
52 virtual bool RightClick( wxPoint
WXUNUSED(cursor
),
53 wxRect
WXUNUSED(cell
),
54 wxDataViewListModel
*WXUNUSED(model
),
56 size_t WXUNUSED(row
) )
58 virtual bool StartDrag( wxPoint
WXUNUSED(cursor
),
59 wxRect
WXUNUSED(cell
),
60 wxDataViewListModel
*WXUNUSED(model
),
62 size_t WXUNUSED(row
) )
65 // Create DC on request
66 virtual wxDC
*GetDC();
72 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell
)
75 // ---------------------------------------------------------
76 // wxDataViewCustomCell
77 // ---------------------------------------------------------
79 class WXDLLIMPEXP_ADV wxDataViewCustomCell
: public wxDataViewCell
82 wxDataViewCustomCell( const wxString
&varianttype
= wxT("string"),
83 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
86 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell
)
89 // ---------------------------------------------------------
91 // ---------------------------------------------------------
93 class WXDLLIMPEXP_ADV wxDataViewTextCell
: public wxDataViewCustomCell
96 wxDataViewTextCell( const wxString
&varianttype
= wxT("string"),
97 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
99 bool SetValue( const wxVariant
&value
);
100 bool GetValue( wxVariant
&value
);
102 bool Render( wxRect cell
, wxDC
*dc
, int state
);
109 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell
)
112 // ---------------------------------------------------------
113 // wxDataViewToggleCell
114 // ---------------------------------------------------------
116 class WXDLLIMPEXP_ADV wxDataViewToggleCell
: public wxDataViewCustomCell
119 wxDataViewToggleCell( const wxString
&varianttype
= wxT("bool"),
120 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
122 bool SetValue( const wxVariant
&value
);
123 bool GetValue( wxVariant
&value
);
125 bool Render( wxRect cell
, wxDC
*dc
, int state
);
126 bool Activate( wxRect cell
, wxDataViewListModel
*model
, size_t col
, size_t row
);
133 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell
)
136 // ---------------------------------------------------------
137 // wxDataViewProgressCell
138 // ---------------------------------------------------------
140 class WXDLLIMPEXP_ADV wxDataViewProgressCell
: public wxDataViewCustomCell
143 wxDataViewProgressCell( const wxString
&label
= wxEmptyString
,
144 const wxString
&varianttype
= wxT("long"),
145 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
146 ~wxDataViewProgressCell();
148 bool SetValue( const wxVariant
&value
);
150 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
151 virtual wxSize
GetSize();
158 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell
)
161 // ---------------------------------------------------------
162 // wxDataViewDateCell
163 // ---------------------------------------------------------
165 class WXDLLIMPEXP_ADV wxDataViewDateCell
: public wxDataViewCustomCell
168 wxDataViewDateCell( const wxString
&varianttype
= wxT("datetime"),
169 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
);
171 bool SetValue( const wxVariant
&value
);
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
);
182 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell
)
185 // ---------------------------------------------------------
187 // ---------------------------------------------------------
189 class WXDLLIMPEXP_ADV wxDataViewColumn
: public wxDataViewColumnBase
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();
196 virtual void SetTitle( const wxString
&title
);
198 virtual int GetWidth();
200 virtual void SetFixedWidth( int width
);
201 virtual int GetFixedWidth();
205 wxDataViewColumnSizing m_sizing
;
209 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn
)
212 // ---------------------------------------------------------
214 // ---------------------------------------------------------
216 class WXDLLIMPEXP_ADV wxDataViewCtrl
: public wxDataViewCtrlBase
,
217 public wxScrollHelperNative
220 wxDataViewCtrl() : wxScrollHelperNative(this)
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)
231 Create(parent
, id
, pos
, size
, style
, validator
);
234 virtual ~wxDataViewCtrl();
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
);
243 virtual bool AssociateModel( wxDataViewListModel
*model
);
244 virtual bool AppendColumn( wxDataViewColumn
*col
);
247 friend class wxDataViewMainWindow
;
248 friend class wxDataViewHeaderWindow
;
249 wxDataViewListModelNotifier
*m_notifier
;
250 wxDataViewMainWindow
*m_clientArea
;
251 wxDataViewHeaderWindow
*m_headerArea
;
254 void OnSize( wxSizeEvent
&event
);
256 // we need to return a special WM_GETDLGCODE value to process just the
257 // arrows but let the other navigation characters through
259 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
262 WX_FORWARD_TO_SCROLL_HELPER()
265 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl
)
266 DECLARE_NO_COPY_CLASS(wxDataViewCtrl
)
267 DECLARE_EVENT_TABLE()
271 #endif // __GENERICDATAVIEWCTRLH__