don't update the tree unnecessarily in Expand/CollapseAllChildren() (patch 1809520)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49262 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -205,6 +205,7 @@ All (GUI):
|
||||
behaviour of GetNextSibling() consistent between wxMSW and generic versions.
|
||||
- Merged wxRichTextAttr and wxTextAttrEx into wxTextAttr, and added a font table
|
||||
to wxRichTextBuffer to reduce wxFont consumption and increase performance.
|
||||
- Optimize wxGenericTreeCtrl::Collapse/ExpandAllChildren() (Szczepan Holyszewski)
|
||||
|
||||
wxGTK:
|
||||
|
||||
|
@@ -191,6 +191,7 @@ void wxTreeCtrlBase::ExpandAll()
|
||||
|
||||
void wxTreeCtrlBase::ExpandAllChildren(const wxTreeItemId& item)
|
||||
{
|
||||
Freeze();
|
||||
// expand this item first, this might result in its children being added on
|
||||
// the fly
|
||||
if ( item != GetRootItem() || !HasFlag(wxTR_HIDE_ROOT) )
|
||||
@@ -205,6 +206,7 @@ void wxTreeCtrlBase::ExpandAllChildren(const wxTreeItemId& item)
|
||||
{
|
||||
ExpandAllChildren(idCurr);
|
||||
}
|
||||
Thaw();
|
||||
}
|
||||
|
||||
void wxTreeCtrlBase::CollapseAll()
|
||||
@@ -217,6 +219,7 @@ void wxTreeCtrlBase::CollapseAll()
|
||||
|
||||
void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item)
|
||||
{
|
||||
Freeze();
|
||||
// first (recursively) collapse all the children
|
||||
wxTreeItemIdValue cookie;
|
||||
for ( wxTreeItemId idCurr = GetFirstChild(item, cookie);
|
||||
@@ -228,6 +231,7 @@ void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item)
|
||||
|
||||
// then collapse this element too
|
||||
Collapse(item);
|
||||
Thaw();
|
||||
}
|
||||
|
||||
bool wxTreeCtrlBase::IsEmpty() const
|
||||
|
@@ -1646,9 +1646,16 @@ void wxGenericTreeCtrl::Expand(const wxTreeItemId& itemId)
|
||||
}
|
||||
|
||||
item->Expand();
|
||||
if ( !m_freezeCount )
|
||||
{
|
||||
CalculatePositions();
|
||||
|
||||
RefreshSubtree(item);
|
||||
}
|
||||
else // frozen
|
||||
{
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
event.SetEventType(wxEVT_COMMAND_TREE_ITEM_EXPANDED);
|
||||
GetEventHandler()->ProcessEvent( event );
|
||||
@@ -3582,6 +3589,9 @@ void wxGenericTreeCtrl::Thaw()
|
||||
|
||||
if ( --m_freezeCount == 0 )
|
||||
{
|
||||
if ( m_dirty )
|
||||
DoDirtyProcessing();
|
||||
else
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user