]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix check toolbar items behaviour in non-native toolbars in wxOSX.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Nov 2010 21:43:28 +0000 (21:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Nov 2010 21:43:28 +0000 (21:43 +0000)
Update the button state when the tool is toggled. Also use NSToggleButton for
this tool and not NSOnOffButton as the latter doesn't use the alternative
(toggled) image.

Closes #12408.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/toolbar.mm

index 433eadb1a58551b8613c9ec060ab3d8c70428090..ccc6bbaf43c8a50c28f9c5703b225e7e8527f4d1 100644 (file)
@@ -537,7 +537,11 @@ void wxToolBarTool::UpdateToggleImage( bool toggle )
         else
             [m_toolbarItem setImage:m_bmpNormal.GetNSImage()];
     }
+    else
 #endif
+    {
+        [(NSButton*)m_controlHandle setState:(toggle ? NSOnState : NSOffState)];
+    }
 }
 
 wxToolBarTool::wxToolBarTool(
@@ -1268,7 +1272,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
 
                 [v setBezelStyle:NSRegularSquareBezelStyle];
                 [v setBordered:NO];
-                [v setButtonType: ( tool->CanBeToggled() ? NSOnOffButton : NSMomentaryPushInButton )];
+                [v setButtonType: ( tool->CanBeToggled() ? NSToggleButton : NSMomentaryPushInButton )];
                 [v setImplementation:tool];
 
                 controlHandle = v;