Commit ed39e7c0 authored by Jon Griffiths's avatar Jon Griffiths Committed by Alexandre Julliard

Draw disabled toolbar buttons correctly.

parent 4a4b5d40
...@@ -614,39 +614,51 @@ TOOLBAR_DrawPattern (HDC hdc, LPRECT lpRect) ...@@ -614,39 +614,51 @@ TOOLBAR_DrawPattern (HDC hdc, LPRECT lpRect)
} }
static void static void TOOLBAR_DrawMasked(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
TOOLBAR_DrawMasked (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc, INT x, INT y)
HDC hdc, INT x, INT y)
{ {
HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, 0); HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, 0);
INT cx, cy;
HBITMAP hbmMask;
HDC hdcMask;
if (!himl)
return;
ImageList_GetIconSize(himl, &cx, &cy);
/* create new dc's */
hdcMask = CreateCompatibleDC (0);
/* create new bitmap */ if (himl)
hbmMask = CreateBitmap (cx, cy, 1, 1, NULL); {
SelectObject (hdcMask, hbmMask); INT cx, cy;
HBITMAP hbmMask, hbmImage;
/* copy the mask bitmap */ HDC hdcMask, hdcImage;
ImageList_DrawEx(himl, btnPtr->iBitmap, hdcMask, 0, 0, 0, 0, RGB(255, 255, 255), RGB(0, 0, 0), ILD_MASK);
ImageList_GetIconSize(himl, &cx, &cy);
/* draw the new mask */
SelectObject (hdc, GetSysColorBrush (COLOR_3DHILIGHT)); /* Create src image */
BitBlt (hdc, x+1, y+1, cx, cy, hdcMask, 0, 0, 0xB8074A); hdcImage = CreateCompatibleDC(hdc);
hbmImage = CreateBitmap(cx, cy, GetDeviceCaps(hdc,PLANES),
SelectObject (hdc, GetSysColorBrush (COLOR_3DSHADOW)); GetDeviceCaps(hdc,BITSPIXEL), NULL);
BitBlt (hdc, x, y, cx, cy, hdcMask, 0, 0, 0xB8074A); SelectObject(hdcImage, hbmImage);
ImageList_DrawEx(himl, btnPtr->iBitmap, hdcImage, 0, 0, cx, cy,
DeleteObject (hbmMask); RGB(0xff, 0xff, 0xff), RGB(0,0,0), ILD_NORMAL);
DeleteDC (hdcMask);
/* Create Mask */
hdcMask = CreateCompatibleDC(0);
hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
SelectObject(hdcMask, hbmMask);
/* Remove the background and all white pixels */
SetBkColor(hdcImage, ImageList_GetBkColor(himl));
BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, SRCCOPY);
SetBkColor(hdcImage, RGB(0xff, 0xff, 0xff));
BitBlt(hdcMask, 0, 0, cx, cy, hdcImage, 0, 0, NOTSRCERASE);
/* draw the new mask 'etched' to hdc */
SetBkColor(hdc, RGB(255, 255, 255));
SelectObject(hdc, GetSysColorBrush(COLOR_3DHILIGHT));
BitBlt(hdc, x + 1, y + 1, cx, cy, hdcMask, 0, 0, 0xE20746);
SelectObject(hdc, GetSysColorBrush(COLOR_3DSHADOW));
BitBlt(hdc, x, y, cx, cy, hdcMask, 0, 0, 0xE20746);
/* Cleanup */
DeleteObject(hbmImage);
DeleteDC(hdcImage);
DeleteObject (hbmMask);
DeleteDC(hdcMask);
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment