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"
16 #include "wx/radiobox.h"
20 #include "wx/arrstr.h"
23 #import <AppKit/NSView.h>
25 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
26 BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
28 // WX_IMPLEMENT_COCOA_OWNER(wxRadioBox,NSTextField,NSControl,NSView)
30 bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid,
31 const wxString& title,
34 const wxArrayString& choices,
36 long style, const wxValidator& validator,
39 wxCArrayString chs(choices);
41 return Create(parent, winid, title, pos, size, chs.GetCount(),
42 chs.GetStrings(), majorDim, style, validator, name);
45 bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid,
46 const wxString& title,
49 int n, const wxString choices[],
51 long style, const wxValidator& validator,
54 if(!CreateControl(parent,winid,pos,size,style,validator,name))
56 SetNSView([[NSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
57 [m_cocoaNSView release];
59 m_parent->CocoaAddChild(this);
60 SetInitialFrameRect(pos,size);
65 wxRadioBox::~wxRadioBox()
70 void wxRadioBox::SetSelection(int n)
74 int wxRadioBox::GetSelection() const
80 unsigned int wxRadioBox::GetCount() const
85 wxString wxRadioBox::GetString(unsigned int n) const
90 void wxRadioBox::SetString(unsigned int n, const wxString& label)
94 // change the individual radio button state
95 bool wxRadioBox::Enable(unsigned int n, bool enable)
101 bool wxRadioBox::Show(unsigned int n, bool show)
107 wxSize wxRadioBox::DoGetBestSize() const
109 return wxSize(50,50);