From 32f25cf8b4e05d078ce8a85f1da1194bb7a2e966 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 24 May 2019 21:01:15 +0200 Subject: [PATCH] ACTION_MENU::appendCopy: Fix an issue on Windows with Check-able menu-items. The source bitmap was copied to the new created item. However, for Checkable menu-items, when setting a bitmap, our standard check bitmap is also added. This is unwanted when the source bitmap is the wxNullBitmap (bitmap sizes are different) --- common/tool/action_menu.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/tool/action_menu.cpp b/common/tool/action_menu.cpp index 738835340e..7af205c4e4 100644 --- a/common/tool/action_menu.cpp +++ b/common/tool/action_menu.cpp @@ -498,7 +498,13 @@ wxMenuItem* ACTION_MENU::appendCopy( const wxMenuItem* aSource ) wxMenuItem* newItem = new wxMenuItem( this, aSource->GetId(), aSource->GetItemLabel(), aSource->GetHelp(), aSource->GetKind() ); - AddBitmapToMenuItem( newItem, aSource->GetBitmap() ); + // Add the source bitmap if it is not the wxNullBitmap + // On Windows, for Checkable Menu items, adding a null bitmap adds also + // our predefined checked alternate bitmap + const wxBitmap& src_bitmap = aSource->GetBitmap(); + + if( src_bitmap.GetHeight() > 1 ) // a null bitmap has a 0 size + AddBitmapToMenuItem( newItem, src_bitmap ); if( aSource->IsSubMenu() ) {