X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/687706f5e722ac8a39172024f794ae0ffbd190e2..1b14412585d582acde42d422c8cd5d23d4daef14:/src/msw/radiobox.cpp diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 6e928f08ad..d34034c6b1 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -177,7 +177,7 @@ bool wxRadioBox::Create(wxWindow *parent, m_radioWidth[i] = m_radioHeight[i] = wxDefaultCoord; long styleBtn = BS_AUTORADIOBUTTON | WS_TABSTOP | WS_CHILD | WS_VISIBLE; - if ( i == 0 && style == 0 ) + if ( i == 0 ) styleBtn |= WS_GROUP; long newId = NewControlId(); @@ -366,7 +366,7 @@ int wxRadioBox::GetNumHor() const void wxRadioBox::SetString(int item, const wxString& label) { - wxCHECK_RET( item >= 0 && item < GetCount(), wxT("invalid radiobox index") ); + wxCHECK_RET( IsValid(item), wxT("invalid radiobox index") ); m_radioWidth[item] = m_radioHeight[item] = wxDefaultCoord; @@ -376,7 +376,7 @@ void wxRadioBox::SetString(int item, const wxString& label) void wxRadioBox::SetSelection(int N) { - wxCHECK_RET( (N >= 0) && (N < GetCount()), wxT("invalid radiobox index") ); + wxCHECK_RET( IsValid(N), wxT("invalid radiobox index") ); // unselect the old button if ( m_selectedButton != wxNOT_FOUND ) @@ -391,7 +391,7 @@ void wxRadioBox::SetSelection(int N) // Find string for position wxString wxRadioBox::GetString(int item) const { - wxCHECK_MSG( item >= 0 && item < GetCount(), wxEmptyString, + wxCHECK_MSG( IsValid(item), wxEmptyString, wxT("invalid radiobox index") ); return wxGetWindowText((*m_radioButtons)[item]); @@ -408,21 +408,25 @@ void wxRadioBox::SetFocus() } // Enable a specific button -void wxRadioBox::Enable(int item, bool enable) +bool wxRadioBox::Enable(int item, bool enable) { - wxCHECK_RET( item >= 0 && item < GetCount(), + wxCHECK_MSG( IsValid(item), false, wxT("invalid item in wxRadioBox::Enable()") ); - ::EnableWindow((*m_radioButtons)[item], enable); + BOOL ret = ::EnableWindow((*m_radioButtons)[item], enable); + + return (ret == 0) == enable; } // Show a specific button -void wxRadioBox::Show(int item, bool show) +bool wxRadioBox::Show(int item, bool show) { - wxCHECK_RET( item >= 0 && item < GetCount(), + wxCHECK_MSG( IsValid(item), false, wxT("invalid item in wxRadioBox::Show()") ); - ::ShowWindow((*m_radioButtons)[item], show ? SW_SHOW : SW_HIDE); + BOOL ret = ::ShowWindow((*m_radioButtons)[item], show ? SW_SHOW : SW_HIDE); + + return (ret != 0) == show; } WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(wxRadioBox, wxStaticBox, m_radioButtons) @@ -477,7 +481,7 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const int width = GetNumHor() * (sizeBtn.x + cx1) + cx1; // Add extra space under the label, if it exists. - if (!wxControl::GetLabel().IsEmpty()) + if (!wxControl::GetLabel().empty()) height += cy1/2; // and also wide enough for its label @@ -561,7 +565,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) y_offset += cy1; // Add extra space under the label, if it exists. - if (!wxControl::GetLabel().IsEmpty()) + if (!wxControl::GetLabel().empty()) y_offset += cy1/2; int startX = x_offset;