- if ( (state & ODS_DISABLED) && (GetWindowStyleFlag() & wxBU_AUTODRAW) )
- DrawButtonDisable( (WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom, TRUE ) ;
- else if ( (state & ODS_FOCUS) && (GetWindowStyleFlag() & wxBU_AUTODRAW) )
- DrawButtonFocus( (WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom, ((state & ODS_SELECTED) == ODS_SELECTED));
+ // 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
+ PATCOPY) // bg ROP
+ );
+
+ ::SelectObject(hDC, hbrOld);
+ ::DeleteObject(hbrBackground);
+ }
+ else
+#endif // Win32
+ {
+ ok = ::BitBlt(hDC, x1, y1, wBmp, hBmp, // dst
+ memDC, 0, 0, // src
+ SRCCOPY); // ROP
+ }
+
+ if ( !ok )
+ {
+ wxLogLastError(_T("Mask/BitBlt()"));
+ }
+
+ if ( (state & ODS_DISABLED) && autoDraw )
+ {
+ DrawButtonDisable((WXHDC) hDC,
+ lpDIS->rcItem.left, lpDIS->rcItem.top,
+ lpDIS->rcItem.right, lpDIS->rcItem.bottom,
+ TRUE);
+ }
+ else if ( (state & ODS_FOCUS) && autoDraw )
+ {
+ DrawButtonFocus((WXHDC) hDC,
+ lpDIS->rcItem.left,
+ lpDIS->rcItem.top,
+ lpDIS->rcItem.right,
+ lpDIS->rcItem.bottom,
+ isSelected);
+ }