X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e53b3d16de127872e39bf276f7e616b32f161645..bb69632a56a827bed4cfae842bfffa88259ac1aa:/src/osx/checkbox_osx.cpp diff --git a/src/osx/checkbox_osx.cpp b/src/osx/checkbox_osx.cpp index 0e224f15d7..968e557a6e 100644 --- a/src/osx/checkbox_osx.cpp +++ b/src/osx/checkbox_osx.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/checkbox.cpp +// Name: src/osx/carbon/checkbox.cpp // Purpose: wxCheckBox // Author: Stefan Csomor // Modified by: @@ -82,31 +82,39 @@ void wxCheckBox::DoSet3StateValue(wxCheckBoxState val) bool wxCheckBox::HandleClicked( double timestampsec ) { - wxCheckBoxState origState, newState; - - newState = origState = Get3StateValue(); - - switch (origState) + bool sendEvent = true; + wxCheckBoxState newState = Get3StateValue(); + + if ( !m_peer->ButtonClickDidStateChange() ) { - case wxCHK_UNCHECKED: - newState = wxCHK_CHECKED; - break; - - case wxCHK_CHECKED: - // If the style flag to allow the user setting the undetermined state is set, - // then set the state to undetermined; otherwise set state to unchecked. - newState = Is3rdStateAllowedForUser() ? wxCHK_UNDETERMINED : wxCHK_UNCHECKED; - break; - - case wxCHK_UNDETERMINED: - newState = wxCHK_UNCHECKED; - break; - - default: - break; + wxCheckBoxState origState ; + + newState = origState = Get3StateValue(); + + switch (origState) + { + case wxCHK_UNCHECKED: + newState = wxCHK_CHECKED; + break; + + case wxCHK_CHECKED: + // If the style flag to allow the user setting the undetermined state is set, + // then set the state to undetermined; otherwise set state to unchecked. + newState = Is3rdStateAllowedForUser() ? wxCHK_UNDETERMINED : wxCHK_UNCHECKED; + break; + + case wxCHK_UNDETERMINED: + newState = wxCHK_UNCHECKED; + break; + + default: + break; + } + if (newState == origState) + sendEvent = false; } - if (newState != origState) + if (sendEvent) { Set3StateValue( newState );