Don't attempt to uncheck menu radio item in wxGTK

Unchecking radio item makes no sense and wxMSW does nothing in this case, so
don't do anything in wxGTK neither, in particular don't generate a spurious
wxEVT_MENU.

Closes #17318.
This commit is contained in:
Artur Wieczorek 2016-01-05 21:13:39 +01:00 committed by Vadim Zeitlin
parent 6c897a28fd
commit dbd98a1078

View File

@ -684,18 +684,23 @@ void wxMenuItem::Check( bool check )
if (check == m_isChecked)
return;
wxMenuItemBase::Check( check );
switch ( GetKind() )
{
case wxITEM_CHECK:
case wxITEM_RADIO:
// It doesn't make sense to uncheck a radio item.
if ( !check )
return;
wxFALLTHROUGH;
case wxITEM_CHECK:
gtk_check_menu_item_set_active( (GtkCheckMenuItem*)m_menuItem, (gint)check );
break;
default:
wxFAIL_MSG( wxT("can't check this item") );
}
wxMenuItemBase::Check( check );
}
void wxMenuItem::Enable( bool enable )