]>
Commit | Line | Data |
---|---|---|
7c798d00 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/osx/iphone/checkbox.mm | |
3 | // Purpose: wxCheckBox | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 2008-08-20 | |
7 | // RCS-ID: $Id: checkbox.mm 54129 2008-06-11 19:30:52Z SC $ | |
8 | // Copyright: (c) Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #if wxUSE_CHECKBOX | |
15 | ||
16 | #include "wx/checkbox.h" | |
17 | #include "wx/osx/private.h" | |
18 | ||
19 | @interface wxUISwitch : UISwitch | |
20 | { | |
21 | } | |
22 | ||
23 | @end | |
24 | ||
25 | @implementation wxUISwitch | |
26 | ||
27 | + (void)initialize | |
28 | { | |
29 | static BOOL initialized = NO; | |
03647350 | 30 | if (!initialized) |
7c798d00 SC |
31 | { |
32 | initialized = YES; | |
33 | wxOSXIPhoneClassAddWXMethods( self ); | |
34 | } | |
35 | } | |
36 | ||
37 | - (int) intValue | |
38 | { | |
39 | return [self isOn] ? 1 : 0; | |
40 | } | |
41 | ||
42 | - (void) setIntValue: (int) v | |
43 | { | |
44 | [self setOn:v != 0 animated:NO]; | |
45 | } | |
46 | ||
47 | @end | |
48 | ||
03647350 VZ |
49 | wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer, |
50 | wxWindowMac* WXUNUSED(parent), | |
51 | wxWindowID WXUNUSED(id), | |
7c798d00 | 52 | const wxString& WXUNUSED(label), |
03647350 | 53 | const wxPoint& pos, |
7c798d00 | 54 | const wxSize& size, |
03647350 VZ |
55 | long style, |
56 | long WXUNUSED(extraStyle)) | |
7c798d00 SC |
57 | { |
58 | CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; | |
59 | wxUISwitch* v = [[wxUISwitch alloc] initWithFrame:r]; | |
60 | ||
61 | // if (style & wxCHK_3STATE) | |
62 | // [v setAllowsMixedState:YES]; | |
03647350 | 63 | |
7c798d00 SC |
64 | wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v ); |
65 | return c; | |
66 | } | |
67 | ||
68 | #endif |