X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dad7b12aee25f7f061b4876d3dc10e5657497b2a..6eae1f7d48196dea9968c8e478f28a4166bd0fe9:/src/mac/carbon/radiobox.cpp diff --git a/src/mac/carbon/radiobox.cpp b/src/mac/carbon/radiobox.cpp index 9df4bb6cb4..685ce0a654 100644 --- a/src/mac/carbon/radiobox.cpp +++ b/src/mac/carbon/radiobox.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: radiobox.cpp +// Name: src/mac/carbon/radiobox.cpp // Purpose: wxRadioBox // Author: Stefan Csomor // Modified by: JS Lair (99/11/15) first implementation @@ -9,11 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "radioboxbase.h" -#pragma implementation "radiobox.h" -#endif - //------------------------------------------------------------------------------------- // headers //------------------------------------------------------------------------------------- @@ -28,16 +23,14 @@ #include "wx/radiobut.h" #include "wx/mac/uma.h" -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) -#endif //------------------------------------------------------------------------------------- // ¥ wxRadioBox() //------------------------------------------------------------------------------------- // 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 ) @@ -57,7 +50,6 @@ wxRadioBox::wxRadioBox() { m_noItems = 0; m_noRowsOrCols = 0; - m_majorDim = 0 ; m_radioButtonCycle = NULL; } @@ -126,11 +118,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, m_noRowsOrCols = majorDim; m_radioButtonCycle = NULL; - if (majorDim==0) - m_majorDim = n ; - else - m_majorDim = majorDim ; - + SetMajorDim(majorDim == 0 ? n : majorDim, style); m_label = label ; @@ -199,7 +187,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 +219,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 +279,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 +301,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 +326,8 @@ bool wxRadioBox::Show(bool show) wxControl::Show(show); current=m_radioButtonCycle; - for (i=0;iShow(show); current=current->NextInCycle(); } @@ -350,20 +339,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 +408,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 +433,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) eachHeight[i] = (int)((3*eachHeight[i])/2); if (maxWidth