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
This commit is contained in:
Vadim Zeitlin 2003-09-30 12:29:34 +00:00
parent 9542f0a109
commit cb0bcdd65c

View File

@ -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); DWORD menu_bg_color = GetSysColor(COLOR_MENU);
if (GetRValue(menu_bg_color) >= 0xf0 && if ( ( GetRValue( menu_bg_color ) >= 0xf0 &&
GetGValue(menu_bg_color) >= 0xf0 && GetGValue( menu_bg_color ) >= 0xf0 &&
GetBValue(menu_bg_color) >= 0xf0) GetBValue( menu_bg_color ) >= 0xf0 )
// ... or if the menu item is disabled
|| ( st & wxODDisabled )
)
{ {
draw_bitmap_edge = false; draw_bitmap_edge = false;
} }
@ -402,11 +405,20 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
} }
} }
else { else {
wxBitmap bmp( // for disabled items we use m_bmpDisabled if it exists wxBitmap bmp;
( GetDisabledBitmap() != wxNullBitmap && ( st & wxODDisabled ) ) ? GetDisabledBitmap() :
// for uncheckable item we use only the 'checked' bitmap if ( st & wxODDisabled )
GetBitmap(IsCheckable() ? ((st & wxODChecked) != 0) : TRUE) {
); 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() ) { if ( bmp.Ok() ) {
wxMemoryDC dcMem(&dc); wxMemoryDC dcMem(&dc);
dcMem.SelectObject(bmp); dcMem.SelectObject(bmp);