]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/radiobox.cpp
adding OS level Window Menu by default
[wxWidgets.git] / src / os2 / radiobox.cpp
index 283fd9cdbf01aa6ed025f887d83558990566a644..fe73e0207019e2243a4761c8cfe1f128e4292867 100644 (file)
@@ -75,7 +75,7 @@ wxRadioBox::wxRadioBox()
 
 wxRadioBox::~wxRadioBox()
 {
 
 wxRadioBox::~wxRadioBox()
 {
-    m_isBeingDeleted = TRUE;
+    m_isBeingDeleted = true;
 
     if (m_ahRadioButtons)
     {
 
     if (m_ahRadioButtons)
     {
@@ -247,9 +247,9 @@ bool wxRadioBox::ContainsHWND(
     for (i = 0; i < nCount; i++)
     {
         if (GetRadioButtons()[i] == hWnd)
     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(
 } // end of wxRadioBox::ContainsHWND
 
 bool wxRadioBox::Create(
@@ -288,7 +288,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;
@@ -307,14 +307,14 @@ bool wxRadioBox::Create(
                        ,rVal
                        ,rsName
                       ))
                        ,rVal
                        ,rsName
                       ))
-        return FALSE;
-    if (!OS2CreateControl( "STATIC"
+        return false;
+    if (!OS2CreateControl( wxT("STATIC")
                           ,SS_GROUPBOX
                           ,rPos
                           ,rSize
                           ,rsTitle
                          ))
                           ,SS_GROUPBOX
                           ,rPos
                           ,rSize
                           ,rsTitle
                          ))
-        return FALSE;
+        return false;
 
     wxAssociateWinWithHandle(m_hWnd, this);
 
 
     wxAssociateWinWithHandle(m_hWnd, this);
 
@@ -339,7 +339,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)
@@ -363,7 +363,7 @@ bool wxRadioBox::Create(
                          );
         if (!hWndBtn)
         {
                          );
         if (!hWndBtn)
         {
-            return FALSE;
+            return false;
         }
         m_ahRadioButtons[i] = (WXHWND)hWndBtn;
         SubclassRadioButton((WXHWND)hWndBtn);
         }
         m_ahRadioButtons[i] = (WXHWND)hWndBtn;
         SubclassRadioButton((WXHWND)hWndBtn);
@@ -425,7 +425,7 @@ bool wxRadioBox::Create(
             ,rSize.x
             ,rSize.y
            );
             ,rSize.x
             ,rSize.y
            );
-    return TRUE;
+    return true;
 } // end of wxRadioBox::Create
 
 wxSize wxRadioBox::DoGetBestSize() const
 } // end of wxRadioBox::Create
 
 wxSize wxRadioBox::DoGetBestSize() const
@@ -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;
     if (nYy < 0)
         nYy = 0;
         nYy = nCurrentY;
     if (nYy < 0)
         nYy = 0;
@@ -646,7 +646,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?
         //
@@ -669,15 +668,13 @@ void wxRadioBox::DoSetSize(
     }
 } // end of 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);
                  wxT("invalid item in wxRadioBox::Enable()") );
 
     ::WinEnableWindow((HWND) m_ahRadioButtons[nItem], bEnable);
