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
;
24 class WXDLLIMPEXP_CORE wxDataViewMainWindow
;
25 class WXDLLIMPEXP_CORE wxDataViewHeaderWindow
;
27 // ---------------------------------------------------------
29 // ---------------------------------------------------------
31 class wxDataViewCell
: public wxDataViewCellBase
34 wxDataViewCell( const wxString
&varianttype
, wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
37 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell
)
40 // ---------------------------------------------------------
42 // ---------------------------------------------------------
44 class wxDataViewTextCell
: public wxDataViewCell
47 wxDataViewTextCell( const wxString
&varianttype
= wxT("string"),
48 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
50 bool SetValue( const wxVariant
&value
);
51 bool GetValue( wxVariant
&value
);
54 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell
)
57 // ---------------------------------------------------------
58 // wxDataViewToggleCell
59 // ---------------------------------------------------------
61 class wxDataViewToggleCell
: public wxDataViewCell
64 wxDataViewToggleCell( const wxString
&varianttype
= wxT("bool"),
65 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
67 bool SetValue( const wxVariant
&value
);
68 bool GetValue( wxVariant
&value
);
71 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell
)
74 // ---------------------------------------------------------
75 // wxDataViewCustomCell
76 // ---------------------------------------------------------
78 class wxDataViewCustomCell
: public wxDataViewCell
81 wxDataViewCustomCell( const wxString
&varianttype
= wxT("string"),
82 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
83 ~wxDataViewCustomCell();
86 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
) = 0;
87 virtual wxSize
GetSize() = 0;
89 virtual bool Activate( wxRect cell
,
90 wxDataViewListModel
*model
, size_t col
, size_t row
)
93 virtual bool LeftClick( wxPoint cursor
, wxRect cell
,
94 wxDataViewListModel
*model
, size_t col
, size_t row
)
96 virtual bool RightClick( wxPoint cursor
, wxRect cell
,
97 wxDataViewListModel
*model
, size_t col
, size_t row
)
99 virtual bool StartDrag( wxPoint cursor
, wxRect cell
,
100 wxDataViewListModel
*model
, size_t col
, size_t row
)
103 // Create DC on request
104 virtual wxDC
*GetDC();
110 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell
)
113 // ---------------------------------------------------------
114 // wxDataViewProgressCell
115 // ---------------------------------------------------------
117 class wxDataViewProgressCell
: public wxDataViewCustomCell
120 wxDataViewProgressCell( const wxString
&label
= wxEmptyString
,
121 const wxString
&varianttype
= wxT("long"),
122 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
123 ~wxDataViewProgressCell();
125 bool SetValue( const wxVariant
&value
);
127 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
128 virtual wxSize
GetSize();
135 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell
)
138 // ---------------------------------------------------------
139 // wxDataViewDateCell
140 // ---------------------------------------------------------
142 class wxDataViewDateCell
: public wxDataViewCustomCell
145 wxDataViewDateCell( const wxString
&varianttype
= wxT("datetime"),
146 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
);
148 bool SetValue( const wxVariant
&value
);
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
);
159 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell
)
162 // ---------------------------------------------------------
164 // ---------------------------------------------------------
166 class WXDLLIMPEXP_CORE wxDataViewColumn
: public wxDataViewColumnBase
169 wxDataViewColumn( const wxString
&title
, wxDataViewCell
*cell
, size_t model_column
, int flags
= 0 );
170 virtual ~wxDataViewColumn();
172 virtual void SetTitle( const wxString
&title
);
174 void SetWidth( int width
) { m_width
= width
; }
175 int GetWidth() { return m_width
; }
181 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn
)
184 // ---------------------------------------------------------
186 // ---------------------------------------------------------
188 class WXDLLIMPEXP_CORE wxDataViewCtrl
: public wxDataViewCtrlBase
,
189 public wxScrollHelperNative
192 wxDataViewCtrl() : wxScrollHelperNative(this)
197 wxDataViewCtrl( wxWindow
*parent
, wxWindowID id
,
198 const wxPoint
& pos
= wxDefaultPosition
,
199 const wxSize
& size
= wxDefaultSize
, long style
= 0,
200 const wxValidator
& validator
= wxDefaultValidator
)
201 : wxScrollHelperNative(this)
203 Create(parent
, id
, pos
, size
, style
, validator
);
206 virtual ~wxDataViewCtrl();
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
);
215 virtual bool AssociateModel( wxDataViewListModel
*model
);
216 virtual bool AppendColumn( wxDataViewColumn
*col
);
219 friend class wxDataViewMainWindow
;
220 wxDataViewListModelNotifier
*m_notifier
;
221 wxDataViewMainWindow
*m_clientArea
;
222 wxDataViewHeaderWindow
*m_headerArea
;
225 void OnSize( wxSizeEvent
&event
);
227 // we need to return a special WM_GETDLGCODE value to process just the
228 // arrows but let the other navigation characters through
230 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
233 WX_FORWARD_TO_SCROLL_HELPER()
236 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl
)
237 DECLARE_NO_COPY_CLASS(wxDataViewCtrl
)
238 DECLARE_EVENT_TABLE()
242 #endif // __GENERICDATAVIEWCTRLH__