X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ac7b44cc0765b8444324d71b58cf648009d41c2..aa99e0cd2242db04fe1f9bb7d91aea545def2422:/src/common/gbsizer.cpp diff --git a/src/common/gbsizer.cpp b/src/common/gbsizer.cpp index 85653bc76d..3bd6720e68 100644 --- a/src/common/gbsizer.cpp +++ b/src/common/gbsizer.cpp @@ -494,7 +494,8 @@ wxSize wxGridBagSizer::CalcMin() for (idx=0; idx < m_rows; idx++) height += m_rowHeights[idx] + ( idx == m_rows-1 ? 0 : m_vgap ); - return wxSize(width, height); + m_calculatedMinSize = wxSize(width, height); + return m_calculatedMinSize; } @@ -504,9 +505,6 @@ void wxGridBagSizer::RecalcSizes() if (m_children.GetCount() == 0) return; - // Calculates minsize and populates m_rowHeights and m_colWidths - wxSize minsz( CalcMin() ); - wxPoint pt( GetPosition() ); wxSize sz( GetSize() ); @@ -514,7 +512,7 @@ void wxGridBagSizer::RecalcSizes() m_cols = m_colWidths.GetCount(); int idx, width, height; - AdjustForGrowables(sz, minsz, m_rows, m_cols); + AdjustForGrowables(sz, m_calculatedMinSize, m_rows, m_cols); // Find the start positions on the window of the rows and columns wxArrayInt rowpos; @@ -549,11 +547,13 @@ void wxGridBagSizer::RecalcSizes() height = 0; for(idx=row; idx <= endrow; idx++) - height += m_rowHeights[idx] + m_vgap; + height += m_rowHeights[idx]; + height += (endrow - row) * m_vgap; // add a vgap for every row spanned width = 0; for (idx=col; idx <= endcol; idx++) - width += m_colWidths[idx] + m_hgap; + width += m_colWidths[idx]; + width += (endcol - col) * m_hgap; // add a hgap for every col spanned SetItemBounds(item, colpos[col], rowpos[row], width, height);