diff --git a/include/wx/dataview.h b/include/wx/dataview.h index f02ad00a19..b2b9275d4f 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -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 diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index debcecdb43..21f04a8472 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -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.