]> git.saurik.com Git - wxWidgets.git/commitdiff
The gaps should *not* be included in the space given to the item, and
authorRobin Dunn <robin@alldunn.com>
Wed, 30 Jun 2004 23:43:02 +0000 (23:43 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 30 Jun 2004 23:43:02 +0000 (23:43 +0000)
so should also not be accounted for in the alignment adjustmanets

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/gbsizer.cpp
src/common/sizer.cpp

index 2dde7a8410faf469a56d6759fffabd8ffd68963d..3bd6720e68727d7e402f4f54ecc49e5a4e3174c3 100644 (file)
@@ -547,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);
 
index 165d7d8bba5f4834a865c70499c9ac8fe74af3a9..f64ac6654cdc303735989c83f8cbc1afcd625caf 100644 (file)
@@ -1044,7 +1044,7 @@ wxSize wxGridSizer::CalcMin()
 void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h )
 {
     wxPoint pt( x,y );
-    wxSize sz( item->CalcMin() );
+    wxSize sz( item->GetMinSizeWithBorder() ); 
     int flag = item->GetFlag();
 
     if ((flag & wxEXPAND) || (flag & wxSHAPED))
@@ -1055,20 +1055,20 @@ void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h )
     {
         if (flag & wxALIGN_CENTER_HORIZONTAL)
         {
-            pt.x = x + (w - sz.x - m_hgap) / 2;
+            pt.x = x + (w - sz.x) / 2;
         }
         else if (flag & wxALIGN_RIGHT)
         {
-            pt.x = x + (w - sz.x - m_hgap);
+            pt.x = x + (w - sz.x);
         }
 
         if (flag & wxALIGN_CENTER_VERTICAL)
         {
-            pt.y = y + (h - sz.y - m_vgap) / 2;
+            pt.y = y + (h - sz.y) / 2;
         }
         else if (flag & wxALIGN_BOTTOM)
         {
-            pt.y = y + (h - sz.y - m_vgap);
+            pt.y = y + (h - sz.y);
         }
     }