]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/iphone/checkbox.mm
avoid setting initial position if it was not specified, broken in r70734
[wxWidgets.git] / src / osx / iphone / checkbox.mm
index efe49c628122ef6feb2657717d59acf741839122..de9f8c0876eb2b640cac64d441df9b2f8f51987e 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     2008-08-20
-// RCS-ID:      $Id: checkbox.mm 54129 2008-06-11 19:30:52Z SC $
 // Copyright:   (c) Stefan Csomor
 // Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 + (void)initialize
 {
     static BOOL initialized = NO;
-    if (!initialized) 
+    if (!initialized)
     {
         initialized = YES;
         wxOSXIPhoneClassAddWXMethods( self );
     }
 }
 
-- (int) intValue
-{
-    return [self isOn] ? 1 : 0;
-}
+@end
 
-- (void) setIntValue: (int) v
+class wxCheckBoxIPhoneImpl : public wxWidgetIPhoneImpl
 {
-    [self setOn:v != 0 animated:NO];
-}
-
-@end
+public:
+    wxCheckBoxIPhoneImpl(wxWindowMac *wxpeer, UISwitch *v)
+    : wxWidgetIPhoneImpl(wxpeer, v)
+    {
+        m_control = v;
+    }
+    
+    wxInt32  GetValue() const
+    {
+        return [m_control isOn] ? 1 : 0;
+    }
+    
+    void SetValue( wxInt32 v ) 
+    {
+        [m_control setOn:v != 0 animated:NO];
+    }
+private:
+    UISwitch* m_control;
+};
 
-wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer, 
-                                    wxWindowMac* WXUNUSED(parent), 
-                                    wxWindowID WXUNUSED(id), 
+wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
+                                    wxWindowMac* WXUNUSED(parent),
+                                    wxWindowID WXUNUSED(id),
                                     const wxString& WXUNUSED(label),
-                                    const wxPoint& pos, 
+                                    const wxPoint& pos,
                                     const wxSize& size,
-                                    long style, 
-                                    long WXUNUSED(extraStyle)) 
+                                    long style,
+                                    long WXUNUSED(extraStyle))
 {
     CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
     wxUISwitch* v = [[wxUISwitch alloc] initWithFrame:r];
 
 //    if (style & wxCHK_3STATE)
 //        [v setAllowsMixedState:YES];
-        
-    wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v );
+
+    wxCheckBoxIPhoneImpl* c = new wxCheckBoxIPhoneImpl( wxpeer, v );
     return c;
 }