X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f033830e257227dc73225809de2326db0093e5fe..33f4afdbc08a2a8b8438420aa9d16aadee0bacc2:/src/osx/cocoa/bmpbuttn.mm diff --git a/src/osx/cocoa/bmpbuttn.mm b/src/osx/cocoa/bmpbuttn.mm index ac47c4f03f..ab3433bd7f 100644 --- a/src/osx/cocoa/bmpbuttn.mm +++ b/src/osx/cocoa/bmpbuttn.mm @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/bmpbuttn.cpp +// Name: src/osx/carbon/bmpbuttn.cpp // Purpose: wxBitmapButton // Author: Stefan Csomor // Modified by: @@ -31,16 +31,24 @@ wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer, long style, long extraStyle) { - NSView* sv = (wxpeer->GetParent()->GetHandle() ); - - NSRect r = wxToNSRect( sv, wxRect( pos, size) ); - // Rect bounds = wxMacGetBoundsForControl( wxpeer, pos , size ) ; + 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]; + } - [v setBezelStyle:NSRegularSquareBezelStyle]; - + [v setImage:bitmap.GetNSImage() ]; [v setButtonType:NSMomentaryPushInButton]; - [sv addSubview:v]; wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v ); [v setImplementation:c]; return c;