Fixed a problem when the style is BS_BITMAP or BS_ICON: the bitmap or

icon needed to be centered when the button is smaller than the bitmap.
This commit is contained in:
Pierre Mageau 1999-07-30 18:03:15 +00:00 committed by Alexandre Julliard
parent 4691d0cb89
commit cfbafe3247
1 changed files with 18 additions and 12 deletions

View File

@ -480,6 +480,10 @@ static void BUTTON_DrawPushButton(
imageWidth = bm.bmWidth;
imageHeight = bm.bmHeight;
DeleteObject(iconInfo.hbmColor);
DeleteObject(iconInfo.hbmMask);
}
else
{
@ -495,17 +499,15 @@ static void BUTTON_DrawPushButton(
xOffset = (((rc.right - rc.left) - 2*xBorderOffset) - imageWidth ) / 2;
yOffset = (((rc.bottom - rc.top) - 2*yBorderOffset) - imageHeight) / 2;
/* If the image is to big for the button */
if (xOffset < 0)
/* If the image is too big for the button then create a region*/
if(xOffset < 0 || yOffset < 0)
{
imageWidth = rc.right - rc.left - 2*xBorderOffset -1;
xOffset = xBorderOffset;
}
if (yOffset < 0)
{
imageHeight = rc.bottom - rc.top - 2*yBorderOffset -1;
yOffset = yBorderOffset;
HRGN hBitmapRgn = NULL;
hBitmapRgn = CreateRectRgn(
rc.left + xBorderOffset, rc.top +yBorderOffset,
rc.right - xBorderOffset, rc.bottom - yBorderOffset);
SelectClipRgn(hDC, hBitmapRgn);
DeleteObject(hBitmapRgn);
}
/* Let minimum 1 space from border */
@ -517,8 +519,7 @@ static void BUTTON_DrawPushButton(
if (wndPtr->dwStyle & BS_ICON)
{
DrawIcon(hDC,
rc.left + xOffset,
rc.top + yOffset,
rc.left + xOffset, rc.top + yOffset,
(HICON)infoPtr->hImage);
}
else
@ -535,6 +536,11 @@ static void BUTTON_DrawPushButton(
DeleteDC (hdcMem);
}
if(xOffset < 0 || yOffset < 0)
{
SelectClipRgn(hDC, NULL);
}
}
if (TWEAK_WineLook != WIN31_LOOK