X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/33ac7e6f01acbac1cff0ad400d8ea7f0bfd0a62f..a3f2769e09849b3da8bbae84e015610bf3069740:/src/common/sizer.cpp diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 049760f8c2..8735020e9b 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -378,9 +378,12 @@ void wxSizer::SetSizeHints( wxWindow *window ) wxSize wxSizer::GetMaxWindowSize( wxWindow *WXUNUSED(window) ) { - wxSize sizeMax = wxGetDisplaySize(); - // make the max size a bit smaller than the screen, a window which takes - // the entire screen doesn't look very nice neither + wxRect rect = wxGetClientDisplayRect(); + wxSize sizeMax (rect.width,rect.height); + + // Make the max size a bit smaller than the visible portion of + // the screen. A window which takes the entire screen doesn't + // look very nice either sizeMax.x *= 9; sizeMax.x /= 10; @@ -941,14 +944,43 @@ wxSize wxBoxSizer::CalcMin() m_fixedWidth = 0; m_fixedHeight = 0; + // Find how long each stretch unit needs to be + int stretchSize = 1; wxNode *node = m_children.GetFirst(); while (node) + { + wxSizerItem *item = (wxSizerItem*) node->Data(); + if (item->GetOption() != 0) + { + int stretch = item->GetOption(); + wxSize size( item->CalcMin() ); + int sizePerStretch; + // Integer division rounded up is (a + b - 1) / b + if (m_orient == wxHORIZONTAL) + sizePerStretch = ( size.x + stretch - 1 ) / stretch; + else + sizePerStretch = ( size.y + stretch - 1 ) / stretch; + if (sizePerStretch > stretchSize) + stretchSize = sizePerStretch; + } + node = node->Next(); + } + // Calculate overall minimum size + node = m_children.GetFirst(); + while (node) { wxSizerItem *item = (wxSizerItem*) node->Data(); m_stretchable += item->GetOption(); wxSize size( item->CalcMin() ); + if (item->GetOption() != 0) + { + if (m_orient == wxHORIZONTAL) + size.x = stretchSize * item->GetOption(); + else + size.y = stretchSize * item->GetOption(); + } if (m_orient == wxHORIZONTAL) {