X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..8d36b2167df7e86ecfc58d148eaf6abe0a5b7971:/src/os2/radiobox.cpp diff --git a/src/os2/radiobox.cpp b/src/os2/radiobox.cpp index 73a67c1d7a..1f789a294f 100644 --- a/src/os2/radiobox.cpp +++ b/src/os2/radiobox.cpp @@ -6,7 +6,7 @@ // Created: 10/12/99 // RCS-ID: $Id$ // Copyright: (c) David Webster -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". @@ -75,7 +75,7 @@ wxRadioBox::wxRadioBox() wxRadioBox::~wxRadioBox() { - m_isBeingDeleted = TRUE; + m_isBeingDeleted = true; if (m_ahRadioButtons) { @@ -107,11 +107,12 @@ void wxRadioBox::AdjustButtons( int nStartY; int nMaxWidth; int nMaxHeight; + wxFont vFont = GetFont(); wxGetCharSize( m_hWnd ,&nCx1 ,&nCy1 - ,&GetFont() + ,&vFont ); vMaxSize = GetMaxButtonSize(); nMaxWidth = vMaxSize.x; @@ -246,9 +247,9 @@ bool wxRadioBox::ContainsHWND( for (i = 0; i < nCount; i++) { if (GetRadioButtons()[i] == hWnd) - return TRUE; + return true; } - return FALSE; + return false; } // end of wxRadioBox::ContainsHWND bool wxRadioBox::Create( @@ -306,14 +307,14 @@ bool wxRadioBox::Create( ,rVal ,rsName )) - return FALSE; + return false; if (!OS2CreateControl( "STATIC" ,SS_GROUPBOX ,rPos ,rSize ,rsTitle )) - return FALSE; + return false; wxAssociateWinWithHandle(m_hWnd, this); @@ -362,7 +363,7 @@ bool wxRadioBox::Create( ); if (!hWndBtn) { - return FALSE; + return false; } m_ahRadioButtons[i] = (WXHWND)hWndBtn; SubclassRadioButton((WXHWND)hWndBtn); @@ -424,7 +425,7 @@ bool wxRadioBox::Create( ,rSize.x ,rSize.y ); - return TRUE; + return true; } // end of wxRadioBox::Create wxSize wxRadioBox::DoGetBestSize() const @@ -463,6 +464,7 @@ void wxRadioBox::DoSetSize( int nTotHeight; int nStartX; int nStartY; + wxFont vFont = GetFont(); m_nSizeFlags = nSizeFlags; GetPosition( &nCurrentX @@ -472,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; @@ -484,7 +486,7 @@ void wxRadioBox::DoSetSize( wxGetCharSize( m_hWnd ,&nCx1 ,&nCy1 - ,&GetFont() + ,&vFont ); // @@ -667,15 +669,13 @@ void wxRadioBox::DoSetSize( } } // end of wxRadioBox::DoSetSize -void wxRadioBox::Enable( - int nItem -, bool bEnable -) +bool wxRadioBox::Enable(int nItem, bool bEnable) { - wxCHECK_RET( nItem >= 0 && nItem < m_nNoItems, + wxCHECK_MSG( IsValid(nItem), false, wxT("invalid item in wxRadioBox::Enable()") ); ::WinEnableWindow((HWND) m_ahRadioButtons[nItem], bEnable); + return true; } // end of wxRadioBox::Enable bool wxRadioBox::Enable( @@ -683,10 +683,10 @@ bool wxRadioBox::Enable( ) { if ( !wxControl::Enable(bEnable) ) - return FALSE; + return false; for (int i = 0; i < m_nNoItems; i++) ::WinEnableWindow((HWND)m_ahRadioButtons[i], bEnable); - return TRUE; + return true; } // end of wxRadioBox::Enable int wxRadioBox::FindString( @@ -715,7 +715,7 @@ wxString wxRadioBox::GetLabel( int nItem ) const { - wxCHECK_MSG(nItem >= 0 && nItem < m_nNoItems, wxT(""), wxT("invalid radiobox index") ); + wxCHECK_MSG( IsValid(nItem), wxEmptyString, wxT("invalid radiobox index") ); return wxGetWindowText(m_ahRadioButtons[nItem]); } // end of wxRadioBox::GetLabel @@ -903,11 +903,12 @@ wxSize wxRadioBox::GetTotalButtonSize( int nHeight; int nWidth; int nWidthLabel; + wxFont vFont = GetFont(); wxGetCharSize( m_hWnd ,&nCx1 ,&nCy1 - ,(wxFont*)&GetFont() + ,&vFont ); nExtraHeight = nCy1; @@ -969,7 +970,7 @@ bool wxRadioBox::OS2Command( if (uCmd == BN_CLICKED) { if (wId == GetId()) - return TRUE; + return true; for (int i = 0; i < m_nNoItems; i++) @@ -985,17 +986,17 @@ bool wxRadioBox::OS2Command( // // Just ignore it // - return FALSE; + return false; } if (nSelectedButton != m_nSelectedButton) { m_nSelectedButton = nSelectedButton; SendNotificationEvent(); } - return TRUE; + return true; } else - return FALSE; + return false; } // end of wxRadioBox::OS2Command void wxRadioBox::SendNotificationEvent() @@ -1030,7 +1031,7 @@ bool wxRadioBox::SetFont( // // Nothing to do // - return FALSE; + return false; } // // Also set the font of our radio buttons @@ -1044,16 +1045,16 @@ bool wxRadioBox::SetFont( ); ::WinInvalidateRect(hWndBtn, NULL, FALSE); } - return TRUE; + return true; } // end of wxRadioBox::SetFont 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); @@ -1066,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()); @@ -1081,10 +1082,10 @@ bool wxRadioBox::SetStringSelection( if (nSel > -1) { SetSelection(nSel); - return TRUE; + return true; } else - return FALSE; + return false; } // end of wxRadioBox::SetStringSelection bool wxRadioBox::Show( @@ -1092,25 +1093,27 @@ bool wxRadioBox::Show( ) { if (!wxControl::Show(bShow)) - return FALSE; + return false; for (int i = 0; i < m_nNoItems; i++) { ::WinShowWindow((HWND)m_ahRadioButtons[i], (BOOL)bShow); } - return TRUE; + return true; } // 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( @@ -1157,7 +1160,7 @@ MRESULT wxRadioBtnWndProc( ,QWL_USER ); USHORT uVk = SHORT2FROMMP((MPARAM)lParam); - bool bProcessed = TRUE; + bool bProcessed = true; wxDirection eDir; switch(uVk) @@ -1179,7 +1182,7 @@ MRESULT wxRadioBtnWndProc( break; default: - bProcessed = FALSE; + bProcessed = false; // // Just to suppress the compiler warning