From 7d59475e80c3ed8b9bb002fd402d6a7cc7dc090a Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 9 May 2004 16:30:26 +0000 Subject: [PATCH] Fixed size problem due to wxMac window implementation difference git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wincmn.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index beeea89932..34bb9d4924 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -47,6 +47,10 @@ #include "wx/dcclient.h" #endif //WX_PRECOMP +#if defined(__WXMAC__) && wxUSE_SCROLLBAR + #include "wx/scrolbar.h" +#endif + #if wxUSE_CONSTRAINTS #include "wx/layout.h" #endif // wxUSE_CONSTRAINTS @@ -492,6 +496,24 @@ void wxWindowBase::FitInside() } } +// On Mac, scrollbars are explicitly children. +#ifdef __WXMAC__ +static bool wxHasRealChildren(const wxWindowBase* win) +{ + int realChildCount = 0; + + for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); + node; + node = node->GetNext() ) + { + wxWindow *win = node->GetData(); + if ( !win->IsTopLevel() && win->IsShown() && !win->IsKindOf(CLASSINFO(wxScrollBar))) + realChildCount ++; + } + return (realChildCount > 0); +} +#endif + // return the size best suited for the current window wxSize wxWindowBase::DoGetBestSize() const { @@ -536,7 +558,11 @@ wxSize wxWindowBase::DoGetBestSize() const return wxSize(maxX, maxY); } #endif // wxUSE_CONSTRAINTS - else if ( !GetChildren().empty() ) + else if ( !GetChildren().empty() +#ifdef __WXMAC__ + && wxHasRealChildren(this) +#endif + ) { // our minimal acceptable size is such that all our visible child windows fit inside int maxX = 0, -- 2.45.2