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"
28 wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
31 const wxString& label,
37 NSView* sv = (wxpeer->GetParent()->GetHandle() );
39 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
40 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
42 [v setBezelStyle:NSRoundedBezelStyle];
43 [v setButtonType:NSOnOffButton];
45 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
46 [v setImplementation:c];
50 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
53 const wxBitmap& label,
59 NSView* sv = (wxpeer->GetParent()->GetHandle() );
61 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
62 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
64 [v setBezelStyle:NSRegularSquareBezelStyle];
65 [v setButtonType:NSOnOffButton];
67 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
68 [v setImplementation:c];
72 #endif // wxUSE_TOGGLEBTN