X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e53b3d16de127872e39bf276f7e616b32f161645..29188693b3b8ba4b07762df012cc652d421dae79:/src/osx/checkbox_osx.cpp?ds=sidebyside diff --git a/src/osx/checkbox_osx.cpp b/src/osx/checkbox_osx.cpp index 0e224f15d7..93cbf2c7bb 100644 --- a/src/osx/checkbox_osx.cpp +++ b/src/osx/checkbox_osx.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/checkbox.cpp +// Name: src/osx/carbon/checkbox.cpp // Purpose: wxCheckBox // Author: Stefan Csomor // Modified by: // Created: 04/01/98 -// RCS-ID: $Id: checkbox.cpp 54129 2008-06-11 19:30:52Z SC $ +// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -36,6 +36,7 @@ bool wxCheckBox::Create(wxWindow *parent, m_labelOrig = m_label = label ; + WXValidateStyle( &style ); m_peer = wxWidgetImpl::CreateCheckBox( this, parent, id, label, pos, size, style, GetExtraStyle() ) ; MacPostControlCreate(pos, size) ; @@ -80,33 +81,41 @@ void wxCheckBox::DoSet3StateValue(wxCheckBoxState val) m_peer->SetValue( val ) ; } -bool wxCheckBox::HandleClicked( double timestampsec ) +bool wxCheckBox::OSXHandleClicked( double WXUNUSED(timestampsec) ) { - wxCheckBoxState origState, newState; + bool sendEvent = true; + wxCheckBoxState newState = Get3StateValue(); - newState = origState = Get3StateValue(); - - switch (origState) + 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 );