don't leave pixels due to rounding errors in wxBoxSizer, allocate the extra pixels to the last item(s) instead, as wxFlexGridSizer (now) does
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45584 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1660,13 +1660,14 @@ void wxBoxSizer::RecalcSizes()
|
|||||||
|
|
||||||
// the amount of free space which we should redistribute among the
|
// the amount of free space which we should redistribute among the
|
||||||
// stretchable items (i.e. those with non zero proportion)
|
// stretchable items (i.e. those with non zero proportion)
|
||||||
const int delta = SizeInMajorDir(m_size) - SizeInMajorDir(m_minSize);
|
int delta = SizeInMajorDir(m_size) - SizeInMajorDir(m_minSize);
|
||||||
|
|
||||||
// the position at which we put the next child
|
// the position at which we put the next child
|
||||||
wxPoint pt(m_position);
|
wxPoint pt(m_position);
|
||||||
|
|
||||||
const wxCoord totalMinorSize = SizeInMinorDir(m_size);
|
const wxCoord totalMinorSize = SizeInMinorDir(m_size);
|
||||||
|
|
||||||
|
int totalProportion = m_totalProportion;
|
||||||
for ( wxSizerItemList::const_iterator i = m_children.begin();
|
for ( wxSizerItemList::const_iterator i = m_children.begin();
|
||||||
i != m_children.end();
|
i != m_children.end();
|
||||||
++i )
|
++i )
|
||||||
@@ -1681,11 +1682,15 @@ void wxBoxSizer::RecalcSizes()
|
|||||||
|
|
||||||
// adjust the size in the major direction using the proportion
|
// adjust the size in the major direction using the proportion
|
||||||
wxCoord majorSize = SizeInMajorDir(sizeThis);
|
wxCoord majorSize = SizeInMajorDir(sizeThis);
|
||||||
if ( item->GetProportion() )
|
const int propItem = item->GetProportion();
|
||||||
|
if ( propItem )
|
||||||
{
|
{
|
||||||
// as at least one visible item has non-zero proportion the total
|
const int deltaItem = (delta * propItem) / totalProportion;
|
||||||
// proportion must be non zero
|
|
||||||
majorSize += (delta * item->GetProportion()) / m_totalProportion;
|
majorSize += deltaItem;
|
||||||
|
|
||||||
|
delta -= deltaItem;
|
||||||
|
totalProportion -= propItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user