]> git.saurik.com Git - wxWidgets.git/blob - src/osx/cocoa/tglbtn.mm
fix undefined variable color to colour
[wxWidgets.git] / src / osx / cocoa / tglbtn.mm
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
6 // Modified by:
7 // Created: 08.02.01
8 // RCS-ID: $Id: tglbtn.cpp 54129 2008-06-11 19:30:52Z SC $
9 // Copyright: (c) Stefan Csomor
10 // License: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // ============================================================================
14 // declatations
15 // ============================================================================
16
17 // ----------------------------------------------------------------------------
18 // headers
19 // ----------------------------------------------------------------------------
20
21 #include "wx/wxprec.h"
22
23 #if wxUSE_TOGGLEBTN
24
25 #include "wx/tglbtn.h"
26 #include "wx/osx/private.h"
27
28 wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
29 wxWindowMac* parent,
30 wxWindowID id,
31 const wxString& label,
32 const wxPoint& pos,
33 const wxSize& size,
34 long style,
35 long extraStyle)
36 {
37 NSView* sv = (wxpeer->GetParent()->GetHandle() );
38
39 NSRect r = wxToNSRect( sv, wxRect( pos, size) );
40 // Rect bounds = wxMacGetBoundsForControl( wxpeer, pos , size ) ;
41 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
42
43 [v setBezelStyle:NSRoundedBezelStyle];
44 [v setButtonType:NSOnOffButton];
45 [sv addSubview:v];
46 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
47 [v setImplementation:c];
48 return c;
49 }
50
51 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
52 wxWindowMac* parent,
53 wxWindowID id,
54 const wxBitmap& label,
55 const wxPoint& pos,
56 const wxSize& size,
57 long style,
58 long extraStyle)
59 {
60 NSView* sv = (wxpeer->GetParent()->GetHandle() );
61
62 NSRect r = wxToNSRect( sv, wxRect( pos, size) );
63 // Rect bounds = wxMacGetBoundsForControl( wxpeer, pos , size ) ;
64 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
65
66 [v setBezelStyle:NSRegularSquareBezelStyle];
67 [v setButtonType:NSOnOffButton];
68 [sv addSubview:v];
69 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
70 [v setImplementation:c];
71 return c;
72 }
73
74 #endif // wxUSE_TOGGLEBTN
75