X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d15694e8cad1d44087323bd568ca33ff5b354f2c..683df83d51c0f080e2e5210dc8115be0cb30d1ad:/src/osx/checkbox_osx.cpp diff --git a/src/osx/checkbox_osx.cpp b/src/osx/checkbox_osx.cpp index 1830c610d9..c82b404313 100644 --- a/src/osx/checkbox_osx.cpp +++ b/src/osx/checkbox_osx.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/checkbox.cpp +// Name: src/osx/checkbox_osx.cpp // Purpose: wxCheckBox // Author: Stefan Csomor // Modified by: @@ -89,7 +89,7 @@ bool wxCheckBox::OSXHandleClicked( double WXUNUSED(timestampsec) ) { wxCheckBoxState origState ; - newState = origState = Get3StateValue(); + origState = Get3StateValue(); switch (origState) { @@ -110,15 +110,25 @@ bool wxCheckBox::OSXHandleClicked( double WXUNUSED(timestampsec) ) default: break; } + if (newState == origState) sendEvent = false; + else + Set3StateValue( newState ); } - + else + { + // in case we cannot avoid this user state change natively (eg cocoa) we intercept it here + if ( newState == wxCHK_UNDETERMINED && !Is3rdStateAllowedForUser() ) + { + newState = wxCHK_CHECKED; + Set3StateValue( newState ); + } + } + if (sendEvent) { - Set3StateValue( newState ); - - wxCommandEvent event( wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId ); + wxCommandEvent event( wxEVT_CHECKBOX, m_windowId ); event.SetInt( newState ); event.SetEventObject( this ); ProcessCommand( event );