1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/radiobox.mm
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWidgets licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
18 #include "wx/radiobox.h"
19 #include "wx/arrstr.h"
22 #import <AppKit/NSView.h>
24 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
25 BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
27 // WX_IMPLEMENT_COCOA_OWNER(wxRadioBox,NSTextField,NSControl,NSView)
29 bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid,
30 const wxString& title,
33 const wxArrayString& choices,
35 long style, const wxValidator& validator,
38 wxCArrayString chs(choices);
40 return Create(parent, winid, title, pos, size, chs.GetCount(),
41 chs.GetStrings(), majorDim, style, validator, name);
44 bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid,
45 const wxString& title,
48 int n, const wxString choices[],
50 long style, const wxValidator& validator,
53 if(!CreateControl(parent,winid,pos,size,style,validator,name))
55 SetNSView([[NSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
56 [m_cocoaNSView release];
58 m_parent->CocoaAddChild(this);
59 SetInitialFrameRect(pos,size);
64 wxRadioBox::~wxRadioBox()
69 void wxRadioBox::SetSelection(int n)
73 int wxRadioBox::GetSelection() const
79 size_t wxRadioBox::GetCount() const
84 wxString wxRadioBox::GetString(int n) const
89 void wxRadioBox::SetString(int n, const wxString& label)
93 // change the individual radio button state
94 bool wxRadioBox::Enable(int n, bool enable)
100 bool wxRadioBox::Show(int n, bool show)
106 wxSize wxRadioBox::DoGetBestSize() const
108 return wxSize(50,50);