From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/updown.c | 48 ++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 6e08975d567..f3cf58fd322 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -362,23 +362,31 @@ static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr) * * Draw buddy background for visual integration. */ -static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc) +static void UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc) { - RECT br, r; + RECT rect; + HTHEME theme = GetWindowTheme(infoPtr->Self); HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy); - if (!buddyTheme) return FALSE; - - GetWindowRect (infoPtr->Buddy, &br); - MapWindowPoints (NULL, infoPtr->Self, (POINT*)&br, 2); - GetClientRect (infoPtr->Self, &r); - - if (infoPtr->dwStyle & UDS_ALIGNLEFT) - br.left = r.left; - else if (infoPtr->dwStyle & UDS_ALIGNRIGHT) - br.right = r.right; - /* FIXME: take disabled etc. into account */ - DrawThemeBackground (buddyTheme, hdc, 0, 0, &br, NULL); - return TRUE; + + if (theme && buddyTheme) + { + RECT br; + + GetWindowRect(infoPtr->Buddy, &br); + MapWindowPoints(NULL, infoPtr->Self, (POINT*)&br, 2); + GetClientRect(infoPtr->Self, &rect); + + if (infoPtr->dwStyle & UDS_ALIGNLEFT) + br.left = rect.left; + else if (infoPtr->dwStyle & UDS_ALIGNRIGHT) + br.right = rect.right; + /* FIXME: take disabled etc. into account */ + DrawThemeBackground(buddyTheme, hdc, 0, 0, &br, NULL); + return; + } + + GetClientRect(infoPtr->Self, &rect); + DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_BOTTOM | BF_TOP | (infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); }
static BOOL UPDOWN_IsUpArrowPressed(const UPDOWN_INFO *infoPtr) @@ -463,14 +471,8 @@ static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc) }
/* Draw the common border between ourselves and our buddy */ - if (UPDOWN_NeedBuddyBackground(infoPtr)) { - if (!theme || !UPDOWN_DrawBuddyBackground (infoPtr, hdc)) { - GetClientRect(infoPtr->Self, &rect); - DrawEdge(hdc, &rect, EDGE_SUNKEN, - BF_BOTTOM | BF_TOP | - (infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); - } - } + if (UPDOWN_NeedBuddyBackground(infoPtr)) + UPDOWN_DrawBuddyBackground(infoPtr, hdc);
/* Draw the incr button */ UPDOWN_GetArrowRect (infoPtr, &rect, FLAG_INCR);