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:
@@ -149,13 +149,10 @@ UINT GetMenuState(HMENU hMenu, UINT id, UINT flags)
|
|||||||
}
|
}
|
||||||
#endif // __WXWINCE__
|
#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
|
return bmp.GetWidth() > ::GetSystemMetrics(SM_CXMENUCHECK) ||
|
||||||
// default SM_CXMENUCHECK value but I have no idea what do we really
|
bmp.GetHeight() > ::GetSystemMetrics(SM_CYMENUCHECK);
|
||||||
// need to use here
|
|
||||||
return bmp.GetWidth() < ::GetSystemMetrics(SM_CXMENUCHECK) + 4 &&
|
|
||||||
bmp.GetHeight() < ::GetSystemMetrics(SM_CYMENUCHECK) + 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
@@ -529,8 +526,8 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
const wxBitmap& bmpUnchecked = pItem->GetBitmap(false),
|
const wxBitmap& bmpUnchecked = pItem->GetBitmap(false),
|
||||||
bmpChecked = pItem->GetBitmap(true);
|
bmpChecked = pItem->GetBitmap(true);
|
||||||
|
|
||||||
if ( (bmpUnchecked.Ok() && !IsLessThanStdSize(bmpUnchecked)) ||
|
if ( (bmpUnchecked.Ok() && IsGreaterThanStdSize(bmpUnchecked)) ||
|
||||||
(bmpChecked.Ok() && !IsLessThanStdSize(bmpChecked)) )
|
(bmpChecked.Ok() && IsGreaterThanStdSize(bmpChecked)) )
|
||||||
{
|
{
|
||||||
mustUseOwnerDrawn = true;
|
mustUseOwnerDrawn = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user