]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/checkbox.cpp
Blind fix for bug #1209944, wxFileConfig constructor corrupts the stack
[wxWidgets.git] / src / os2 / checkbox.cpp
index 40eac8c61495ed9172a89239a1c52f9791778518..e4df8924462741969f23333aa2d434c61930f489 100644 (file)
 IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
 
+extern void  wxAssociateWinWithHandle( HWND         hWnd
+                                      ,wxWindowOS2* pWin
+                                     );
+
 // ============================================================================
 // implementation
 // ============================================================================
@@ -58,42 +62,52 @@ bool wxCheckBox::Create(
 , const wxPoint&                    rPos
 , const wxSize&                     rSize
 , long                              lStyle
-#if wxUSE_VALIDATORS
 , const wxValidator&                rValidator
-#endif
 , const wxString&                   rsName
 )
 {
+    LONG                            lColor;
+    bool                            bOk;
+
     if (!CreateControl( pParent
                        ,vId
                        ,rPos
                        ,rSize
                        ,lStyle
-#if wxUSE_VALIDATORS
                        ,rValidator
-#endif
                        ,rsName
                       ))
         return FALSE;
 
+
     long                            osStyle = BS_AUTOCHECKBOX |
                                               WS_TABSTOP      |
                                               WS_VISIBLE;
 
-    return OS2CreateControl( wxT("BUTTON")
-                            ,osStyle
-                            ,rPos
-                            ,rSize
-                            ,rsLabel
-                            ,0
-                           );
+    bOk = OS2CreateControl( wxT("BUTTON")
+                           ,osStyle
+                           ,rPos
+                           ,rSize
+                           ,rsLabel
+                           ,0
+                          );
+    m_backgroundColour = pParent->GetBackgroundColour();
+    lColor = (LONG)m_backgroundColour.GetPixel();
+    ::WinSetPresParam( m_hWnd
+                      ,PP_BACKGROUNDCOLOR
+                      ,sizeof(LONG)
+                      ,(PVOID)&lColor
+                     );
+    wxAssociateWinWithHandle(m_hWnd, this);
+    return bOk;
 } // end of wxCheckBox::Create
 
 void wxCheckBox::SetLabel(
   const wxString&                   rsLabel
 )
 {
-    ::WinSetWindowText(GetHwnd(), rsLabel.c_str());
+    wxString                         sLabel=::wxPMTextToLabel(rsLabel);
+    ::WinSetWindowText(GetHwnd(), (PSZ)sLabel.c_str());
 } // end of wxCheckBox::SetLabel
 
 wxSize wxCheckBox::DoGetBestSize() const
@@ -175,9 +189,7 @@ bool wxBitmapCheckBox::Create(
 , const wxPoint&                    rPos
 , const wxSize&                     rSize
 , long                              lStyle
-#if wxUSE_VALIDATORS
 , const wxValidator&                rValidator
-#endif
 , const wxString&                   rsName
 )
 {