]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/bmpbuttn.mm
fix wxGTK1 compilation after wxTextEntry DoGetValue() change
[wxWidgets.git] / src / osx / cocoa / bmpbuttn.mm
index 3de4eafe5facd3f22a76f3a6e58df12c80382898..f6fbea347648606ad869c69ef3348cd806d5749f 100644 (file)
@@ -31,17 +31,27 @@ wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer,
                                     long style, 
                                     long extraStyle) 
 {
-    NSView* sv = static_cast<NSView*>(wxpeer->GetParent()->GetHandle() );
-    
     NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
     wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
+
+    // trying to get as close as possible to flags
+    if ( style & wxBORDER_NONE )
+    {
+        [v setBezelStyle:NSShadowlessSquareBezelStyle];
+    }
+    else
+    {
+        if ( style & wxBU_AUTODRAW )
+            [v setBezelStyle:NSShadowlessSquareBezelStyle];
+        else
+            [v setBezelStyle:NSRegularSquareBezelStyle];
+    }
+    
+    if (bitmap.Ok())
+        [v setImage:bitmap.GetNSImage() ];
     
-    [v setBezelStyle:NSRegularSquareBezelStyle];
-    [v setImage:bitmap.GetNSImage() ];
     [v setButtonType:NSMomentaryPushInButton];
-    [sv addSubview:v];
     wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
-    [v setImplementation:c];
     return c;
 }