]>
git.saurik.com Git - wxWidgets.git/blob - src/qt/radiobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "radiobox.h"
16 #include "wx/radiobox.h"
18 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox
, wxControl
)
21 wxRadioBox::wxRadioBox()
23 m_selectedButton
= -1;
29 bool wxRadioBox::Create(wxWindow
*parent
, wxWindowID id
, const wxString
& title
,
30 const wxPoint
& pos
, const wxSize
& size
,
31 int n
, const wxString choices
[],
32 int majorDim
, long style
,
33 const wxValidator
& val
, const wxString
& name
)
35 m_selectedButton
= -1;
41 parent
->AddChild(this);
43 m_windowStyle
= (long&)style
;
46 m_windowId
= NewControlId();
50 m_noRowsOrCols
= majorDim
;
55 m_majorDim
= majorDim
;
58 // TODO create radiobox
63 wxRadioBox::~wxRadioBox()
68 wxString
wxRadioBox::GetLabel(int item
) const
74 void wxRadioBox::SetLabel(int item
, const wxString
& label
)
79 int wxRadioBox::FindString(const wxString
& s
) const
85 void wxRadioBox::SetSelection(int n
)
87 if ((n
< 0) || (n
>= m_noItems
))
94 // Get single selection, for single choice list items
95 int wxRadioBox::GetSelection() const
97 return m_selectedButton
;
100 // Find string for position
101 wxString
wxRadioBox::GetString(int n
) const
107 void wxRadioBox::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
112 void wxRadioBox::GetSize(int *width
, int *height
) const
117 void wxRadioBox::GetPosition(int *x
, int *y
) const
122 wxString
wxRadioBox::GetLabel() const
128 void wxRadioBox::SetLabel(const wxString
& label
)
133 void wxRadioBox::SetFocus()
138 bool wxRadioBox::Show(bool show
)
144 // Enable a specific button
145 void wxRadioBox::Enable(int item
, bool enable
)
150 // Enable all controls
151 void wxRadioBox::Enable(bool enable
)
153 wxControl::Enable(enable
);
158 // Show a specific button
159 void wxRadioBox::Show(int item
, bool show
)
164 // For single selection items only
165 wxString
wxRadioBox::GetStringSelection () const
167 int sel
= GetSelection ();
169 return this->GetString (sel
);
174 bool wxRadioBox::SetStringSelection (const wxString
& s
)
176 int sel
= FindString (s
);
186 void wxRadioBox::Command (wxCommandEvent
& event
)
188 SetSelection (event
.m_commandInt
);
189 ProcessCommand (event
);