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,8 +170,9 @@ wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap )
return bitmap;
}
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL )
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL )
{
wxMenuItem* item;
@ -182,14 +183,14 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
if( useImagesInMenus )
{
if( aType == wxITEM_CHECK )
if( aType == wxITEM_CHECK || aType == wxITEM_RADIO )
{
#if defined( __WINDOWS__ )
item->SetBitmaps( KiBitmap( checked_ok_xpm ), aImage );
// 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
item->SetFont(*wxNORMAL_FONT);
item->SetFont( *wxNORMAL_FONT );
#endif
}
else
@ -201,6 +202,7 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
return item;
}
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxString& aHelpText, const wxBitmap& aImage,
wxItemKind aType = wxITEM_NORMAL )
@ -214,14 +216,14 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
if( useImagesInMenus )
{
if( aType == wxITEM_CHECK )
if( aType == wxITEM_CHECK || aType == wxITEM_RADIO )
{
#if defined( __WINDOWS__ )
item->SetBitmaps( KiBitmap( checked_ok_xpm ), aImage );
// 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
item->SetFont(*wxNORMAL_FONT);
item->SetFont( *wxNORMAL_FONT );
#endif
}
else
@ -233,6 +235,7 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
return item;
}
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
const wxString& aText, const wxBitmap& aImage )
{
@ -255,7 +258,7 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
const wxString& aText, const wxString& aHelpText,
const wxBitmap& aImage )
const wxBitmap& aImage )
{
wxMenuItem* item;