X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1eba21938708bcd10ab13837b4ad51e44f783b40..38923e84def08206486cc9658cd05aee6e4bd274:/src/common/sizer.cpp?ds=sidebyside diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 2fd2d9f854..37c790a4bd 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -195,9 +195,14 @@ wxSize wxSizerItem::CalcMin() { 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(); @@ -1045,20 +1053,20 @@ void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ) { if (flag & wxALIGN_CENTER_HORIZONTAL) { - pt.x = x + (w - sz.x) / 2; + pt.x = x + (w - sz.x - m_hgap) / 2; } else if (flag & wxALIGN_RIGHT) { - pt.x = x + (w - sz.x); + pt.x = x + (w - sz.x - m_hgap); } if (flag & wxALIGN_CENTER_VERTICAL) { - pt.y = y + (h - sz.y) / 2; + pt.y = y + (h - sz.y - m_vgap) / 2; } else if (flag & wxALIGN_BOTTOM) { - pt.y = y + (h - sz.y); + pt.y = y + (h - sz.y - m_vgap); } } @@ -1624,6 +1632,12 @@ wxSize wxStaticBoxSizer::CalcMin() return ret; } +void wxStaticBoxSizer::ShowItems( bool show ) +{ + m_staticBox->Show( show ); + wxBoxSizer::ShowItems( show ); +} + #endif // wxUSE_STATBOX // ----------------------------------------------------------------------------