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"
18 // ---------------------------------------------------------
20 // ---------------------------------------------------------
22 class WXDLLIMPEXP_CORE wxDataViewCtrl
;
24 // ---------------------------------------------------------
26 // ---------------------------------------------------------
28 class wxDataViewCell
: public wxDataViewCellBase
31 wxDataViewCell( const wxString
&varianttype
, wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
34 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell
)
37 // ---------------------------------------------------------
39 // ---------------------------------------------------------
41 class wxDataViewTextCell
: public wxDataViewCell
44 wxDataViewTextCell( const wxString
&varianttype
= wxT("string"),
45 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
47 bool SetValue( const wxVariant
&value
);
48 bool GetValue( wxVariant
&value
);
51 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell
)
54 // ---------------------------------------------------------
55 // wxDataViewToggleCell
56 // ---------------------------------------------------------
58 class wxDataViewToggleCell
: public wxDataViewCell
61 wxDataViewToggleCell( const wxString
&varianttype
= wxT("bool"),
62 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
64 bool SetValue( const wxVariant
&value
);
65 bool GetValue( wxVariant
&value
);
68 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell
)
71 // ---------------------------------------------------------
72 // wxDataViewCustomCell
73 // ---------------------------------------------------------
75 class wxDataViewCustomCell
: public wxDataViewCell
78 wxDataViewCustomCell( const wxString
&varianttype
= wxT("string"),
79 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
)
80 ~wxDataViewCustomCell();
83 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
) = 0;
84 virtual wxSize
GetSize() = 0;
86 virtual bool Activate( wxRect cell
,
87 wxDataViewListModel
*model
, size_t col
, size_t row
)
90 virtual bool LeftClick( wxPoint cursor
, wxRect cell
,
91 wxDataViewListModel
*model
, size_t col
, size_t row
)
93 virtual bool RightClick( wxPoint cursor
, wxRect cell
,
94 wxDataViewListModel
*model
, size_t col
, size_t row
)
96 virtual bool StartDrag( wxPoint cursor
, wxRect cell
,
97 wxDataViewListModel
*model
, size_t col
, size_t row
)
100 // Create DC on request
101 virtual wxDC
*GetDC();
107 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell
)
110 // ---------------------------------------------------------
111 // wxDataViewProgressCell
112 // ---------------------------------------------------------
114 class wxDataViewProgressCell
: public wxDataViewCustomCell
117 wxDataViewProgressCell( const wxString
&label
= wxEmptyString
,
118 const wxString
&varianttype
= wxT("long"),
119 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
120 ~wxDataViewProgressCell();
122 bool SetValue( const wxVariant
&value
);
124 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
125 virtual wxSize
GetSize();
132 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell
)
135 // ---------------------------------------------------------
136 // wxDataViewDateCell
137 // ---------------------------------------------------------
139 class wxDataViewDateCell
: public wxDataViewCustomCell
142 wxDataViewDateCell( const wxString
&varianttype
= wxT("datetime"),
143 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
);
145 bool SetValue( const wxVariant
&value
);
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
);
156 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell
)
159 // ---------------------------------------------------------
161 // ---------------------------------------------------------
163 class WXDLLIMPEXP_CORE wxDataViewColumn
: public wxDataViewColumnBase
166 wxDataViewColumn( const wxString
&title
, wxDataViewCell
*cell
, size_t model_column
, int flags
= 0 );
167 virtual ~wxDataViewColumn();
169 virtual void SetTitle( const wxString
&title
);
174 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn
)
177 // ---------------------------------------------------------
179 // ---------------------------------------------------------
181 class WXDLLIMPEXP_CORE wxDataViewCtrl
: public wxDataViewCtrlBase
,
182 public wxScrollHelperNative
185 wxDataViewCtrl() : wxScrollHelperNative(this)
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)
196 Create(parent
, id
, pos
, size
, style
, validator
);
199 virtual ~wxDataViewCtrl();
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
);
208 virtual bool AssociateModel( wxDataViewListModel
*model
);
209 virtual bool AppendColumn( wxDataViewColumn
*col
);
212 wxDataViewListModelNotifier
*m_notifier
;
213 wxWindow
*m_clientArea
;
214 wxWindow
*m_headerArea
;
217 virtual void ScrollWindow( int dx
, int dy
, const wxRect
*rect
);
219 // we need to return a special WM_GETDLGCODE value to process just the
220 // arrows but let the other navigation characters through
222 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
225 WX_FORWARD_TO_SCROLL_HELPER()
228 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl
)
229 DECLARE_NO_COPY_CLASS(wxDataViewCtrl
)
233 #endif // __GENERICDATAVIEWCTRLH__