X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1a87edf286921de9b182f3d19adb6bb63ba85ebd..37d0bfa8756716ac456879bd64c57ec27fe20be5:/src/mac/carbon/radiobox.cpp diff --git a/src/mac/carbon/radiobox.cpp b/src/mac/carbon/radiobox.cpp index be78021cf1..07210463af 100644 --- a/src/mac/carbon/radiobox.cpp +++ b/src/mac/carbon/radiobox.cpp @@ -37,7 +37,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) //------------------------------------------------------------------------------------- // Default constructor BEGIN_EVENT_TABLE(wxRadioBox, wxControl) -EVT_RADIOBUTTON( -1 , wxRadioBox::OnRadioButton ) +EVT_RADIOBUTTON( wxID_ANY , wxRadioBox::OnRadioButton ) END_EVENT_TABLE() void wxRadioBox::OnRadioButton( wxCommandEvent &outer ) @@ -140,7 +140,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, if ( bounds.bottom <= bounds.top ) bounds.bottom = bounds.top + 100 ; - m_peer = new wxMacControl() ; + m_peer = new wxMacControl(this) ; verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") , true /*primary*/ , m_peer->GetControlRefAddr() ) ) ; @@ -199,7 +199,7 @@ bool wxRadioBox::Enable(int item, bool enable) int i; wxRadioButton *current; - if ((item < 0) || (item >= m_noItems)) + if (!IsValid(item)) return false; i = 0; @@ -231,7 +231,7 @@ wxString wxRadioBox::GetString(int item) const int i; wxRadioButton *current; - if ((item < 0) || (item >= m_noItems)) + if (!IsValid(item)) return wxEmptyString; i = 0; @@ -291,7 +291,7 @@ void wxRadioBox::SetString(int item,const wxString& label) int i; wxRadioButton *current; - if ((item < 0) || (item >= m_noItems)) + if (!IsValid(item)) return; i=0; current=m_radioButtonCycle; @@ -313,7 +313,7 @@ void wxRadioBox::SetSelection(int item) int i; wxRadioButton *current; - if ((item < 0) || (item >= m_noItems)) + if (!IsValid(item)) return; i=0; current=m_radioButtonCycle; @@ -338,7 +338,8 @@ bool wxRadioBox::Show(bool show) wxControl::Show(show); current=m_radioButtonCycle; - for (i=0;iShow(show); current=current->NextInCycle(); } @@ -350,20 +351,20 @@ bool wxRadioBox::Show(bool show) //------------------------------------------------------------------------------------- // Shows or hides the given button -void wxRadioBox::Show(int item, bool show) +bool wxRadioBox::Show(int item, bool show) { - int i; + int i; wxRadioButton *current; - if ((item < 0) || (item >= m_noItems)) - return; + if (!IsValid(item)) + return false; i=0; current=m_radioButtonCycle; while (i!=item) { i++; current=current->NextInCycle(); } - current->Show(show); + return current->Show(show); } //------------------------------------------------------------------------------------- @@ -419,9 +420,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) x_offset = x; y_offset = y; GetPosition(&x_current, &y_current); - if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + if ((x == wxDefaultCoord) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) x_offset = x_current; - if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + if ((y == wxDefaultCoord)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) y_offset = y_current; // define size @@ -444,7 +445,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) eachHeight[i] = (int)((3*eachHeight[i])/2); if (maxWidth