Replace wxSizer::RecalcSizes() with RepositionChildren()

The new method takes minimal size just computed by RecalcSizes() as its
argument making it unnecessary to store it as a member variable in the derived
classes such as wx{Box,FlexGrid}Sizer.

The old method can still be overridden for compatibility and by the derived
class that don't need minimal size when updating children.
This commit is contained in:
Vadim Zeitlin
2015-10-11 01:13:33 +02:00
parent 7d9675472d
commit 622deec262
7 changed files with 84 additions and 72 deletions

View File

@@ -497,13 +497,12 @@ wxSize wxGridBagSizer::CalcMin()
for (idx=0; idx < m_rows; idx++)
height += m_rowHeights[idx] + ( idx == m_rows-1 ? 0 : m_vgap );
m_calculatedMinSize = wxSize(width, height);
return m_calculatedMinSize;
return wxSize(width, height);
}
void wxGridBagSizer::RecalcSizes()
void wxGridBagSizer::RepositionChildren(const wxSize& minSize)
{
// We can't lay out our elements if we don't have at least a single row and
// a single column. Notice that this may happen even if we have some
@@ -519,7 +518,7 @@ void wxGridBagSizer::RecalcSizes()
m_cols = m_colWidths.GetCount();
int idx, width, height;
AdjustForGrowables(sz);
AdjustForGrowables(sz, minSize);
// Find the start positions on the window of the rows and columns
wxArrayInt rowpos;