Add wxDataViewModel::ChangeValue() and use it in wxDVC implementation.

ChangeValue() is a trivial wrapper calling both SetValue() and ValueChanged().
It allows to replace many calls to SetValue() immediately followed by
ValueChanged() with a single function call which is significantly shorter and
less error-prone (e.g. most of the existing code didn't test SetValue() return
code at all).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-10-23 23:49:16 +00:00
parent 8c9833d09e
commit 795dac4c86
7 changed files with 54 additions and 32 deletions

View File

@@ -1318,8 +1318,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
// variable definition and initialization:
wxVariant modifiedData(true);
if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData, dvItem, col) &&
dataViewCtrlPtr->GetModel()->ValueChanged(dvItem, col))
if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col))
return noErr;
else
return errDataBrowserInvalidPropertyData;
@@ -1329,8 +1328,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
// variable definition and initialization:
wxVariant modifiedData(false);
if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData, dvItem, col) &&
dataViewCtrlPtr->GetModel()->ValueChanged(dvItem, col))
if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col))
return noErr;
else
return errDataBrowserInvalidPropertyData;
@@ -1357,8 +1355,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
#endif
wxVariant modifiedData(modifiedString.AsString());
if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData, dvItem, col) &&
dataViewCtrlPtr->GetModel()->ValueChanged(dvItem, col))
if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col))
return noErr;
else
return errDataBrowserInvalidPropertyData;