From ec07419336652454bc305659e9cd9b8fc767f3bd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 1 Oct 2008 13:57:53 +0000 Subject: [PATCH] don't distribute negative extra space among box sizer items, this isn't useful as it results in overlapping windows (#10008) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56010 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/sizer.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 071ee21039..206f09a255 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -1939,15 +1939,22 @@ void wxBoxSizer::RecalcSizes() // adjust the size in the major direction using the proportion wxCoord majorSize = GetSizeInMajorDir(sizeThis); - const int propItem = item->GetProportion(); - if ( propItem ) + + // if there is not enough space, don't try to distribute negative space + // among the children, this would result in overlapping windows which + // we don't want + if ( delta > 0 ) { - const int deltaItem = (delta * propItem) / totalProportion; + const int propItem = item->GetProportion(); + if ( propItem ) + { + const int deltaItem = (delta * propItem) / totalProportion; - majorSize += deltaItem; + majorSize += deltaItem; - delta -= deltaItem; - totalProportion -= propItem; + delta -= deltaItem; + totalProportion -= propItem; + } }