]> git.saurik.com Git - wxWidgets.git/blob - src/osx/cocoa/tglbtn.mm
Fix GetMsgCatalogSubdirs() to do as documentation says.
[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 const wxBitmap& bitmap = wxBitmap());
35
36 wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
37 wxWindowMac* WXUNUSED(parent),
38 wxWindowID winid,
39 const wxString& label,
40 const wxPoint& pos,
41 const wxSize& size,
42 long style,
43 long WXUNUSED(extraStyle))
44 {
45 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
46 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
47
48 SetBezelStyleFromBorderFlags(v, style, winid, label);
49
50 [v setButtonType:NSOnOffButton];
51 wxWidgetCocoaImpl* c = new wxButtonCocoaImpl( wxpeer, v );
52 return c;
53 }
54
55 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
56 wxWindowMac* WXUNUSED(parent),
57 wxWindowID winid,
58 const wxBitmap& label,
59 const wxPoint& pos,
60 const wxSize& size,
61 long style,
62 long WXUNUSED(extraStyle))
63 {
64 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
65 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
66
67 SetBezelStyleFromBorderFlags(v, style, winid, wxString(), label);
68
69 if (label.IsOk())
70 [v setImage:label.GetNSImage() ];
71
72 [v setButtonType:NSOnOffButton];
73 wxWidgetCocoaImpl* c = new wxButtonCocoaImpl( wxpeer, v );
74 return c;
75 }
76
77 #endif // wxUSE_TOGGLEBTN
78