]>
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 int wxRadioBox::FindString(const wxString
& s
) const
76 void wxRadioBox::SetSelection(int n
)
78 if ((n
< 0) || (n
>= m_noItems
))
85 // Get single selection, for single choice list items
86 int wxRadioBox::GetSelection() const
88 return m_selectedButton
;
91 // Find string for position
92 wxString
wxRadioBox::GetString(int n
) const
98 void wxRadioBox::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
100 wxControl::DoSetSize( x
, y
, width
, height
, sizeFlags
) ;
103 void wxRadioBox::GetSize(int *width
, int *height
) const
105 wxControl::GetSize( width
, height
) ;
108 void wxRadioBox::GetPosition(int *x
, int *y
) const
110 wxControl::GetPosition( x
, y
) ;
113 wxString
wxRadioBox::GetLabel( int item
) const
119 void wxRadioBox::SetLabel(int item
, const wxString
& label
)
124 void wxRadioBox::SetFocus()
129 bool wxRadioBox::Show(bool show
)
131 return wxControl::Show( show
) ;
134 // Enable a specific button
135 void wxRadioBox::Enable(int item
, bool enable
)
139 // Enable all controls
140 bool wxRadioBox::Enable(bool enable
)
142 return wxControl::Enable(enable
);
145 // Show a specific button
146 void wxRadioBox::Show(int item
, bool show
)
151 // For single selection items only
152 wxString
wxRadioBox::GetStringSelection () const
154 int sel
= GetSelection ();
156 return this->GetString (sel
);
161 bool wxRadioBox::SetStringSelection (const wxString
& s
)
163 int sel
= FindString (s
);
173 void wxRadioBox::Command (wxCommandEvent
& event
)
175 SetSelection (event
.m_commandInt
);
176 ProcessCommand (event
);