From 4e7c767fed7847b135aef7617eb6ed2cca1c9e1e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 23 Jan 2010 13:21:20 +0000 Subject: [PATCH] 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 --- src/msw/menu.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index d1f777f816..07541b8554 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -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 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(itemText.wx_str()); -- 2.45.2