Module: wine Branch: refs/heads/master Commit: a05bfbfb86cb9d5d81fdbbfef02f5dd11e1f1a53 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=a05bfbfb86cb9d5d81fdbbfe...
Author: Phil Krylov phil@newstar.rinet.ru Date: Mon Jan 9 18:41:45 2006 +0100
comctl32: Fix rebar autosize behaviour. Allow autoresizing rebar by PostMessage(hwndRebar, WM_SIZE, 0, 0) like native does, taking as few rows as possible and using the parent window client area size for the other dimension (width for horizontal rebars or height for vertical ones).
---
dlls/comctl32/rebar.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index 468fe24..81633d6 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -1492,10 +1492,11 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPREC cxsep = (cntonrow == 0) ? 0 : SEP_WIDTH; cx = lpBand->lcx;
+ /* In native, 0 as one of the coordinates means no limit */ if (infoPtr->dwStyle & CCS_VERT) - dobreak = (y + cx + cxsep > adjcy); + dobreak = (adjcy && (y + cx + cxsep > adjcy)); else - dobreak = (x + cx + cxsep > adjcx); + dobreak = (adjcx && (x + cx + cxsep > adjcx));
/* This is the check for whether we need to start a new row */ if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) || @@ -1537,14 +1538,14 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPREC /* if boundary rect specified then limit mcy */ if (lpRect) { if (infoPtr->dwStyle & CCS_VERT) { - if (x+mcy > adjcx) { + if (adjcx && (x+mcy > adjcx)) { mcy = adjcx - x; TRACE("P1 row %u limiting mcy=%d, adjcx=%d, x=%d\n", i, mcy, adjcx, x); } } else { - if (y+mcy > adjcy) { + if (adjcy && (y+mcy > adjcy)) { mcy = adjcy - y; TRACE("P1 row %u limiting mcy=%d, adjcy=%d, y=%d\n", i, mcy, adjcy, y); @@ -1656,8 +1657,9 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPREC /* ******* Start Phase 2 - split rows till adjustment height full ******* */
/* assumes that the following variables contain: */ - /* y/x current height/width of all rows */ - if (lpRect) { + /* y/x current height/width of all rows */ + /* adjcy/adjcx adjustment height/width or 0 (as small as possible) */ + if (lpRect && ((infoPtr->dwStyle & CCS_VERT) ? adjcx : adjcy)) { INT i, prev_rh, new_rh, adj_rh, prev_idx, current_idx; REBAR_BAND *prev, *current, *walk; UINT j; @@ -4501,9 +4503,14 @@ REBAR_Size (REBAR_INFO *infoPtr, WPARAM if ((lParam == 0) && (rcClient.right + rcClient.bottom != 0) && (infoPtr->dwStyle & RBS_AUTOSIZE)) { /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */ - /* native seems to use the current client rect for the size */ + /* native seems to use the current parent width for the size */ infoPtr->fStatus |= BAND_NEEDS_LAYOUT; - TRACE("sizing rebar to client (%ld,%ld) size is zero but AUTOSIZE set\n", + GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient); + if (infoPtr->dwStyle & CCS_VERT) + rcClient.right = 0; + else + rcClient.bottom = 0; + TRACE("sizing rebar to parent (%ld,%ld) size is zero but AUTOSIZE set\n", rcClient.right, rcClient.bottom); } else {