1. moved m_majorDim duplicated in many ports to wxRadioBoxBase
[wxWidgets.git] / src / cocoa / radiobox.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        cocoa/radiobox.mm
3 // Purpose:     wxRadioBox
4 // Author:      David Elliott
5 // Modified by:
6 // Created:     2003/02/15
7 // RCS-ID:      $Id:
8 // Copyright:   (c) 2003 David Elliott
9 // Licence:     wxWidgets licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_RADIOBOX
15
16 #ifndef WX_PRECOMP
17     #include "wx/app.h"
18     #include "wx/radiobox.h"
19     #include "wx/arrstr.h"
20 #endif //WX_PRECOMP
21
22 #import <AppKit/NSView.h>
23
24 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
25 BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
26 END_EVENT_TABLE()
27 // WX_IMPLEMENT_COCOA_OWNER(wxRadioBox,NSTextField,NSControl,NSView)
28
29 bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid,
30             const wxString& title,
31             const wxPoint& pos,
32             const wxSize& size,
33             const wxArrayString& choices,
34             int majorDim,
35             long style, const wxValidator& validator,
36             const wxString& name)
37 {
38     wxCArrayString chs(choices);
39
40     return Create(parent, winid, title, pos, size, chs.GetCount(),
41                   chs.GetStrings(), majorDim, style, validator, name);
42 }
43
44 bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid,
45             const wxString& title,
46             const wxPoint& pos,
47             const wxSize& size,
48             int n, const wxString choices[],
49             int majorDim,
50             long style, const wxValidator& validator,
51             const wxString& name)
52 {
53     if(!CreateControl(parent,winid,pos,size,style,validator,name))
54         return false;
55     SetNSView([[NSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
56     [m_cocoaNSView release];
57     if(m_parent)
58         m_parent->CocoaAddChild(this);
59     SetInitialFrameRect(pos,size);
60
61     return true;
62 }
63
64 wxRadioBox::~wxRadioBox()
65 {
66 }
67
68     // selection
69 void wxRadioBox::SetSelection(int n)
70 {
71 }
72
73 int wxRadioBox::GetSelection() const
74 {
75     return 0;
76 }
77
78     // string access
79 int wxRadioBox::GetCount() const
80 {
81     return 0;
82 }
83
84 wxString wxRadioBox::GetString(int n) const
85 {
86     return wxEmptyString;
87 }
88
89 void wxRadioBox::SetString(int n, const wxString& label)
90 {
91 }
92
93     // change the individual radio button state
94 bool wxRadioBox::Enable(int n, bool enable)
95 {
96     // TODO
97     return false;
98 }
99
100 bool wxRadioBox::Show(int n, bool show)
101 {
102     // TODO
103     return false;
104 }
105
106 wxSize wxRadioBox::DoGetBestSize() const
107 {
108     return wxSize(50,50);
109 }
110
111 #endif
112