implementing checkbox using UISwitch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61518 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ac1665bdb9
commit
7c798d002e
68
src/osx/iphone/checkbox.mm
Normal file
68
src/osx/iphone/checkbox.mm
Normal file
@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/osx/iphone/checkbox.mm
|
||||
// Purpose: wxCheckBox
|
||||
// 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
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_CHECKBOX
|
||||
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
@interface wxUISwitch : UISwitch
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation wxUISwitch
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
static BOOL initialized = NO;
|
||||
if (!initialized)
|
||||
{
|
||||
initialized = YES;
|
||||
wxOSXIPhoneClassAddWXMethods( self );
|
||||
}
|
||||
}
|
||||
|
||||
- (int) intValue
|
||||
{
|
||||
return [self isOn] ? 1 : 0;
|
||||
}
|
||||
|
||||
- (void) setIntValue: (int) v
|
||||
{
|
||||
[self setOn:v != 0 animated:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
|
||||
wxWindowMac* WXUNUSED(parent),
|
||||
wxWindowID WXUNUSED(id),
|
||||
const wxString& WXUNUSED(label),
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
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 );
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user