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
This commit is contained in:
Włodzimierz Skiba
2005-02-23 16:52:31 +00:00
parent 55866801f0
commit fa50c0e3bf
6 changed files with 22 additions and 22 deletions

View File

@@ -116,10 +116,8 @@ public:
,WXWORD wId ,WXWORD wId
); );
void SendNotificationEvent(void); void SendNotificationEvent(void);
virtual void Show( int nItem virtual bool Show(int nItem, bool bShow = true);
,bool bShow = true virtual bool Show(bool bShow = true);
) ;
bool Show(bool bShow);
MRESULT WindowProc( WXUINT uMsg MRESULT WindowProc( WXUINT uMsg
,WXWPARAM wParam ,WXWPARAM wParam
,WXLPARAM lParam ,WXLPARAM lParam

View File

@@ -100,7 +100,7 @@ public:
virtual bool Enable(int n, bool enable = true); virtual bool Enable(int n, bool enable = true);
virtual bool Show(bool show = 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 void SetLabel(const wxString& label);
virtual wxString GetLabel(); virtual wxString GetLabel();

View File

@@ -96,7 +96,7 @@ public:
virtual void SetString(int n, const wxString& label); virtual void SetString(int n, const wxString& label);
virtual bool Enable(int n, bool enable = true); 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 // we also override the wxControl methods to avoid virtual function hiding
virtual bool Enable(bool enable = true); virtual bool Enable(bool enable = true);
@@ -132,9 +132,6 @@ protected:
// common part of all ctors // common part of all ctors
void Init(); 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 // sets m_majorDim and calculate m_numCols and m_numRows
void SetMajorDim(int majorDim); void SetMajorDim(int majorDim);

View File

@@ -474,9 +474,9 @@ void wxRadioBox::DoSetSize(
,&nHeightOld ,&nHeightOld
); );
if (nX == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) if (nX == wxDefaultCoord && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
nXx = nCurrentX; nXx = nCurrentX;
if (nY == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) if (nY == wxDefaultCoord && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
nYy = nCurrentY; nYy = nCurrentY;
if (nYy < 0) if (nYy < 0)
nYy = 0; nYy = 0;
@@ -671,7 +671,7 @@ void wxRadioBox::DoSetSize(
bool wxRadioBox::Enable(int nItem, bool bEnable) 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()") ); wxT("invalid item in wxRadioBox::Enable()") );
::WinEnableWindow((HWND) m_ahRadioButtons[nItem], bEnable); ::WinEnableWindow((HWND) m_ahRadioButtons[nItem], bEnable);
@@ -715,7 +715,7 @@ wxString wxRadioBox::GetLabel(
int nItem int nItem
) const ) 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]); return wxGetWindowText(m_ahRadioButtons[nItem]);
} // end of wxRadioBox::GetLabel } // end of wxRadioBox::GetLabel
@@ -1052,9 +1052,9 @@ void wxRadioBox::SetSelection(
int nNum 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[m_nSelectedButton], BM_SETCHECK, (MPARAM)0, (MPARAM)0);
::WinSendMsg((HWND)m_ahRadioButtons[nNum], BM_SETCHECK, (MPARAM)1, (MPARAM)0); ::WinSendMsg((HWND)m_ahRadioButtons[nNum], BM_SETCHECK, (MPARAM)1, (MPARAM)0);
@@ -1067,7 +1067,7 @@ void wxRadioBox::SetString(
, const wxString& rsLabel , 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; m_pnRadioWidth[nItem] = m_pnRadioHeight[nItem] = -1;
::WinSetWindowText((HWND)m_ahRadioButtons[nItem], rsLabel.c_str()); ::WinSetWindowText((HWND)m_ahRadioButtons[nItem], rsLabel.c_str());
@@ -1103,15 +1103,17 @@ bool wxRadioBox::Show(
} // end of wxRadioBox::Show } // end of wxRadioBox::Show
// Show a specific button // Show a specific button
void wxRadioBox::Show( bool wxRadioBox::Show(
int nItem int nItem
, bool bShow , bool bShow
) )
{ {
wxCHECK_RET( nItem >= 0 && nItem < m_nNoItems, wxCHECK_MSG( IsValid(nItem), false,
wxT("invalid item in wxRadioBox::Show()") ); wxT("invalid item in wxRadioBox::Show()") );
::WinShowWindow((HWND)m_ahRadioButtons[nItem], bShow); ::WinShowWindow((HWND)m_ahRadioButtons[nItem], bShow);
return true;
} // end of wxRadioBox::Show } // end of wxRadioBox::Show
void wxRadioBox::SubclassRadioButton( void wxRadioBox::SubclassRadioButton(

View File

@@ -354,12 +354,15 @@ bool wxRadioBox::Enable(int item, bool enable)
bool wxRadioBox::Show(bool show) bool wxRadioBox::Show(bool show)
{ {
// TODO
return false; return false;
} }
// Show a specific button // Show a specific button
void wxRadioBox::Show(int item, bool show) bool wxRadioBox::Show(int item, bool show)
{ {
// TODO
return false;
} }
wxString wxRadioBox::GetLabel() wxString wxRadioBox::GetLabel()

View File

@@ -329,11 +329,11 @@ bool wxRadioBox::Enable(int n, bool enable)
return m_buttons[n]->Enable(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);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------