]>
Commit | Line | Data |
---|---|---|
da0634c1 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cocoa/checkbox.mm | |
3 | // Purpose: wxCheckBox | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2003/03/16 | |
7 | // RCS-ID: $Id: | |
8 | // Copyright: (c) 2003 David Elliott | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/app.h" | |
13 | #include "wx/checkbox.h" | |
14 | #include "wx/log.h" | |
15 | ||
16 | #import <AppKit/NSButton.h> | |
17 | #import <Foundation/NSString.h> | |
18 | ||
19 | IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) | |
20 | BEGIN_EVENT_TABLE(wxCheckBox, wxCheckBoxBase) | |
21 | END_EVENT_TABLE() | |
22 | WX_IMPLEMENT_COCOA_OWNER(wxCheckBox,NSButton,NSControl,NSView) | |
23 | ||
24 | bool wxCheckBox::Create(wxWindow *parent, wxWindowID winid, | |
25 | const wxString& label, | |
26 | const wxPoint& pos, | |
27 | const wxSize& size, | |
28 | long style, | |
29 | const wxValidator& validator, | |
30 | const wxString& name) | |
31 | { | |
32 | if(!CreateControl(parent,winid,pos,size,style,validator,name)) | |
33 | return false; | |
34 | m_cocoaNSView = NULL; | |
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]; | |
41 | ||
42 | if(m_parent) | |
43 | m_parent->CocoaAddChild(this); | |
44 | return true; | |
45 | } | |
46 | ||
47 | wxCheckBox::~wxCheckBox() | |
48 | { | |
570aaadf | 49 | DisassociateNSButton(m_cocoaNSView); |
da0634c1 DE |
50 | } |
51 | ||
52 | void wxCheckBox::SetValue(bool) | |
53 | { | |
54 | } | |
55 | ||
56 | bool wxCheckBox::GetValue() const | |
57 | { | |
58 | return false; | |
59 | } | |
60 | ||
61 | void wxCheckBox::Cocoa_wxNSButtonAction(void) | |
62 | { | |
63 | wxLogDebug("Checkbox"); | |
64 | } | |
65 |