From: Vadim Zeitlin Date: Sat, 30 Sep 2006 18:32:33 +0000 (+0000) Subject: offset the text correctly inside the item rect in DrawItem(), it was off by 1 X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/746146e0e30d5cb6fa8ee95677bb97f98ed099fb offset the text correctly inside the item rect in DrawItem(), it was off by 1 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41536 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/univ/stdrend.cpp b/src/univ/stdrend.cpp index 255092ca44..4b25de7700 100644 --- a/src/univ/stdrend.cpp +++ b/src/univ/stdrend.cpp @@ -42,6 +42,9 @@ static const int FRAME_TITLEBAR_HEIGHT = 18; static const int FRAME_BUTTON_WIDTH = 16; static const int FRAME_BUTTON_HEIGHT = 14; +// the margin between listbox item text and its rectangle +static const int ITEM_MARGIN = 1; + // ============================================================================ // wxStdRenderer implementation // ============================================================================ @@ -483,7 +486,7 @@ bool wxStdRenderer::AreScrollbarsInsideBorder() const wxCoord wxStdRenderer::GetListboxItemHeight(wxCoord fontHeight) { - return fontHeight + 2; + return fontHeight + 2*ITEM_MARGIN; } void wxStdRenderer::DrawTextBorder(wxDC& dc, @@ -609,9 +612,9 @@ void wxStdRenderer::DrawItem(wxDC& dc, dc.DrawRectangle(rect); } + // horizontal adjustment is arbitrary wxRect rectText = rect; - rectText.x += 2; - rectText.width -= 2; + rectText.Deflate(2, ITEM_MARGIN); dc.DrawLabel(label, wxNullBitmap, rectText); if ( flags & wxCONTROL_FOCUSED )