+    return true;
 } // end of wxRadioBox::Enable
 
 bool wxRadioBox::Enable(
 } // end of wxRadioBox::Enable
 
 bool wxRadioBox::Enable(
@@ -685,10 +682,10 @@ bool wxRadioBox::Enable(
 )
 {
     if ( !wxControl::Enable(bEnable) )
 )
 {
     if ( !wxControl::Enable(bEnable) )
-        return FALSE;
+        return false;
     for (int i = 0; i < m_nNoItems; i++)
         ::WinEnableWindow((HWND)m_ahRadioButtons[i], bEnable);
     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(
 } // end of wxRadioBox::Enable
 
 int wxRadioBox::FindString(
@@ -717,7 +714,7 @@ wxString wxRadioBox::GetLabel(
   int                               nItem
 ) const
 {
   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
 
     return wxGetWindowText(m_ahRadioButtons[nItem]);
 } // end of wxRadioBox::GetLabel
@@ -972,7 +969,7 @@ bool wxRadioBox::OS2Command(
     if (uCmd == BN_CLICKED)
     {
         if (wId == GetId())
     if (uCmd == BN_CLICKED)
     {
         if (wId == GetId())
-            return TRUE;
+            return true;
 
 
         for (int i = 0; i < m_nNoItems; i++)
 
 
         for (int i = 0; i < m_nNoItems; i++)
@@ -988,17 +985,17 @@ bool wxRadioBox::OS2Command(
             //
             // Just ignore it
             //
             //
             // Just ignore it
             //
-            return FALSE;
+            return false;
         }
         if (nSelectedButton != m_nSelectedButton)
         {
             m_nSelectedButton = nSelectedButton;
             SendNotificationEvent();
         }
         }
         if (nSelectedButton != m_nSelectedButton)
         {
             m_nSelectedButton = nSelectedButton;
             SendNotificationEvent();
         }
-        return TRUE;
+        return true;
     }
     else
     }
     else
-        return FALSE;
+        return false;
 } // end of wxRadioBox::OS2Command
 
 void wxRadioBox::SendNotificationEvent()
 } // end of wxRadioBox::OS2Command
 
 void wxRadioBox::SendNotificationEvent()
@@ -1033,7 +1030,7 @@ bool wxRadioBox::SetFont(
         //
         // Nothing to do
         //
         //
         // Nothing to do
         //
-        return FALSE;
+        return false;
     }
     //
     // Also set the font of our radio buttons
     }
     //
     // Also set the font of our radio buttons
@@ -1047,16 +1044,16 @@ bool wxRadioBox::SetFont(
                     );
         ::WinInvalidateRect(hWndBtn, NULL, FALSE);
     }
                     );
         ::WinInvalidateRect(hWndBtn, NULL, FALSE);
     }
-    return TRUE;
+    return true;
 } // end of wxRadioBox::SetFont
 
 void wxRadioBox::SetSelection(
   int                               nNum
 )
 {
 } // 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);
         ::WinSendMsg((HWND)m_ahRadioButtons[m_nSelectedButton], BM_SETCHECK, (MPARAM)0, (MPARAM)0);
 
     ::WinSendMsg((HWND)m_ahRadioButtons[nNum], BM_SETCHECK, (MPARAM)1, (MPARAM)0);
@@ -1069,10 +1066,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(
@@ -1084,10 +1081,10 @@ bool wxRadioBox::SetStringSelection(
     if (nSel > -1)
     {
         SetSelection(nSel);
     if (nSel > -1)
     {
         SetSelection(nSel);
-        return TRUE;
+        return true;
     }
     else
     }
     else
-        return FALSE;
+        return false;
 } // end of wxRadioBox::SetStringSelection
 
 bool wxRadioBox::Show(
 } // end of wxRadioBox::SetStringSelection
 
 bool wxRadioBox::Show(
@@ -1095,25 +1092,27 @@ bool wxRadioBox::Show(
 )
 {
     if (!wxControl::Show(bShow))
 )
 {
     if (!wxControl::Show(bShow))
-        return FALSE;
+        return false;
 
     for (int i = 0; i < m_nNoItems; i++)
     {
         ::WinShowWindow((HWND)m_ahRadioButtons[i], (BOOL)bShow);
     }
 
     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
 } // 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(
@@ -1160,7 +1159,7 @@ MRESULT wxRadioBtnWndProc(
                                                                                                 ,QWL_USER
                                                                                                );
                         USHORT                  uVk = SHORT2FROMMP((MPARAM)lParam);
                                                                                                 ,QWL_USER
                                                                                                );
                         USHORT                  uVk = SHORT2FROMMP((MPARAM)lParam);
-                        bool                    bProcessed = TRUE;
+                        bool                    bProcessed = true;
                         wxDirection             eDir;
 
                         switch(uVk)
                         wxDirection             eDir;
 
                         switch(uVk)
@@ -1182,7 +1181,7 @@ MRESULT wxRadioBtnWndProc(
                                 break;
 
                             default:
                                 break;
 
                             default:
-                                bProcessed = FALSE;
+                                bProcessed = false;
 
                                 //
                                 // Just to suppress the compiler warning
 
                                 //
                                 // Just to suppress the compiler warning