X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c33522fca7cddc441a316f5b9fb50d7685435ba..2f36b4d22beeb7f4f0cedf922c0c26d037f54477:/src/common/wrapsizer.cpp diff --git a/src/common/wrapsizer.cpp b/src/common/wrapsizer.cpp index 9cb3285cb9..e1b112bed5 100644 --- a/src/common/wrapsizer.cpp +++ b/src/common/wrapsizer.cpp @@ -3,7 +3,6 @@ // Purpose: provides wxWrapSizer class for layout // Author: Arne Steinarson // Created: 2008-05-08 -// RCS-ID: $Id$ // Copyright: (c) Arne Steinarson // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -59,7 +58,7 @@ private: wxSizerItem& m_item; const int m_propOld; - DECLARE_NO_COPY_CLASS(wxPropChanger) + wxDECLARE_NO_COPY_CLASS(wxPropChanger); }; } // anonymous namespace @@ -177,15 +176,6 @@ wxSize wxWrapSizer::CalcMin() // layout, trying to maintain the possibility to re-arrange lines by // sizing - wxSize szBoundary; // Keep track of boundary so we don't overflow - if ( m_availSize > 0 ) - { - if ( m_dirInform == m_orient ) - szBoundary = SizeFromMajorMinor(m_availSize, m_availableOtherDir); - else - szBoundary = SizeFromMajorMinor(m_availableOtherDir, m_availSize); - } - if ( !m_lastUsed ) { // Case 1 above: InformFirstDirection() has just been called @@ -195,21 +185,22 @@ wxSize wxWrapSizer::CalcMin() // a wrap sizer, depending on whether the first reported size component // is the opposite as our own orientation (the simpler case) or the same // one (more complicated). - wxSize szMinPrev = m_minSize; if ( m_dirInform == m_orient ) CalcMinFromMajor(m_availSize); else CalcMinFromMinor(m_availSize); - - // If overflowing given boundary, go back to previous min size - if ( m_minSize.x > szBoundary.x || m_minSize.y>szBoundary.y ) - m_minSize = szMinPrev; } else // Case 2 above: not immediately after InformFirstDirection() { if ( m_availSize > 0 ) { - CalcMinFittingSize(szBoundary); + wxSize szAvail; // Keep track of boundary so we don't overflow + if ( m_dirInform == m_orient ) + szAvail = SizeFromMajorMinor(m_availSize, m_availableOtherDir); + else + szAvail = SizeFromMajorMinor(m_availableOtherDir, m_availSize); + + CalcMinFittingSize(szAvail); } else // Initial calculation, before we have size available to us { @@ -425,7 +416,7 @@ void wxWrapSizer::CalcMinFromMinor(int totMinor) wxSizerItem *item = node->GetData(); if ( item->IsShown() ) { - sz = item->GetMinSize(); + sz = item->GetMinSizeWithBorder(); if ( line->m_width+SizeInMajorDir(sz)>lineSize ) { line = new wxWrapLine; @@ -458,7 +449,7 @@ void wxWrapSizer::CalcMinFromMinor(int totMinor) // Take what is not used on this line, see how much extension we get // by adding first item on next line. int size = lineSize-lines[ix]->m_width; // Left over at end of this line - int extSize = GetSizeInMajorDir(lines[ix+1]->m_first->GetMinSize()) - size; + int extSize = GetSizeInMajorDir(lines[ix+1]->m_first->GetMinSizeWithBorder()) - size; if ( (extSize>=tailSize && (extSizebestExtSize && bestExtSizeIsShown() ) continue; - wxSize minItemSize = item->GetMinSize(); + wxSize minItemSize = item->GetMinSizeWithBorder(); const int itemMajor = SizeInMajorDir(minItemSize); const int itemMinor = SizeInMinorDir(minItemSize); if ( itemMajor > 0 && itemMajor < m_minItemMajor )