From: Vadim Zeitlin Date: Tue, 30 Sep 2003 12:29:34 +0000 (+0000) Subject: don't draw raised border around disabled bitmaps (patch 814745) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/cb0bcdd65c5ce1e2dc947a1149020610ea3782f8 don't draw raised border around disabled bitmaps (patch 814745) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24007 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/ownerdrw.cpp b/src/msw/ownerdrw.cpp index 2670d5464a..624dd00f4e 100644 --- a/src/msw/ownerdrw.cpp +++ b/src/msw/ownerdrw.cpp @@ -261,11 +261,14 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc, } - // if background is white, don't draw an edge around the bitmap + // don't draw an edge around the bitmap, if background is white ... DWORD menu_bg_color = GetSysColor(COLOR_MENU); - if (GetRValue(menu_bg_color) >= 0xf0 && - GetGValue(menu_bg_color) >= 0xf0 && - GetBValue(menu_bg_color) >= 0xf0) + if ( ( GetRValue( menu_bg_color ) >= 0xf0 && + GetGValue( menu_bg_color ) >= 0xf0 && + GetBValue( menu_bg_color ) >= 0xf0 ) + // ... or if the menu item is disabled + || ( st & wxODDisabled ) + ) { draw_bitmap_edge = false; } @@ -402,11 +405,20 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc, } } else { - wxBitmap bmp( // for disabled items we use m_bmpDisabled if it exists - ( GetDisabledBitmap() != wxNullBitmap && ( st & wxODDisabled ) ) ? GetDisabledBitmap() : - // for uncheckable item we use only the 'checked' bitmap - GetBitmap(IsCheckable() ? ((st & wxODChecked) != 0) : TRUE) - ); + wxBitmap bmp; + + if ( st & wxODDisabled ) + { + bmp = GetDisabledBitmap(); + } + + if ( !bmp.Ok() ) + { + // for not checkable bitmaps we should always use unchecked one because + // their checked bitmap is not set + bmp = GetBitmap(!IsCheckable() || (st & wxODChecked)); + } + if ( bmp.Ok() ) { wxMemoryDC dcMem(&dc); dcMem.SelectObject(bmp);