Make wxDataViewCtrl::Expand() expand ancestors in native ports too

Expand() called ExpandAncestors() in the generic wxDataViewCtrl implementation
but not in the native ones, resulting in observable difference in the
behaviour: for example, the wxDataViewTreeCtrl in the dataview sample appeared
initially expanded under MSW, using the generic version, but collapsed under
GTK and OSX.

Harmonize this among all ports. This also has a nice side effect of making
Expand() less horribly inefficient as it is not recursively called by
ExpandAncestors() which it itself used to call: now ExpandAncestors() only
calls DoExpand() which is a simple function that only expands the item passed
to it and does nothing else.

Closes #14803.
This commit is contained in:
Vadim Zeitlin
2016-03-22 21:22:36 +01:00
parent aa9e7d3326
commit 716dace3d6
12 changed files with 30 additions and 14 deletions

View File

@@ -62,7 +62,6 @@ public:
virtual bool Add (wxDataViewItem const& parent, wxDataViewItemArray const& itesm) = 0; // adds a items to the native control
virtual void Collapse (wxDataViewItem const& item) = 0; // collapses the passed item in the native control
virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) = 0; // ensures that the passed item's value in the passed column is visible (column pointer can be NULL)
virtual void Expand (wxDataViewItem const& item) = 0; // expands the passed item in the native control
virtual unsigned int GetCount (void) const = 0; // returns the number of items in the native control
virtual wxRect GetRectangle (wxDataViewItem const& item, wxDataViewColumn const* columnPtr) = 0; // returns the rectangle that is used by the passed item and column in the native control
virtual bool IsExpanded (wxDataViewItem const& item) const = 0; // checks if the passed item is expanded in the native control
@@ -104,6 +103,8 @@ public:
// other methods
//
virtual void DoSetIndent (int indent) = 0; // sets the indention in the native control
virtual void DoExpand (wxDataViewItem const& item) = 0; // expands the passed item in the native control
virtual void HitTest (wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const = 0; // return the item and column pointer that contains with the passed point
virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height) = 0; // sets the height of the row containg the passed item in the native control
virtual void OnSize (void) = 0; // updates the layout of the native control after a size event