1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/datavcmn.cpp
3 // Purpose: wxDataViewCtrl base classes and common parts
4 // Author: Robert Roebling
7 // Copyright: (c) 2006, Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #include "wx/object.h"
19 #include "wx/dataview.h"
23 // ---------------------------------------------------------
25 // ---------------------------------------------------------
27 IMPLEMENT_ABSTRACT_CLASS(wxDataViewModel
, wxObject
)
29 // ---------------------------------------------------------
30 // wxDataViewListModel
31 // ---------------------------------------------------------
33 IMPLEMENT_ABSTRACT_CLASS(wxDataViewListModel
, wxDataViewModel
)
35 wxDataViewListModel::wxDataViewListModel()
40 wxDataViewListModel::~wxDataViewListModel()
46 bool wxDataViewListModel::RowAppended()
49 return m_notifier
->RowAppended();
54 bool wxDataViewListModel::RowPrepended()
57 return m_notifier
->RowPrepended();
62 bool wxDataViewListModel::RowInserted( size_t before
)
65 return m_notifier
->RowInserted( before
);
70 bool wxDataViewListModel::RowDeleted( size_t row
)
73 return m_notifier
->RowDeleted( row
);
78 bool wxDataViewListModel::RowChanged( size_t row
)
81 return m_notifier
->RowChanged( row
);
86 bool wxDataViewListModel::ValueChanged( size_t row
, size_t col
)
89 return m_notifier
->RowAppended();
94 bool wxDataViewListModel::Cleared()
97 return m_notifier
->Cleared();
102 void wxDataViewListModel::SetNotifier( wxDataViewListModelNotifier
*notifier
)
107 m_notifier
= notifier
;
110 wxDataViewListModelNotifier
* wxDataViewListModel::GetNotifier()
115 // ---------------------------------------------------------
116 // wxDataViewColumnBase
117 // ---------------------------------------------------------
119 IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumnBase
, wxObject
)
121 wxDataViewColumnBase::wxDataViewColumnBase( const wxString
&title
, wxDataViewCtrl
*ctrl
,
122 wxDataViewColumnType kind
, int flags
)
130 void wxDataViewColumnBase::SetTitle( const wxString
&title
)
135 wxString
wxDataViewColumnBase::GetTitle()
140 // ---------------------------------------------------------
141 // wxDataViewCtrlBase
142 // ---------------------------------------------------------
144 IMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase
, wxControl
)
146 wxDataViewCtrlBase::wxDataViewCtrlBase()
149 m_cols
.DeleteContents( true );
152 wxDataViewCtrlBase::~wxDataViewCtrlBase()
158 bool wxDataViewCtrlBase::AssociateModel( wxDataViewListModel
*model
)
168 wxDataViewListModel
* wxDataViewCtrlBase::GetModel()
173 bool wxDataViewCtrlBase::AppendStringColumn( const wxString
&label
)
175 return AppendColumn( new wxDataViewColumn( label
, (wxDataViewCtrl
*) this, wxDATAVIEW_COL_TEXT
) );
178 bool wxDataViewCtrlBase::AppendColumn( wxDataViewColumn
*col
)
180 m_cols
.Append( (wxObject
*) col
);
184 size_t wxDataViewCtrlBase::GetNumberOfColumns()
186 return m_cols
.GetCount();
189 bool wxDataViewCtrlBase::DeleteColumn( size_t pos
)
194 bool wxDataViewCtrlBase::ClearColumns()
199 wxDataViewColumn
* wxDataViewCtrlBase::GetColumn( size_t pos
)
201 return (wxDataViewColumn
*) m_cols
[ pos
];