if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item))
{
// sent the equivalent wxWidget event:
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId());
dataViewEvent.SetEventObject(m_DataViewCtrlPtr);
dataViewEvent.SetItem(item);
{
size_t const noOfItems = items.GetCount();
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId());
dataViewEvent.SetEventObject(m_DataViewCtrlPtr);
wxCHECK_MSG(GetOwner() != NULL,false,"Owner not initialized.");
if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item))
{
- wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId());
+ wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId());
dataViewEvent.SetEventObject(m_DataViewCtrlPtr);
dataViewEvent.SetColumn(col);
wxDataViewCtrl::~wxDataViewCtrl()
{
ClearColumns();
+
+ // Ensure that the already destructed controls is not notified about changes
+ // in the model any more.
+ if (m_ModelNotifier != NULL)
+ m_ModelNotifier->GetOwner()->RemoveNotifier(m_ModelNotifier);
}
void wxDataViewCtrl::Init()
m_CustomRendererPtr = NULL;
m_Deleting = false;
m_cgContext = NULL;
+ m_ModelNotifier = NULL;
}
bool wxDataViewCtrl::Create(wxWindow *parent,
wxCHECK_MSG(dataViewWidgetPtr != NULL,false,"Pointer to native control must not be NULL.");
+
+ // We could have been associated with another model previously, break the
+ // association in this case.
+ if ( m_ModelNotifier )
+ m_ModelNotifier->GetOwner()->RemoveNotifier(m_ModelNotifier);
+
if (wxDataViewCtrlBase::AssociateModel(model) && dataViewWidgetPtr->AssociateModel(model))
{
if (model != NULL)
- model->AddNotifier(new wxOSXDataViewModelNotifier(this));
+ {
+ m_ModelNotifier = new wxOSXDataViewModelNotifier(this);
+ model->AddNotifier(m_ModelNotifier);
+ }
return true;
}
else
GetDataViewPeer()->SetCurrentItem(item);
}
+wxDataViewColumn *wxDataViewCtrl::GetCurrentColumn() const
+{
+ return GetDataViewPeer()->GetCurrentColumn();
+}
+
wxRect wxDataViewCtrl::GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const
{
if (item.IsOk() && (columnPtr != NULL))
(void) GetModel()->ItemsAdded(parentItem,items);
}
-void wxDataViewCtrl::StartEditor( const wxDataViewItem & item, unsigned int column )
+void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn *column)
{
- GetDataViewPeer()->StartEditor(item, column);
+ GetDataViewPeer()->StartEditor(item, GetColumnPosition(column));
}
void wxDataViewCtrl::FinishCustomItemEditing()