From 27f8357f3ceb709c4ea8653818e4f1a79f8f59fe Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 24 Jul 2006 18:12:23 +0000 Subject: [PATCH] call DoDirtyProcessing() from OnIdle() instead of using wxYield() (patch 1518119) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40286 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/treectlg.h | 2 ++ src/generic/treectlg.cpp | 31 ++++++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/include/wx/generic/treectlg.h b/include/wx/generic/treectlg.h index f72b8fc465..ccaa5fbdb0 100644 --- a/include/wx/generic/treectlg.h +++ b/include/wx/generic/treectlg.h @@ -341,6 +341,8 @@ protected: void UnselectAllChildren( wxGenericTreeItem *item ); void ChildrenClosing(wxGenericTreeItem* item); + void DoDirtyProcessing(); + private: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index eaea98d3ba..0c37bbbc46 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1962,7 +1962,7 @@ void wxGenericTreeCtrl::ScrollTo(const wxTreeItemId &item) #if defined( __WXMSW__ ) || defined(__WXMAC__) Update(); #else - wxYieldIfNeeded(); + DoDirtyProcessing(); #endif wxGenericTreeItem *gitem = (wxGenericTreeItem*) item.m_pItem; @@ -2906,7 +2906,7 @@ wxTextCtrl *wxGenericTreeCtrl::EditLabel(const wxTreeItemId& item, #if defined( __WXMSW__ ) || defined(__WXMAC__) Update(); #else - wxYieldIfNeeded(); + DoDirtyProcessing(); #endif // TODO: use textCtrlClass here to create the control of correct class @@ -3293,17 +3293,10 @@ void wxGenericTreeCtrl::OnInternalIdle() SelectItem(GetRootItem()); } - /* after all changes have been done to the tree control, - * we actually redraw the tree when everything is over */ - - if (!m_dirty) return; - if (m_freezeCount) return; - - m_dirty = false; - - CalculatePositions(); - Refresh(); - AdjustMyScrollbars(); + // after all changes have been done to the tree control, + // actually redraw the tree when everything is over + if (m_dirty) + DoDirtyProcessing(); } void wxGenericTreeCtrl::CalculateSize( wxGenericTreeItem *item, wxDC &dc ) @@ -3550,4 +3543,16 @@ void wxGenericTreeCtrl::SetItemSelectedImage(const wxTreeItemId& item, int image #endif // WXWIN_COMPATIBILITY_2_4 +void wxGenericTreeCtrl::DoDirtyProcessing() +{ + if (m_freezeCount) + return; + + m_dirty = false; + + CalculatePositions(); + Refresh(); + AdjustMyScrollbars(); +} + #endif // wxUSE_TREECTRL -- 2.45.2