From: Robin Dunn Date: Thu, 13 May 2004 19:12:06 +0000 (+0000) Subject: Take the hgap and vgap into account when doing alignments in grid X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/89a94520ea3a77cd4b75a34c1007f850d49aa737 Take the hgap and vgap into account when doing alignments in grid sizers. The gap is not part of the "cell" so alignments should be relative to the edge of the gap, not the next cell. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27263 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index c2320a4d5a..37c790a4bd 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -1053,20 +1053,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) / 2; + pt.x = x + (w - sz.x - m_hgap) / 2; } else if (flag & wxALIGN_RIGHT) { - pt.x = x + (w - sz.x); + pt.x = x + (w - sz.x - m_hgap); } if (flag & wxALIGN_CENTER_VERTICAL) { - pt.y = y + (h - sz.y) / 2; + pt.y = y + (h - sz.y - m_vgap) / 2; } else if (flag & wxALIGN_BOTTOM) { - pt.y = y + (h - sz.y); + pt.y = y + (h - sz.y - m_vgap); } }