]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/checkbox_osx.cpp
setting the image position after the label is set, otherwise image_only will have...
[wxWidgets.git] / src / osx / checkbox_osx.cpp
index 9d4191de73e5bd997a9b6ac0a9b951154735b5bf..e45c547eabb633ef3f5ea8758a4357cfba1d3970 100644 (file)
@@ -89,7 +89,7 @@ bool wxCheckBox::OSXHandleClicked( double WXUNUSED(timestampsec) )
     {
         wxCheckBoxState origState ;
 
-        newState = origState = Get3StateValue();
+        origState = Get3StateValue();
 
         switch (origState)
         {
@@ -110,14 +110,24 @@ 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 );
         event.SetInt( newState );
         event.SetEventObject( this );