]> git.saurik.com Git - wxWidgets.git/blame - src/osx/iphone/checkbox.mm
adding support for wxCANCEL_DEFAULT
[wxWidgets.git] / src / osx / iphone / checkbox.mm
CommitLineData
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
ffb317d4 37@end
7c798d00 38
ffb317d4 39class wxCheckBoxIPhoneImpl : public wxWidgetIPhoneImpl
7c798d00 40{
ffb317d4
SC
41public:
42 wxCheckBoxIPhoneImpl(wxWindowMac *wxpeer, UISwitch *v)
43 : wxWidgetIPhoneImpl(wxpeer, v)
44 {
45 m_control = v;
46 }
47
48 wxInt32 GetValue() const
49 {
50 return [m_control isOn] ? 1 : 0;
51 }
52
53 void SetValue( wxInt32 v )
54 {
55 [m_control setOn:v != 0 animated:NO];
56 }
57private:
58 UISwitch* m_control;
59};
7c798d00 60
03647350
VZ
61wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
62 wxWindowMac* WXUNUSED(parent),
63 wxWindowID WXUNUSED(id),
7c798d00 64 const wxString& WXUNUSED(label),
03647350 65 const wxPoint& pos,
7c798d00 66 const wxSize& size,
03647350
VZ
67 long style,
68 long WXUNUSED(extraStyle))
7c798d00
SC
69{
70 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
71 wxUISwitch* v = [[wxUISwitch alloc] initWithFrame:r];
72
73// if (style & wxCHK_3STATE)
74// [v setAllowsMixedState:YES];
03647350 75
ffb317d4 76 wxCheckBoxIPhoneImpl* c = new wxCheckBoxIPhoneImpl( wxpeer, v );
7c798d00
SC
77 return c;
78}
79
80#endif