]> git.saurik.com Git - wxWidgets.git/commitdiff
support for toggle bitmap button
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 3 Apr 2010 09:10:38 +0000 (09:10 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 3 Apr 2010 09:10:38 +0000 (09:10 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63838 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/button.mm
src/osx/cocoa/tglbtn.mm

index 355b77707a8440db15050edad69986e82f445544..5e4d5db404a9e32dcf75429e5830305f383676c9 100644 (file)
@@ -130,6 +130,8 @@ private:
     }
 };
 
+extern "C" void SetBezelStyleFromBorderFlags(NSButton *v, long style);
+    
 // set bezel style depending on the wxBORDER_XXX flags specified by the style
 void SetBezelStyleFromBorderFlags(NSButton *v, long style)
 {
index 8b4fe03b966d92e18549a0168fb73a725614d43f..8f752de7d20adb32df2b8dfe900ef94511cd8d25 100644 (file)
 #include "wx/tglbtn.h"
 #include "wx/osx/private.h"
 
+// from button.mm
+
+extern "C" void SetBezelStyleFromBorderFlags(NSButton *v, long style);
+
 wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
                                     wxWindowMac* WXUNUSED(parent),
                                     wxWindowID WXUNUSED(id),
@@ -37,7 +41,8 @@ wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
     NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
     wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
 
-    [v setBezelStyle:NSSmallSquareBezelStyle];
+    SetBezelStyleFromBorderFlags(v, style);
+
     [v setButtonType:NSOnOffButton];
     wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
     return c;
@@ -46,16 +51,20 @@ wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
                                     wxWindowMac* WXUNUSED(parent),
                                     wxWindowID WXUNUSED(id),
-                                    const wxBitmap& WXUNUSED(label),
+                                    const wxBitmap& label,
                                     const wxPoint& pos,
                                     const wxSize& size,
-                                    long WXUNUSED(style),
+                                    long style,
                                     long WXUNUSED(extraStyle))
 {
     NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
     wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
 
-    [v setBezelStyle:NSRegularSquareBezelStyle];
+    if (label.Ok())
+        [v setImage:label.GetNSImage() ];
+
+    SetBezelStyleFromBorderFlags(v, style);
+
     [v setButtonType:NSOnOffButton];
     wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
     return c;