1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDataViewCtrl base classes
4 // Author: Robert Roebling
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DATAVIEW_H_BASE_
13 #define _WX_DATAVIEW_H_BASE_
17 #if wxUSE_DATAVIEWCTRL
19 #include "wx/control.h"
20 #include "wx/textctrl.h"
21 #include "wx/bitmap.h"
22 #include "wx/variant.h"
24 // ----------------------------------------------------------------------------
25 // wxDataViewCtrl flags
26 // ----------------------------------------------------------------------------
28 // ----------------------------------------------------------------------------
29 // wxDataViewCtrl globals
30 // ----------------------------------------------------------------------------
32 extern WXDLLEXPORT_DATA(const wxChar
) wxDataViewCtrlNameStr
[];
34 // ---------------------------------------------------------
36 // ---------------------------------------------------------
38 class wxDataViewModel
: public wxObject
42 virtual ~wxDataViewModel() { }
45 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewModel
)
48 // ---------------------------------------------------------
49 // wxDataViewListModelNotifier
50 // ---------------------------------------------------------
52 class wxDataViewListModelNotifier
55 wxDataViewListModelNotifier() { }
56 virtual ~wxDataViewListModelNotifier() { }
58 virtual bool RowAppended() = 0;
59 virtual bool RowPrepended() = 0;
60 virtual bool RowInserted( size_t before
) = 0;
61 virtual bool RowDeleted( size_t row
) = 0;
62 virtual bool RowChanged( size_t row
) = 0;
63 virtual bool ValueChanged( size_t row
, size_t col
) = 0;
64 virtual bool Cleared() = 0;
67 // ---------------------------------------------------------
68 // wxDataViewListModel
69 // ---------------------------------------------------------
71 class wxDataViewListModel
: public wxDataViewModel
74 wxDataViewListModel();
75 virtual ~wxDataViewListModel();
77 virtual size_t GetNumberOfRows() = 0;
78 virtual size_t GetNumberOfCols() = 0;
79 // as reported by wxVariant
80 virtual wxString
GetColType( size_t col
) = 0;
81 virtual wxVariant
GetValue( size_t col
, size_t row
) = 0;
83 // delegated notifiers
86 bool RowInserted( size_t before
);
87 bool RowDeleted( size_t row
);
88 bool RowChanged( size_t row
);
89 bool ValueChanged( size_t row
, size_t col
);
92 void SetNotifier( wxDataViewListModelNotifier
*notifier
);
93 wxDataViewListModelNotifier
* GetNotifier();
96 wxDataViewListModelNotifier
*m_notifier
;
99 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewListModel
)
102 // ---------------------------------------------------------
103 // wxDataViewCtrlBase
104 // ---------------------------------------------------------
106 class wxDataViewCtrlBase
: public wxControl
109 wxDataViewCtrlBase();
110 ~wxDataViewCtrlBase();
112 virtual bool AppendStringColumn( const wxString
&label
) = 0;
114 virtual bool AssociateModel( wxDataViewModel
*model
);
115 wxDataViewModel
* GetModel();
118 wxDataViewModel
*m_model
;
121 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase
)
126 #if defined(__WXGTK20__)
127 #include "wx/gtk/dataview.h"
128 #elif defined(__WXMAC__)
129 #include "wx/mac/dataview.h"
131 #include "wx/generic/dataview.h"
134 #endif // wxUSE_DATAVIEWCTRL
137 // _WX_DATAVIEW_H_BASE_