From 5eedf51df69219ab44e2878ddacf6e002cdb08dc Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 6 May 2010 00:15:05 +0400 Subject: [PATCH] comctl32/rebar: Try to center child rectangle only if cyChild height is not zero. --- dlls/comctl32/rebar.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index cc064255096..cd3abadd60c 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -707,7 +707,7 @@ REBAR_CalcHorzBand (const REBAR_INFO *infoPtr, UINT rstart, UINT rend) /* *** Supports only Horizontal bars. *** */ { REBAR_BAND *lpBand; - UINT i, xoff, yoff; + UINT i, xoff; RECT work; for(i=rstart; ihwndChild != NULL) { - int cyBand = lpBand->rcBand.bottom - lpBand->rcBand.top; - yoff = (cyBand - lpBand->cyChild) / 2; - SetRect (&lpBand->rcChild, - lpBand->rcBand.left + lpBand->cxHeader, lpBand->rcBand.top + yoff, - lpBand->rcBand.right - REBAR_POST_CHILD, lpBand->rcBand.top + yoff + lpBand->cyChild); + if (lpBand->hwndChild) { + + lpBand->rcChild.left = lpBand->rcBand.left + lpBand->cxHeader; + lpBand->rcChild.right = lpBand->rcBand.right - REBAR_POST_CHILD; + + if (lpBand->cyChild > 0) { + + UINT yoff = (lpBand->rcBand.bottom - lpBand->rcBand.top - lpBand->cyChild) / 2; + + /* center child if height is known */ + lpBand->rcChild.top = lpBand->rcBand.top + yoff; + lpBand->rcChild.bottom = lpBand->rcBand.top + yoff + lpBand->cyChild; + } + else { + lpBand->rcChild.top = lpBand->rcBand.top; + lpBand->rcChild.bottom = lpBand->rcBand.bottom; + } + if ((lpBand->fStyle & RBBS_USECHEVRON) && (lpBand->rcChild.right - lpBand->rcChild.left < lpBand->cxIdeal)) { lpBand->rcChild.right -= CHEVRON_WIDTH; -- 2.11.4.GIT