X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b19d4eb9bf0623c8d4402621b49acdece19223d8..9fd8f2dd3df305448a0c2d56508c04e26385a76d:/src/univ/stdrend.cpp diff --git a/src/univ/stdrend.cpp b/src/univ/stdrend.cpp index 255092ca44..5a78545902 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 // ============================================================================ @@ -164,9 +167,20 @@ void wxStdRenderer::DrawBackground(wxDC& dc, int WXUNUSED(flags), wxWindow *window) { - wxColour colBg = col.Ok() ? col - : window ? m_scheme->GetBackground(window) - : wxSCHEME_COLOUR(m_scheme, CONTROL); + wxColour colBg; + + if (col.Ok()) + { + colBg = col; + } + else if (window) + { + colBg = m_scheme->GetBackground(window); + } + else + { + colBg = wxSCHEME_COLOUR(m_scheme, CONTROL); + } DrawSolidRect(dc, colBg, rect); } @@ -483,7 +497,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 +623,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 )