From: Václav Slavík Date: Tue, 12 Feb 2008 15:53:35 +0000 (+0000) Subject: use ClientToWindowSize/WindowToClientSize X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/77fe7204b5fa4d7f703a3d0bc2f1a4f0363f538d use ClientToWindowSize/WindowToClientSize git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 6030fd9f20..7c68b8a405 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -861,10 +861,7 @@ wxSize wxSizer::Fit( wxWindow *window ) sizeMax = wxDisplay(disp).GetClientArea().GetSize(); // space for decorations and toolbars etc. - wxSize tlw_client_size = tlw->GetClientSize(); - wxSize tlw_size = tlw->GetSize(); - sizeMax.x -= tlw_size.x - tlw_client_size.x; - sizeMax.y -= tlw_size.y - tlw_client_size.y; + sizeMax = tlw->WindowToClientSize(sizeMax); } else { @@ -931,12 +928,7 @@ wxSize wxSizer::GetMaxWindowSize( wxWindow *window ) const wxSize wxSizer::GetMinWindowSize( wxWindow *window ) { - wxSize minSize( GetMinSize() ); - wxSize size( window->GetSize() ); - wxSize client_size( window->GetClientSize() ); - - return wxSize( minSize.x+size.x-client_size.x, - minSize.y+size.y-client_size.y ); + return window->ClientToWindowSize(GetMinSize()); } // TODO on mac we need a function that determines how much free space this @@ -944,18 +936,7 @@ wxSize wxSizer::GetMinWindowSize( wxWindow *window ) // space around the controls wxSize wxSizer::GetMaxClientSize( wxWindow *window ) const { - wxSize maxSize( window->GetMaxSize() ); - - if ( maxSize != wxDefaultSize ) - { - wxSize size( window->GetSize() ); - wxSize client_size( window->GetClientSize() ); - - return wxSize( maxSize.x + client_size.x - size.x, - maxSize.y + client_size.y - size.y ); - } - else - return wxDefaultSize; + return window->WindowToClientSize(window->GetMaxSize()); } wxSize wxSizer::GetMinClientSize( wxWindow *WXUNUSED(window) )