From c207a909994a450ff43b28edb29a35c9f372b70b Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Wed, 11 Nov 2020 00:33:37 +0000 Subject: [PATCH] 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. --- common/eda_base_frame.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 0e7fbcbb3b..4297315914 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -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 }