X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cc11cc69186f64a7729cd3b5a892dd487b9f6f0c..6cef0db28018fd2644ee4e38af715872e5242459:/src/mac/carbon/radiobox.cpp diff --git a/src/mac/carbon/radiobox.cpp b/src/mac/carbon/radiobox.cpp index eaefe7429e..69ce082c1b 100644 --- a/src/mac/carbon/radiobox.cpp +++ b/src/mac/carbon/radiobox.cpp @@ -15,15 +15,18 @@ #include "wx/radiobox.h" -#include "wx/arrstr.h" -#include "wx/radiobut.h" +#ifndef WX_PRECOMP + #include "wx/radiobut.h" + #include "wx/arrstr.h" +#endif + #include "wx/mac/uma.h" IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) BEGIN_EVENT_TABLE(wxRadioBox, wxControl) -EVT_RADIOBUTTON( wxID_ANY , wxRadioBox::OnRadioButton ) + EVT_RADIOBUTTON( wxID_ANY , wxRadioBox::OnRadioButton ) END_EVENT_TABLE() @@ -104,7 +107,7 @@ bool wxRadioBox::Create( wxWindow *parent, SetMajorDim( majorDim == 0 ? n : majorDim, style ); - m_label = label; + m_labelOrig = m_label = label; Rect bounds = wxMacGetBoundsForControl( this, pos, size ); if ( bounds.right <= bounds.left ) @@ -125,7 +128,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxRadioButton *radBtn = new wxRadioButton( this, wxID_ANY, - wxStripMenuCodes(choices[i]), + GetLabelText(choices[i]), wxPoint( 5, 20 * i + 10 ), wxDefaultSize, i == 0 ? wxRB_GROUP : 0 ); @@ -178,6 +181,22 @@ bool wxRadioBox::Enable(unsigned int item, bool enable) return current->Enable( enable ); } +bool wxRadioBox::IsItemEnabled(unsigned int item) const +{ + if (!IsValid( item )) + return false; + + unsigned int i = 0; + wxRadioButton *current = m_radioButtonCycle; + while (i != item) + { + i++; + current = current->NextInCycle(); + } + + return current->IsEnabled(); +} + // Returns the radiobox label // wxString wxRadioBox::GetLabel() const @@ -306,6 +325,23 @@ bool wxRadioBox::Show(unsigned int item, bool show) return current->Show( show ); } +bool wxRadioBox::IsItemShown(unsigned int item) const +{ + if (!IsValid( item )) + return false; + + unsigned int i = 0; + wxRadioButton *current = m_radioButtonCycle; + while (i != item) + { + i++; + current = current->NextInCycle(); + } + + return current->IsShown(); +} + + // Simulates the effect of the user issuing a command to the item // void wxRadioBox::Command( wxCommandEvent& event ) @@ -318,14 +354,11 @@ void wxRadioBox::Command( wxCommandEvent& event ) // void wxRadioBox::SetFocus() { - int i; wxRadioButton *current; - i = 0; current = m_radioButtonCycle; while (!current->GetValue()) { - i++; current = current->NextInCycle(); }