]> git.saurik.com Git - wxWidgets.git/blame - src/osx/cocoa/checkbox.mm
A few checks for null pointers to avoid problems during app shutdown.
[wxWidgets.git] / src / osx / cocoa / checkbox.mm
CommitLineData
f033830e
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/osx/cocoa/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
19wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
20 wxWindowMac* parent,
21 wxWindowID id,
22 const wxString& label,
23 const wxPoint& pos,
24 const wxSize& size,
25 long style,
26 long extraStyle)
27{
28 NSView* sv = (wxpeer->GetParent()->GetHandle() );
29
dbeddfb9 30 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
f033830e
SC
31 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
32
33 [v setButtonType:NSSwitchButton];
34 if (style & wxCHK_3STATE)
35 [v setAllowsMixedState:YES];
36
37 [sv addSubview:v];
38 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
39 [v setImplementation:c];
40 return c;
41}
42
43#endif