Don't optimize if there are child windows since children won't be scrolled

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44438 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2007-02-10 09:41:42 +00:00
parent fe641ffb97
commit 90863a014b

View File

@@ -41,6 +41,10 @@
#include "wx/sizer.h"
#endif
#ifdef __WXMAC__
#include "wx/scrolbar.h"
#endif
#include "wx/recguard.h"
#ifdef __WXMSW__
@@ -447,6 +451,22 @@ wxWindow *wxScrollHelper::GetTargetWindow() const
return m_targetWindow;
}
#ifdef __WXMAC__
static bool wxScrolledWindowHasChildren(wxWindow* win)
{
wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
while ( node )
{
wxWindow* child = node->GetData();
if ( !child->IsKindOf(CLASSINFO(wxScrollBar)) )
return true;
node = node->GetNext();
}
return false;
}
#endif
// ----------------------------------------------------------------------------
// scrolling implementation itself
// ----------------------------------------------------------------------------
@@ -465,7 +485,8 @@ void wxScrollHelper::HandleOnScroll(wxScrollWinEvent& event)
bool needsRefresh = false;
#ifdef __WXMAC__
// OS X blocks on immediate redraws, so make this a refresh
needsRefresh = true;
if (!wxScrolledWindowHasChildren(m_targetWindow))
needsRefresh = true;
#endif
int dx = 0,
dy = 0;