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
9 // Copyright: (c) Stefan Csomor
10 // Licence: wxWindows licence
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,
32 wxWindowID winid = wxID_ANY,
33 const wxString& label = wxString());
35 wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
36 wxWindowMac* WXUNUSED(parent),
38 const wxString& label,
42 long WXUNUSED(extraStyle))
44 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
45 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
47 SetBezelStyleFromBorderFlags(v, style, winid, label);
49 [v setButtonType:NSOnOffButton];
50 wxWidgetCocoaImpl* c = new wxButtonCocoaImpl( wxpeer, v );
54 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
55 wxWindowMac* WXUNUSED(parent),
57 const wxBitmap& label,
61 long WXUNUSED(extraStyle))
63 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
64 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
66 SetBezelStyleFromBorderFlags(v, style, winid);
69 [v setImage:label.GetNSImage() ];
71 [v setButtonType:NSOnOffButton];
72 wxWidgetCocoaImpl* c = new wxButtonCocoaImpl( wxpeer, v );
76 #endif // wxUSE_TOGGLEBTN