Remove the extra margins when checking owner drawn menu icons size.

The extra +4 in IsLessThanStdSize() functions resulted in assert failures
under Windows XP after the ownerdraw drawing changes so remove it as nobody
knew why was it there anyhow.

Also replace IsLessThanStdSize() with IsGreaterThanStdSize() to allow using it
directly instead of always testing for !IsLessThanStdSize().

See #11657.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64088 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-04-21 14:40:28 +00:00
parent 42a8164310
commit c71238020c

View File

@@ -149,13 +149,10 @@ UINT GetMenuState(HMENU hMenu, UINT id, UINT flags)
}
#endif // __WXWINCE__
inline bool IsLessThanStdSize(const wxBitmap& bmp)
inline bool IsGreaterThanStdSize(const wxBitmap& bmp)
{
// FIXME: these +4 are chosen so that 16*16 bitmaps pass this test with
// default SM_CXMENUCHECK value but I have no idea what do we really
// need to use here
return bmp.GetWidth() < ::GetSystemMetrics(SM_CXMENUCHECK) + 4 &&
bmp.GetHeight() < ::GetSystemMetrics(SM_CYMENUCHECK) + 4;
return bmp.GetWidth() > ::GetSystemMetrics(SM_CXMENUCHECK) ||
bmp.GetHeight() > ::GetSystemMetrics(SM_CYMENUCHECK);
}
} // anonymous namespace
@@ -529,8 +526,8 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
const wxBitmap& bmpUnchecked = pItem->GetBitmap(false),
bmpChecked = pItem->GetBitmap(true);
if ( (bmpUnchecked.Ok() && !IsLessThanStdSize(bmpUnchecked)) ||
(bmpChecked.Ok() && !IsLessThanStdSize(bmpChecked)) )
if ( (bmpUnchecked.Ok() && IsGreaterThanStdSize(bmpUnchecked)) ||
(bmpChecked.Ok() && IsGreaterThanStdSize(bmpChecked)) )
{
mustUseOwnerDrawn = true;
}