Draw disabled toolbar buttons correctly.
This commit is contained in:
parent
4a4b5d407c
commit
ed39e7c039
|
@ -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)
|
if (himl)
|
||||||
return;
|
{
|
||||||
|
INT cx, cy;
|
||||||
|
HBITMAP hbmMask, hbmImage;
|
||||||
|
HDC hdcMask, hdcImage;
|
||||||
|
|
||||||
ImageList_GetIconSize(himl, &cx, &cy);
|
ImageList_GetIconSize(himl, &cx, &cy);
|
||||||
|
|
||||||
/* create new dc's */
|
/* Create src image */
|
||||||
hdcMask = CreateCompatibleDC (0);
|
hdcImage = CreateCompatibleDC(hdc);
|
||||||
|
hbmImage = CreateBitmap(cx, cy, GetDeviceCaps(hdc,PLANES),
|
||||||
|
GetDeviceCaps(hdc,BITSPIXEL), NULL);
|
||||||
|
SelectObject(hdcImage, hbmImage);
|
||||||
|
ImageList_DrawEx(himl, btnPtr->iBitmap, hdcImage, 0, 0, cx, cy,
|
||||||
|
RGB(0xff, 0xff, 0xff), RGB(0,0,0), ILD_NORMAL);
|
||||||
|
|
||||||
/* create new bitmap */
|
/* Create Mask */
|
||||||
hbmMask = CreateBitmap (cx, cy, 1, 1, NULL);
|
hdcMask = CreateCompatibleDC(0);
|
||||||
SelectObject (hdcMask, hbmMask);
|
hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
|
||||||
|
SelectObject(hdcMask, hbmMask);
|
||||||
|
|
||||||
/* copy the mask bitmap */
|
/* Remove the background and all white pixels */
|
||||||
ImageList_DrawEx(himl, btnPtr->iBitmap, hdcMask, 0, 0, 0, 0, RGB(255, 255, 255), RGB(0, 0, 0), ILD_MASK);
|
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 */
|
/* draw the new mask 'etched' to hdc */
|
||||||
SelectObject (hdc, GetSysColorBrush (COLOR_3DHILIGHT));
|
SetBkColor(hdc, RGB(255, 255, 255));
|
||||||
BitBlt (hdc, x+1, y+1, cx, cy, hdcMask, 0, 0, 0xB8074A);
|
SelectObject(hdc, GetSysColorBrush(COLOR_3DHILIGHT));
|
||||||
|
BitBlt(hdc, x + 1, y + 1, cx, cy, hdcMask, 0, 0, 0xE20746);
|
||||||
SelectObject (hdc, GetSysColorBrush (COLOR_3DSHADOW));
|
SelectObject(hdc, GetSysColorBrush(COLOR_3DSHADOW));
|
||||||
BitBlt (hdc, x, y, cx, cy, hdcMask, 0, 0, 0xB8074A);
|
BitBlt(hdc, x, y, cx, cy, hdcMask, 0, 0, 0xE20746);
|
||||||
|
|
||||||
|
/* Cleanup */
|
||||||
|
DeleteObject(hbmImage);
|
||||||
|
DeleteDC(hdcImage);
|
||||||
DeleteObject (hbmMask);
|
DeleteObject (hbmMask);
|
||||||
DeleteDC (hdcMask);
|
DeleteDC(hdcMask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue