]> git.saurik.com Git - wxWidgets.git/blob - src/osx/cocoa/tglbtn.mm
spell error fixed
[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$
9 // Copyright: (c) Stefan Csomor
10 // Licence: wxWindows licence
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 // from button.mm
29
30 extern "C" void SetBezelStyleFromBorderFlags(NSButton *v,
31 long style,
32 wxWindowID winid = wxID_ANY,
33 const wxString& label = wxString());
34
35 wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
36 wxWindowMac* WXUNUSED(parent),
37 wxWindowID winid,
38 const wxString& label,
39 const wxPoint& pos,
40 const wxSize& size,
41 long style,
42 long WXUNUSED(extraStyle))
43 {
44 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
45 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
46
47 SetBezelStyleFromBorderFlags(v, style, winid, label);
48
49 [v setButtonType:NSOnOffButton];
50 wxWidgetCocoaImpl* c = new wxButtonCocoaImpl( wxpeer, v );
51 return c;
52 }
53
54 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
55 wxWindowMac* WXUNUSED(parent),
56 wxWindowID winid,
57 const wxBitmap& label,
58 const wxPoint& pos,
59 const wxSize& size,
60 long style,
61 long WXUNUSED(extraStyle))
62 {
63 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
64 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
65
66 SetBezelStyleFromBorderFlags(v, style, winid);
67
68 if (label.IsOk())
69 [v setImage:label.GetNSImage() ];
70
71 [v setButtonType:NSOnOffButton];
72 wxWidgetCocoaImpl* c = new wxButtonCocoaImpl( wxpeer, v );
73 return c;
74 }
75
76 #endif // wxUSE_TOGGLEBTN
77