1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/bmpbuttn.cpp
3 // Purpose: wxBitmapButton
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: bmpbuttn.cpp 54820 2008-07-29 20:04:11Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/bmpbuttn.h"
20 #include "wx/dcmemory.h"
23 #include "wx/osx/private.h"
25 wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer,
26 wxWindowMac* WXUNUSED(parent),
27 wxWindowID WXUNUSED(id),
28 const wxBitmap& bitmap,
32 long WXUNUSED(extraStyle))
34 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
35 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
37 // trying to get as close as possible to flags
38 if ( style & wxBORDER_NONE )
40 [v setBezelStyle:NSShadowlessSquareBezelStyle];
45 // see trac #11128 for a thorough discussion
46 if ( (style & wxBORDER_MASK) == wxBORDER_RAISED )
47 [v setBezelStyle:NSRegularSquareBezelStyle];
48 else if ( (style & wxBORDER_MASK) == wxBORDER_SUNKEN )
49 [v setBezelStyle:NSSmallSquareBezelStyle];
51 [v setBezelStyle:NSShadowlessSquareBezelStyle];
55 [v setImage:bitmap.GetNSImage() ];
57 [v setButtonType:NSMomentaryPushInButton];
58 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );