X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/35c71386316b480769f568d6cb4ac40317c2b6ba..9859d369b49e35a1cad0f760173e165f974fb6cb:/src/generic/scrlwing.cpp diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 984bcad7f5..d46d0a017c 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -41,6 +41,10 @@ #include "wx/sizer.h" #endif +#ifdef __WXMAC__ +#include "wx/scrolbar.h" +#endif + #include "wx/recguard.h" #ifdef __WXMSW__ @@ -464,6 +468,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 // ---------------------------------------------------------------------------- @@ -482,7 +502,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; @@ -1371,7 +1392,13 @@ bool wxScrolledWindow::Create(wxWindow *parent, MacSetClipChildren( true ) ; #endif - bool ok = wxPanel::Create(parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name); + // by default, we're scrollable in both directions (but if one of the + // styles is specified explicitly, we shouldn't add the other one + // automatically) + if ( !(style & (wxHSCROLL | wxVSCROLL)) ) + style |= wxHSCROLL | wxVSCROLL; + + bool ok = wxPanel::Create(parent, id, pos, size, style, name); return ok; }