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:
@@ -186,9 +186,20 @@ public:
|
||||
virtual void GetValue( wxVariant &variant,
|
||||
const wxDataViewItem &item, unsigned int col ) const = 0;
|
||||
|
||||
// set value, call ValueChanged() afterwards!
|
||||
virtual bool SetValue( const wxVariant &variant,
|
||||
const wxDataViewItem &item, unsigned int col ) = 0;
|
||||
// usually ValueChanged() should be called after changing the value in the
|
||||
// model to update the control, ChangeValue() does it on its own while
|
||||
// SetValue() does not -- so while you will override SetValue(), you should
|
||||
// be usually calling ChangeValue()
|
||||
virtual bool SetValue(const wxVariant &variant,
|
||||
const wxDataViewItem &item,
|
||||
unsigned int col) = 0;
|
||||
|
||||
bool ChangeValue(const wxVariant& variant,
|
||||
const wxDataViewItem& item,
|
||||
unsigned int col)
|
||||
{
|
||||
return SetValue(variant, item, col) && ValueChanged(item, col);
|
||||
}
|
||||
|
||||
// Get text attribute, return false of default attributes should be used
|
||||
virtual bool GetAttr( const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) )
|
||||
|
Reference in New Issue
Block a user