Ignore:
Timestamp:
Mar 17, 2004, 5:38:52 PM (22 years ago)
Author:
sandervl
Message:

Wine merge + status & rebar fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/rebar.c

    r10139 r10535  
    120120 *    Still to do:
    121121 *  2. Following still not handled: RBBS_FIXEDBMP,
    122  *            RBBS_USECHEVRON, CCS_NORESIZE,
     122 *            CCS_NORESIZE,
    123123 *            CCS_NOMOVEX, CCS_NOMOVEY
    124124 *  3. Following are only partially handled:
     
    137137 *  7. The following notifications are not implemented:
    138138 *        NM_CUSTOMDRAW, NM_RELEASEDCAPTURE
    139  *        RB_CHEVRONPUSHED, RBN_MINMAX
     139 *        RBN_MINMAX
    140140 */
    141141
     142#include <stdarg.h>
    142143#include <stdlib.h>
    143144#include <string.h>
    144145
     146#include "windef.h"
    145147#include "winbase.h"
    146148#include "wingdi.h"
    147149#include "wine/unicode.h"
     150#include "winuser.h"
     151#include "winnls.h"
    148152#include "commctrl.h"
    149 /* #include "spy.h" */
     153#include "comctl32.h"
    150154#include "wine/debug.h"
    151155
     
    191195    RECT    rcCapText;      /* calculated caption text rectangle */
    192196    RECT    rcChild;        /* calculated child rectangle */
     197    RECT    rcChevron;      /* calculated chevron rectangle */
    193198
    194199    LPWSTR    lpText;
     
    207212#define DRAW_RIGHTSEP   0x00000010
    208213#define DRAW_BOTTOMSEP  0x00000020
     214#define DRAW_CHEVRONHOT 0x00000040
     215#define DRAW_CHEVRONPUSHED 0x00000080
     216#define DRAW_LAST_IN_ROW   0x00000100
     217#define DRAW_FIRST_IN_ROW  0x00000200
    209218#define NTF_INVALIDATE  0x01000000
    210 
    211 typedef struct
    212 {
    213     INT      istartband;  /* index of first band in row */
    214     INT      iendband;    /* index of last band in row */
    215 } REBAR_ROW;
    216 
    217219
    218220typedef struct
     
    245247    POINTS   dragStart;   /* x,y of button down */
    246248    POINTS   dragNow;     /* x,y of this MouseMove */
    247     INT      ihitBand;    /* band number of band whose gripper was grabbed */
     249    INT      iOldBand;    /* last band that had the mouse cursor over it */
    248250    INT      ihitoffset;  /* offset of hotspot from gripper.left */
    249251    POINT    origin;      /* left/upper corner of client */
    250 
    251     REBAR_ROW  *rows;       /* pointer to row indexes              */
     252    INT      ichevronhotBand; /* last band that had a hot chevron */
     253    INT      iGrabbedBand;/* band number of band whose gripper was grabbed */
     254
    252255    REBAR_BAND *bands;      /* pointer to the array of rebar bands */
    253256} REBAR_INFO;
     
    290293#define GRIPPER_WIDTH  3
    291294
     295/* Width of the chevron button if present */
     296#define CHEVRON_WIDTH  10
     297
    292298/* Height of divider for Rebar if not disabled (CCS_NODIVIDER)     */
    293299/* either top or bottom                                            */
     
    299305/* ----   End of REBAR layout constants.                      ---- */
    300306
     307#define RB_GETBANDINFO_OLD (WM_USER+5) /* obsoleted after IE3, but we have to support it anyway */
    301308
    302309/*  The following 6 defines return the proper rcBand element       */
     
    331338static UINT mindragy = 0;
    332339
    333 static char *band_stylename[] = {
     340static const char *band_stylename[] = {
    334341    "RBBS_BREAK",              /* 0001 */
    335342    "RBBS_FIXEDSIZE",          /* 0002 */
     
    343350    NULL };
    344351
    345 static char *band_maskname[] = {
     352static const char *band_maskname[] = {
    346353    "RBBIM_STYLE",         /*    0x00000001 */
    347354    "RBBIM_COLORS",        /*    0x00000002 */
     
    408415        TRACE("band info:");
    409416        if (pB->fMask & RBBIM_SIZE)
    410             DPRINTF(" cx=%u", pB->cx);
     417            TRACE(" cx=%u", pB->cx);
    411418        if (pB->fMask & RBBIM_IDEALSIZE)
    412             DPRINTF(" xIdeal=%u", pB->cxIdeal);
     419            TRACE(" xIdeal=%u", pB->cxIdeal);
    413420        if (pB->fMask & RBBIM_HEADERSIZE)
    414             DPRINTF(" xHeader=%u", pB->cxHeader);
     421            TRACE(" xHeader=%u", pB->cxHeader);
    415422        if (pB->fMask & RBBIM_LPARAM)
    416             DPRINTF(" lParam=0x%08lx", pB->lParam);
    417         DPRINTF("\n");
     423            TRACE(" lParam=0x%08lx", pB->lParam);
     424        TRACE("\n");
    418425    }
    419426    if (pB->fMask & RBBIM_CHILDSIZE)
     
    434441          iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,
    435442          iP->calcSize.cx, iP->calcSize.cy);
    436     TRACE("hwnd=%p: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n",
     443    TRACE("hwnd=%p: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, iGrabbedBand=%d\n",
    437444          iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y,
    438445          iP->dragNow.x, iP->dragNow.y,
    439           iP->ihitBand);
     446          iP->iGrabbedBand);
    440447    TRACE("hwnd=%p: style=%08lx, I'm Unicode=%s, notify in Unicode=%s, redraw=%s\n",
    441448          iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE",
     
    453460        if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) {
    454461            if (pB->fMask & RBBIM_SIZE)
    455                 DPRINTF(" cx=%u", pB->cx);
     462                TRACE(" cx=%u", pB->cx);
    456463            if (pB->fMask & RBBIM_IDEALSIZE)
    457                 DPRINTF(" xIdeal=%u", pB->cxIdeal);
     464                TRACE(" xIdeal=%u", pB->cxIdeal);
    458465            if (pB->fMask & RBBIM_LPARAM)
    459                 DPRINTF(" lParam=0x%08lx", pB->lParam);
    460         }
    461         DPRINTF("\n");
     466                TRACE(" lParam=0x%08lx", pB->lParam);
     467        }
     468        TRACE("\n");
    462469        if (RBBIM_CHILDSIZE)
    463470            TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
     
    468475        TRACE("band # %u: lcx=%u, ccx=%u, hcx=%u, lcy=%u, ccy=%u, hcy=%u, offChild=%ld,%ld\n",
    469476              i, pB->lcx, pB->ccx, pB->hcx, pB->lcy, pB->ccy, pB->hcy, pB->offChild.cx, pB->offChild.cy);
    470         TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n",
     477        TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%ld,%ld)-(%ld,%ld), Grip=(%ld,%ld)-(%ld,%ld)\n",
    471478              i, pB->fStatus, pB->fDraw,
    472479              pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom,
    473480              pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom);
    474         TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n",
     481        TRACE("band # %u: Img=(%ld,%ld)-(%ld,%ld), Txt=(%ld,%ld)-(%ld,%ld), Child=(%ld,%ld)-(%ld,%ld)\n",
    475482              i,
    476483              pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom,
     
    481488}
    482489
     490static void
     491REBAR_DrawChevron (HDC hdc, INT left, INT top, INT colorRef)
     492{
     493    INT x, y;
     494    HPEN hPen, hOldPen;
     495
     496    if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return;
     497    hOldPen = SelectObject ( hdc, hPen );
     498    x = left + 2;
     499    y = top;
     500    MoveToEx (hdc, x, y, NULL);
     501    LineTo (hdc, x+5, y++); x++;
     502    MoveToEx (hdc, x, y, NULL);
     503    LineTo (hdc, x+3, y++); x++;
     504    MoveToEx (hdc, x, y, NULL);
     505    LineTo (hdc, x+1, y++);
     506    SelectObject( hdc, hOldPen );
     507    DeleteObject( hPen );
     508}
    483509
    484510static HWND
     
    610636    }
    611637
     638    if (!IsRectEmpty(&lpBand->rcChevron))
     639    {
     640        if (lpBand->fDraw & DRAW_CHEVRONPUSHED)
     641        {
     642            DrawEdge(hdc, &lpBand->rcChevron, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
     643            REBAR_DrawChevron(hdc, lpBand->rcChevron.left+1, lpBand->rcChevron.top + 11, COLOR_WINDOWFRAME);
     644        }
     645        else if (lpBand->fDraw & DRAW_CHEVRONHOT)
     646        {
     647            DrawEdge(hdc, &lpBand->rcChevron, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);
     648            REBAR_DrawChevron(hdc, lpBand->rcChevron.left, lpBand->rcChevron.top + 10, COLOR_WINDOWFRAME);
     649        }
     650        else
     651            REBAR_DrawChevron(hdc, lpBand->rcChevron.left, lpBand->rcChevron.top + 10, COLOR_WINDOWFRAME);
     652    }
     653
    612654    if (lpBand->uCDret == (CDRF_NOTIFYPOSTPAINT | CDRF_NOTIFYITEMDRAW)) {
    613655        nmcd.dwDrawStage = CDDS_ITEMPOSTPAINT;
     
    628670{
    629671    REBAR_BAND *lpBand;
    630     UINT i, oldrow;
     672    UINT i;
    631673
    632674    if (!infoPtr->DoRedraw) return;
    633675
    634     oldrow = infoPtr->bands[0].iRow;
    635676    for (i = 0; i < infoPtr->uNumBands; i++) {
    636677        lpBand = &infoPtr->bands[i];
     
    681722            (lpBand->rcoldBand.bottom !=lpBand->rcBand.bottom)) {
    682723            lpBand->fDraw |= NTF_INVALIDATE;
    683             TRACE("band %d row=%d: changed to (%d,%d)-(%d,%d) from (%d,%d)-(%d,%d)\n",
     724            TRACE("band %d row=%d: changed to (%ld,%ld)-(%ld,%ld) from (%ld,%ld)-(%ld,%ld)\n",
    684725                  i, lpBand->iRow,
    685726                  lpBand->rcBand.left, lpBand->rcBand.top,
     
    689730        }
    690731        else
    691             TRACE("band %d row=%d: unchanged (%d,%d)-(%d,%d)\n",
     732            TRACE("band %d row=%d: unchanged (%ld,%ld)-(%ld,%ld)\n",
    692733                  i, lpBand->iRow,
    693734                  lpBand->rcBand.left, lpBand->rcBand.top,
     
    765806        else
    766807            lpBand->rcBand.right = lpBand->rcBand.left + curwidth;
    767         TRACE("Phase 1 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",
     808        TRACE("Phase 1 band %d, (%ld,%ld)-(%ld,%ld), orig x=%d, xsep=%d\n",
    768809              i, lpBand->rcBand.left, lpBand->rcBand.top,
    769810              lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);
     
    835876        else
    836877            lpBand->rcBand.right = lpBand->rcBand.left + curwidth;
    837         TRACE("Phase 2 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",
     878        TRACE("Phase 2 band %d, (%ld,%ld)-(%ld,%ld), orig x=%d, xsep=%d\n",
    838879              i, lpBand->rcBand.left, lpBand->rcBand.top,
    839880              lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);
     
    951992                   lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top+yoff,
    952993                   lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);
     994          if ((lpBand->fStyle & RBBS_USECHEVRON) && (lpBand->rcChild.right - lpBand->rcChild.left < lpBand->cxIdeal))
     995          {
     996              lpBand->rcChild.right -= CHEVRON_WIDTH;
     997              SetRect(&lpBand->rcChevron, lpBand->rcChild.right,
     998                      lpBand->rcChild.top, lpBand->rcChild.right + CHEVRON_WIDTH,
     999                      lpBand->rcChild.bottom);
     1000          }
    9531001      }
    9541002      else {
     
    9631011           (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
    9641012          TRACE("Child rectangle changed for band %u\n", i);
    965           TRACE("    from (%d,%d)-(%d,%d)  to (%d,%d)-(%d,%d)\n",
     1013          TRACE("    from (%ld,%ld)-(%ld,%ld)  to (%ld,%ld)-(%ld,%ld)\n",
    9661014                oldChild.left, oldChild.top,
    9671015                oldChild.right, oldChild.bottom,
     
    9701018      }
    9711019      if (lpBand->fDraw & NTF_INVALIDATE) {
    972           TRACE("invalidating (%d,%d)-(%d,%d)\n",
     1020          TRACE("invalidating (%ld,%ld)-(%ld,%ld)\n",
    9731021                lpBand->rcBand.left,
    9741022                lpBand->rcBand.top,
     
    11021150             (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
    11031151            TRACE("Child rectangle changed for band %u\n", i);
    1104             TRACE("    from (%d,%d)-(%d,%d)  to (%d,%d)-(%d,%d)\n",
     1152            TRACE("    from (%ld,%ld)-(%ld,%ld)  to (%ld,%ld)-(%ld,%ld)\n",
    11051153                  oldChild.left, oldChild.top,
    11061154                  oldChild.right, oldChild.bottom,
     
    11091157        }
    11101158        if (lpBand->fDraw & NTF_INVALIDATE) {
    1111             TRACE("invalidating (%d,%d)-(%d,%d)\n",
     1159            TRACE("invalidating (%ld,%ld)-(%ld,%ld)\n",
    11121160                  lpBand->rcBand.left,
    11131161                  lpBand->rcBand.top,
     
    11421190    GetClientRect (infoPtr->hwndSelf, &rc);
    11431191
    1144     TRACE( " old [%ld x %ld], new [%ld x %ld], client [%d x %d]\n",
     1192    TRACE( " old [%ld x %ld], new [%ld x %ld], client [%ld x %ld]\n",
    11451193           infoPtr->oldSize.cx, infoPtr->oldSize.cy,
    11461194           infoPtr->calcSize.cx, infoPtr->calcSize.cy,
     
    12281276        infoPtr->hwndSelf, infoPtr->dwStyle,
    12291277        x, y, width, height);
    1230 
    12311278#ifdef __WIN32OS2__
    12321279//NOTE: this one is causing problems!!!!
     
    12711318            if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) {
    12721319                TRACE("Child rect changed by NOTIFY for band %u\n", i);
    1273                 TRACE("    from (%d,%d)-(%d,%d)  to (%d,%d)-(%d,%d)\n",
     1320                TRACE("    from (%ld,%ld)-(%ld,%ld)  to (%ld,%ld)-(%ld,%ld)\n",
    12741321                      lpBand->rcChild.left, lpBand->rcChild.top,
    12751322                      lpBand->rcChild.right, lpBand->rcChild.bottom,
     
    13021349
    13031350                /* center combo box inside child area */
    1304                 TRACE("moving child (Combo(Ex)) %p to (%d,%d) for (%d,%d)\n",
     1351                TRACE("moving child (Combo(Ex)) %p to (%ld,%d) for (%ld,%d)\n",
    13051352                      lpBand->hwndChild,
    13061353                      lpBand->rcChild.left, yPos,
     
    13171364            }
    13181365            else {
    1319                 TRACE("moving child (Other) %p to (%d,%d) for (%d,%d)\n",
     1366                TRACE("moving child (Other) %p to (%ld,%ld) for (%ld,%ld)\n",
    13201367                      lpBand->hwndChild,
    13211368                      lpBand->rcChild.left, lpBand->rcChild.top,
     
    13771424
    13781425    GetClientRect (infoPtr->hwndSelf, &rcClient);
    1379     TRACE("Client is (%d,%d)-(%d,%d)\n",
     1426    TRACE("Client is (%ld,%ld)-(%ld,%ld)\n",
    13801427          rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
    13811428
    13821429    if (lpRect) {
    13831430        rcAdj = *lpRect;
    1384         TRACE("adjustment rect is (%d,%d)-(%d,%d)\n",
     1431        TRACE("adjustment rect is (%ld,%ld)-(%ld,%ld)\n",
    13851432              rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom);
    13861433    }
     
    14331480        lpBand->iRow = row;
    14341481
     1482        SetRectEmpty(&lpBand->rcChevron);
     1483
    14351484        if (HIDDENBAND(lpBand)) continue;
    14361485
     
    14461495        /* separator from previous band */
    14471496        cxsep = (cntonrow == 0) ? 0 : SEP_WIDTH;
    1448 
    1449         /* Header: includes gripper, text, image */
    1450         cx = lpBand->cxHeader;
    1451         if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx;
     1497        cx = lpBand->lcx;
    14521498
    14531499        if (infoPtr->dwStyle & CCS_VERT)
     
    15381584            x = rightx;
    15391585        }
    1540         TRACE("P1 band %u, row %d, (%d,%d)-(%d,%d)\n",
     1586        TRACE("P1 band %u, row %d, (%ld,%ld)-(%ld,%ld)\n",
    15411587              i, row,
    15421588              lpBand->rcBand.left, lpBand->rcBand.top,
     
    16171663    /*   y/x     current height/width of all rows                    */
    16181664    if (lpRect) {
    1619         INT i, j, prev_rh, new_rh, adj_rh, prev_idx, current_idx;
     1665        INT i, prev_rh, new_rh, adj_rh, prev_idx, current_idx;
    16201666        REBAR_BAND *prev, *current, *walk;
     1667        UINT j;
    16211668
    16221669/* FIXME:  problem # 2 */
     
    16251672             (x < adjcx) : (y < adjcy)
    16261673#else
    1627              (adjcx - x > 4) : (adjcy - y > 4)
     1674             (adjcx - x > 5) : (adjcy - y > 4)
    16281675#endif
    16291676             ) &&
     
    16781725                        y += adj_rh;
    16791726                    }
    1680                     TRACE("P2 moving band %d to own row at (%d,%d)-(%d,%d)\n",
     1727                    TRACE("P2 moving band %d to own row at (%ld,%ld)-(%ld,%ld)\n",
    16811728                          current_idx,
    16821729                          current->rcBand.left, current->rcBand.top,
    16831730                          current->rcBand.right, current->rcBand.bottom);
    1684                     TRACE("P2 prev band %d at (%d,%d)-(%d,%d)\n",
     1731                    TRACE("P2 prev band %d at (%ld,%ld)-(%ld,%ld)\n",
    16851732                          prev_idx,
    16861733                          prev->rcBand.left, prev->rcBand.top,
     
    17131760
    17141761
    1715     /* ******* Start Phase 2a - create array of start and end  ******* */
    1716     /*                          indexes by row                         */
    1717 
    1718     if (infoPtr->uNumRows != origrows) {
    1719         if (infoPtr->rows) COMCTL32_Free (infoPtr->rows);
    1720         infoPtr->rows = COMCTL32_Alloc (sizeof (REBAR_ROW) * infoPtr->uNumRows);
    1721     }
    1722 
    1723     row = 0;
    1724     for (i = 0; i < infoPtr->uNumBands; i++) {
    1725         lpBand = &infoPtr->bands[i];
    1726         if (HIDDENBAND(lpBand)) continue;
    1727 
    1728         if (lpBand->iRow > row) {
    1729             row++;
    1730             infoPtr->rows[row-1].istartband = i;
    1731         }
    1732         if (row == 0) {
    1733             ERR("P2a bug!!!!!!\n");
    1734         }
    1735         infoPtr->rows[row-1].iendband = i;
    1736     }
    1737 
    1738     for (i = 0; i < infoPtr->uNumRows; i++) {
    1739         REBAR_ROW *p;
    1740 
    1741         p = &infoPtr->rows[i];
    1742         TRACE("P2a row %d, starts %d, ends %d\n",
    1743               i+1, p->istartband, p->iendband);
    1744     }
    1745 
    1746     /* ******* End Phase 2a - create array of start and end    ******* */
    1747     /*                          indexes by row                         */
     1762    /* ******* Start Phase 2a - mark first and last band in each ******* */
     1763
     1764    prevBand = NULL;
     1765    for (i = 0; i < infoPtr->uNumBands; i++) {   
     1766        lpBand = &infoPtr->bands[i];     
     1767        if (HIDDENBAND(lpBand))
     1768            continue;
     1769        if( !prevBand ) {
     1770            lpBand->fDraw |= DRAW_FIRST_IN_ROW;
     1771            prevBand = lpBand;
     1772        }
     1773        else if( prevBand->iRow == lpBand->iRow )
     1774            prevBand = lpBand;
     1775        else {
     1776            prevBand->fDraw |= DRAW_LAST_IN_ROW;
     1777            lpBand->fDraw |= DRAW_FIRST_IN_ROW;
     1778            prevBand = lpBand;
     1779        }
     1780    }
     1781    if( prevBand )
     1782        prevBand->fDraw |= DRAW_LAST_IN_ROW;
     1783
     1784    /* ******* End Phase 2a - mark first and last band in each ******* */
    17481785
    17491786
     
    17551792    if (((infoPtr->dwStyle & CCS_VERT) ? clientcx > x : clientcy > y) &&
    17561793        infoPtr->uNumBands) {
    1757         INT diff, i, iband, j;
     1794        INT diff, i;
     1795        UINT j;
    17581796
    17591797        diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y;
    1760         for (i = infoPtr->uNumRows; i >= 1; i--) {
    1761             /* if row has more than 1 band, ignore row   */
    1762             if (infoPtr->rows[i-1].istartband != infoPtr->rows[i-1].iendband)
    1763                 continue;
    1764             /* point to only band in row  */
    1765             iband = infoPtr->rows[i-1].istartband;
    1766             lpBand = &infoPtr->bands[iband];
     1798
     1799        /* iterate backwards thru the rows */
     1800        for (i = infoPtr->uNumBands-1; i>=0; i--) {
     1801            lpBand = &infoPtr->bands[i];
    17671802            if(HIDDENBAND(lpBand)) continue;
     1803
     1804            /* if row has more than 1 band, ignore it */
     1805            if( !(lpBand->fDraw&DRAW_FIRST_IN_ROW) )
     1806                continue;
     1807            if( !(lpBand->fDraw&DRAW_LAST_IN_ROW) )
     1808                continue;
     1809
    17681810            if (lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;
    17691811            if (((INT)lpBand->cyMaxChild < 1) ||
     
    17711813                if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue;
    17721814                ERR("P2b band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n",
    1773                     iband, lpBand->cyMaxChild, lpBand->cyIntegral);
     1815                    i, lpBand->cyMaxChild, lpBand->cyIntegral);
    17741816                continue;
    17751817            }
     
    17841826            else
    17851827                lpBand->rcBand.bottom = lpBand->rcBand.top + j;
    1786             TRACE("P2b band %d, row %d changed to (%d,%d)-(%d,%d)\n",
    1787                   iband, lpBand->iRow,
     1828            TRACE("P2b band %d, row %d changed to (%ld,%ld)-(%ld,%ld)\n",
     1829                  i, lpBand->iRow,
    17881830                  lpBand->rcBand.left, lpBand->rcBand.top,
    17891831                  lpBand->rcBand.right, lpBand->rcBand.bottom);
     
    18061848
    18071849    if (infoPtr->uNumBands) {
    1808         REBAR_ROW *p;
     1850        int startband;
    18091851
    18101852        /* If RBS_BANDBORDERS set then indicate to draw bottom separator */
     
    18141856        if (infoPtr->dwStyle & RBS_BANDBORDERS) {
    18151857
    1816             for(i = 0; i < infoPtr->uNumRows; i++) {
    1817                 p = &infoPtr->rows[i];
    1818                 for (j = p->istartband; j <= p->iendband; j++) {
    1819                     lpBand = &infoPtr->bands[j];
    1820                     if (HIDDENBAND(lpBand)) continue;
    1821                     if (j != p->iendband)
    1822                         lpBand->fDraw |= DRAW_RIGHTSEP;
    1823                     if (i != infoPtr->uNumRows-1)
    1824                         lpBand->fDraw |= DRAW_BOTTOMSEP;
    1825                 }
     1858            for (i=0; i<infoPtr->uNumBands; i++) {
     1859                lpBand = &infoPtr->bands[i];
     1860                if (HIDDENBAND(lpBand))
     1861                    continue;
     1862
     1863                /* not righthand bands */
     1864                if( !(lpBand->fDraw & DRAW_LAST_IN_ROW) )
     1865                    lpBand->fDraw |= DRAW_RIGHTSEP;
     1866
     1867                /* not the last row */
     1868                if( lpBand->iRow != infoPtr->uNumRows )
     1869                    lpBand->fDraw |= DRAW_BOTTOMSEP;
    18261870            }
    18271871        }
     
    18291873        /* Distribute the extra space on the horizontal and adjust  */
    18301874        /* all bands in row to same height.                         */
    1831         for (i=1; i<=infoPtr->uNumRows; i++) {
    1832             p = &infoPtr->rows[i-1];
    1833             mcy = 0;
    1834 
    1835             TRACE("P3 processing row %d, starting band %d, ending band %d\n",
    1836                   i, p->istartband, p->iendband);
    1837 
    1838             /* Find the largest height of the bands in the row */
    1839             for (j = p->istartband; j <= p->iendband; j++) {
    1840                 lpBand = &infoPtr->bands[j];
    1841                 if (HIDDENBAND(lpBand)) continue;
    1842                 if (mcy < ircBw(lpBand))
    1843                     mcy = ircBw(lpBand);
    1844             }
    1845 
    1846             REBAR_AdjustBands (infoPtr, p->istartband, p->iendband,
     1875        mcy = 0;
     1876        startband = -1;
     1877        for (i=0; i<infoPtr->uNumBands; i++) {
     1878
     1879            lpBand = &infoPtr->bands[i];
     1880
     1881            if( lpBand->fDraw & DRAW_FIRST_IN_ROW )
     1882            {
     1883                startband = i;
     1884                mcy = 0;
     1885            }
     1886
     1887            if ( (mcy < ircBw(lpBand)) && !HIDDENBAND(lpBand) )
     1888                mcy = ircBw(lpBand);
     1889
     1890            if( lpBand->fDraw & DRAW_LAST_IN_ROW )
     1891            {
     1892                TRACE("P3 processing row %d, starting band %d, ending band %d\n",
     1893                      lpBand->iRow, startband, i);
     1894                if( startband < 0 )
     1895                    ERR("Last band %d with no first, row %d\n", i, lpBand->iRow);
     1896
     1897                REBAR_AdjustBands (infoPtr, startband, i,
    18471898                               (infoPtr->dwStyle & CCS_VERT) ?
    18481899                               clientcy : clientcx, mcy);
     1900            }
    18491901        }
    18501902
     
    19001952    UINT header=0;
    19011953    UINT textheight=0;
    1902     INT i, nonfixed;
     1954    UINT i, nonfixed;
    19031955    REBAR_BAND *tBand;
    19041956
     
    20382090}
    20392091
    2040 static void
     2092static BOOL
    20412093REBAR_CommonSetupBand (HWND hwnd, LPREBARBANDINFOA lprbbi, REBAR_BAND *lpBand)
    20422094     /* Function:  This routine copies the supplied values from   */
    20432095     /*  user input (lprbbi) to the internal band structure.      */
    2044 {
     2096     /*  It returns true if something changed and false if not.   */
     2097{
     2098    BOOL bChanged = FALSE;
     2099
    20452100    lpBand->fMask |= lprbbi->fMask;
    20462101
    2047     if (lprbbi->fMask & RBBIM_STYLE)
     2102    if( (lprbbi->fMask & RBBIM_STYLE) &&
     2103        (lpBand->fStyle != lprbbi->fStyle ) )
     2104    {
    20482105        lpBand->fStyle = lprbbi->fStyle;
    2049 
    2050     if (lprbbi->fMask & RBBIM_COLORS) {
     2106        bChanged = TRUE;
     2107    }
     2108
     2109    if( (lprbbi->fMask & RBBIM_COLORS) &&
     2110       ( ( lpBand->clrFore != lprbbi->clrFore ) ||
     2111         ( lpBand->clrBack != lprbbi->clrBack ) ) )
     2112    {
    20512113        lpBand->clrFore = lprbbi->clrFore;
    20522114        lpBand->clrBack = lprbbi->clrBack;
    2053     }
    2054 
    2055     if (lprbbi->fMask & RBBIM_IMAGE)
     2115        bChanged = TRUE;
     2116    }
     2117
     2118    if( (lprbbi->fMask & RBBIM_IMAGE) &&
     2119       ( lpBand->iImage != lprbbi->iImage ) )
     2120    {
    20562121        lpBand->iImage = lprbbi->iImage;
    2057 
    2058     if (lprbbi->fMask & RBBIM_CHILD) {
     2122        bChanged = TRUE;
     2123    }
     2124
     2125    if( (lprbbi->fMask & RBBIM_CHILD) &&
     2126       (lprbbi->hwndChild != lpBand->hwndChild ) )
     2127    {
    20592128        if (lprbbi->hwndChild) {
    20602129            lpBand->hwndChild = lprbbi->hwndChild;
     
    20712140            lpBand->hwndPrevParent = 0;
    20722141        }
    2073     }
    2074 
    2075     if (lprbbi->fMask & RBBIM_CHILDSIZE) {
     2142        bChanged = TRUE;
     2143    }
     2144
     2145    if( (lprbbi->fMask & RBBIM_CHILDSIZE) &&
     2146        ( (lpBand->cxMinChild != lprbbi->cxMinChild) ||
     2147          (lpBand->cyMinChild != lprbbi->cyMinChild ) ||
     2148          ( (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) &&
     2149            ( (lpBand->cyChild    != lprbbi->cyChild ) ||
     2150              (lpBand->cyMaxChild != lprbbi->cyMaxChild ) ||
     2151              (lpBand->cyIntegral != lprbbi->cyIntegral ) ) ) ||
     2152          ( (lprbbi->cbSize < sizeof (REBARBANDINFOA)) &&
     2153            ( (lpBand->cyChild ||
     2154               lpBand->cyMaxChild ||
     2155               lpBand->cyIntegral ) ) ) ) )
     2156    {
    20762157        lpBand->cxMinChild = lprbbi->cxMinChild;
    20772158        lpBand->cyMinChild = lprbbi->cyMinChild;
     
    20872168            lpBand->cyIntegral = 0;
    20882169        }
    2089     }
    2090 
    2091     if (lprbbi->fMask & RBBIM_SIZE)
     2170        bChanged = TRUE;
     2171    }
     2172
     2173    if( (lprbbi->fMask & RBBIM_SIZE) &&
     2174        (lpBand->cx != lprbbi->cx ) )
     2175    {
    20922176        lpBand->cx = lprbbi->cx;
    2093 
    2094     if (lprbbi->fMask & RBBIM_BACKGROUND)
     2177        bChanged = TRUE;
     2178    }
     2179
     2180    if( (lprbbi->fMask & RBBIM_BACKGROUND) &&
     2181       ( lpBand->hbmBack != lprbbi->hbmBack ) )
     2182    {
    20952183        lpBand->hbmBack = lprbbi->hbmBack;
    2096 
    2097     if (lprbbi->fMask & RBBIM_ID)
     2184        bChanged = TRUE;
     2185    }
     2186
     2187    if( (lprbbi->fMask & RBBIM_ID) &&
     2188        (lpBand->wID != lprbbi->wID ) )
     2189    {
    20982190        lpBand->wID = lprbbi->wID;
     2191        bChanged = TRUE;
     2192    }
    20992193
    21002194    /* check for additional data */
    21012195    if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
    2102         if (lprbbi->fMask & RBBIM_IDEALSIZE)
     2196        if( (lprbbi->fMask & RBBIM_IDEALSIZE) &&
     2197            ( lpBand->cxIdeal != lprbbi->cxIdeal ) )
     2198        {
    21032199            lpBand->cxIdeal = lprbbi->cxIdeal;
    2104 
    2105         if (lprbbi->fMask & RBBIM_LPARAM)
     2200            bChanged = TRUE;
     2201        }
     2202
     2203        if( (lprbbi->fMask & RBBIM_LPARAM) &&
     2204            (lpBand->lParam != lprbbi->lParam ) )
     2205        {
    21062206            lpBand->lParam = lprbbi->lParam;
    2107 
    2108         if (lprbbi->fMask & RBBIM_HEADERSIZE)
     2207            bChanged = TRUE;
     2208        }
     2209
     2210        if( (lprbbi->fMask & RBBIM_HEADERSIZE) &&
     2211            (lpBand->cxHeader != lprbbi->cxHeader ) )
     2212        {
    21092213            lpBand->cxHeader = lprbbi->cxHeader;
    2110     }
     2214            bChanged = TRUE;
     2215        }
     2216    }
     2217
     2218    return bChanged;
    21112219}
    21122220
     
    21192227{
    21202228    REBAR_BAND *lpBand;
    2121     INT i, oldrow;
     2229    UINT i;
     2230    INT oldrow;
    21222231    HDC hdc = (HDC)wParam;
    21232232    RECT rect;
     
    21452254                    DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM);
    21462255                }
    2147                 TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n",
     2256                TRACE ("drawing band separator bottom (%ld,%ld)-(%ld,%ld)\n",
    21482257                       rcRowSep.left, rcRowSep.top,
    21492258                       rcRowSep.right, rcRowSep.bottom);
     
    21632272                DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT);
    21642273            }
    2165             TRACE("drawing band separator right (%d,%d)-(%d,%d)\n",
     2274            TRACE("drawing band separator right (%ld,%ld)-(%ld,%ld)\n",
    21662275                  rcSep.left, rcSep.top, rcSep.right, rcSep.bottom);
    21672276        }
     
    21902299
    21912300        rect = lpBand->rcBand;
    2192         TRACE("%s background color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n",
     2301        TRACE("%s background color=0x%06lx, band (%ld,%ld)-(%ld,%ld), clip (%ld,%ld)-(%ld,%ld)\n",
    21932302              (lpBand->clrBack == CLR_NONE) ? "none" :
    21942303                ((lpBand->clrBack == CLR_DEFAULT) ? "dft" : ""),
     
    22062315
    22072316static void
    2208 REBAR_InternalHitTest (REBAR_INFO *infoPtr, LPPOINT lpPt, UINT *pFlags, INT *pBand)
     2317REBAR_InternalHitTest (REBAR_INFO *infoPtr, const LPPOINT lpPt, UINT *pFlags, INT *pBand)
    22092318{
    22102319    REBAR_BAND *lpBand;
    22112320    RECT rect;
    2212     INT  iCount;
     2321    UINT  iCount;
    22132322
    22142323    GetClientRect (infoPtr->hwndSelf, &rect);
     
    22262335        else {
    22272336            /* somewhere inside */
    2228             infoPtr->ihitBand = -1;
    22292337            for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
    22302338                lpBand = &infoPtr->bands[iCount];
     
    22352343                    if (PtInRect (&lpBand->rcGripper, *lpPt)) {
    22362344                        *pFlags = RBHT_GRABBER;
    2237                         infoPtr->ihitBand = iCount;
    22382345                        TRACE("ON GRABBER %d\n", iCount);
    22392346                        return;
     
    22542361                        return;
    22552362                    }
     2363                    else if (PtInRect (&lpBand->rcChevron, *lpPt)) {
     2364                        *pFlags = RBHT_CHEVRON;
     2365                        TRACE("ON CHEVRON %d\n", iCount);
     2366                        return;
     2367                    }
    22562368                    else {
    22572369                        *pFlags = RBHT_NOWHERE;
     
    22772389        return;
    22782390    }
    2279 
    2280     TRACE("flags=0x%X\n", *pFlags);
    2281     return;
    22822391}
    22832392
     
    23442453    READJ(band, Readjust);
    23452454
    2346     TRACE("band %d:  left=%d, right=%d, move=%d, rtn=%d, rcBand=(%d,%d)-(%d,%d)\n",
     2455    TRACE("band %d:  left=%d, right=%d, move=%d, rtn=%d, rcBand=(%ld,%ld)-(%ld,%ld)\n",
    23472456          i, Leadjust, Readjust, movement, ret,
    23482457          band->rcBand.left, band->rcBand.top,
     
    23752484            infoPtr->dragStart.y = 0;
    23762485            infoPtr->dragNow = infoPtr->dragStart;
    2377             infoPtr->ihitBand = -1;
     2486            infoPtr->iGrabbedBand = -1;
    23782487            ReleaseCapture ();
    23792488            return ;
     
    23822491    }
    23832492
    2384     ihitBand = infoPtr->ihitBand;
     2493    ihitBand = infoPtr->iGrabbedBand;
    23852494    hitBand = &infoPtr->bands[ihitBand];
    23862495    imaxdBand = ihitBand; /* to suppress warning message */
     
    25272636        if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)
    25282637            childhwnd = lpBand->hwndChild;
    2529         COMCTL32_Free (infoPtr->bands);
     2638        Free (infoPtr->bands);
    25302639        infoPtr->bands = NULL;
    25312640        infoPtr->uNumBands = 0;
     
    25392648
    25402649        infoPtr->uNumBands--;
    2541         infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);
     2650        infoPtr->bands = Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);
    25422651        if (uBand > 0) {
    25432652            memcpy (&infoPtr->bands[0], &oldBands[0],
     
    25502659        }
    25512660
    2552         COMCTL32_Free (oldBands);
     2661        Free (oldBands);
    25532662    }
    25542663
     
    26312740    if (lprbbi == NULL)
    26322741        return FALSE;
    2633     if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
     2742    if (lprbbi->cbSize < REBARBANDINFOA_V3_SIZE)
    26342743        return FALSE;
    26352744    if ((UINT)wParam >= infoPtr->uNumBands)
     
    27172826    if (lprbbi == NULL)
    27182827        return FALSE;
    2719     if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
     2828    if (lprbbi->cbSize < REBARBANDINFOW_V3_SIZE)
    27202829        return FALSE;
    27212830    if ((UINT)wParam >= infoPtr->uNumBands)
     
    28682977    CopyRect (lprc, &lpBand->rcBand);
    28692978
    2870     TRACE("band %d, (%d,%d)-(%d,%d)\n", iBand,
     2979    TRACE("band %d, (%ld,%ld)-(%ld,%ld)\n", iBand,
    28712980          lprc->left, lprc->top, lprc->right, lprc->bottom);
    28722981
     
    28882997{
    28892998    INT iRow = (INT)wParam;
    2890     int ret = 0;
    2891     int i, j = 0;
     2999    int j = 0, ret = 0;
     3000    UINT i;
    28923001    REBAR_BAND *lpBand;
    28933002
     
    29913100    if (lprbbi == NULL)
    29923101        return FALSE;
    2993     if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
     3102    if (lprbbi->cbSize < REBARBANDINFOA_V3_SIZE)
    29943103        return FALSE;
    29953104
     
    29993108
    30003109    if (infoPtr->uNumBands == 0) {
    3001         infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
     3110        infoPtr->bands = (REBAR_BAND *)Alloc (sizeof (REBAR_BAND));
    30023111        uIndex = 0;
    30033112    }
     
    30053114        REBAR_BAND *oldBands = infoPtr->bands;
    30063115        infoPtr->bands =
    3007             (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
     3116            (REBAR_BAND *)Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
    30083117        if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
    30093118            uIndex = infoPtr->uNumBands;
     
    30213130        }
    30223131
    3023         COMCTL32_Free (oldBands);
     3132        Free (oldBands);
    30243133    }
    30253134
     
    30423151        INT len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 );
    30433152        if (len > 1) {
    3044             lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR));
     3153            lpBand->lpText = (LPWSTR)Alloc (len*sizeof(WCHAR));
    30453154            MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len );
    30463155        }
     
    30723181    if (lprbbi == NULL)
    30733182        return FALSE;
    3074     if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
     3183    if (lprbbi->cbSize < REBARBANDINFOW_V3_SIZE)
    30753184        return FALSE;
    30763185
     
    30803189
    30813190    if (infoPtr->uNumBands == 0) {
    3082         infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
     3191        infoPtr->bands = (REBAR_BAND *)Alloc (sizeof (REBAR_BAND));
    30833192        uIndex = 0;
    30843193    }
     
    30863195        REBAR_BAND *oldBands = infoPtr->bands;
    30873196        infoPtr->bands =
    3088             (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
     3197            (REBAR_BAND *)Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
    30893198        if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
    30903199            uIndex = infoPtr->uNumBands;
     
    30973206
    30983207        /* post copy */
    3099         if (uIndex < infoPtr->uNumBands - 1) {
     3208        if (uIndex <= infoPtr->uNumBands - 1) {
    31003209            memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
    3101                     (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
    3102         }
    3103 
    3104         COMCTL32_Free (oldBands);
     3210                    (infoPtr->uNumBands - uIndex) * sizeof(REBAR_BAND));
     3211        }
     3212
     3213        Free (oldBands);
    31053214    }
    31063215
     
    31233232        INT len = lstrlenW (lprbbi->lpText);
    31243233        if (len > 0) {
    3125             lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     3234            lpBand->lpText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
    31263235            strcpyW (lpBand->lpText, lprbbi->lpText);
    31273236        }
     
    31313240    /* On insert of second band, revalidate band 1 to possible add gripper */
    31323241    if (infoPtr->uNumBands == 2)
    3133         REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);
     3242        REBAR_ValidateBand (infoPtr, &infoPtr->bands[uIndex ? 0 : 1]);
    31343243
    31353244    REBAR_DumpBand (infoPtr);
     
    32123321            lpBand->cxHeader;
    32133322    if (movement < 0) {
    3214         ERR("something is wrong, band=(%d,%d)-(%d,%d), cxheader=%d\n",
     3323        ERR("something is wrong, band=(%ld,%ld)-(%ld,%ld), cxheader=%d\n",
    32153324            lpBand->rcBand.left, lpBand->rcBand.top,
    32163325            lpBand->rcBand.right, lpBand->rcBand.bottom,
     
    33333442    memcpy (&holder, &oldBands[uFrom], sizeof(REBAR_BAND));
    33343443
    3335     /* close up rest of bands (psuedo delete) */
     3444    /* close up rest of bands (pseudo delete) */
    33363445    if (uFrom < infoPtr->uNumBands - 1) {
    33373446        memcpy (&oldBands[uFrom], &oldBands[uFrom+1],
     
    33413450    /* allocate new space and copy rest of bands into it */
    33423451    infoPtr->bands =
    3343         (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND));
     3452        (REBAR_BAND *)Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND));
    33443453
    33453454    /* pre insert copy */
     
    33583467    }
    33593468
    3360     COMCTL32_Free (oldBands);
     3469    Free (oldBands);
    33613470
    33623471    TRACE("moved band %d to index %d\n", uFrom, uTo);
     
    33773486
    33783487
     3488/* return TRUE if two strings are different */
     3489static BOOL
     3490REBAR_strdifW( LPCWSTR a, LPCWSTR b )
     3491{
     3492    return ( (a && !b) || (b && !a) || (a && b && lstrcmpW(a, b) ) );
     3493}
     3494
    33793495static LRESULT
    33803496REBAR_SetBandInfoA (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
     
    33823498    LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
    33833499    REBAR_BAND *lpBand;
     3500    BOOL bChanged;
    33843501
    33853502    if (lprbbi == NULL)
    33863503        return FALSE;
    3387     if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
     3504    if (lprbbi->cbSize < REBARBANDINFOA_V3_SIZE)
    33883505        return FALSE;
    33893506    if ((UINT)wParam >= infoPtr->uNumBands)
     
    33963513    lpBand = &infoPtr->bands[(UINT)wParam];
    33973514
    3398     REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand);
     3515    bChanged = REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand);
    33993516    if (lprbbi->fMask & RBBIM_TEXT) {
    3400         if (lpBand->lpText) {
    3401             COMCTL32_Free (lpBand->lpText);
    3402             lpBand->lpText = NULL;
    3403         }
    3404         if (lprbbi->lpText) {
    3405             INT len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 );
    3406             lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR));
    3407             MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len );
    3408         }
     3517        LPWSTR wstr = NULL;
     3518
     3519        if (lprbbi->lpText)
     3520        {
     3521            INT len;
     3522            len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 );
     3523            if (len > 1)
     3524                wstr = (LPWSTR)Alloc (len*sizeof(WCHAR));
     3525            if (wstr)
     3526                MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, wstr, len );
     3527        }
     3528        if (REBAR_strdifW(lpBand->lpText, wstr)) {
     3529            if (lpBand->lpText) {
     3530                Free (lpBand->lpText);
     3531                lpBand->lpText = NULL;
     3532            }
     3533            if (wstr) {
     3534                lpBand->lpText = wstr;
     3535                wstr = NULL;
     3536            }
     3537            bChanged = TRUE;
     3538        }
     3539        if (wstr)
     3540            Free (wstr);
    34093541    }
    34103542
     
    34133545    REBAR_DumpBand (infoPtr);
    34143546
    3415     if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) {
     3547    if (bChanged && (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE))) {
    34163548          REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
    34173549          InvalidateRect(infoPtr->hwndSelf, 0, 1);
     
    34213553}
    34223554
    3423 
    34243555static LRESULT
    34253556REBAR_SetBandInfoW (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
     
    34273558    LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
    34283559    REBAR_BAND *lpBand;
     3560    BOOL bChanged;
    34293561
    34303562    if (lprbbi == NULL)
    34313563        return FALSE;
    3432     if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
     3564    if (lprbbi->cbSize < REBARBANDINFOW_V3_SIZE)
    34333565        return FALSE;
    34343566    if ((UINT)wParam >= infoPtr->uNumBands)
     
    34413573    lpBand = &infoPtr->bands[(UINT)wParam];
    34423574
    3443     REBAR_CommonSetupBand (infoPtr->hwndSelf, (LPREBARBANDINFOA)lprbbi, lpBand);
    3444     if (lprbbi->fMask & RBBIM_TEXT) {
     3575    bChanged = REBAR_CommonSetupBand (infoPtr->hwndSelf, (LPREBARBANDINFOA)lprbbi, lpBand);
     3576    if( (lprbbi->fMask & RBBIM_TEXT) &&
     3577        REBAR_strdifW( lpBand->lpText, lprbbi->lpText ) ) {
    34453578        if (lpBand->lpText) {
    3446             COMCTL32_Free (lpBand->lpText);
     3579            Free (lpBand->lpText);
    34473580            lpBand->lpText = NULL;
    34483581        }
    34493582        if (lprbbi->lpText) {
    34503583            INT len = lstrlenW (lprbbi->lpText);
    3451             lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    3452             strcpyW (lpBand->lpText, lprbbi->lpText);
    3453         }
     3584            if (len > 0)
     3585            {
     3586                lpBand->lpText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
     3587                strcpyW (lpBand->lpText, lprbbi->lpText);
     3588            }
     3589        }
     3590        bChanged = TRUE;
    34543591    }
    34553592
     
    34583595    REBAR_DumpBand (infoPtr);
    34593596
    3460     if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) {
     3597    if ( bChanged && (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) ) {
    34613598      REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
    34623599      InvalidateRect(infoPtr->hwndSelf, 0, 1);
     
    36083745    }
    36093746
     3747    infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
    36103748    REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
    36113749    InvalidateRect(infoPtr->hwndSelf, 0, 1);
     
    36243762       return FALSE;
    36253763
    3626     TRACE("[%d %d %d %d]\n",
     3764    TRACE("[%ld %ld %ld %ld]\n",
    36273765          lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
    36283766
    36293767    /*  what is going on???? */
    36303768    GetWindowRect(infoPtr->hwndSelf, &t1);
    3631     TRACE("window rect [%d %d %d %d]\n",
     3769    TRACE("window rect [%ld %ld %ld %ld]\n",
    36323770          t1.left, t1.top, t1.right, t1.bottom);
    36333771    GetClientRect(infoPtr->hwndSelf, &t1);
    3634     TRACE("client rect [%d %d %d %d]\n",
     3772    TRACE("client rect [%ld %ld %ld %ld]\n",
    36353773          t1.left, t1.top, t1.right, t1.bottom);
    36363774
     
    36543792        GetWindowRect(infoPtr->hwndSelf, &wnrc1);
    36553793        GetClientRect(infoPtr->hwndSelf, &clrc1);
    3656         TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
     3794        TRACE("window=(%ld,%ld)-(%ld,%ld) client=(%ld,%ld)-(%ld,%ld) cs=(%d,%d %dx%d)\n",
    36573795              wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
    36583796              clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
     
    36693807{
    36703808    REBAR_BAND *lpBand;
    3671     INT i;
     3809    UINT i;
    36723810
    36733811
     
    36803818            /* delete text strings */
    36813819            if (lpBand->lpText) {
    3682                 COMCTL32_Free (lpBand->lpText);
     3820                Free (lpBand->lpText);
    36833821                lpBand->lpText = NULL;
    36843822            }
     
    36883826
    36893827        /* free band array */
    3690         COMCTL32_Free (infoPtr->bands);
     3828        Free (infoPtr->bands);
    36913829        infoPtr->bands = NULL;
    36923830    }
     
    37003838
    37013839    /* free rebar info data */
    3702     COMCTL32_Free (infoPtr);
     3840    Free (infoPtr);
    37033841    TRACE("destroyed!\n");
    37043842    return 0;
     
    37233861}
    37243862
     3863static LRESULT
     3864REBAR_PushChevron(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
     3865{
     3866    if (wParam >= 0 && (UINT)wParam < infoPtr->uNumBands)
     3867    {
     3868        NMREBARCHEVRON nmrbc;
     3869        REBAR_BAND *lpBand = &infoPtr->bands[wParam];
     3870
     3871        TRACE("Pressed chevron on band %d\n", wParam);
     3872
     3873        /* redraw chevron in pushed state */
     3874        lpBand->fDraw |= DRAW_CHEVRONPUSHED;
     3875        RedrawWindow(infoPtr->hwndSelf, &lpBand->rcChevron,0,
     3876          RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
     3877
     3878        /* notify app so it can display a popup menu or whatever */
     3879        nmrbc.uBand = wParam;
     3880        nmrbc.wID = lpBand->wID;
     3881        nmrbc.lParam = lpBand->lParam;
     3882        nmrbc.rc = lpBand->rcChevron;
     3883        nmrbc.lParamNM = lParam;
     3884        REBAR_Notify((NMHDR*)&nmrbc, infoPtr, RBN_CHEVRONPUSHED);
     3885
     3886        /* redraw chevron in previous state */
     3887        lpBand->fDraw &= ~DRAW_CHEVRONPUSHED;
     3888        InvalidateRect(infoPtr->hwndSelf, &lpBand->rcChevron, TRUE);
     3889
     3890        return TRUE;
     3891    }
     3892    return FALSE;
     3893}
    37253894
    37263895static LRESULT
     
    37283897{
    37293898    REBAR_BAND *lpBand;
    3730 
    3731     /* If InternalHitTest did not find a hit on the Gripper, */
    3732     /* then ignore the button click.                         */
    3733     if (infoPtr->ihitBand == -1) return 0;
    3734 
    3735     SetCapture (infoPtr->hwndSelf);
    3736 
    3737     /* save off the LOWORD and HIWORD of lParam as initial x,y */
    3738     lpBand = &infoPtr->bands[infoPtr->ihitBand];
    3739     infoPtr->dragStart = MAKEPOINTS(lParam);
    3740     infoPtr->dragNow = infoPtr->dragStart;
    3741     if (infoPtr->dwStyle & CCS_VERT)
    3742         infoPtr->ihitoffset = infoPtr->dragStart.y - (lpBand->rcBand.top+REBAR_PRE_GRIPPER);
    3743     else
    3744         infoPtr->ihitoffset = infoPtr->dragStart.x - (lpBand->rcBand.left+REBAR_PRE_GRIPPER);
    3745 
     3899    UINT htFlags;
     3900    UINT iHitBand;
     3901    POINT ptMouseDown;
     3902    ptMouseDown.x = (INT)LOWORD(lParam);
     3903    ptMouseDown.y = (INT)HIWORD(lParam);
     3904
     3905    REBAR_InternalHitTest(infoPtr, &ptMouseDown, &htFlags, &iHitBand);
     3906    lpBand = &infoPtr->bands[iHitBand];
     3907
     3908    if (htFlags == RBHT_CHEVRON)
     3909    {
     3910        REBAR_PushChevron(infoPtr, iHitBand, 0);
     3911    }
     3912    else if (htFlags == RBHT_GRABBER || htFlags == RBHT_CAPTION)
     3913    {
     3914        TRACE("Starting drag\n");
     3915
     3916        SetCapture (infoPtr->hwndSelf);
     3917        infoPtr->iGrabbedBand = iHitBand;
     3918
     3919        /* save off the LOWORD and HIWORD of lParam as initial x,y */
     3920        infoPtr->dragStart = MAKEPOINTS(lParam);
     3921        infoPtr->dragNow = infoPtr->dragStart;
     3922        if (infoPtr->dwStyle & CCS_VERT)
     3923            infoPtr->ihitoffset = infoPtr->dragStart.y - (lpBand->rcBand.top+REBAR_PRE_GRIPPER);
     3924        else
     3925            infoPtr->ihitoffset = infoPtr->dragStart.x - (lpBand->rcBand.left+REBAR_PRE_GRIPPER);
     3926    }
    37463927    return 0;
    37473928}
    3748 
    37493929
    37503930static LRESULT
    37513931REBAR_LButtonUp (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
    37523932{
    3753     NMHDR layout;
    3754     RECT rect;
    3755     INT ihitBand;
    3756 
    3757     /* If InternalHitTest did not find a hit on the Gripper, */
    3758     /* then ignore the button click.                         */
    3759     if (infoPtr->ihitBand == -1) return 0;
    3760 
    3761     ihitBand = infoPtr->ihitBand;
    3762     infoPtr->dragStart.x = 0;
    3763     infoPtr->dragStart.y = 0;
    3764     infoPtr->dragNow = infoPtr->dragStart;
    3765     infoPtr->ihitBand = -1;
    3766 
    3767     ReleaseCapture ();
    3768 
    3769     if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) {
    3770         REBAR_Notify((NMHDR *) &layout, infoPtr, RBN_LAYOUTCHANGED);
    3771         REBAR_Notify_NMREBAR (infoPtr, ihitBand, RBN_ENDDRAG);
    3772         infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED;
    3773     }
    3774 
    3775     GetClientRect(infoPtr->hwndSelf, &rect);
    3776     InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     3933    if (infoPtr->iGrabbedBand >= 0)
     3934    {
     3935        NMHDR layout;
     3936        RECT rect;
     3937
     3938        infoPtr->dragStart.x = 0;
     3939        infoPtr->dragStart.y = 0;
     3940        infoPtr->dragNow = infoPtr->dragStart;
     3941
     3942        ReleaseCapture ();
     3943
     3944        if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) {
     3945            REBAR_Notify(&layout, infoPtr, RBN_LAYOUTCHANGED);
     3946            REBAR_Notify_NMREBAR (infoPtr, infoPtr->iGrabbedBand, RBN_ENDDRAG);
     3947            infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED;
     3948        }
     3949
     3950        infoPtr->iGrabbedBand = -1;
     3951
     3952        GetClientRect(infoPtr->hwndSelf, &rect);
     3953        InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     3954    }
    37773955
    37783956    return 0;
    37793957}
    37803958
     3959static LRESULT
     3960REBAR_MouseLeave (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
     3961{
     3962    if (infoPtr->ichevronhotBand >= 0)
     3963    {
     3964        REBAR_BAND *lpChevronBand = &infoPtr->bands[infoPtr->ichevronhotBand];
     3965        if (lpChevronBand->fDraw & DRAW_CHEVRONHOT)
     3966        {
     3967            lpChevronBand->fDraw &= ~DRAW_CHEVRONHOT;
     3968            InvalidateRect(infoPtr->hwndSelf, &lpChevronBand->rcChevron, TRUE);
     3969        }
     3970    }
     3971    infoPtr->iOldBand = -1;
     3972    infoPtr->ichevronhotBand = -2;
     3973
     3974    return TRUE;
     3975}
    37813976
    37823977static LRESULT
    37833978REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
    37843979{
    3785     REBAR_BAND *band1, *band2;
     3980    REBAR_BAND *lpChevronBand;
    37863981    POINTS ptsmove;
    37873982
    3788     /* Validate entry as hit on Gripper has occurred */
    3789     if (GetCapture() != infoPtr->hwndSelf) return 0;
    3790     if (infoPtr->ihitBand == -1) return 0;
    3791 
    37923983    ptsmove = MAKEPOINTS(lParam);
    37933984
    3794     /* if mouse did not move much, exit */
    3795     if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) &&
    3796         (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0;
    3797 
    3798     band1 = &infoPtr->bands[infoPtr->ihitBand-1];
    3799     band2 = &infoPtr->bands[infoPtr->ihitBand];
    3800 
    3801     /* Test for valid drag case - must not be first band in row */
    3802     if (infoPtr->dwStyle & CCS_VERT) {
    3803         if ((ptsmove.x < band2->rcBand.left) ||
    3804             (ptsmove.x > band2->rcBand.right) ||
    3805             ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) {
    3806             FIXME("Cannot drag to other rows yet!!\n");
    3807         }
    3808         else {
    3809             REBAR_HandleLRDrag (infoPtr, &ptsmove);
    3810         }
    3811     }
    3812     else {
    3813         if ((ptsmove.y < band2->rcBand.top) ||
    3814             (ptsmove.y > band2->rcBand.bottom) ||
    3815             ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) {
    3816             FIXME("Cannot drag to other rows yet!!\n");
    3817         }
    3818         else {
    3819             REBAR_HandleLRDrag (infoPtr, &ptsmove);
    3820         }
    3821     }
     3985    /* if we are currently dragging a band */
     3986    if (infoPtr->iGrabbedBand >= 0)
     3987    {
     3988        REBAR_BAND *band1, *band2;
     3989   
     3990        if (GetCapture() != infoPtr->hwndSelf)
     3991            ERR("We are dragging but haven't got capture?!?\n");
     3992
     3993        band1 = &infoPtr->bands[infoPtr->iGrabbedBand-1];
     3994        band2 = &infoPtr->bands[infoPtr->iGrabbedBand];
     3995
     3996        /* if mouse did not move much, exit */
     3997        if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) &&
     3998            (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0;
     3999
     4000        /* Test for valid drag case - must not be first band in row */
     4001        if (infoPtr->dwStyle & CCS_VERT) {
     4002            if ((ptsmove.x < band2->rcBand.left) ||
     4003              (ptsmove.x > band2->rcBand.right) ||
     4004              ((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) {
     4005                FIXME("Cannot drag to other rows yet!!\n");
     4006            }
     4007            else {
     4008                REBAR_HandleLRDrag (infoPtr, &ptsmove);
     4009            }
     4010        }
     4011        else {
     4012            if ((ptsmove.y < band2->rcBand.top) ||
     4013              (ptsmove.y > band2->rcBand.bottom) ||
     4014              ((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) {
     4015                FIXME("Cannot drag to other rows yet!!\n");
     4016            }
     4017            else {
     4018                REBAR_HandleLRDrag (infoPtr, &ptsmove);
     4019            }
     4020        }
     4021    }
     4022    else
     4023    {
     4024        POINT ptMove;
     4025        INT iHitBand;
     4026        UINT htFlags;
     4027        TRACKMOUSEEVENT trackinfo;
     4028
     4029        ptMove.x = (INT)ptsmove.x;
     4030        ptMove.y = (INT)ptsmove.y;
     4031        REBAR_InternalHitTest(infoPtr, &ptMove, &htFlags, &iHitBand);
     4032
     4033        if (infoPtr->iOldBand >= 0 && infoPtr->iOldBand == infoPtr->ichevronhotBand)
     4034        {
     4035            lpChevronBand = &infoPtr->bands[infoPtr->ichevronhotBand];
     4036            if (lpChevronBand->fDraw & DRAW_CHEVRONHOT)
     4037            {
     4038                lpChevronBand->fDraw &= ~DRAW_CHEVRONHOT;
     4039                InvalidateRect(infoPtr->hwndSelf, &lpChevronBand->rcChevron, TRUE);
     4040            }
     4041            infoPtr->ichevronhotBand = -2;
     4042        }
     4043
     4044        if (htFlags == RBHT_CHEVRON)
     4045        {
     4046            /* fill in the TRACKMOUSEEVENT struct */
     4047            trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
     4048            trackinfo.dwFlags = TME_QUERY;
     4049            trackinfo.hwndTrack = infoPtr->hwndSelf;
     4050            trackinfo.dwHoverTime = 0;
     4051
     4052            /* call _TrackMouseEvent to see if we are currently tracking for this hwnd */
     4053            _TrackMouseEvent(&trackinfo);
     4054
     4055            /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */
     4056            if(!(trackinfo.dwFlags & TME_LEAVE))
     4057            {
     4058                trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
     4059
     4060                /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
     4061                /* and can properly deactivate the hot chevron */
     4062                _TrackMouseEvent(&trackinfo);
     4063            }
     4064
     4065            lpChevronBand = &infoPtr->bands[iHitBand];
     4066            if (!(lpChevronBand->fDraw & DRAW_CHEVRONHOT))
     4067            {
     4068                lpChevronBand->fDraw |= DRAW_CHEVRONHOT;
     4069                InvalidateRect(infoPtr->hwndSelf, &lpChevronBand->rcChevron, TRUE);
     4070                infoPtr->ichevronhotBand = iHitBand;
     4071            }
     4072        }
     4073        infoPtr->iOldBand = iHitBand;
     4074    }
     4075
    38224076    return 0;
    38234077}
     
    38314085                    -GetSystemMetrics(SM_CYEDGE));
    38324086    }
    3833     TRACE("new client=(%d,%d)-(%d,%d)\n",
     4087    TRACE("new client=(%ld,%ld)-(%ld,%ld)\n",
    38344088          ((LPRECT)lParam)->left, ((LPRECT)lParam)->top,
    38354089          ((LPRECT)lParam)->right, ((LPRECT)lParam)->bottom);
     
    38564110        GetWindowRect(hwnd, &wnrc1);
    38574111        GetClientRect(hwnd, &clrc1);
    3858         TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
     4112        TRACE("window=(%ld,%ld)-(%ld,%ld) client=(%ld,%ld)-(%ld,%ld) cs=(%d,%d %dx%d)\n",
    38594113              wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
    38604114              clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
     
    38634117
    38644118    /* allocate memory for info structure */
    3865     infoPtr = (REBAR_INFO *)COMCTL32_Alloc (sizeof(REBAR_INFO));
     4119    infoPtr = (REBAR_INFO *)Alloc (sizeof(REBAR_INFO));
    38664120    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
    38674121
     
    38714125    infoPtr->clrBtnText = GetSysColor (COLOR_BTNTEXT);
    38724126    infoPtr->clrBtnFace = GetSysColor (COLOR_BTNFACE);
    3873     infoPtr->ihitBand = -1;
     4127    infoPtr->iOldBand = -1;
     4128    infoPtr->ichevronhotBand = -2;
     4129    infoPtr->iGrabbedBand = -1;
    38744130    infoPtr->hwndSelf = hwnd;
    38754131    infoPtr->DoRedraw = TRUE;
    3876     infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA);
    3877     infoPtr->hcurHorz  = LoadCursorA (0, IDC_SIZEWEA);
    3878     infoPtr->hcurVert  = LoadCursorA (0, IDC_SIZENSA);
    3879     infoPtr->hcurDrag  = LoadCursorA (0, IDC_SIZEA);
     4132    infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROWA);
     4133    infoPtr->hcurHorz  = LoadCursorA (0, (LPSTR)IDC_SIZEWEA);
     4134    infoPtr->hcurVert  = LoadCursorA (0, (LPSTR)IDC_SIZENSA);
     4135    infoPtr->hcurDrag  = LoadCursorA (0, (LPSTR)IDC_SIZEA);
    38804136    infoPtr->bUnicode = IsWindowUnicode (hwnd);
    38814137    infoPtr->fStatus = CREATE_RUNNING;
     
    39894245        GetWindowRect (infoPtr->hwndSelf, &rcWindow);
    39904246        OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
    3991         TRACE("rect (%d,%d)-(%d,%d)\n",
     4247        TRACE("rect (%ld,%ld)-(%ld,%ld)\n",
    39924248              rcWindow.left, rcWindow.top,
    39934249              rcWindow.right, rcWindow.bottom);
     
    40304286    hdc = wParam==0 ? BeginPaint (infoPtr->hwndSelf, &ps) : (HDC)wParam;
    40314287
    4032     TRACE("painting (%d,%d)-(%d,%d) client (%d,%d)-(%d,%d)\n",
     4288    TRACE("painting (%ld,%ld)-(%ld,%ld) client (%ld,%ld)-(%ld,%ld)\n",
    40334289          ps.rcPaint.left, ps.rcPaint.top,
    40344290          ps.rcPaint.right, ps.rcPaint.bottom,
     
    41554411        infoPtr->fStatus &= ~CREATE_RUNNING;
    41564412        GetWindowRect ( infoPtr->hwndSelf, &rcWin);
    4157         TRACE("win rect (%d,%d)-(%d,%d)\n",
     4413        TRACE("win rect (%ld,%ld)-(%ld,%ld)\n",
    41584414              rcWin.left, rcWin.top, rcWin.right, rcWin.bottom);
    41594415
     
    41624418            /* native control seems to do this */
    41634419            GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient);
    4164             TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n",
     4420            TRACE("sizing rebar, message and client zero, parent client (%ld,%ld)\n",
    41654421                  rcClient.right, rcClient.bottom);
    41664422        }
     
    41764432            /* do the actual WM_SIZE request */
    41774433            GetClientRect (infoPtr->hwndSelf, &rcClient);
    4178             TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n",
     4434            TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%ld,%ld)\n",
    41794435                  infoPtr->calcSize.cx, infoPtr->calcSize.cy,
    41804436                  LOWORD(lParam), HIWORD(lParam),
     
    41964452            /* native seems to use the current client rect for the size      */
    41974453            infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
    4198             TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n",
     4454            TRACE("sizing rebar to client (%ld,%ld) size is zero but AUTOSIZE set\n",
    41994455                  rcClient.right, rcClient.bottom);
    42004456        }
    42014457        else {
    4202             TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n",
     4458#ifdef __WIN32OS2__
     4459            INT  width, x, y, height;
     4460            RECT parent_rect, rcWin;
     4461
     4462            if(HIWORD(lParam) != (rcClient.bottom - rcClient.top) ||
     4463               LOWORD(lParam) != (rcClient.right  - rcClient.left))
     4464            {
     4465                /* Need to resize width to match parent */
     4466                GetWindowRect ( infoPtr->hwndSelf, &rcWin);
     4467                height = (rcWin.bottom - rcWin.top);
     4468 
     4469                /* width and height don't apply */
     4470                GetClientRect (GetParent(infoPtr->hwndSelf), &parent_rect);
     4471                width = parent_rect.right - parent_rect.left;
     4472                TRACE("Rebar: resize to match parent");
     4473                SetWindowPos (infoPtr->hwndSelf, 0, 0, 0, width, height, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
     4474                return 0;;
     4475            }
     4476#endif
     4477            TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%ld,%ld)\n",
    42034478                  infoPtr->calcSize.cx, infoPtr->calcSize.cy,
    42044479                  LOWORD(lParam), HIWORD(lParam),
     
    42144489        autosize.rcActual = autosize.rcTarget;  /* ??? */
    42154490        REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE);
    4216         TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n",
     4491        TRACE("RBN_AUTOSIZE client=(%ld,%ld), lp=%08lx\n",
    42174492              autosize.rcTarget.right, autosize.rcTarget.bottom, lParam);
    42184493    }
     
    42554530                         wParam, lParam);
    42564531    GetWindowRect(infoPtr->hwndSelf, &rc);
    4257     TRACE("hwnd %p new pos (%d,%d)-(%d,%d)\n",
     4532    TRACE("hwnd %p new pos (%ld,%ld)-(%ld,%ld)\n",
    42584533          infoPtr->hwndSelf, rc.left, rc.top, rc.right, rc.bottom);
    42594534    return ret;
    42604535}
    42614536
     4537#ifdef __WIN32OS2__
     4538#ifdef DEBUG
     4539static void dprintfMsg(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     4540{
     4541 char *msg = NULL;
     4542
     4543  switch (uMsg)
     4544  {
     4545  case RB_DELETEBAND:
     4546      msg = "RB_DELETEBAND";
     4547      break;
     4548  case RB_GETBANDBORDERS:
     4549      msg = "RB_GETBANDBORDERS";
     4550      break;
     4551  case RB_GETBANDCOUNT:
     4552      msg = "RB_GETBANDCOUNT";
     4553      break;
     4554  case RB_GETBANDINFO_OLD:
     4555      msg = "RB_GETBANDINFO_OLD";
     4556      break;
     4557  case RB_GETBANDINFOA:
     4558      msg = "RB_GETBANDINFOA";
     4559      break;
     4560  case RB_GETBANDINFOW:
     4561      msg = "RB_GETBANDINFOW";
     4562      break;
     4563  case RB_GETBARHEIGHT:
     4564      msg = "RB_GETBARHEIGHT";
     4565      break;
     4566  case RB_GETBARINFO:
     4567      msg = "RB_GETBARINFO";
     4568      break;
     4569  case RB_GETBKCOLOR:
     4570      msg = "RB_GETBKCOLOR";
     4571      break;
     4572  case RB_GETPALETTE:
     4573      msg = "RB_GETPALETTE";
     4574      break;
     4575  case RB_GETRECT:
     4576      msg = "RB_GETRECT";
     4577      break;
     4578  case RB_GETROWCOUNT:
     4579      msg = "RB_GETROWCOUNT";
     4580      break;
     4581  case RB_GETROWHEIGHT:
     4582      msg = "RB_GETROWHEIGHT";
     4583      break;
     4584  case RB_GETTEXTCOLOR:
     4585      msg = "RB_GETTEXTCOLOR";
     4586      break;
     4587  case RB_GETTOOLTIPS:
     4588      msg = "RB_GETTOOLTIPS";
     4589      break;
     4590  case RB_GETUNICODEFORMAT:
     4591      msg = "RB_GETUNICODEFORMAT";
     4592      break;
     4593  case CCM_GETVERSION:
     4594      msg = "CCM_GETVERSION";
     4595      break;
     4596  case RB_HITTEST:
     4597      msg = "RB_HITTEST";
     4598      break;
     4599  case RB_IDTOINDEX:
     4600      msg = "RB_IDTOINDEX";
     4601      break;
     4602  case RB_INSERTBANDA:
     4603      msg = "RB_INSERTBANDA";
     4604      break;
     4605  case RB_INSERTBANDW:
     4606      msg = "RB_INSERTBANDW";
     4607      break;
     4608  case RB_MAXIMIZEBAND:
     4609      msg = "RB_MAXIMIZEBAND";
     4610      break;
     4611  case RB_MINIMIZEBAND:
     4612      msg = "RB_MINIMIZEBAND";
     4613      break;
     4614  case RB_MOVEBAND:
     4615      msg = "RB_MOVEBAND";
     4616      break;
     4617  case RB_PUSHCHEVRON:
     4618      msg = "RB_PUSHCHEVRON";
     4619      break;
     4620  case RB_SETBANDINFOA:
     4621      msg = "RB_SETBANDINFOA";
     4622      break;
     4623  case RB_SETBANDINFOW:
     4624      msg = "RB_SETBANDINFOW";
     4625      break;
     4626  case RB_SETBARINFO:
     4627      msg = "RB_SETBARINFO";
     4628      break;
     4629  case RB_SETBKCOLOR:
     4630      msg = "RB_SETBKCOLOR";
     4631      break;
     4632  case RB_SETPARENT:
     4633      msg = "RB_SETPARENT";
     4634      break;
     4635  case RB_SETTEXTCOLOR:
     4636      msg = "RB_SETTEXTCOLOR";
     4637      break;
     4638  case RB_SETUNICODEFORMAT:
     4639      msg = "RB_SETUNICODEFORMAT";
     4640      break;
     4641  case CCM_SETVERSION:
     4642      msg = "CCM_SETVERSION";
     4643      break;
     4644  case RB_SHOWBAND:
     4645      msg = "RB_SHOWBAND";
     4646      break;
     4647  case RB_SIZETORECT:
     4648      msg = "RB_SIZETORECT";
     4649      break;
     4650/*      case RB_BEGINDRAG: */
     4651/*      case RB_DRAGMOVE: */
     4652/*      case RB_ENDDRAG: */
     4653/*      case RB_GETCOLORSCHEME: */
     4654/*      case RB_GETDROPTARGET: */
     4655/*      case RB_SETCOLORSCHEME: */
     4656/*      case RB_SETPALETTE: */
     4657/*          return REBAR_GetPalette (infoPtr, wParam, lParam); */
     4658/*      case RB_SETTOOLTIPS: */
     4659
     4660  default:
     4661      return;
     4662  }
     4663  dprintf(("Rebar %x %s %x %x", hwnd, msg, wParam, lParam));
     4664}
     4665#endif
     4666#endif //__WIN32OS2__
    42624667
    42634668static LRESULT WINAPI
     
    42664671    REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
    42674672
     4673#if defined(DEBUG) && defined(__WIN32OS2__)
     4674    dprintfMsg(hwnd, uMsg, wParam, lParam);
     4675#else
    42684676    TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
    4269           hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
     4677          hwnd, uMsg, wParam, lParam);
     4678#endif
    42704679    if (!infoPtr && (uMsg != WM_NCCREATE))
    42714680            return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     
    42864695            return REBAR_GetBandCount (infoPtr);
    42874696
    4288         case RB_GETBANDINFO:    /* obsoleted after IE3, but we have to
    4289                                    support it anyway. */
     4697        case RB_GETBANDINFO_OLD:
    42904698        case RB_GETBANDINFOA:
    42914699            return REBAR_GetBandInfoA (infoPtr, wParam, lParam);
     
    43504758        case RB_MOVEBAND:
    43514759            return REBAR_MoveBand (infoPtr, wParam, lParam);
     4760
     4761        case RB_PUSHCHEVRON:
     4762            return REBAR_PushChevron (infoPtr, wParam, lParam);
    43524763
    43534764        case RB_SETBANDINFOA:
     
    44264837        case WM_MOUSEMOVE:
    44274838            return REBAR_MouseMove (infoPtr, wParam, lParam);
     4839
     4840        case WM_MOUSELEAVE:
     4841            return REBAR_MouseLeave (infoPtr, wParam, lParam);
    44284842
    44294843        case WM_NCCALCSIZE:
     
    45154929REBAR_Unregister (void)
    45164930{
    4517     UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL);
    4518 }
     4931    UnregisterClassA (REBARCLASSNAMEA, NULL);
     4932}
Note: See TracChangeset for help on using the changeset viewer.