]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/radiobox.cpp
check default library directories in WX_PATH_FIND_LIBRARIES; do *not* add default...
[wxWidgets.git] / src / os2 / radiobox.cpp
index 3e52e2a3a2cabeac60baa62587c71a860cc629c4..1e026433fc50a2b5c58173d13797b93aa5bd3ade 100644 (file)
@@ -90,24 +90,22 @@ wxRadioBox::~wxRadioBox()
         delete[] m_pnRadioHeight;
 } // end of 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
 
     wxGetCharSize( m_hWnd
                   ,&nCx1
@@ -288,7 +286,7 @@ bool wxRadioBox::Create(
     wxColour                        vColour;
     LONG                            lColor;
 
     wxColour                        vColour;
     LONG                            lColor;
 
-    vColour.Set(wxString("BLACK"));
+    vColour.Set(wxString(wxT("BLACK")));
     m_backgroundColour = pParent->GetBackgroundColour();
     m_nSelectedButton = -1;
     m_nNoItems = 0;
     m_backgroundColour = pParent->GetBackgroundColour();
     m_nSelectedButton = -1;
     m_nNoItems = 0;
@@ -308,7 +306,7 @@ bool wxRadioBox::Create(
                        ,rsName
                       ))
         return false;
                        ,rsName
                       ))
         return false;
-    if (!OS2CreateControl( "STATIC"
+    if (!OS2CreateControl( wxT("STATIC")
                           ,SS_GROUPBOX
                           ,rPos
                           ,rSize
                           ,SS_GROUPBOX
                           ,rPos
                           ,rSize
@@ -339,7 +337,7 @@ bool wxRadioBox::Create(
 
         HWND                        hWndBtn = (WXHWND)::WinCreateWindow ( GetHwndOf(pParent)
                                                                          ,WC_BUTTON
 
         HWND                        hWndBtn = (WXHWND)::WinCreateWindow ( GetHwndOf(pParent)
                                                                          ,WC_BUTTON
-                                                                         ,asChoices[i]
+                                                                         ,(PSZ)asChoices[i].c_str()
                                                                          ,lStyleBtn
                                                                          ,0, 0, 0, 0
                                                                          ,GetWinHwnd(pParent)
                                                                          ,lStyleBtn
                                                                          ,0, 0, 0, 0
                                                                          ,GetWinHwnd(pParent)
@@ -474,9 +472,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;
     if (nYy < 0)
         nYy = 0;
         nYy = nCurrentY;
     if (nYy < 0)
         nYy = 0;
@@ -646,7 +644,6 @@ void wxRadioBox::DoSetSize(
                           ,(LONG)nMaxHeight
                           ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
                          );
                           ,(LONG)nMaxHeight
                           ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
                          );
-        GetParent()->Refresh();
         //
         // Where do we put the next button?
         //
         //
         // Where do we put the next button?
         //
@@ -671,7 +668,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()") );
 
     ::WinEnableWindow((HWND) m_ahRadioButtons[nItem], bEnable);
                  wxT("invalid item in wxRadioBox::Enable()") );
 
     ::WinEnableWindow((HWND) m_ahRadioButtons[nItem], bEnable);
@@ -715,7 +712,7 @@ wxString wxRadioBox::GetLabel(
   int                               nItem
 ) const
 {
   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
 
     return wxGetWindowText(m_ahRadioButtons[nItem]);
 } // end of wxRadioBox::GetLabel
@@ -755,10 +752,8 @@ wxSize wxRadioBox::GetMaxButtonSize() const
         if (nHeightMax < nHeight )
             nHeightMax = nHeight;
     }
         if (nHeightMax < nHeight )
             nHeightMax = nHeight;
     }
-    return(wxSize( nWidthMax
-                  ,nHeightMax
-                 )
-          );
+    wxSize maxsize( nWidthMax, nHeightMax);
+    return maxsize;
 } // end of wxRadioBox::GetMaxButtonSize
 
 int wxRadioBox::GetNumHor() const
 } // end of wxRadioBox::GetMaxButtonSize
 
 int wxRadioBox::GetNumHor() const
@@ -785,13 +780,11 @@ int wxRadioBox::GetNumVer() const
     }
 } // end of wxRadioBox::GetNumVer
 
     }
 } // end of wxRadioBox::GetNumVer
 
-void wxRadioBox::GetPosition(
-  int*                              pnX
-, int*                              pnY
-) const
+void wxRadioBox::GetPosition( int* pnX,
+                              int* WXUNUSED(pnY) ) const
 {
     wxWindowOS2*                    pParent = GetParent();
 {
     wxWindowOS2*                    pParent = GetParent();
-    RECT                            vRect = { -1, -1, -1, -1 };;
+    RECT                            vRect = { -1, -1, -1, -1 };
     POINTL                          vPoint;
     int                             i;
 
     POINTL                          vPoint;
     int                             i;
 
@@ -893,23 +886,17 @@ wxString wxRadioBox::GetStringSelection() const
     return sResult;
 } // end of wxRadioBox::GetStringSelection
 
     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);
     nExtraHeight = nCy1;
 
     nHeight = GetNumVer() * rSizeBtn.y + (2 * nCy1);
@@ -926,46 +913,37 @@ wxSize wxRadioBox::GetTotalButtonSize(
     if (nWidthLabel > nWidth)
         nWidth = nWidthLabel;
 
     if (nWidthLabel > nWidth)
         nWidth = nWidthLabel;
 
-    return(wxSize( nWidth
-                  ,nHeight
-                 )
-          );
+    wxSize total( nWidth, nHeight );
+    return total;
 } // end of wxRadioBox::GetTotalButtonSize
 
 } // 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);
 
 
     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());
 
 
     ::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
 
     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)
     {
 
     if (uCmd == BN_CLICKED)
     {
@@ -1052,9 +1030,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[nNum], BM_SETCHECK, (MPARAM)1, (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);
@@ -1067,10 +1045,10 @@ 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], (PSZ)rsLabel.c_str());
 } // end of wxRadioBox::SetString
 
 bool wxRadioBox::SetStringSelection(
 } // end of wxRadioBox::SetString
 
 bool wxRadioBox::SetStringSelection(
@@ -1103,15 +1081,17 @@ bool wxRadioBox::Show(
 } // end of wxRadioBox::Show
 
 // Show a specific button
 } // end of wxRadioBox::Show
 
 // Show a specific button
-void wxRadioBox::Show(
+bool wxRadioBox::Show(
   int                               nItem
 , bool                              bShow
 )
 {
   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);
                  wxT("invalid item in wxRadioBox::Show()") );
 
     ::WinShowWindow((HWND)m_ahRadioButtons[nItem], bShow);
+
+    return true;
 } // end of wxRadioBox::Show
 
 void wxRadioBox::SubclassRadioButton(
 } // end of wxRadioBox::Show
 
 void wxRadioBox::SubclassRadioButton(
@@ -1234,4 +1214,3 @@ MRESULT EXPENTRY wxRadioBoxWndProc(
                              )
            );
 } // end of wxRadioBoxWndProc
                              )
            );
 } // end of wxRadioBoxWndProc
-