Don't change the icon when editing wxDataViewIconText cells in generic version.

wxDataViewIconTextRenderer changed the icon to that of the last item drawn by
it when editing a cell. Fix this by getting the original icon directly from
the model instead of from the last item.

Closes #14187.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-04-05 18:40:23 +00:00
parent e911dd0a5a
commit cdacccaee8

View File

@ -1187,7 +1187,17 @@ bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVar
{
wxTextCtrl *text = (wxTextCtrl*) editor;
wxDataViewIconText iconText(text->GetValue(), m_value.GetIcon());
// The icon can't be edited so get its old value and reuse it.
wxVariant valueOld;
wxDataViewColumn* const col = GetOwner();
GetView()->GetModel()->GetValue(valueOld, m_item, col->GetModelColumn());
wxDataViewIconText iconText;
iconText << valueOld;
// But replace the text with the value entered by user.
iconText.SetText(text->GetValue());
value << iconText;
return true;
}