1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/checkbox.mm
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/checkbox.h"
16 #import <AppKit/NSButton.h>
17 #import <Foundation/NSString.h>
19 IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
20 BEGIN_EVENT_TABLE(wxCheckBox, wxCheckBoxBase)
22 WX_IMPLEMENT_COCOA_OWNER(wxCheckBox,NSButton,NSControl,NSView)
24 bool wxCheckBox::Create(wxWindow *parent, wxWindowID winid,
25 const wxString& label,
29 const wxValidator& validator,
32 if(!CreateControl(parent,winid,pos,size,style,validator,name))
35 NSRect cocoaRect = NSMakeRect(10,10,20,20);
36 SetNSButton([[NSButton alloc] initWithFrame: cocoaRect]);
37 [m_cocoaNSView release];
38 [GetNSButton() setButtonType: NSSwitchButton];
39 [GetNSButton() setTitle:[NSString stringWithCString: label.c_str()]];
40 [GetNSControl() sizeToFit];
43 m_parent->CocoaAddChild(this);
47 wxCheckBox::~wxCheckBox()
49 CocoaRemoveFromParent();
53 void wxCheckBox::SetValue(bool)
57 bool wxCheckBox::GetValue() const
62 void wxCheckBox::Cocoa_wxNSButtonAction(void)
64 wxLogDebug("Checkbox");