Set up menu bitmaps correctly for checkable items.
We must not set MENUITEMINFO::hbmpItem for the checkable items as it would then be used for both checked and unchecked state. Closes #11244. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63221 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -401,6 +401,9 @@ HBITMAP GetHBitmapForMenu(wxMenuItem *pItem, bool checked = true)
|
||||
|
||||
return GetHbitmapOf(pItem->GetBitmap(checked));
|
||||
}
|
||||
//else: bitmap is not set
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
@@ -518,18 +521,19 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
WinStruct<MENUITEMINFO> mii;
|
||||
mii.fMask = MIIM_STRING | MIIM_DATA;
|
||||
|
||||
if ( pItem->GetBitmap().IsOk() )
|
||||
{
|
||||
mii.fMask |= MIIM_BITMAP;
|
||||
mii.hbmpItem = GetHBitmapForMenu(pItem);
|
||||
}
|
||||
|
||||
// don't set hbmpItem for the checkable items as it would
|
||||
// be used for both checked and unchecked state
|
||||
if ( pItem->IsCheckable() )
|
||||
{
|
||||
mii.fMask |= MIIM_CHECKMARKS;
|
||||
mii.hbmpChecked = GetHBitmapForMenu(pItem, true);
|
||||
mii.hbmpUnchecked = GetHBitmapForMenu(pItem, false);
|
||||
}
|
||||
else if ( pItem->GetBitmap().IsOk() )
|
||||
{
|
||||
mii.fMask |= MIIM_BITMAP;
|
||||
mii.hbmpItem = GetHBitmapForMenu(pItem);
|
||||
}
|
||||
|
||||
mii.cch = itemText.length();
|
||||
mii.dwTypeData = const_cast<wxChar *>(itemText.wx_str());
|
||||
|
Reference in New Issue
Block a user