Use new upstream IsCheckable function in UI update event handling

This function is introduced in wxWidgets 3.1.5 and allows you to
query the event with if it should be checked or not instead of
having to figure it out based on the item type.
This commit is contained in:
Ian McInerney 2020-11-11 00:33:37 +00:00
parent 05595da235
commit c207a90999
1 changed files with 7 additions and 0 deletions

View File

@ -339,6 +339,12 @@ void EDA_BASE_FRAME::HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAM
aEvent.Enable( enableRes );
aEvent.Show( showRes );
// wxWidgets 3.1.5+ includes a field in the event that says if the event supports being
// checked, since wxMenuItems don't want to be checked unless they actually are checkable
#if wxCHECK_VERSION( 3, 1, 5 )
if( aEvent.IsCheckable() )
aEvent.Check( checkRes );
#else
bool canCheck = true;
// wxMenuItems don't want to be checked unless they actually are checkable, so we have to check to
@ -348,6 +354,7 @@ void EDA_BASE_FRAME::HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAM
if( canCheck )
aEvent.Check( checkRes );
#endif
}