1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/tglbtn.mm
3 // Purpose: Definition of the wxToggleButton class, which implements a
4 // toggle button under wxMac.
5 // Author: Stefan Csomor
8 // RCS-ID: $Id: tglbtn.cpp 54129 2008-06-11 19:30:52Z SC $
9 // Copyright: (c) Stefan Csomor
10 // License: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
13 // ============================================================================
15 // ============================================================================
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 #include "wx/wxprec.h"
25 #include "wx/tglbtn.h"
26 #include "wx/osx/private.h"
30 extern "C" void SetBezelStyleFromBorderFlags(NSButton *v, long style);
32 wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
33 wxWindowMac* WXUNUSED(parent),
34 wxWindowID WXUNUSED(id),
35 const wxString& WXUNUSED(label),
39 long WXUNUSED(extraStyle))
41 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
42 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
44 SetBezelStyleFromBorderFlags(v, style);
46 [v setButtonType:NSOnOffButton];
47 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
51 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
52 wxWindowMac* WXUNUSED(parent),
53 wxWindowID WXUNUSED(id),
54 const wxBitmap& label,
58 long WXUNUSED(extraStyle))
60 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
61 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
64 [v setImage:label.GetNSImage() ];
66 SetBezelStyleFromBorderFlags(v, style);
68 [v setButtonType:NSOnOffButton];
69 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
73 #endif // wxUSE_TOGGLEBTN