comctl32: Use InflateRect() too when expanding in just one axis.
Michael Stefaniuc
mstefani at redhat.de
Fri Jul 8 03:18:39 CDT 2016
Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
---
The pattern of using InflateRect() when 3 coordinates of a RECT change
is already present in comctl32.
dlls/comctl32/rebar.c | 6 ++----
dlls/comctl32/tab.c | 11 +++--------
dlls/comctl32/theme_button.c | 3 +--
dlls/comctl32/toolbar.c | 3 +--
4 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index 3089378..a6243a9 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -730,8 +730,7 @@ REBAR_CalcHorzBand (const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
lpBand->fDraw |= DRAW_GRIPPER;
lpBand->rcGripper.left += REBAR_PRE_GRIPPER;
lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH;
- lpBand->rcGripper.top += 2;
- lpBand->rcGripper.bottom -= 2;
+ InflateRect(&lpBand->rcGripper, 0, -2);
SetRect (&lpBand->rcCapImage,
lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.top,
@@ -859,8 +858,7 @@ REBAR_CalcVertBand (const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
}
else {
/* horizontal gripper */
- lpBand->rcGripper.left += 2;
- lpBand->rcGripper.right -= 2;
+ InflateRect(&lpBand->rcGripper, -2, 0);
lpBand->rcGripper.top += REBAR_PRE_GRIPPER;
lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_WIDTH;
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index d228c07..9806783 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -1618,8 +1618,7 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect
if (iItem != infoPtr->iSelected)
{
drawRect->left += 2;
- drawRect->top += 2;
- drawRect->bottom -= 2;
+ InflateRect(drawRect, 0, -2);
}
}
else if (infoPtr->dwStyle & TCS_VERTICAL)
@@ -1630,9 +1629,8 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect
}
else
{
- drawRect->top += 2;
drawRect->right -= 2;
- drawRect->bottom -= 2;
+ InflateRect(drawRect, 0, -2);
}
}
else if (infoPtr->dwStyle & TCS_BOTTOM)
@@ -1715,10 +1713,7 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect
drawRect->top += 2;
drawRect->right -= 1;
if ( iItem == infoPtr->iSelected )
- {
- drawRect->right -= 1;
- drawRect->left += 1;
- }
+ InflateRect(drawRect, -1, 0);
id = (UINT)GetWindowLongPtrW( infoPtr->hwnd, GWLP_ID );
diff --git a/dlls/comctl32/theme_button.c b/dlls/comctl32/theme_button.c
index edb31e6..f136b5d 100644
--- a/dlls/comctl32/theme_button.c
+++ b/dlls/comctl32/theme_button.c
@@ -278,8 +278,7 @@ static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
if (text)
{
- textRect.left += 2;
- textRect.right -= 2;
+ InflateRect(&textRect, -2, 0);
DrawThemeText(theme, hDC, BP_GROUPBOX, state, text, lstrlenW(text), 0, 0, &textRect);
HeapFree(GetProcessHeap(), 0, text);
}
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 3b32e91..422845c 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -957,8 +957,7 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc,
/* calculate text position */
if (lpText)
{
- rcText.left += GetSystemMetrics(SM_CXEDGE);
- rcText.right -= GetSystemMetrics(SM_CXEDGE);
+ InflateRect(&rcText, -GetSystemMetrics(SM_CXEDGE), 0);
if (dwStyle & TBSTYLE_LIST)
{
rcText.left += infoPtr->nBitmapWidth + infoPtr->iListGap + 2;
--
2.4.11
More information about the wine-patches
mailing list