Merge branch 'propagate-inform-first-dir'

Fix some layouts involving wxWrapSizer by correctly propagating
InformFirstDirection() call to the nested sizers that need it.

See https://github.com/wxWidgets/wxWidgets/pull/988
This commit is contained in:
Vadim Zeitlin
2018-11-01 00:13:18 +01:00
3 changed files with 50 additions and 0 deletions

View File

@@ -2544,6 +2544,31 @@ wxSize wxBoxSizer::CalcMin()
return m_calculatedMinSize;
}
bool
wxBoxSizer::InformFirstDirection(int direction, int size, int availableOtherDir)
{
// In principle, we could propagate the information about the size in the
// sizer major direction too, but this would require refactoring CalcMin()
// to determine the actual sizes all our items would have with the given
// size and we don't do this yet, so for now handle only the simpler case
// of informing all our items about their size in the orthogonal direction.
if ( direction == GetOrientation() )
return false;
bool didUse = false;
for ( wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
node;
node = node->GetNext() )
{
didUse |= node->GetData()->InformFirstDirection(direction,
size,
availableOtherDir);
}
return didUse;
}
//---------------------------------------------------------------------------
// wxStaticBoxSizer
//---------------------------------------------------------------------------