fix rounding errors in stretchable items size calculation (patch 1754785)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-07-16 20:04:13 +00:00
parent cb47b30098
commit 83ea1b79e7

View File

@@ -1651,6 +1651,7 @@ void wxBoxSizer::RecalcSizes()
wxPoint pt( m_position ); wxPoint pt( m_position );
int stretchable = m_stretchable;
wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
@@ -1667,7 +1668,9 @@ void wxBoxSizer::RecalcSizes()
{ {
// Because of at least one visible item has non-zero // Because of at least one visible item has non-zero
// proportion then m_stretchable is not zero // proportion then m_stretchable is not zero
height = (delta * item->GetProportion()) / m_stretchable; height = (delta * item->GetProportion()) / stretchable;
delta -= height;
stretchable -= item->GetProportion();
} }
wxPoint child_pos( pt ); wxPoint child_pos( pt );
@@ -1693,7 +1696,9 @@ void wxBoxSizer::RecalcSizes()
{ {
// Because of at least one visible item has non-zero // Because of at least one visible item has non-zero
// proportion then m_stretchable is not zero // proportion then m_stretchable is not zero
width = (delta * item->GetProportion()) / m_stretchable; width = (delta * item->GetProportion()) / stretchable;
delta -= width;
stretchable -= item->GetProportion();
} }
wxPoint child_pos( pt ); wxPoint child_pos( pt );