]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/radiobox.cpp
Realize remap code cleanup
[wxWidgets.git] / src / os2 / radiobox.cpp
index fe73e0207019e2243a4761c8cfe1f128e4292867..0a2a31fde13614b1d2013e8c24fa5ec6c045298f 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        radiobox.cpp
+// Name:        src/os2/radiobox.cpp
 // Purpose:     wxRadioBox
 // Author:      David Webster
 // Modified by:
@@ -90,24 +90,22 @@ wxRadioBox::~wxRadioBox()
         delete[] m_pnRadioHeight;
 } // end of wxRadioBox::~wxRadioBox
 
-void wxRadioBox::AdjustButtons(
-  int                               nX
-, int                               nY
-, int                               nWidth
-, int                               nHeight
-, int                               nSizeFlags
-)
+void wxRadioBox::AdjustButtons( int nX,
+                                int nY,
+                                int nWidth,
+                                int nHeight,
+                                int WXUNUSED(nSizeFlags) )
 {
-    wxSize                          vMaxSize;
-    int                             nXOffset = nX;
-    int                             nYOffset = nY + nHeight;
-    int                             nCx1;
-    int                             nCy1;
-    int                             nStartX;
-    int                             nStartY;
-    int                             nMaxWidth;
-    int                             nMaxHeight;
-    wxFont                          vFont = GetFont();
+    wxSize vMaxSize;
+    int    nXOffset = nX;
+    int    nYOffset = nY + nHeight;
+    int    nCx1;
+    int    nCy1;
+    int    nStartX;
+    int    nStartY;
+    int    nMaxWidth;
+    int    nMaxHeight;
+    wxFont vFont = GetFont();
 
     wxGetCharSize( m_hWnd
                   ,&nCx1
@@ -378,16 +376,16 @@ bool wxRadioBox::Create(
     //
     // Create a dummy radio control to end the group.
     //
-    (void)::WinCreateWindow ( GetHwndOf(pParent)
-                             ,WC_BUTTON
-                             ,""
-                             ,WS_GROUP | BS_AUTORADIOBUTTON
-                             ,0, 0, 0, 0
-                             ,GetWinHwnd(pParent)
-                             ,HWND_TOP
-                             ,(HMENU)NewControlId()
-                             ,NULL
-                             ,NULL
+    (void)::WinCreateWindow ( GetHwndOf(pParent),
+                              WC_BUTTON,
+                              "",
+                              WS_GROUP | BS_AUTORADIOBUTTON,
+                              0, 0, 0, 0,
+                              GetWinHwnd(pParent),
+                              HWND_TOP,
+                              (HMENU)NewControlId(),
+                              NULL,
+                              NULL
                             );
     SetFont(*wxSMALL_FONT);
     fnWndProcRadioBox = (WXFARPROC)::WinSubclassWindow( GetHwnd()
@@ -688,18 +686,6 @@ bool wxRadioBox::Enable(
     return true;
 } // end of wxRadioBox::Enable
 
-int wxRadioBox::FindString(
-  const wxString&                   rsStr
-) const
-{
-    for (int i = 0; i < m_nNoItems; i++)
-    {
-        if (rsStr == wxGetWindowText(m_ahRadioButtons[i]) )
-            return i;
-    }
-    return wxNOT_FOUND;
-} // end of wxRadioBox::FindString
-
 int wxRadioBox::GetColumnCount() const
 {
     return GetNumHor();
@@ -710,9 +696,7 @@ int wxRadioBox::GetCount() const
     return m_nNoItems;
 } // end of wxRadioBox::GetCount
 
-wxString wxRadioBox::GetLabel(
-  int                               nItem
-) const
+wxString wxRadioBox::GetLabel(int nItem) const
 {
     wxCHECK_MSG( IsValid(nItem), wxEmptyString, wxT("invalid radiobox index") );
 
@@ -754,10 +738,8 @@ wxSize wxRadioBox::GetMaxButtonSize() const
         if (nHeightMax < nHeight )
             nHeightMax = nHeight;
     }
-    return(wxSize( nWidthMax
-                  ,nHeightMax
-                 )
-          );
+    wxSize maxsize( nWidthMax, nHeightMax);
+    return maxsize;
 } // end of wxRadioBox::GetMaxButtonSize
 
 int wxRadioBox::GetNumHor() const
@@ -784,13 +766,11 @@ int wxRadioBox::GetNumVer() const
     }
 } // end of wxRadioBox::GetNumVer
 
-void wxRadioBox::GetPosition(
-  int*                              pnX
-, int*                              pnY
-) const
+void wxRadioBox::GetPosition( int* pnX,
+                              int* WXUNUSED(pnY) ) const
 {
     wxWindowOS2*                    pParent = GetParent();
-    RECT                            vRect = { -1, -1, -1, -1 };;
+    RECT                            vRect = { -1, -1, -1, -1 };
     POINTL                          vPoint;
     int                             i;
 
@@ -844,10 +824,7 @@ int wxRadioBox::GetSelection() const
     return m_nSelectedButton;
 } // end of wxRadioBox::GetSelection
 
-void wxRadioBox::GetSize(
-  int*                              pnWidth
-, int*                              pnHeight
-) const
+void wxRadioBox::GetSize( int* pnWidth, int* pnHeight ) const
 {
     RECT                            vRect;
     int                             i;
@@ -892,23 +869,17 @@ wxString wxRadioBox::GetStringSelection() const
     return sResult;
 } // end of wxRadioBox::GetStringSelection
 
-wxSize wxRadioBox::GetTotalButtonSize(
-  const wxSize&                     rSizeBtn
-) const
+wxSize wxRadioBox::GetTotalButtonSize( const wxSize& rSizeBtn ) const
 {
-    int                             nCx1;
-    int                             nCy1;
-    int                             nExtraHeight;
-    int                             nHeight;
-    int                             nWidth;
-    int                             nWidthLabel;
-    wxFont                          vFont = GetFont();
-
-    wxGetCharSize( m_hWnd
-                  ,&nCx1
-                  ,&nCy1
-                  ,&vFont
-                 );
+    int    nCx1;
+    int    nCy1;
+    int    nExtraHeight;
+    int    nHeight;
+    int    nWidth;
+    int    nWidthLabel;
+    wxFont vFont = GetFont();
+
+    wxGetCharSize( m_hWnd, &nCx1, &nCy1, &vFont );
     nExtraHeight = nCy1;
 
     nHeight = GetNumVer() * rSizeBtn.y + (2 * nCy1);
@@ -917,54 +888,42 @@ wxSize wxRadioBox::GetTotalButtonSize(
     //
     // And also wide enough for its label
     //
-    GetTextExtent( GetTitle()
-                  ,&nWidthLabel
-                  ,NULL
-                 );
+    GetTextExtent( GetLabel(), &nWidthLabel, NULL );
     nWidthLabel += RADIO_SIZE;
     if (nWidthLabel > nWidth)
         nWidth = nWidthLabel;
 
-    return(wxSize( nWidth
-                  ,nHeight
-                 )
-          );
+    wxSize total( nWidth, nHeight );
+    return total;
 } // end of wxRadioBox::GetTotalButtonSize
 
-WXHBRUSH wxRadioBox::OnCtlColor(
-  WXHDC                             hwinDC
-, WXHWND                            hWnd
-, WXUINT                            uCtlColor
-, WXUINT                            uMessage
-, WXWPARAM                          wParam
-, WXLPARAM                          lParam
-)
+WXHBRUSH wxRadioBox::OnCtlColor( WXHDC    hwinDC,
+                                 WXHWND   WXUNUSED(hWnd),
+                                 WXUINT   WXUNUSED(uCtlColor),
+                                 WXUINT   WXUNUSED(uMessage),
+                                 WXWPARAM WXUNUSED(wParam),
+                                 WXLPARAM WXUNUSED(lParam) )
 {
-    HPS                             hPS = (HPS)hwinDC; // pass in a PS handle in OS/2
+    HPS hPS = (HPS)hwinDC; // pass in a PS handle in OS/2
 
     if (GetParent()->GetTransparentBackground())
         ::GpiSetBackMix(hPS, BM_LEAVEALONE);
     else
         ::GpiSetBackMix(hPS, BM_OVERPAINT);
 
-    wxColour                        vColBack = GetBackgroundColour();
+    wxColour vColBack = GetBackgroundColour();
 
     ::GpiSetBackColor(hPS, vColBack.GetPixel());
     ::GpiSetColor(hPS, vColBack.GetPixel());
 
-
-    wxBrush*                        pBrush = wxTheBrushList->FindOrCreateBrush( vColBack
-                                                                               ,wxSOLID
-                                                                              );
+    wxBrush* pBrush = wxTheBrushList->FindOrCreateBrush( vColBack, wxSOLID );
     return ((WXHBRUSH)pBrush->GetResourceHandle());
 } // end of wxRadioBox::OnCtlColor
 
-bool wxRadioBox::OS2Command(
-  WXUINT                            uCmd
-, WXWORD                            wId
-)
+bool wxRadioBox::OS2Command( WXUINT uCmd,
+                             WXWORD wId)
 {
-    int                             nSelectedButton = -1;
+    int nSelectedButton = -1;
 
     if (uCmd == BN_CLICKED)
     {
@@ -1072,11 +1031,9 @@ void wxRadioBox::SetString(
     ::WinSetWindowText((HWND)m_ahRadioButtons[nItem], (PSZ)rsLabel.c_str());
 } // end of wxRadioBox::SetString
 
-bool wxRadioBox::SetStringSelection(
-  const wxString&                   rsStr
-)
+bool wxRadioBox::SetStringSelection(const wxString& rsStr)
 {
-    int                             nSel = FindString(rsStr);
+    int nSel = FindString(rsStr);
 
     if (nSel > -1)
     {
@@ -1221,18 +1178,14 @@ MRESULT wxRadioBtnWndProc(
                             );
 } // end of wxRadioBtnWndProc
 
-MRESULT EXPENTRY wxRadioBoxWndProc(
-  HWND                              hWnd
-, UINT                              uMessage
-, MPARAM                            wParam
-, MPARAM                            lParam
-)
+MRESULT EXPENTRY wxRadioBoxWndProc( HWND hWnd,
+                                    UINT uMessage,
+                                    MPARAM wParam,
+                                    MPARAM lParam )
 {
-    return (fnWndProcRadioBox( hWnd
-                              ,(ULONG)uMessage
-                              ,(MPARAM)wParam
-                              ,(MPARAM)lParam
-                             )
+    return (fnWndProcRadioBox( hWnd,
+                               (ULONG)uMessage,
+                               (MPARAM)wParam,
+                               (MPARAM)lParam )
            );
 } // end of wxRadioBoxWndProc
-