]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/radiobox.mm
don't reset the selection after event was vetoed if there is no old selection
[wxWidgets.git] / src / cocoa / radiobox.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/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 #include "wx/radiobox.h"
17
18 #ifndef WX_PRECOMP
19 #include "wx/app.h"
20 #include "wx/arrstr.h"
21 #endif //WX_PRECOMP
22
23 #import <AppKit/NSView.h>
24
25 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
26 BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
27 END_EVENT_TABLE()
28 // WX_IMPLEMENT_COCOA_OWNER(wxRadioBox,NSTextField,NSControl,NSView)
29
30 bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid,
31 const wxString& title,
32 const wxPoint& pos,
33 const wxSize& size,
34 const wxArrayString& choices,
35 int majorDim,
36 long style, const wxValidator& validator,
37 const wxString& name)
38 {
39 wxCArrayString chs(choices);
40
41 return Create(parent, winid, title, pos, size, chs.GetCount(),
42 chs.GetStrings(), majorDim, style, validator, name);
43 }
44
45 bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid,
46 const wxString& title,
47 const wxPoint& pos,
48 const wxSize& size,
49 int n, const wxString choices[],
50 int majorDim,
51 long style, const wxValidator& validator,
52 const wxString& name)
53 {
54 if(!CreateControl(parent,winid,pos,size,style,validator,name))
55 return false;
56 SetNSView([[NSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
57 [m_cocoaNSView release];
58 if(m_parent)
59 m_parent->CocoaAddChild(this);
60 SetInitialFrameRect(pos,size);
61
62 return true;
63 }
64
65 wxRadioBox::~wxRadioBox()
66 {
67 }
68
69 // selection
70 void wxRadioBox::SetSelection(int n)
71 {
72 }
73
74 int wxRadioBox::GetSelection() const
75 {
76 return 0;
77 }
78
79 // string access
80 unsigned int wxRadioBox::GetCount() const
81 {
82 return 0;
83 }
84
85 wxString wxRadioBox::GetString(unsigned int n) const
86 {
87 return wxEmptyString;
88 }
89
90 void wxRadioBox::SetString(unsigned int n, const wxString& label)
91 {
92 }
93
94 // change the individual radio button state
95 bool wxRadioBox::Enable(unsigned int n, bool enable)
96 {
97 // TODO
98 return false;
99 }
100
101 bool wxRadioBox::Show(unsigned int n, bool show)
102 {
103 // TODO
104 return false;
105 }
106
107 wxSize wxRadioBox::DoGetBestSize() const
108 {
109 return wxSize(50,50);
110 }
111
112 #endif