added wxADJUST_MINSIZE sizer flag

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9369 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-02-14 14:13:38 +00:00
parent f41cb81efc
commit d13d8d4e5f
3 changed files with 41 additions and 25 deletions

View File

@@ -133,21 +133,28 @@ wxSize wxSizerItem::CalcMin()
if (IsSizer())
{
ret = m_sizer->GetMinSize();
// if we have to preserve aspect ratio _AND_ this is
// the first-time calculation, consider ret to be initial size
if ((m_flag & wxSHAPED) && !m_ratio) SetRatio(ret);
if ((m_flag & wxSHAPED) && !m_ratio)
SetRatio(ret);
}
/*
The minimum size of a window should be the
initial size, as saved in m_minSize, not the
current size.
else
if (IsWindow())
ret = m_window->GetSize();
*/
else ret = m_minSize;
{
if ( IsWindow() && (m_flag & wxADJUST_MINSIZE) )
{
// check if the best (minimal, in fact) window size hadn't changed
// by chance: this may happen for, e.g. static text if its label
// changed
wxSize size = m_window->GetBestSize();
if ( size.x > m_minSize.x )
m_minSize.x = size.x;
if ( size.y > m_minSize.y )
m_minSize.y = size.y;
}
ret = m_minSize;
}
if (m_flag & wxWEST)
ret.x += m_border;