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 = wxToNSRect( sv, wxRect( pos, size) );
40 // Rect bounds = wxMacGetBoundsForControl( wxpeer, pos , size ) ;
41 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
43 [v setBezelStyle:NSRoundedBezelStyle];
44 [v setButtonType:NSOnOffButton];
46 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
47 [v setImplementation:c];
51 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
54 const wxBitmap& label,
60 NSView* sv = (wxpeer->GetParent()->GetHandle() );
62 NSRect r = wxToNSRect( sv, wxRect( pos, size) );
63 // Rect bounds = wxMacGetBoundsForControl( wxpeer, pos , size ) ;
64 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
66 [v setBezelStyle:NSRegularSquareBezelStyle];
67 [v setButtonType:NSOnOffButton];
69 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
70 [v setImplementation:c];
74 #endif // wxUSE_TOGGLEBTN