]>
Commit | Line | Data |
---|---|---|
da0634c1 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cocoa/radiobut.mm | |
3 | // Purpose: wxRadioButton | |
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/radiobut.h" | |
14 | #include "wx/log.h" | |
15 | ||
16 | #import <AppKit/NSButton.h> | |
c8cae94c | 17 | #include "wx/cocoa/string.h" |
e51c36de | 18 | #include "wx/cocoa/autorelease.h" |
da0634c1 DE |
19 | |
20 | IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl) | |
21 | // wxRadioButtonBase == wxControl | |
22 | BEGIN_EVENT_TABLE(wxRadioButton, wxControl) | |
23 | END_EVENT_TABLE() | |
24 | WX_IMPLEMENT_COCOA_OWNER(wxRadioButton,NSButton,NSControl,NSView) | |
25 | ||
26 | bool wxRadioButton::Create(wxWindow *parent, wxWindowID winid, | |
27 | const wxString& label, | |
28 | const wxPoint& pos, | |
29 | const wxSize& size, | |
30 | long style, | |
31 | const wxValidator& validator, | |
32 | const wxString& name) | |
33 | { | |
e51c36de | 34 | wxAutoNSAutoreleasePool pool; |
da0634c1 DE |
35 | if(!CreateControl(parent,winid,pos,size,style,validator,name)) |
36 | return false; | |
37 | m_cocoaNSView = NULL; | |
8d656ea9 | 38 | SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]); |
da0634c1 DE |
39 | [m_cocoaNSView release]; |
40 | [GetNSButton() setButtonType: NSRadioButton]; | |
c8cae94c | 41 | [GetNSButton() setTitle:wxNSStringWithWxString(label)]; |
da0634c1 DE |
42 | [GetNSControl() sizeToFit]; |
43 | ||
44 | if(m_parent) | |
45 | m_parent->CocoaAddChild(this); | |
8d656ea9 DE |
46 | SetInitialFrameRect(pos,size); |
47 | ||
da0634c1 DE |
48 | return true; |
49 | } | |
50 | ||
51 | wxRadioButton::~wxRadioButton() | |
52 | { | |
570aaadf | 53 | DisassociateNSButton(m_cocoaNSView); |
da0634c1 DE |
54 | } |
55 | ||
56 | void wxRadioButton::SetValue(bool) | |
57 | { | |
58 | } | |
59 | ||
60 | bool wxRadioButton::GetValue() const | |
61 | { | |
62 | return false; | |
63 | } | |
64 | ||
65 | void wxRadioButton::Cocoa_wxNSButtonAction(void) | |
66 | { | |
67 | wxLogDebug("wxRadioButton"); | |
68 | } | |
69 |