Commit ecde1c3c authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

comctl32: rebar: Image height should be taken into account when computing the band height.

parent 81590db3
...@@ -1513,7 +1513,7 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand) ...@@ -1513,7 +1513,7 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
/* the internal band structure: cxHeader, cyHeader, cxMinBand, cyMinBand, fStatus */ /* the internal band structure: cxHeader, cyHeader, cxMinBand, cyMinBand, fStatus */
{ {
UINT header=0; UINT header=0;
UINT textheight=0; UINT textheight=0, imageheight = 0;
UINT i, nonfixed; UINT i, nonfixed;
REBAR_BAND *tBand; REBAR_BAND *tBand;
...@@ -1576,11 +1576,11 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand) ...@@ -1576,11 +1576,11 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
lpBand->fStatus |= HAS_IMAGE; lpBand->fStatus |= HAS_IMAGE;
if (infoPtr->dwStyle & CCS_VERT) { if (infoPtr->dwStyle & CCS_VERT) {
header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE); header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE);
lpBand->cyMinBand = infoPtr->imageSize.cx + 2; imageheight = infoPtr->imageSize.cx + 4;
} }
else { else {
header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE); 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) ...@@ -1610,7 +1610,7 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
/* check if user overrode the header value */ /* check if user overrode the header value */
if (!(lpBand->fStyle & RBBS_UNDOC_FIXEDHEADER)) if (!(lpBand->fStyle & RBBS_UNDOC_FIXEDHEADER))
lpBand->cxHeader = header; lpBand->cxHeader = header;
lpBand->cyHeader = textheight; lpBand->cyHeader = max(textheight, imageheight);
/* Now compute minimum size of child window */ /* Now compute minimum size of child window */
update_min_band_height(infoPtr, lpBand); /* update lpBand->cyMinBand from cyHeader and cyChild*/ 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 ...@@ -2633,7 +2633,7 @@ REBAR_SetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnic
REBAR_DumpBand (infoPtr); 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); REBAR_Layout(infoPtr);
InvalidateRect(infoPtr->hwndSelf, 0, 1); InvalidateRect(infoPtr->hwndSelf, 0, 1);
} }
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * 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 <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -252,6 +256,11 @@ rbsize_result_t rbsize_results[] = { ...@@ -252,6 +256,11 @@ rbsize_result_t rbsize_results[] = {
{ {328, 0, 511, 20}, 0x00, 183}, { {511, 0, 672, 20}, 0x00, 161}, { {328, 0, 511, 20}, 0x00, 183}, { {511, 0, 672, 20}, 0x00, 161},
{ { 0, 20, 672, 40}, 0x00, 200}, { { 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, 0}, 0, 0, {0, }, 0, {{{0, 0, 0, 0}, 0, 0},
}, }, }, },
{ {0, 0, 672, 65}, 65, 1, {65, }, 3, { { {0, 0, 672, 65}, 65, 1, {65, }, 3, {
...@@ -329,6 +338,8 @@ static void layout_test(void) ...@@ -329,6 +338,8 @@ static void layout_test(void)
{ {
HWND hRebar = NULL; HWND hRebar = NULL;
REBARBANDINFO rbi; REBARBANDINFO rbi;
HIMAGELIST himl;
REBARINFO ri;
rebuild_rebar(&hRebar); rebuild_rebar(&hRebar);
check_sizes(); check_sizes();
...@@ -406,6 +417,17 @@ static void layout_test(void) ...@@ -406,6 +417,17 @@ static void layout_test(void)
SendMessageA(hRebar, RB_MINIMIZEBAND, 0, 0); SendMessageA(hRebar, RB_MINIMIZEBAND, 0, 0);
check_sizes(); 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 */ /* VARHEIGHT resizing test on a horizontal rebar */
rebuild_rebar(&hRebar); rebuild_rebar(&hRebar);
SetWindowLong(hRebar, GWL_STYLE, GetWindowLong(hRebar, GWL_STYLE) | RBS_AUTOSIZE); SetWindowLong(hRebar, GWL_STYLE, GetWindowLong(hRebar, GWL_STYLE) | RBS_AUTOSIZE);
...@@ -793,7 +815,7 @@ START_TEST(rebar) ...@@ -793,7 +815,7 @@ START_TEST(rebar)
MSG msg; MSG msg;
RECT rc; RECT rc;
hComctl32 = GetModuleHandleA("comctl32.dll"); hComctl32 = LoadLibraryA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx"); pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx) if (!pInitCommonControlsEx)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment