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)
This commit is contained in:
jean-pierre charras 2019-05-24 21:01:15 +02:00
parent 057366e97e
commit 32f25cf8b4
1 changed files with 7 additions and 1 deletions

View File

@ -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() )
{