/////////////////////////////////////////////////////////////////////////////
-// Name: src/mac/carbon/bmpbuttn.cpp
+// Name: src/osx/carbon/bmpbuttn.cpp
// Purpose: wxBitmapButton
// Author: Stefan Csomor
// Modified by:
#include "wx/osx/private.h"
-wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer,
- wxWindowMac* parent,
- wxWindowID id,
+wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer,
+ wxWindowMac* WXUNUSED(parent),
+ wxWindowID WXUNUSED(id),
const wxBitmap& bitmap,
- const wxPoint& pos,
+ const wxPoint& pos,
const wxSize& size,
- long style,
- long extraStyle)
+ long style,
+ long WXUNUSED(extraStyle))
{
- NSView* sv = (wxpeer->GetParent()->GetHandle() );
-
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
-
- [v setBezelStyle:NSRegularSquareBezelStyle];
-
+
+ // trying to get as close as possible to flags
+ if ( style & wxBORDER_NONE )
+ {
+ [v setBezelStyle:NSShadowlessSquareBezelStyle];
+ [v setBordered:NO];
+ }
+ else
+ {
+ // see trac #11128 for a thorough discussion
+ if ( (style & wxBORDER_MASK) == wxBORDER_RAISED )
+ [v setBezelStyle:NSRegularSquareBezelStyle];
+ else if ( (style & wxBORDER_MASK) == wxBORDER_SUNKEN )
+ [v setBezelStyle:NSSmallSquareBezelStyle];
+ else
+ [v setBezelStyle:NSShadowlessSquareBezelStyle];
+ }
+
+ if (bitmap.Ok())
+ [v setImage:bitmap.GetNSImage() ];
+
[v setButtonType:NSMomentaryPushInButton];
- [sv addSubview:v];
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
- [v setImplementation:c];
return c;
}