backported wxSizer::SetSizeHints() fix to make it work correctly when the best size decreases

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52332 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-03-05 15:09:16 +00:00
parent c46a31dd46
commit b185fa1efb
2 changed files with 9 additions and 1 deletions

View File

@@ -122,6 +122,7 @@ All (GUI):
wxRESERVE_SPACE_EVEN_IF_HIDDEN sizer flag.
- Added wxWindow::ClientToWindowSize() and WindowToClientSize() helpers.
- Added wxSizer::ComputeFittingClientSize() and ComputeFittingWindowSize().
- Fixed wxSizer::SetSizeHints() to work when the best size decreases.
All (Unix):

View File

@@ -885,12 +885,19 @@ void wxSizer::SetSizeHints( wxWindow *window )
// Preserve the window's max size hints, but set the
// lower bound according to the sizer calculations.
wxSize size = Fit( window );
// This is equivalent to calling Fit(), except that we need to set
// the size hints _in between_ the two steps performed by Fit
// (1. ComputeFittingWindowSize, 2. SetSize). That's because
// otherwise SetSize() could have no effect if there already are
// size hints in effect that forbid requested size.
const wxSize size = ComputeFittingWindowSize(window);
window->SetSizeHints( size.x,
size.y,
window->GetMaxWidth(),
window->GetMaxHeight() );
window->SetSize(size);
}
void wxSizer::SetVirtualSizeHints( wxWindow *window )