X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/395a82b13fa5f316d2d0dead17701e9bc23337d3..7fa4dc1cfcc55b0fe425a3ebe5e992ff8255481b:/src/common/sizer.cpp diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index b6e4498e28..c2320a4d5a 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -193,11 +193,16 @@ wxSize wxSizerItem::CalcMin() } else { - if ( IsWindow() ) + if ( IsWindow() && !(m_flag & wxFIXED_MINSIZE) ) { - // the size of the window may change during run-time, we should - // use the current minimal size - m_minSize = m_window->GetAdjustedBestSize(); + // Since the size of the window may change during runtime, we + // should use the current minimal size. If there is a MinSize, + // use it, otherwise use the BestSize. + wxSize min = m_window->GetMinSize(); + wxSize best = m_window->GetBestSize(); + if (min.x == -1) min.x = best.x; + if (min.y == -1) min.y = best.y; + m_minSize = min; } ret = m_minSize; @@ -280,7 +285,10 @@ void wxSizerItem::SetDimension( wxPoint pos, wxSize size ) void wxSizerItem::DeleteWindows() { if (m_window) + { m_window->Destroy(); + m_window = NULL; + } if (m_sizer) m_sizer->DeleteWindows(); @@ -735,7 +743,7 @@ bool wxSizer::DoSetItemMinSize( wxWindow *window, int width, int height ) if (item->GetWindow() == window) { - item->SetInitSize( width, height ); + item->SetMinSize( width, height ); return true; } node = node->GetNext(); @@ -814,7 +822,7 @@ bool wxSizer::DoSetItemMinSize( size_t index, int width, int height ) else { // ... but the minimal size of spacers and windows in stored in them - item->SetInitSize( width, height ); + item->SetMinSize( width, height ); } return true; @@ -1624,6 +1632,12 @@ wxSize wxStaticBoxSizer::CalcMin() return ret; } +void wxStaticBoxSizer::ShowItems( bool show ) +{ + m_staticBox->Show( show ); + wxBoxSizer::ShowItems( show ); +} + #endif // wxUSE_STATBOX // ----------------------------------------------------------------------------