]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/bmpbuttn.cpp
compilation fix for non-threaded compilation (threads are still broken
[wxWidgets.git] / src / msw / bmpbuttn.cpp
index 22234319d36dddb081069bc52af99a22a38148bd..2cee20c982d46c2aa4b7b2f8d6a4c7f8938395fd 100644 (file)
@@ -39,7 +39,10 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
 {
   m_buttonBitmap = bitmap;
   SetName(name);
+
+#if wxUSE_VALIDATORS
   SetValidator(validator);
+#endif // wxUSE_VALIDATORS
 
   parent->AddChild(this);
 
@@ -172,21 +175,34 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
     }
 
     BOOL ok;
+
+    // no MaskBlt() under Win16
+#ifdef __WIN32__
     wxMask *mask = bitmap->GetMask();
     if ( mask )
     {
         // the fg ROP is applied for the pixels of the mask bitmap which are 1
         // (for a wxMask this means that this is a non transparent pixel), the
         // bg ROP is applied for all the others
+
+        wxColour colBg = GetBackgroundColour();
+        HBRUSH hbrBackground =
+            ::CreateSolidBrush(RGB(colBg.Red(), colBg.Green(), colBg.Blue()));
+        HBRUSH hbrOld = (HBRUSH)::SelectObject(hDC, hbrBackground);
+
         ok = ::MaskBlt(
                        hDC, x1, y1, wBmp, hBmp,                 // dst
                        memDC, 0, 0,                             // src
                        (HBITMAP)mask->GetMaskBitmap(), 0, 0,    // mask
                        MAKEROP4(SRCCOPY,                        // fg ROP
-                                SRCPAINT)                       // bg ROP
+                                PATCOPY)                        // bg ROP
                       );
+
+        ::SelectObject(hDC, hbrOld);
+        ::DeleteObject(hbrBackground);
     }
     else
+#endif // Win32
     {
         ok = ::BitBlt(hDC, x1, y1, wBmp, hBmp,  // dst
                       memDC, 0, 0,              // src