Factor out wxDataViewRendererBase::NotifyEditingStarted()

Reuse the same code from the generic and native GTK and OS X implementations
of wxDataViewCtrl instead of triplicating it.

This fixes a small discrepancy between the wxOSX version, which didn't see the
model pointer correctly in the generated event, and all the others, but mainly
paves way for future improvements.
This commit is contained in:
Vadim Zeitlin
2015-11-26 01:18:22 +01:00
parent 40502651f9
commit 235e8ebd1a
4 changed files with 25 additions and 21 deletions

View File

@@ -703,15 +703,22 @@ bool wxDataViewRendererBase::StartEditing( const wxDataViewItem &item, wxRect la
m_editorCtrl->SetFocus();
#endif
// Now we should send Editing Started event
NotifyEditingStarted(item);
return true;
}
void wxDataViewRendererBase::NotifyEditingStarted(const wxDataViewItem& item)
{
wxDataViewColumn* const column = GetOwner();
wxDataViewCtrl* const dv_ctrl = column->GetOwner();
wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_EDITING_STARTED, dv_ctrl->GetId() );
event.SetDataViewColumn( GetOwner() );
event.SetDataViewColumn( column );
event.SetModel( dv_ctrl->GetModel() );
event.SetItem( item );
event.SetEventObject( dv_ctrl );
dv_ctrl->GetEventHandler()->ProcessEvent( event );
return true;
}
void wxDataViewRendererBase::DestroyEditControl()