]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/radiobox.cpp
3393009f47ea2200ae0cca2a62018f192a4e182a
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
)
111 wxControl::SetSize( x
, y
, width
, height
, 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
)
143 return wxWindow::Show( show
) ;
146 // Enable a specific button
147 void wxRadioBox::Enable(int item
, bool enable
)
149 wxControl::Enable(enable
);
153 // Enable all controls
154 void wxRadioBox::Enable(bool enable
)
156 wxControl::Enable(enable
);
161 // Show a specific button
162 void wxRadioBox::Show(int item
, bool show
)
167 // For single selection items only
168 wxString
wxRadioBox::GetStringSelection () const
170 int sel
= GetSelection ();
172 return this->GetString (sel
);
177 bool wxRadioBox::SetStringSelection (const wxString
& s
)
179 int sel
= FindString (s
);
189 void wxRadioBox::Command (wxCommandEvent
& event
)
191 SetSelection (event
.m_commandInt
);
192 ProcessCommand (event
);