]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/radiobut.mm
Added wxUSE_COMBOBOX guard
[wxWidgets.git] / src / cocoa / radiobut.mm
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>
17 #include "wx/cocoa/string.h"
18
19 IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
20 // wxRadioButtonBase == wxControl
21 BEGIN_EVENT_TABLE(wxRadioButton, wxControl)
22 END_EVENT_TABLE()
23 WX_IMPLEMENT_COCOA_OWNER(wxRadioButton,NSButton,NSControl,NSView)
24
25 bool wxRadioButton::Create(wxWindow *parent, wxWindowID winid,
26 const wxString& label,
27 const wxPoint& pos,
28 const wxSize& size,
29 long style,
30 const wxValidator& validator,
31 const wxString& name)
32 {
33 if(!CreateControl(parent,winid,pos,size,style,validator,name))
34 return false;
35 m_cocoaNSView = NULL;
36 NSRect cocoaRect = NSMakeRect(10,10,20,20);
37 SetNSButton([[NSButton alloc] initWithFrame: cocoaRect]);
38 [m_cocoaNSView release];
39 [GetNSButton() setButtonType: NSRadioButton];
40 [GetNSButton() setTitle:wxNSStringWithWxString(label)];
41 [GetNSControl() sizeToFit];
42
43 if(m_parent)
44 m_parent->CocoaAddChild(this);
45 return true;
46 }
47
48 wxRadioButton::~wxRadioButton()
49 {
50 DisassociateNSButton(m_cocoaNSView);
51 }
52
53 void wxRadioButton::SetValue(bool)
54 {
55 }
56
57 bool wxRadioButton::GetValue() const
58 {
59 return false;
60 }
61
62 void wxRadioButton::Cocoa_wxNSButtonAction(void)
63 {
64 wxLogDebug("wxRadioButton");
65 }
66