]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/radiobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "radiobox.h"
16 #include "wx/radiobox.h"
18 #if !USE_SHARED_LIBRARY
19 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox
, wxControl
)
23 wxRadioBox::wxRadioBox()
25 m_selectedButton
= -1;
31 bool wxRadioBox::Create(wxWindow
*parent
, wxWindowID id
, const wxString
& title
,
32 const wxPoint
& pos
, const wxSize
& size
,
33 int n
, const wxString choices
[],
34 int majorDim
, long style
,
35 const wxValidator
& val
, const wxString
& name
)
37 m_selectedButton
= -1;
43 parent
->AddChild(this);
45 m_windowStyle
= (long&)style
;
48 m_windowId
= NewControlId();
52 m_noRowsOrCols
= majorDim
;
57 m_majorDim
= majorDim
;
60 // TODO create radiobox
65 wxRadioBox::~wxRadioBox()
70 wxString
wxRadioBox::GetLabel(int item
) const
76 void wxRadioBox::SetLabel(int item
, const wxString
& label
)
81 int wxRadioBox::FindString(const wxString
& s
) const
87 void wxRadioBox::SetSelection(int n
)
89 if ((n
< 0) || (n
>= m_noItems
))
96 // Get single selection, for single choice list items
97 int wxRadioBox::GetSelection() const
99 return m_selectedButton
;
102 // Find string for position
103 wxString
wxRadioBox::GetString(int n
) const
109 void wxRadioBox::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
114 void wxRadioBox::GetSize(int *width
, int *height
) const
119 void wxRadioBox::GetPosition(int *x
, int *y
) const
124 wxString
wxRadioBox::GetLabel() const
130 void wxRadioBox::SetLabel(const wxString
& label
)
135 void wxRadioBox::SetFocus()
140 bool wxRadioBox::Show(bool show
)
146 // Enable a specific button
147 void wxRadioBox::Enable(int item
, bool enable
)
152 // Enable all controls
153 void wxRadioBox::Enable(bool enable
)
155 wxControl::Enable(enable
);
160 // Show a specific button
161 void wxRadioBox::Show(int item
, bool show
)
166 // For single selection items only
167 wxString
wxRadioBox::GetStringSelection () const
169 int sel
= GetSelection ();
171 return this->GetString (sel
);
176 bool wxRadioBox::SetStringSelection (const wxString
& s
)
178 int sel
= FindString (s
);
188 void wxRadioBox::Command (wxCommandEvent
& event
)
190 SetSelection (event
.m_commandInt
);
191 ProcessCommand (event
);