From fa50c0e3bfe333bf527177ada29fe24fbc6f6353 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Wed, 23 Feb 2005 16:52:31 +0000 Subject: [PATCH] Linup API of wxRadioBox::Show on all ports. Move wxRadioBox::IsValid from wxUniversal to base class (+ GTK which do not use base class) and use it where applicable. Minor source cleaning. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32329 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/radiobox.h | 6 ++---- include/wx/palmos/radiobox.h | 2 +- include/wx/univ/radiobox.h | 5 +---- src/os2/radiobox.cpp | 20 +++++++++++--------- src/palmos/radiobox.cpp | 5 ++++- src/univ/radiobox.cpp | 6 +++--- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/wx/os2/radiobox.h b/include/wx/os2/radiobox.h index f1309b5bf3..955dc12e42 100644 --- a/include/wx/os2/radiobox.h +++ b/include/wx/os2/radiobox.h @@ -116,10 +116,8 @@ public: ,WXWORD wId ); void SendNotificationEvent(void); - virtual void Show( int nItem - ,bool bShow = true - ) ; - bool Show(bool bShow); + virtual bool Show(int nItem, bool bShow = true); + virtual bool Show(bool bShow = true); MRESULT WindowProc( WXUINT uMsg ,WXWPARAM wParam ,WXLPARAM lParam diff --git a/include/wx/palmos/radiobox.h b/include/wx/palmos/radiobox.h index c69f7a951f..f98c57b851 100644 --- a/include/wx/palmos/radiobox.h +++ b/include/wx/palmos/radiobox.h @@ -100,7 +100,7 @@ public: virtual bool Enable(int n, bool enable = true); virtual bool Show(bool show = true); - virtual void Show(int n, bool show = true); + virtual bool Show(int n, bool show = true); virtual void SetLabel(const wxString& label); virtual wxString GetLabel(); diff --git a/include/wx/univ/radiobox.h b/include/wx/univ/radiobox.h index 59a06918b3..67cf04bc1e 100644 --- a/include/wx/univ/radiobox.h +++ b/include/wx/univ/radiobox.h @@ -96,7 +96,7 @@ public: virtual void SetString(int n, const wxString& label); virtual bool Enable(int n, bool enable = true); - virtual void Show(int n, bool show = true); + virtual bool Show(int n, bool show = true); // we also override the wxControl methods to avoid virtual function hiding virtual bool Enable(bool enable = true); @@ -132,9 +132,6 @@ protected: // common part of all ctors void Init(); - // check that the index is valid - bool IsValid(int n) const { return n >= 0 && n < GetCount(); } - // sets m_majorDim and calculate m_numCols and m_numRows void SetMajorDim(int majorDim); diff --git a/src/os2/radiobox.cpp b/src/os2/radiobox.cpp index 3e52e2a3a2..1f789a294f 100644 --- a/src/os2/radiobox.cpp +++ b/src/os2/radiobox.cpp @@ -474,9 +474,9 @@ void wxRadioBox::DoSetSize( ,&nHeightOld ); - if (nX == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + if (nX == wxDefaultCoord && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) nXx = nCurrentX; - if (nY == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + if (nY == wxDefaultCoord && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) nYy = nCurrentY; if (nYy < 0) nYy = 0; @@ -671,7 +671,7 @@ void wxRadioBox::DoSetSize( bool wxRadioBox::Enable(int nItem, bool bEnable) { - wxCHECK_MSG( nItem >= 0 && nItem < m_nNoItems, false, + wxCHECK_MSG( IsValid(nItem), false, wxT("invalid item in wxRadioBox::Enable()") ); ::WinEnableWindow((HWND) m_ahRadioButtons[nItem], bEnable); @@ -715,7 +715,7 @@ wxString wxRadioBox::GetLabel( int nItem ) const { - wxCHECK_MSG(nItem >= 0 && nItem < m_nNoItems, wxEmptyString, wxT("invalid radiobox index") ); + wxCHECK_MSG( IsValid(nItem), wxEmptyString, wxT("invalid radiobox index") ); return wxGetWindowText(m_ahRadioButtons[nItem]); } // end of wxRadioBox::GetLabel @@ -1052,9 +1052,9 @@ void wxRadioBox::SetSelection( int nNum ) { - wxCHECK_RET( (nNum >= 0) && (nNum < m_nNoItems), wxT("invalid radiobox index") ); + wxCHECK_RET( IsValid(nNum), wxT("invalid radiobox index") ); - if (m_nSelectedButton >= 0 && m_nSelectedButton < m_nNoItems) + if ( IsValid(m_nSelectedButton) ) ::WinSendMsg((HWND)m_ahRadioButtons[m_nSelectedButton], BM_SETCHECK, (MPARAM)0, (MPARAM)0); ::WinSendMsg((HWND)m_ahRadioButtons[nNum], BM_SETCHECK, (MPARAM)1, (MPARAM)0); @@ -1067,7 +1067,7 @@ void wxRadioBox::SetString( , const wxString& rsLabel ) { - wxCHECK_RET( nItem >= 0 && nItem < m_nNoItems, wxT("invalid radiobox index") ); + wxCHECK_RET( IsValid(nItem), wxT("invalid radiobox index") ); m_pnRadioWidth[nItem] = m_pnRadioHeight[nItem] = -1; ::WinSetWindowText((HWND)m_ahRadioButtons[nItem], rsLabel.c_str()); @@ -1103,15 +1103,17 @@ bool wxRadioBox::Show( } // end of wxRadioBox::Show // Show a specific button -void wxRadioBox::Show( +bool wxRadioBox::Show( int nItem , bool bShow ) { - wxCHECK_RET( nItem >= 0 && nItem < m_nNoItems, + wxCHECK_MSG( IsValid(nItem), false, wxT("invalid item in wxRadioBox::Show()") ); ::WinShowWindow((HWND)m_ahRadioButtons[nItem], bShow); + + return true; } // end of wxRadioBox::Show void wxRadioBox::SubclassRadioButton( diff --git a/src/palmos/radiobox.cpp b/src/palmos/radiobox.cpp index 1031b08ccb..91febb5485 100644 --- a/src/palmos/radiobox.cpp +++ b/src/palmos/radiobox.cpp @@ -354,12 +354,15 @@ bool wxRadioBox::Enable(int item, bool enable) bool wxRadioBox::Show(bool show) { + // TODO return false; } // Show a specific button -void wxRadioBox::Show(int item, bool show) +bool wxRadioBox::Show(int item, bool show) { + // TODO + return false; } wxString wxRadioBox::GetLabel() diff --git a/src/univ/radiobox.cpp b/src/univ/radiobox.cpp index a9e5d1a34c..bb6aa6eda1 100644 --- a/src/univ/radiobox.cpp +++ b/src/univ/radiobox.cpp @@ -329,11 +329,11 @@ bool wxRadioBox::Enable(int n, bool enable) return m_buttons[n]->Enable(enable); } -void wxRadioBox::Show(int n, bool show) +bool wxRadioBox::Show(int n, bool show) { - wxCHECK_RET( IsValid(n), _T("invalid index in wxRadioBox::Show") ); + wxCHECK_MSG( IsValid(n), false, _T("invalid index in wxRadioBox::Show") ); - m_buttons[n]->Show(show); + return m_buttons[n]->Show(show); } // ---------------------------------------------------------------------------- -- 2.47.2