Add wxDataViewModel::HasValue().

This method allows to simply test whether we have a value at the given row and
column or not (as it happens for container items unless they too have columns).

Currently this method is not virtual and is not used by the implementations
yet but it might make sense to make it virtual and allow overriding it in the
future.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-10-24 01:03:24 +00:00
parent c27050d2e3
commit b372f20e7e
2 changed files with 22 additions and 0 deletions

View File

@ -186,6 +186,14 @@ public:
virtual void GetValue( wxVariant &variant,
const wxDataViewItem &item, unsigned int col ) const = 0;
// return true if the given item has a value to display in the given
// column: this is always true except for container items which by default
// only show their label in the first column (but see HasContainerColumns())
bool HasValue(const wxDataViewItem& item, unsigned col) const
{
return col == 0 || !IsContainer(item) || HasContainerColumns(item);
}
// 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

View File

@ -193,6 +193,20 @@ public:
*/
virtual bool HasDefaultCompare() const;
/**
Return true if there is a value in the given column of this item.
All normal items have values in all columns but the container items
only show their label in the first column (@a col == 0) by default (but
see HasContainerColumns()). So this function always returns true for
the first column while for the other ones it returns true only if the
item is not a container or HasContainerColumns() was overridden to
return true for it.
@since 2.9.1
*/
bool HasValue(const wxDataViewItem& item, unsigned col) const;
/**
Override this to indicate of @a item is a container, i.e. if
it can have child items.