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_CORE wxDataViewCtrl
;
25 // ---------------------------------------------------------
27 // ---------------------------------------------------------
29 class wxDataViewCell
: public wxDataViewCellBase
32 wxDataViewCell( const wxString
&varianttype
, wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
35 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell
)
38 // ---------------------------------------------------------
40 // ---------------------------------------------------------
42 class wxDataViewTextCell
: public wxDataViewCell
45 wxDataViewTextCell( const wxString
&varianttype
= wxT("string"),
46 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
48 bool SetValue( const wxVariant
&value
);
49 bool GetValue( wxVariant
&value
);
52 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell
)
55 // ---------------------------------------------------------
56 // wxDataViewToggleCell
57 // ---------------------------------------------------------
59 class wxDataViewToggleCell
: public wxDataViewCell
62 wxDataViewToggleCell( const wxString
&varianttype
= wxT("bool"),
63 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
65 bool SetValue( const wxVariant
&value
);
66 bool GetValue( wxVariant
&value
);
69 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell
)
72 // ---------------------------------------------------------
73 // wxDataViewCustomCell
74 // ---------------------------------------------------------
76 class wxDataViewCustomCell
: public wxDataViewCell
79 wxDataViewCustomCell( const wxString
&varianttype
= wxT("string"),
80 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
81 ~wxDataViewCustomCell();
84 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
) = 0;
85 virtual wxSize
GetSize() = 0;
87 virtual bool Activate( wxRect cell
,
88 wxDataViewListModel
*model
, size_t col
, size_t row
)
91 virtual bool LeftClick( wxPoint cursor
, wxRect cell
,
92 wxDataViewListModel
*model
, size_t col
, size_t row
)
94 virtual bool RightClick( wxPoint cursor
, wxRect cell
,
95 wxDataViewListModel
*model
, size_t col
, size_t row
)
97 virtual bool StartDrag( wxPoint cursor
, wxRect cell
,
98 wxDataViewListModel
*model
, size_t col
, size_t row
)
101 // Create DC on request
102 virtual wxDC
*GetDC();
108 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell
)
111 // ---------------------------------------------------------
112 // wxDataViewProgressCell
113 // ---------------------------------------------------------
115 class wxDataViewProgressCell
: public wxDataViewCustomCell
118 wxDataViewProgressCell( const wxString
&label
= wxEmptyString
,
119 const wxString
&varianttype
= wxT("long"),
120 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
121 ~wxDataViewProgressCell();
123 bool SetValue( const wxVariant
&value
);
125 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
126 virtual wxSize
GetSize();
133 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell
)
136 // ---------------------------------------------------------
137 // wxDataViewDateCell
138 // ---------------------------------------------------------
140 class wxDataViewDateCell
: public wxDataViewCustomCell
143 wxDataViewDateCell( const wxString
&varianttype
= wxT("datetime"),
144 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
);
146 bool SetValue( const wxVariant
&value
);
148 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
149 virtual wxSize
GetSize();
150 virtual bool Activate( wxRect cell
,
151 wxDataViewListModel
*model
, size_t col
, size_t row
);
157 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell
)
160 // ---------------------------------------------------------
162 // ---------------------------------------------------------
164 class WXDLLIMPEXP_CORE wxDataViewColumn
: public wxDataViewColumnBase
167 wxDataViewColumn( const wxString
&title
, wxDataViewCell
*cell
, size_t model_column
, int flags
= 0 );
168 virtual ~wxDataViewColumn();
170 virtual void SetTitle( const wxString
&title
);
175 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn
)
178 // ---------------------------------------------------------
180 // ---------------------------------------------------------
182 class WXDLLIMPEXP_CORE wxDataViewCtrl
: public wxDataViewCtrlBase
,
183 public wxScrollHelperNative
186 wxDataViewCtrl() : wxScrollHelperNative(this)
191 wxDataViewCtrl( wxWindow
*parent
, wxWindowID id
,
192 const wxPoint
& pos
= wxDefaultPosition
,
193 const wxSize
& size
= wxDefaultSize
, long style
= 0,
194 const wxValidator
& validator
= wxDefaultValidator
) :
195 wxScrollHelperNative(this)
197 Create(parent
, id
, pos
, size
, style
, validator
);
200 virtual ~wxDataViewCtrl();
204 bool Create(wxWindow
*parent
, wxWindowID id
,
205 const wxPoint
& pos
= wxDefaultPosition
,
206 const wxSize
& size
= wxDefaultSize
, long style
= 0,
207 const wxValidator
& validator
= wxDefaultValidator
);
209 virtual bool AssociateModel( wxDataViewListModel
*model
);
210 virtual bool AppendColumn( wxDataViewColumn
*col
);
213 wxDataViewListModelNotifier
*m_notifier
;
214 wxWindow
*m_clientArea
;
215 wxWindow
*m_headerArea
;
218 virtual void ScrollWindow( int dx
, int dy
, const wxRect
*rect
);
220 // we need to return a special WM_GETDLGCODE value to process just the
221 // arrows but let the other navigation characters through
223 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
226 WX_FORWARD_TO_SCROLL_HELPER()
229 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl
)
230 DECLARE_NO_COPY_CLASS(wxDataViewCtrl
)
234 #endif // __GENERICDATAVIEWCTRLH__