]> git.saurik.com Git - wxWidgets.git/blob - src/osx/iphone/checkbox.mm
Implement setFont on the iOS port of wxStaticText.
[wxWidgets.git] / src / osx / iphone / checkbox.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/iphone/checkbox.mm
3 // Purpose: wxCheckBox
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 2008-08-20
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #if wxUSE_CHECKBOX
14
15 #include "wx/checkbox.h"
16 #include "wx/osx/private.h"
17
18 @interface wxUISwitch : UISwitch
19 {
20 }
21
22 @end
23
24 @implementation wxUISwitch
25
26 + (void)initialize
27 {
28 static BOOL initialized = NO;
29 if (!initialized)
30 {
31 initialized = YES;
32 wxOSXIPhoneClassAddWXMethods( self );
33 }
34 }
35
36 @end
37
38 class wxCheckBoxIPhoneImpl : public wxWidgetIPhoneImpl
39 {
40 public:
41 wxCheckBoxIPhoneImpl(wxWindowMac *wxpeer, UISwitch *v)
42 : wxWidgetIPhoneImpl(wxpeer, v)
43 {
44 m_control = v;
45 }
46
47 wxInt32 GetValue() const
48 {
49 return [m_control isOn] ? 1 : 0;
50 }
51
52 void SetValue( wxInt32 v )
53 {
54 [m_control setOn:v != 0 animated:NO];
55 }
56 private:
57 UISwitch* m_control;
58 };
59
60 wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
61 wxWindowMac* WXUNUSED(parent),
62 wxWindowID WXUNUSED(id),
63 const wxString& WXUNUSED(label),
64 const wxPoint& pos,
65 const wxSize& size,
66 long style,
67 long WXUNUSED(extraStyle))
68 {
69 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
70 wxUISwitch* v = [[wxUISwitch alloc] initWithFrame:r];
71
72 // if (style & wxCHK_3STATE)
73 // [v setAllowsMixedState:YES];
74
75 wxCheckBoxIPhoneImpl* c = new wxCheckBoxIPhoneImpl( wxpeer, v );
76 return c;
77 }
78
79 #endif