diff --git a/dll/win32/comctl32/toolbar.c b/dll/win32/comctl32/toolbar.c index c43dc0c980..9da340aca6 100644 --- a/dll/win32/comctl32/toolbar.c +++ b/dll/win32/comctl32/toolbar.c @@ -1445,6 +1445,7 @@ TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr) { TBUTTON_INFO *btnPtr; INT x, cx, i, j, width; + RECT rc; BOOL bButtonWrap; /* When the toolbar window style is not TBSTYLE_WRAPABLE, */ @@ -1455,7 +1456,21 @@ TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr) btnPtr = infoPtr->buttons; x = infoPtr->nIndent; - width = infoPtr->client_rect.right - infoPtr->client_rect.left; + + if (GetParent(infoPtr->hwndSelf)) + { + /* this can get the parents width, to know how far we can extend + * this toolbar. We cannot use its height, as there may be multiple + * toolbars in a rebar control + */ + GetClientRect(GetParent(infoPtr->hwndSelf), &rc); + width = rc.right - rc.left; + } + else + { + GetWindowRect(infoPtr->hwndSelf, &rc); + width = rc.right - rc.left; + } bButtonWrap = FALSE; @@ -3202,13 +3217,11 @@ TOOLBAR_AutoSize (TOOLBAR_INFO *infoPtr) { TRACE("auto sizing, style=%#x\n", infoPtr->dwStyle); TRACE("nRows: %d, infoPtr->nButtonHeight: %d\n", infoPtr->nRows, infoPtr->nButtonHeight); + RECT parent_rect; + HWND parent; + INT x, y; + INT cx, cy; - if (!(infoPtr->dwStyle & CCS_NORESIZE)) - { - RECT window_rect, parent_rect; - UINT uPosFlags = SWP_NOZORDER | SWP_NOACTIVATE; - HWND parent; - INT x, y, cx, cy; parent = GetParent (infoPtr->hwndSelf); @@ -3223,6 +3236,17 @@ TOOLBAR_AutoSize (TOOLBAR_INFO *infoPtr) cy = TOP_BORDER + infoPtr->nRows * infoPtr->nButtonHeight + BOTTOM_BORDER; cx = parent_rect.right - parent_rect.left; + if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL)) + { + TOOLBAR_LayoutToolbar(infoPtr); + InvalidateRect( infoPtr->hwndSelf, NULL, TRUE ); + } + + if (!(infoPtr->dwStyle & CCS_NORESIZE)) + { + RECT window_rect; + UINT uPosFlags = SWP_NOZORDER | SWP_NOACTIVATE; + if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_NOMOVEY) { GetWindowRect(infoPtr->hwndSelf, &window_rect);