]>
Commit | Line | Data |
---|---|---|
4ed7af08 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/generic/dataview.h | |
3 | // Purpose: wxDataViewCtrl generic implementation header | |
4 | // Author: Robert Roebling | |
b7e9f8b1 | 5 | // Modified By: Bo Yang |
4ed7af08 RR |
6 | // Id: $Id$ |
7 | // Copyright: (c) 1998 Robert Roebling | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef __GENERICDATAVIEWCTRLH__ | |
12 | #define __GENERICDATAVIEWCTRLH__ | |
13 | ||
14 | #include "wx/defs.h" | |
15 | #include "wx/object.h" | |
16 | #include "wx/list.h" | |
17 | #include "wx/control.h" | |
9d14de69 | 18 | #include "wx/scrolwin.h" |
2586d4a1 | 19 | #include "wx/icon.h" |
4ed7af08 | 20 | |
f554a14b | 21 | // --------------------------------------------------------- |
4ed7af08 | 22 | // classes |
f554a14b | 23 | // --------------------------------------------------------- |
4ed7af08 | 24 | |
b5dbe15d VS |
25 | class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl; |
26 | class WXDLLIMPEXP_FWD_ADV wxDataViewMainWindow; | |
27 | class WXDLLIMPEXP_FWD_ADV wxDataViewHeaderWindow; | |
4ed7af08 | 28 | |
f554a14b | 29 | // --------------------------------------------------------- |
baa9ebc4 | 30 | // wxDataViewRenderer |
f554a14b | 31 | // --------------------------------------------------------- |
4ed7af08 | 32 | |
baa9ebc4 | 33 | class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase |
4ed7af08 RR |
34 | { |
35 | public: | |
87f0efe2 | 36 | wxDataViewRenderer( const wxString &varianttype, |
9861f022 RR |
37 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
38 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
baa9ebc4 | 39 | virtual ~wxDataViewRenderer(); |
4ed7af08 | 40 | |
3d9d7cc4 | 41 | virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0; |
9861f022 RR |
42 | virtual wxSize GetSize() const = 0; |
43 | ||
44 | virtual void SetAlignment( int align ) | |
45 | { m_align=align; } | |
46 | virtual int GetAlignment() const | |
47 | { return m_align; } | |
48 | ||
49 | virtual void SetMode( wxDataViewCellMode mode ) | |
50 | { m_mode=mode; } | |
51 | virtual wxDataViewCellMode GetMode() const | |
52 | { return m_mode; } | |
f554a14b WS |
53 | |
54 | virtual bool Activate( wxRect WXUNUSED(cell), | |
aba9bfd0 | 55 | wxDataViewModel *WXUNUSED(model), |
704c3490 | 56 | const wxDataViewItem & WXUNUSED(item), |
aba9bfd0 | 57 | unsigned int WXUNUSED(col) ) |
3d9d7cc4 | 58 | { return false; } |
f554a14b WS |
59 | |
60 | virtual bool LeftClick( wxPoint WXUNUSED(cursor), | |
61 | wxRect WXUNUSED(cell), | |
aba9bfd0 | 62 | wxDataViewModel *WXUNUSED(model), |
704c3490 | 63 | const wxDataViewItem & WXUNUSED(item), |
aba9bfd0 | 64 | unsigned int WXUNUSED(col) ) |
f554a14b WS |
65 | { return false; } |
66 | virtual bool RightClick( wxPoint WXUNUSED(cursor), | |
67 | wxRect WXUNUSED(cell), | |
aba9bfd0 | 68 | wxDataViewModel *WXUNUSED(model), |
704c3490 | 69 | const wxDataViewItem & WXUNUSED(item), |
aba9bfd0 | 70 | unsigned int WXUNUSED(col) ) |
f554a14b WS |
71 | { return false; } |
72 | virtual bool StartDrag( wxPoint WXUNUSED(cursor), | |
73 | wxRect WXUNUSED(cell), | |
aba9bfd0 | 74 | wxDataViewModel *WXUNUSED(model), |
704c3490 | 75 | const wxDataViewItem & WXUNUSED(item), |
aba9bfd0 | 76 | unsigned int WXUNUSED(col) ) |
f554a14b WS |
77 | { return false; } |
78 | ||
3d9d7cc4 RR |
79 | // Create DC on request |
80 | virtual wxDC *GetDC(); | |
4264606e RR |
81 | |
82 | void SetHasAttr( bool set ) { m_hasAttr = set; } | |
83 | void SetAttr( const wxDataViewItemAttr &attr ) { m_attr = attr; } | |
84 | bool GetWantsAttr() { return m_wantsAttr; } | |
f554a14b | 85 | |
3d9d7cc4 | 86 | private: |
99d471a5 RR |
87 | wxDC *m_dc; |
88 | int m_align; | |
89 | wxDataViewCellMode m_mode; | |
4264606e RR |
90 | |
91 | protected: | |
92 | bool m_wantsAttr; | |
93 | bool m_hasAttr; | |
94 | wxDataViewItemAttr m_attr; | |
f554a14b | 95 | |
4ed7af08 | 96 | protected: |
baa9ebc4 | 97 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) |
4ed7af08 | 98 | }; |
f554a14b WS |
99 | |
100 | // --------------------------------------------------------- | |
baa9ebc4 | 101 | // wxDataViewCustomRenderer |
f554a14b | 102 | // --------------------------------------------------------- |
4ed7af08 | 103 | |
baa9ebc4 | 104 | class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer |
4ed7af08 RR |
105 | { |
106 | public: | |
baa9ebc4 | 107 | wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"), |
9861f022 RR |
108 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
109 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
f554a14b | 110 | |
52e750fc RR |
111 | void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state ); |
112 | ||
4ed7af08 | 113 | protected: |
baa9ebc4 | 114 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) |
4ed7af08 | 115 | }; |
f554a14b | 116 | |
99d471a5 | 117 | |
f554a14b | 118 | // --------------------------------------------------------- |
baa9ebc4 | 119 | // wxDataViewTextRenderer |
f554a14b | 120 | // --------------------------------------------------------- |
4ed7af08 | 121 | |
baa9ebc4 | 122 | class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewCustomRenderer |
4ed7af08 RR |
123 | { |
124 | public: | |
baa9ebc4 | 125 | wxDataViewTextRenderer( const wxString &varianttype = wxT("string"), |
9861f022 RR |
126 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
127 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
4ed7af08 RR |
128 | |
129 | bool SetValue( const wxVariant &value ); | |
9861f022 | 130 | bool GetValue( wxVariant &value ) const; |
f554a14b | 131 | |
3d9d7cc4 | 132 | bool Render( wxRect cell, wxDC *dc, int state ); |
9861f022 | 133 | wxSize GetSize() const; |
f554a14b | 134 | |
99d471a5 RR |
135 | // in-place editing |
136 | virtual bool HasEditorCtrl(); | |
137 | virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); | |
138 | virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); | |
139 | ||
4264606e | 140 | protected: |
99d471a5 | 141 | wxString m_text; |
f554a14b | 142 | |
4ed7af08 | 143 | protected: |
baa9ebc4 | 144 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) |
4ed7af08 | 145 | }; |
f554a14b | 146 | |
4264606e RR |
147 | // --------------------------------------------------------- |
148 | // wxDataViewTextRendererAttr | |
149 | // --------------------------------------------------------- | |
150 | ||
151 | class WXDLLIMPEXP_ADV wxDataViewTextRendererAttr: public wxDataViewTextRenderer | |
152 | { | |
153 | public: | |
154 | wxDataViewTextRendererAttr( const wxString &varianttype = wxT("string"), | |
155 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
156 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
157 | ||
158 | bool Render( wxRect cell, wxDC *dc, int state ); | |
159 | ||
160 | protected: | |
161 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRendererAttr) | |
162 | }; | |
163 | ||
2586d4a1 | 164 | // --------------------------------------------------------- |
baa9ebc4 | 165 | // wxDataViewBitmapRenderer |
2586d4a1 RR |
166 | // --------------------------------------------------------- |
167 | ||
baa9ebc4 | 168 | class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewCustomRenderer |
2586d4a1 RR |
169 | { |
170 | public: | |
baa9ebc4 | 171 | wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"), |
9861f022 RR |
172 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
173 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
2586d4a1 RR |
174 | |
175 | bool SetValue( const wxVariant &value ); | |
9861f022 | 176 | bool GetValue( wxVariant &value ) const; |
2586d4a1 RR |
177 | |
178 | bool Render( wxRect cell, wxDC *dc, int state ); | |
9861f022 | 179 | wxSize GetSize() const; |
2586d4a1 RR |
180 | |
181 | private: | |
182 | wxIcon m_icon; | |
183 | wxBitmap m_bitmap; | |
184 | ||
185 | protected: | |
baa9ebc4 | 186 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) |
2586d4a1 RR |
187 | }; |
188 | ||
f554a14b | 189 | // --------------------------------------------------------- |
baa9ebc4 | 190 | // wxDataViewToggleRenderer |
f554a14b | 191 | // --------------------------------------------------------- |
4ed7af08 | 192 | |
baa9ebc4 | 193 | class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewCustomRenderer |
4ed7af08 RR |
194 | { |
195 | public: | |
baa9ebc4 | 196 | wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"), |
9861f022 RR |
197 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
198 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
3d9d7cc4 RR |
199 | |
200 | bool SetValue( const wxVariant &value ); | |
9861f022 | 201 | bool GetValue( wxVariant &value ) const; |
f554a14b | 202 | |
3d9d7cc4 | 203 | bool Render( wxRect cell, wxDC *dc, int state ); |
aba9bfd0 RR |
204 | bool Activate( wxRect cell, wxDataViewModel *model, const wxDataViewItem & item, |
205 | unsigned int col ); | |
9861f022 | 206 | wxSize GetSize() const; |
f554a14b | 207 | |
90675b95 RR |
208 | private: |
209 | bool m_toggle; | |
f554a14b | 210 | |
4ed7af08 | 211 | protected: |
baa9ebc4 | 212 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) |
4ed7af08 | 213 | }; |
f554a14b WS |
214 | |
215 | // --------------------------------------------------------- | |
baa9ebc4 | 216 | // wxDataViewProgressRenderer |
f554a14b | 217 | // --------------------------------------------------------- |
4ed7af08 | 218 | |
baa9ebc4 | 219 | class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer |
4ed7af08 RR |
220 | { |
221 | public: | |
baa9ebc4 RR |
222 | wxDataViewProgressRenderer( const wxString &label = wxEmptyString, |
223 | const wxString &varianttype = wxT("long"), | |
9861f022 RR |
224 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
225 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
baa9ebc4 | 226 | virtual ~wxDataViewProgressRenderer(); |
f554a14b | 227 | |
4ed7af08 | 228 | bool SetValue( const wxVariant &value ); |
9861f022 | 229 | bool GetValue( wxVariant& value ) const; |
f554a14b | 230 | |
4ed7af08 | 231 | virtual bool Render( wxRect cell, wxDC *dc, int state ); |
9861f022 | 232 | virtual wxSize GetSize() const; |
f554a14b | 233 | |
4ed7af08 RR |
234 | private: |
235 | wxString m_label; | |
236 | int m_value; | |
f554a14b | 237 | |
4ed7af08 | 238 | protected: |
baa9ebc4 | 239 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) |
4ed7af08 | 240 | }; |
24c4a50f RR |
241 | |
242 | // --------------------------------------------------------- | |
243 | // wxDataViewIconTextRenderer | |
244 | // --------------------------------------------------------- | |
245 | ||
246 | class wxDataViewIconTextRenderer: public wxDataViewCustomRenderer | |
247 | { | |
248 | public: | |
249 | wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"), | |
250 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
251 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
252 | virtual ~wxDataViewIconTextRenderer(); | |
253 | ||
254 | bool SetValue( const wxVariant &value ); | |
255 | bool GetValue( wxVariant &value ) const; | |
256 | ||
257 | virtual bool Render( wxRect cell, wxDC *dc, int state ); | |
258 | virtual wxSize GetSize() const; | |
259 | ||
260 | virtual bool HasEditorCtrl() { return true; } | |
261 | virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ); | |
262 | virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ); | |
263 | ||
264 | private: | |
265 | wxDataViewIconText m_value; | |
266 | ||
267 | protected: | |
268 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) | |
269 | }; | |
f554a14b WS |
270 | |
271 | // --------------------------------------------------------- | |
baa9ebc4 | 272 | // wxDataViewDateRenderer |
f554a14b | 273 | // --------------------------------------------------------- |
4ed7af08 | 274 | |
baa9ebc4 | 275 | class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer |
4ed7af08 RR |
276 | { |
277 | public: | |
baa9ebc4 | 278 | wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"), |
9861f022 RR |
279 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, |
280 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
f554a14b | 281 | |
4ed7af08 | 282 | bool SetValue( const wxVariant &value ); |
9861f022 | 283 | bool GetValue( wxVariant& value ) const; |
f554a14b | 284 | |
4ed7af08 | 285 | virtual bool Render( wxRect cell, wxDC *dc, int state ); |
9861f022 | 286 | virtual wxSize GetSize() const; |
4ed7af08 | 287 | virtual bool Activate( wxRect cell, |
aba9bfd0 | 288 | wxDataViewModel *model, const wxDataViewItem & item, unsigned int col ); |
f554a14b | 289 | |
4ed7af08 RR |
290 | private: |
291 | wxDateTime m_date; | |
f554a14b | 292 | |
4ed7af08 | 293 | protected: |
baa9ebc4 | 294 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) |
4ed7af08 | 295 | }; |
f554a14b WS |
296 | |
297 | // --------------------------------------------------------- | |
4ed7af08 | 298 | // wxDataViewColumn |
f554a14b | 299 | // --------------------------------------------------------- |
4ed7af08 | 300 | |
f460c29d | 301 | class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase |
4ed7af08 | 302 | { |
87f0efe2 RR |
303 | friend class wxDataViewHeaderWindowBase; |
304 | friend class wxDataViewHeaderWindow; | |
305 | friend class wxDataViewHeaderWindowMSW; | |
306 | ||
4ed7af08 | 307 | public: |
87f0efe2 RR |
308 | wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer, |
309 | unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH, | |
310 | wxAlignment align = wxALIGN_CENTER, | |
311 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
312 | wxDataViewColumn( const wxBitmap &bitmap, wxDataViewRenderer *renderer, | |
313 | unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH, | |
314 | wxAlignment align = wxALIGN_CENTER, | |
315 | int flags = wxDATAVIEW_COL_RESIZABLE ); | |
4ed7af08 RR |
316 | virtual ~wxDataViewColumn(); |
317 | ||
9861f022 RR |
318 | // setters: |
319 | ||
320 | virtual void SetTitle( const wxString &title ) | |
321 | { m_title=title; } | |
87f0efe2 RR |
322 | virtual void SetAlignment( wxAlignment align ) |
323 | { m_align=align; } | |
9861f022 RR |
324 | virtual void SetMinWidth( int minWidth ) |
325 | { m_minWidth=minWidth; } | |
326 | virtual void SetWidth( int width ); | |
31fb32e1 | 327 | virtual void SetSortable( bool sortable ); |
9861f022 RR |
328 | virtual void SetResizeable( bool resizeable ); |
329 | virtual void SetHidden( bool hidden ); | |
47cef10f | 330 | virtual void SetSortOrder( bool ascending ); |
87f0efe2 | 331 | |
87f0efe2 | 332 | |
9861f022 RR |
333 | // getters: |
334 | ||
335 | virtual wxString GetTitle() const | |
336 | { return m_title; } | |
337 | virtual wxAlignment GetAlignment() const | |
338 | { return m_align; } | |
339 | virtual int GetWidth() const | |
340 | { return m_width; } | |
341 | virtual int GetMinWidth() const | |
342 | { return m_minWidth; } | |
343 | virtual bool IsSortable() const | |
344 | { return (m_flags & wxDATAVIEW_COL_SORTABLE) != 0; } | |
345 | virtual bool IsResizeable() const | |
346 | { return (m_flags & wxDATAVIEW_COL_RESIZABLE) != 0; } | |
347 | virtual bool IsHidden() const | |
348 | { return (m_flags & wxDATAVIEW_COL_HIDDEN) != 0; } | |
349 | virtual bool IsSortOrderAscending() const; | |
f554a14b | 350 | |
f554a14b | 351 | |
4ed7af08 | 352 | private: |
533544f2 | 353 | int m_width; |
9861f022 RR |
354 | int m_minWidth; |
355 | int m_flags; | |
356 | wxAlignment m_align; | |
357 | wxString m_title; | |
c3112d56 | 358 | bool m_ascending; |
87f0efe2 RR |
359 | |
360 | void Init(int width); | |
4ed7af08 | 361 | |
9861f022 RR |
362 | // like SetWidth() but does not ask the header window of the |
363 | // wxDataViewCtrl to reflect the width-change. | |
364 | void SetInternalWidth(int width); | |
365 | ||
4ed7af08 RR |
366 | protected: |
367 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn) | |
368 | }; | |
369 | ||
f554a14b | 370 | // --------------------------------------------------------- |
4ed7af08 | 371 | // wxDataViewCtrl |
f554a14b | 372 | // --------------------------------------------------------- |
4ed7af08 | 373 | |
4660b556 VZ |
374 | WX_DECLARE_LIST_WITH_DECL(wxDataViewColumn, wxDataViewColumnList, |
375 | class WXDLLIMPEXP_ADV); | |
afebb87b | 376 | |
f460c29d | 377 | class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase, |
4ed7af08 RR |
378 | public wxScrollHelperNative |
379 | { | |
87f0efe2 RR |
380 | friend class wxDataViewMainWindow; |
381 | friend class wxDataViewHeaderWindowBase; | |
382 | friend class wxDataViewHeaderWindow; | |
383 | friend class wxDataViewHeaderWindowMSW; | |
9861f022 | 384 | friend class wxDataViewColumn; |
87f0efe2 | 385 | |
4ed7af08 RR |
386 | public: |
387 | wxDataViewCtrl() : wxScrollHelperNative(this) | |
388 | { | |
57f2a652 RR |
389 | //No sorting column at start, I think |
390 | m_sortingColumn = NULL; | |
4ed7af08 RR |
391 | Init(); |
392 | } | |
f554a14b | 393 | |
4ed7af08 RR |
394 | wxDataViewCtrl( wxWindow *parent, wxWindowID id, |
395 | const wxPoint& pos = wxDefaultPosition, | |
396 | const wxSize& size = wxDefaultSize, long style = 0, | |
f554a14b | 397 | const wxValidator& validator = wxDefaultValidator ) |
4b3feaa7 | 398 | : wxScrollHelperNative(this) |
4ed7af08 | 399 | { |
57f2a652 | 400 | m_sortingColumn = NULL; |
4ed7af08 RR |
401 | Create(parent, id, pos, size, style, validator ); |
402 | } | |
403 | ||
404 | virtual ~wxDataViewCtrl(); | |
405 | ||
406 | void Init(); | |
407 | ||
408 | bool Create(wxWindow *parent, wxWindowID id, | |
409 | const wxPoint& pos = wxDefaultPosition, | |
410 | const wxSize& size = wxDefaultSize, long style = 0, | |
411 | const wxValidator& validator = wxDefaultValidator ); | |
412 | ||
aba9bfd0 | 413 | virtual bool AssociateModel( wxDataViewModel *model ); |
4ed7af08 | 414 | virtual bool AppendColumn( wxDataViewColumn *col ); |
736fe67c | 415 | virtual bool PrependColumn( wxDataViewColumn *col ); |
f554a14b | 416 | |
3b6280be RR |
417 | virtual void DoSetExpanderColumn(); |
418 | virtual void DoSetIndent(); | |
419 | ||
afebb87b RR |
420 | virtual unsigned int GetColumnCount() const; |
421 | virtual wxDataViewColumn* GetColumn( unsigned int pos ) const; | |
422 | virtual bool DeleteColumn( wxDataViewColumn *column ); | |
423 | virtual bool ClearColumns(); | |
453091c2 | 424 | virtual int GetColumnPosition( const wxDataViewColumn *column ) const; |
afebb87b | 425 | |
21f47fb9 RR |
426 | virtual wxDataViewColumn *GetSortingColumn() const; |
427 | ||
fbda518c | 428 | virtual wxDataViewItem GetSelection() const; |
b7e9f8b1 RR |
429 | virtual int GetSelections( wxDataViewItemArray & sel ) const; |
430 | virtual void SetSelections( const wxDataViewItemArray & sel ); | |
431 | virtual void Select( const wxDataViewItem & item ); | |
432 | virtual void Unselect( const wxDataViewItem & item ); | |
433 | virtual bool IsSelected( const wxDataViewItem & item ) const; | |
434 | ||
66e09788 RR |
435 | virtual void SelectAll(); |
436 | virtual void UnselectAll(); | |
437 | ||
438 | virtual void EnsureVisible( const wxDataViewItem & item, | |
fbda518c | 439 | const wxDataViewColumn *column = NULL ); |
a87b466d | 440 | virtual void HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column ) const; |
fbda518c | 441 | virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const; |
66e09788 | 442 | |
afebb87b RR |
443 | virtual void Expand( const wxDataViewItem & item ); |
444 | virtual void Collapse( const wxDataViewItem & item ); | |
445 | ||
66e09788 | 446 | protected: |
b7e9f8b1 RR |
447 | virtual int GetSelections( wxArrayInt & sel ) const; |
448 | virtual void SetSelections( const wxArrayInt & sel ); | |
449 | virtual void Select( int row ); | |
450 | virtual void Unselect( int row ); | |
451 | virtual bool IsSelected( int row ) const; | |
452 | virtual void SelectRange( int from, int to ); | |
453 | virtual void UnselectRange( int from, int to ); | |
454 | ||
fbda518c | 455 | virtual void EnsureVisible( int row, int column ); |
b7e9f8b1 RR |
456 | |
457 | virtual wxDataViewItem GetItemByRow( unsigned int row ) const; | |
458 | virtual int GetRowByItem( const wxDataViewItem & item ) const; | |
459 | ||
57f2a652 RR |
460 | wxDataViewColumn* GetSortingColumn() { return m_sortingColumn; } |
461 | void SetSortingColumn( wxDataViewColumn* column ) { m_sortingColumn = column; } | |
6ff7eee7 | 462 | |
9861f022 RR |
463 | public: // utility functions not part of the API |
464 | ||
87f0efe2 | 465 | // returns the "best" width for the idx-th column |
9861f022 | 466 | unsigned int GetBestColumnWidth(int WXUNUSED(idx)) const |
87f0efe2 | 467 | { |
9861f022 | 468 | return GetClientSize().GetWidth() / GetColumnCount(); |
87f0efe2 RR |
469 | } |
470 | ||
9861f022 RR |
471 | // updates the header window after a change in a column setting |
472 | void OnColumnChange(); | |
87f0efe2 | 473 | |
1e510b1e | 474 | wxWindow *GetMainWindow() { return (wxWindow*) m_clientArea; } |
99d471a5 | 475 | |
4ed7af08 | 476 | private: |
afebb87b | 477 | wxDataViewColumnList m_cols; |
aba9bfd0 | 478 | wxDataViewModelNotifier *m_notifier; |
4b3feaa7 RR |
479 | wxDataViewMainWindow *m_clientArea; |
480 | wxDataViewHeaderWindow *m_headerArea; | |
57f2a652 | 481 | wxDataViewColumn* m_sortingColumn; |
f554a14b | 482 | |
4ed7af08 | 483 | private: |
4b3feaa7 | 484 | void OnSize( wxSizeEvent &event ); |
f554a14b | 485 | |
4ed7af08 RR |
486 | // we need to return a special WM_GETDLGCODE value to process just the |
487 | // arrows but let the other navigation characters through | |
488 | #ifdef __WXMSW__ | |
489 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
490 | #endif // __WXMSW__ | |
491 | ||
492 | WX_FORWARD_TO_SCROLL_HELPER() | |
4b3feaa7 | 493 | |
4ed7af08 RR |
494 | private: |
495 | DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) | |
496 | DECLARE_NO_COPY_CLASS(wxDataViewCtrl) | |
4b3feaa7 | 497 | DECLARE_EVENT_TABLE() |
4ed7af08 RR |
498 | }; |
499 | ||
500 | ||
501 | #endif // __GENERICDATAVIEWCTRLH__ |