]>
Commit | Line | Data |
---|---|---|
f033830e SC |
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 | ||
dbeddfb9 | 39 | NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; |
f033830e SC |
40 | wxNSButton* v = [[wxNSButton alloc] initWithFrame:r]; |
41 | ||
42 | [v setBezelStyle:NSRoundedBezelStyle]; | |
43 | [v setButtonType:NSOnOffButton]; | |
44 | [sv addSubview:v]; | |
45 | wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v ); | |
46 | [v setImplementation:c]; | |
47 | return c; | |
48 | } | |
49 | ||
50 | wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer, | |
51 | wxWindowMac* parent, | |
52 | wxWindowID id, | |
53 | const wxBitmap& label, | |
54 | const wxPoint& pos, | |
55 | const wxSize& size, | |
56 | long style, | |
57 | long extraStyle) | |
58 | { | |
59 | NSView* sv = (wxpeer->GetParent()->GetHandle() ); | |
60 | ||
dbeddfb9 | 61 | NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; |
f033830e SC |
62 | wxNSButton* v = [[wxNSButton alloc] initWithFrame:r]; |
63 | ||
64 | [v setBezelStyle:NSRegularSquareBezelStyle]; | |
65 | [v setButtonType:NSOnOffButton]; | |
66 | [sv addSubview:v]; | |
67 | wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v ); | |
68 | [v setImplementation:c]; | |
69 | return c; | |
70 | } | |
71 | ||
72 | #endif // wxUSE_TOGGLEBTN | |
73 |