1/////////////////////////////////////////////////////////////////////////////
2// Name:        src/osx/cocoa/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
18wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
19                                    wxWindowMac* WXUNUSED(parent),
20                                    wxWindowID WXUNUSED(id),
21                                    const wxString& WXUNUSED(label),
22                                    const wxPoint& pos,
23                                    const wxSize& size,
24                                    long style,
25                                    long WXUNUSED(extraStyle))
26{
27    NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
28    wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
29
30    [v setButtonType:NSSwitchButton];
31    if (style & wxALIGN_RIGHT)
32        [v setImagePosition:NSImageRight];
33    if (style & wxCHK_3STATE)
34        [v setAllowsMixedState:YES];
35    [v setAlignment: (style & wxALIGN_RIGHT) ?
36                     NSRightTextAlignment : NSLeftTextAlignment];
37
38    wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
39    return c;
40}
41
42#endif
43