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
This commit is contained in:
Julian Smart 2004-05-09 16:30:26 +00:00
parent ba2de0a144
commit 7d59475e80

View File

@ -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,