From f53b9b97e04da8f552f49ede5a8226e800178608 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Miko=C5=82aj_Zalewski?= Date: Wed, 27 Feb 2008 16:56:35 +0100 Subject: [PATCH] comctl32: rebar: image height should be taken into account when computing the band height --- dlls/comctl32/rebar.c | 10 +++++----- dlls/comctl32/tests/rebar.c | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index 9ad46f4..45912f2 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -1513,7 +1513,7 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand) /* the internal band structure: cxHeader, cyHeader, cxMinBand, cyMinBand, fStatus */ { UINT header=0; - UINT textheight=0; + UINT textheight=0, imageheight = 0; UINT i, nonfixed; REBAR_BAND *tBand; @@ -1576,11 +1576,11 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand) lpBand->fStatus |= HAS_IMAGE; if (infoPtr->dwStyle & CCS_VERT) { header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE); - lpBand->cyMinBand = infoPtr->imageSize.cx + 2; + imageheight = infoPtr->imageSize.cx + 4; } else { header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE); - lpBand->cyMinBand = infoPtr->imageSize.cy + 2; + imageheight = infoPtr->imageSize.cy + 4; } } @@ -1610,7 +1610,7 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand) /* check if user overrode the header value */ if (!(lpBand->fStyle & RBBS_UNDOC_FIXEDHEADER)) lpBand->cxHeader = header; - lpBand->cyHeader = textheight; + lpBand->cyHeader = max(textheight, imageheight); /* Now compute minimum size of child window */ update_min_band_height(infoPtr, lpBand); /* update lpBand->cyMinBand from cyHeader and cyChild*/ @@ -2633,7 +2633,7 @@ REBAR_SetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnic REBAR_DumpBand (infoPtr); - if (bChanged && (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE))) { + if (bChanged && (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE | RBBIM_IMAGE))) { REBAR_Layout(infoPtr); InvalidateRect(infoPtr->hwndSelf, 0, 1); } diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c index 1de9cd2..8615cc3 100644 --- a/dlls/comctl32/tests/rebar.c +++ b/dlls/comctl32/tests/rebar.c @@ -17,6 +17,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +/* make sure the structures work with a comctl32 v5.x */ +#define _WIN32_WINNT 0x500 +#define _WIN32_IE 0x500 + #include #include @@ -252,6 +256,11 @@ rbsize_result_t rbsize_results[] = { { {328, 0, 511, 20}, 0x00, 183}, { {511, 0, 672, 20}, 0x00, 161}, { { 0, 20, 672, 40}, 0x00, 200}, }, }, + { {0, 0, 672, 56}, 56, 2, {28, 28, }, 5, { + { { 0, 0, 114, 28}, 0x00, 40}, { {114, 0, 328, 28}, 0x00, 214}, + { {328, 0, 511, 28}, 0x00, 183}, { {511, 0, 672, 28}, 0x00, 161}, + { { 0, 28, 672, 56}, 0x00, 200}, + }, }, { {0, 0, 672, 0}, 0, 0, {0, }, 0, {{{0, 0, 0, 0}, 0, 0}, }, }, { {0, 0, 672, 65}, 65, 1, {65, }, 3, { @@ -329,6 +338,8 @@ static void layout_test(void) { HWND hRebar = NULL; REBARBANDINFO rbi; + HIMAGELIST himl; + REBARINFO ri; rebuild_rebar(&hRebar); check_sizes(); @@ -406,6 +417,17 @@ static void layout_test(void) SendMessageA(hRebar, RB_MINIMIZEBAND, 0, 0); check_sizes(); + /* an image will increase the band height */ + himl = ImageList_LoadImage(LoadLibrary("comctl32"), MAKEINTRESOURCE(121), 24, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR); + ri.cbSize = sizeof(ri); + ri.fMask = RBIM_IMAGELIST; + ri.himl = himl; + ok(SendMessage(hRebar, RB_SETBARINFO, 0, (LPARAM)&ri), "RB_SETBARINFO failed\n"); + rbi.fMask = RBBIM_IMAGE; + rbi.iImage = 1; + SendMessage(hRebar, RB_SETBANDINFO, 1, (LPARAM)&rbi); + check_sizes(); + /* VARHEIGHT resizing test on a horizontal rebar */ rebuild_rebar(&hRebar); SetWindowLong(hRebar, GWL_STYLE, GetWindowLong(hRebar, GWL_STYLE) | RBS_AUTOSIZE); @@ -793,7 +815,7 @@ START_TEST(rebar) MSG msg; RECT rc; - hComctl32 = GetModuleHandleA("comctl32.dll"); + hComctl32 = LoadLibraryA("comctl32.dll"); pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx"); if (!pInitCommonControlsEx) { -- 1.4.4.2