1 /////////////////////////////////////////////////////////////////////////////
 
   2 // Name:        cocoa/radiobut.mm
 
   3 // Purpose:     wxRadioButton
 
   4 // Author:      David Elliott
 
   8 // Copyright:   (c) 2003 David Elliott
 
   9 // Licence:     wxWindows license
 
  10 /////////////////////////////////////////////////////////////////////////////
 
  13 #include "wx/radiobut.h"
 
  16 #import <AppKit/NSButton.h>
 
  17 #include "wx/cocoa/string.h"
 
  18 #include "wx/cocoa/autorelease.h"
 
  20 IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
 
  21 // wxRadioButtonBase == wxControl
 
  22 BEGIN_EVENT_TABLE(wxRadioButton, wxControl)
 
  24 WX_IMPLEMENT_COCOA_OWNER(wxRadioButton,NSButton,NSControl,NSView)
 
  26 bool wxRadioButton::Create(wxWindow *parent, wxWindowID winid,
 
  27            const wxString& label,
 
  31            const wxValidator& validator,
 
  34     wxAutoNSAutoreleasePool pool;
 
  35     if(!CreateControl(parent,winid,pos,size,style,validator,name))
 
  38     NSRect cocoaRect = NSMakeRect(10,10,20,20);
 
  39     SetNSButton([[NSButton alloc] initWithFrame: cocoaRect]);
 
  40     [m_cocoaNSView release];
 
  41     [GetNSButton() setButtonType: NSRadioButton];
 
  42     [GetNSButton() setTitle:wxNSStringWithWxString(label)];
 
  43     [GetNSControl() sizeToFit];
 
  46         m_parent->CocoaAddChild(this);
 
  50 wxRadioButton::~wxRadioButton()
 
  52     DisassociateNSButton(m_cocoaNSView);
 
  55 void wxRadioButton::SetValue(bool)
 
  59 bool wxRadioButton::GetValue() const
 
  64 void wxRadioButton::Cocoa_wxNSButtonAction(void)
 
  66     wxLogDebug("wxRadioButton");