Do not set bitmaps for wxITEM_RADIO menu items on Linux and macOS

This commit is contained in:
Maciej Suminski 2018-02-14 09:08:29 +01:00
parent 5d738dcb6d
commit 461b6aff5e
1 changed files with 11 additions and 8 deletions

View File

@ -170,6 +170,7 @@ wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap )
return bitmap; return bitmap;
} }
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL ) const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL )
{ {
@ -182,12 +183,12 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
if( useImagesInMenus ) if( useImagesInMenus )
{ {
if( aType == wxITEM_CHECK ) if( aType == wxITEM_CHECK || aType == wxITEM_RADIO )
{ {
#if defined( __WINDOWS__ ) #if defined( __WINDOWS__ )
item->SetBitmaps( KiBitmap( checked_ok_xpm ), aImage ); item->SetBitmaps( KiBitmap( checked_ok_xpm ), aImage );
// A workaround to a strange bug on Windows, wx Widgets 3.0: // A workaround to a strange bug on Windows, wx Widgets 3.0:
// size of bitmaps is not taken in account for wxITEM_CHECK menu // size of bitmaps is not taken in account for wxITEM_{CHECK,RADIO} menu
// unless we call SetFont // unless we call SetFont
item->SetFont( *wxNORMAL_FONT ); item->SetFont( *wxNORMAL_FONT );
#endif #endif
@ -201,6 +202,7 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
return item; return item;
} }
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxString& aHelpText, const wxBitmap& aImage, const wxString& aHelpText, const wxBitmap& aImage,
wxItemKind aType = wxITEM_NORMAL ) wxItemKind aType = wxITEM_NORMAL )
@ -214,12 +216,12 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
if( useImagesInMenus ) if( useImagesInMenus )
{ {
if( aType == wxITEM_CHECK ) if( aType == wxITEM_CHECK || aType == wxITEM_RADIO )
{ {
#if defined( __WINDOWS__ ) #if defined( __WINDOWS__ )
item->SetBitmaps( KiBitmap( checked_ok_xpm ), aImage ); item->SetBitmaps( KiBitmap( checked_ok_xpm ), aImage );
// A workaround to a strange bug on Windows, wx Widgets 3.0: // A workaround to a strange bug on Windows, wx Widgets 3.0:
// size of bitmaps is not taken in account for wxITEM_CHECK menu // size of bitmaps is not taken in account for wxITEM_{CHECK,RADIO} menu
// unless we call SetFont // unless we call SetFont
item->SetFont( *wxNORMAL_FONT ); item->SetFont( *wxNORMAL_FONT );
#endif #endif
@ -233,6 +235,7 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
return item; return item;
} }
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
const wxString& aText, const wxBitmap& aImage ) const wxString& aText, const wxBitmap& aImage )
{ {