comctl32/button: Support image list margin for buttons with BS_CENTER or BS_VCENTER.
WinSCP uses image list margin to adjust image position on a button when theming is on. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52076 Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
66cb0ab34a
commit
feb0b73a3c
|
@ -1156,7 +1156,10 @@ static void BUTTON_PositionRect(LONG style, const RECT *outerRect, RECT *innerRe
|
||||||
switch (style & BS_CENTER)
|
switch (style & BS_CENTER)
|
||||||
{
|
{
|
||||||
case BS_CENTER:
|
case BS_CENTER:
|
||||||
innerRect->left = outerRect->left + (outerRect->right - outerRect->left - width) / 2;
|
/* The left and right margins are added to the inner rectangle to get a new rectangle. Then
|
||||||
|
* the new rectangle is adjusted to be in the horizontal center */
|
||||||
|
innerRect->left = outerRect->left + (outerRect->right - outerRect->left - width
|
||||||
|
+ margin->left - margin->right) / 2;
|
||||||
innerRect->right = innerRect->left + width;
|
innerRect->right = innerRect->left + width;
|
||||||
break;
|
break;
|
||||||
case BS_RIGHT:
|
case BS_RIGHT:
|
||||||
|
@ -1182,7 +1185,10 @@ static void BUTTON_PositionRect(LONG style, const RECT *outerRect, RECT *innerRe
|
||||||
break;
|
break;
|
||||||
case BS_VCENTER:
|
case BS_VCENTER:
|
||||||
default:
|
default:
|
||||||
innerRect->top = outerRect->top + (outerRect->bottom - outerRect->top - height) / 2;
|
/* The top and bottom margins are added to the inner rectangle to get a new rectangle. Then
|
||||||
|
* the new rectangle is adjusted to be in the vertical center */
|
||||||
|
innerRect->top = outerRect->top + (outerRect->bottom - outerRect->top - height
|
||||||
|
+ margin->top - margin->bottom) / 2;
|
||||||
innerRect->bottom = innerRect->top + height;
|
innerRect->bottom = innerRect->top + height;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue