Ignore:
Timestamp:
Oct 29, 2002, 1:19:36 PM (23 years ago)
Author:
sandervl
Message:

Wine resync

File:
1 edited

Legend:

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

    r8382 r9370  
    8686    INT nRow;
    8787    RECT rect;
    88 } TBUTTON_INFO; 
     88} TBUTTON_INFO;
    8989
    9090typedef struct
     
    171171#define TOP_BORDER         2
    172172#define BOTTOM_BORDER      2
    173 #define DDARROW_WIDTH      11 
     173#define DDARROW_WIDTH      11
    174174
    175175#define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0))
     
    197197    else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings))
    198198        lpText = infoPtr->strings[btnPtr->iString];
    199    
     199
    200200    return lpText;
    201201}
     
    213213                  btn_num, bP->idCommand,
    214214                  (bP->bHot) ? "TRUE":"FALSE", bP->nRow,
    215                   bP->rect.left, bP->rect.top, 
     215                  bP->rect.left, bP->rect.top,
    216216                  bP->rect.right, bP->rect.bottom);
    217217    }
     
    227227
    228228        dwStyle = GetWindowLongA (iP->hwndSelf, GWL_STYLE);
    229         TRACE("toolbar %08x at line %d, exStyle=%08lx, buttons=%d, bitmaps=%d, strings=%d, style=%08lx\n",
     229        TRACE("toolbar %p at line %d, exStyle=%08lx, buttons=%d, bitmaps=%d, strings=%d, style=%08lx\n",
    230230              iP->hwndSelf, line,
    231231              iP->dwExStyle, iP->nNumButtons, iP->nNumBitmaps,
    232232              iP->nNumStrings, dwStyle);
    233         TRACE("toolbar %08x at line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n",
     233        TRACE("toolbar %p at line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n",
    234234              iP->hwndSelf, line,
    235235              iP->himlInt, iP->himlDef, iP->himlHot, iP->himlDis,
     
    253253{
    254254    if (dwStyle & TBSTYLE_ALTDRAG)
    255         FIXME("[%04x] TBSTYLE_ALTDRAG not implemented\n", hwnd);
     255        FIXME("[%p] TBSTYLE_ALTDRAG not implemented\n", hwnd);
    256256    if (dwStyle & TBSTYLE_REGISTERDROP)
    257         FIXME("[%04x] TBSTYLE_REGISTERDROP not implemented\n", hwnd);
     257        FIXME("[%p] TBSTYLE_REGISTERDROP not implemented\n", hwnd);
    258258}
    259259
     
    264264        if(!IsWindow(infoPtr->hwndSelf))
    265265            return 0;   /* we have just been destroyed */
    266        
     266
    267267    nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf);
    268268    nmhdr->hwndFrom = infoPtr->hwndSelf;
    269269    nmhdr->code = code;
    270270
    271     TRACE("to window %04x, code=%08x, %s\n", infoPtr->hwndNotify, code,
     271    TRACE("to window %p, code=%08x, %s\n", infoPtr->hwndNotify, code,
    272272          (infoPtr->bNtfUnicode) ? "via Unicode" : "via ANSI");
    273273
    274274    if (infoPtr->bNtfUnicode)
    275         return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 
     275        return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
    276276                             (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr);
    277277    else
    278         return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 
     278        return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
    279279                             (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr);
    280280}
     
    287287* is issued to retrieve the index.
    288288*/
    289 static INT 
     289static INT
    290290TOOLBAR_GetBitmapIndex(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
    291291{
     
    306306        }
    307307        ret = nmgd.iImage;
    308         TRACE("TBN_GETDISPINFOA returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n", 
     308        TRACE("TBN_GETDISPINFOA returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n",
    309309              ret, nmgd.dwMask, infoPtr->nNumBitmaps);
    310310    }
     
    313313
    314314
    315 static BOOL 
     315static BOOL
    316316TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index)
    317317{
     
    329329* This function validates the bitmap index (including I_IMAGECALLBACK
    330330* functionality). It then draws the image via the ImageList_Draw
    331 * function. It returns TRUE if the image was drawn, FALSE otherwise. 
     331* function. It returns TRUE if the image was drawn, FALSE otherwise.
    332332*/
    333333static BOOL
     
    341341    if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
    342342        if (btnPtr->iBitmap == I_IMAGENONE) return FALSE;
    343         ERR("index %d is not valid, max %d\n", 
     343        ERR("index %d is not valid, max %d\n",
    344344            btnPtr->iBitmap, infoPtr->nNumBitmaps);
    345345        return FALSE;
     
    376376    if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
    377377        if (btnPtr->iBitmap == I_IMAGENONE) return FALSE;
    378         ERR("index %d is not valid, max %d\n", 
     378        ERR("index %d is not valid, max %d\n",
    379379            btnPtr->iBitmap, infoPtr->nNumBitmaps);
    380380        return FALSE;
     
    403403    myrect.bottom = lpRect->bottom - 2;
    404404
    405     newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 
     405    newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
    406406                comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow;
    407407    oldcolor = SetBkColor (hdc, newcolor);
     
    411411    myrect.right = myrect.left + 1;
    412412
    413     newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 
     413    newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
    414414                comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight;
    415415    SetBkColor (hdc, newcolor);
     
    447447          myrect.left, myrect.top, myrect.right, myrect.bottom);
    448448
    449     newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 
     449    newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
    450450                comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow;
    451451    oldcolor = SetBkColor (hdc, newcolor);
     
    455455    myrect.bottom = myrect.top + 1;
    456456
    457     newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 
     457    newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
    458458                comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight;
    459459    SetBkColor (hdc, newcolor);
     
    468468{
    469469    INT x, y;
    470     SelectObject ( hdc, GetSysColorPen (colorRef));
     470    HPEN hPen, hOldPen;
     471
     472    if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return;
     473    hOldPen = SelectObject ( hdc, hPen );
    471474    x = left + 2;
    472475    y = top + 8;
     
    477480    MoveToEx (hdc, x, y, NULL);
    478481    LineTo (hdc, x+1, y++);
     482    SelectObject( hdc, hOldPen );
     483    DeleteObject( hPen );
    479484}
    480485
     
    627632        else
    628633            rc.right = max(rc.left, rc.right - DDARROW_WIDTH - 2);
    629         rcArrow.left = rc.right; 
     634        rcArrow.left = rc.right;
    630635    }
    631636
     
    641646        rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2;
    642647
    643     TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n", 
     648    TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n",
    644649          btnPtr->iBitmap, rcBitmap.left, rcBitmap.top,
    645650          infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
     
    652657        InflateRect (&rcText, -3, -3);
    653658
    654         if (infoPtr->himlDef && 
     659        if (infoPtr->himlDef &&
    655660            TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
    656661                /* The following test looked like this before
     
    660665                 *    ((btnPtr->fsStyle & TBSTYLE_AUTOSIZE) == 0) &&
    661666                 *       (btnPtr->iBitmap != I_IMAGENONE))
    662                  */ 
     667                 */
    663668                if (dwStyle & TBSTYLE_LIST) {
    664669                    /* LIST style w/ ICON offset is by matching native. */
     
    707712    tbcd.hpenLines = 0;
    708713
    709     /* Issue Item Prepaint notify */ 
     714    /* Issue Item Prepaint notify */
    710715    infoPtr->dwItemCustDraw = 0;
    711716    infoPtr->dwItemCDFlag = 0;
     
    721726        infoPtr->dwItemCustDraw = ntfret & 0xffff;
    722727        infoPtr->dwItemCDFlag = ntfret & 0xffff0000;
    723         if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT) 
     728        if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT)
    724729            return;
    725730        /* save the only part of the rect that the user can change */
     
    761766                      BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
    762767        }
    763        
     768
    764769        if (hasDropDownArrow)
    765770        {
     
    769774
    770775        if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDis,
    771                                    hdc, rcBitmap.left, rcBitmap.top, 
     776                                   hdc, rcBitmap.left, rcBitmap.top,
    772777                                   ILD_NORMAL))
    773778            TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
     
    800805
    801806        TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
    802                                hdc, rcBitmap.left+offset, rcBitmap.top+offset, 
     807                               hdc, rcBitmap.left+offset, rcBitmap.top+offset,
    803808                               ILD_NORMAL);
    804809
     
    821826
    822827        TOOLBAR_DrawPattern (hdc, &rc);
    823        
     828
    824829        TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
    825                                hdc, rcBitmap.left+1, rcBitmap.top+1, 
     830                               hdc, rcBitmap.left+1, rcBitmap.top+1,
    826831                               ILD_NORMAL);
    827832
     
    830835    }
    831836
    832     /* indeterminate */ 
     837    /* indeterminate */
    833838    if (btnPtr->fsState & TBSTATE_INDETERMINATE) {
    834839        if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
     
    884889        if (btnPtr->bHot) {
    885890            /* if hot, attempt to draw with himlHot, if fails, use himlDef */
    886             if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, 
     891            if (!TOOLBAR_DrawImageList (infoPtr, btnPtr,
    887892                                        infoPtr->himlHot,
    888                                         hdc, rcBitmap.left, 
     893                                        hdc, rcBitmap.left,
    889894                                        rcBitmap.top, ILD_NORMAL))
    890895                TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
     
    914919                               hdc, rcBitmap.left, rcBitmap.top,
    915920                               ILD_NORMAL);}
    916    
     921
    917922
    918923    TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd);
     
    9981003*/
    9991004static void
    1000 TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 
     1005TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
    10011006                      HDC hdc, LPSIZE lpSize)
    10021007{
     
    10061011    lpSize->cy = 0;
    10071012
    1008     if (!(btnPtr->fsState & TBSTATE_HIDDEN) ) 
     1013    if (!(btnPtr->fsState & TBSTATE_HIDDEN) )
    10091014    {
    10101015        LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr);
     
    10761081*               TOOLBAR_WrapToolbar
    10771082*
    1078 * This function walks through the buttons and seperators in the 
    1079 * toolbar, and sets the TBSTATE_WRAP flag only on those items where 
    1080 * wrapping should occur based on the width of the toolbar window. 
    1081 * It does *not* calculate button placement itself.  That task 
    1082 * takes place in TOOLBAR_CalcToolbar. If the program wants to manage 
    1083 * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE 
     1083* This function walks through the buttons and seperators in the
     1084* toolbar, and sets the TBSTATE_WRAP flag only on those items where
     1085* wrapping should occur based on the width of the toolbar window.
     1086* It does *not* calculate button placement itself.  That task
     1087* takes place in TOOLBAR_CalcToolbar. If the program wants to manage
     1088* the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE
    10841089* flag, and set the TBSTATE_WRAP flags manually on the appropriate items.
    10851090*
    1086 * Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow 
    1087 * vertical toolbar lists. 
    1088 */ 
     1091* Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow
     1092* vertical toolbar lists.
     1093*/
    10891094
    10901095static void
     
    10971102    BOOL bWrap, bButtonWrap;
    10981103
    1099     /*  When the toolbar window style is not TBSTYLE_WRAPABLE,  */ 
     1104    /*  When the toolbar window style is not TBSTYLE_WRAPABLE,  */
    11001105    /*  no layout is necessary. Applications may use this style */
    11011106    /*  to perform their own layout on the toolbar.             */
    1102     if( !(dwStyle & TBSTYLE_WRAPABLE) && 
     1107    if( !(dwStyle & TBSTYLE_WRAPABLE) &&
    11031108        !(infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1) )  return;
    11041109
     
    11221127        bWrap = FALSE;
    11231128        btnPtr[i].fsState &= ~TBSTATE_WRAP;
    1124        
     1129
    11251130        if (btnPtr[i].fsState & TBSTATE_HIDDEN)
    11261131            continue;
     
    11341139        if ((btnPtr[i].fsStyle & TBSTYLE_SEP) &&
    11351140            !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN))
    1136             cx = (btnPtr[i].iBitmap > 0) ? 
     1141            cx = (btnPtr[i].iBitmap > 0) ?
    11371142                        btnPtr[i].iBitmap : SEPARATOR_WIDTH;
    11381143        else
    11391144            cx = infoPtr->nButtonWidth;
    11401145
    1141         /* Two or more adjacent separators form a separator group.   */ 
     1146        /* Two or more adjacent separators form a separator group.   */
    11421147        /* The first separator in a group should be wrapped to the   */
    11431148        /* next row if the previous wrapping is on a button.         */
    11441149        if( bButtonWrap &&
    1145                 (btnPtr[i].fsStyle & TBSTYLE_SEP) && 
     1150                (btnPtr[i].fsStyle & TBSTYLE_SEP) &&
    11461151                (i + 1 < infoPtr->nNumButtons ) &&
    1147                 (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) 
     1152                (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) )
    11481153        {
    11491154            TRACE("wrap point 1 btn %d style %02x\n", i, btnPtr[i].fsStyle);
     
    11581163        /* Test added to also wrap after a button that starts a row but     */
    11591164        /* is bigger than the area.  - GA  8/01                             */
    1160         if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 
     1165        if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2
    11611166           > infoPtr->nWidth ) ||
    11621167            ((x == infoPtr->nIndent) && (cx > infoPtr->nWidth)))
     
    11641169            BOOL bFound = FALSE;
    11651170
    1166             /*  If the current button is a separator and not hidden,  */ 
     1171            /*  If the current button is a separator and not hidden,  */
    11671172            /*  go to the next until it reaches a non separator.      */
    11681173            /*  Wrap the last separator if it is before a button.     */
    11691174            while( ( ((btnPtr[i].fsStyle & TBSTYLE_SEP) &&
    1170                       !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) || 
     1175                      !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) ||
    11711176                     (btnPtr[i].fsState & TBSTATE_HIDDEN) ) &&
    11721177                        i < infoPtr->nNumButtons )
     
    11751180                bFound = TRUE;
    11761181            }
    1177    
     1182
    11781183            if( bFound && i < infoPtr->nNumButtons )
    11791184            {
    11801185                i--;
    1181                 TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n", 
     1186                TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n",
    11821187                      i, btnPtr[i].fsStyle, x, cx);
    11831188                btnPtr[i].fsState |= TBSTATE_WRAP;
     
    11891194                break;
    11901195
    1191             /*  If the current button is not a separator, find the last  */ 
     1196            /*  If the current button is not a separator, find the last  */
    11921197            /*  separator and wrap it.                                   */
    11931198            for ( j = i - 1; j >= 0  &&  !(btnPtr[j].fsState & TBSTATE_WRAP); j--)
     
    11961201                        !(btnPtr[j].fsState & TBSTATE_HIDDEN))
    11971202                {
    1198                     bFound = TRUE; 
    1199                     i = j; 
    1200                     TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n", 
     1203                    bFound = TRUE;
     1204                    i = j;
     1205                    TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n",
    12011206                          i, btnPtr[i].fsStyle, x, cx);
    12021207                    x = infoPtr->nIndent;
    12031208                    btnPtr[j].fsState |= TBSTATE_WRAP;
    1204                     bButtonWrap = FALSE; 
     1209                    bButtonWrap = FALSE;
    12051210                    break;
    12061211                }
     
    12111216            if (!bFound)
    12121217            {
    1213                 for ( j = i - 1; 
     1218                for ( j = i - 1;
    12141219                        j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--)
    12151220                {
    1216                     if (btnPtr[j].fsState & TBSTATE_HIDDEN) 
     1221                    if (btnPtr[j].fsState & TBSTATE_HIDDEN)
    12171222                        continue;
    12181223
    1219                     bFound = TRUE; 
    1220                     i = j; 
    1221                     TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n", 
     1224                    bFound = TRUE;
     1225                    i = j;
     1226                    TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n",
    12221227                          i, btnPtr[i].fsStyle, x, cx);
    12231228                    x = infoPtr->nIndent;
     
    12291234
    12301235            /* If all above failed, wrap the current button. */
    1231             if (!bFound) 
     1236            if (!bFound)
    12321237            {
    12331238                TRACE("wrap point 5 btn %d style %02x, x=%d, cx=%d\n",
     
    12401245                else
    12411246                    bButtonWrap = TRUE;
    1242             }               
     1247            }
    12431248        }
    12441249        else {
    1245             TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n", 
     1250            TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n",
    12461251                  i, btnPtr[i].fsStyle, x, cx);
    12471252            x += cx;
     
    12541259*               TOOLBAR_CalcToolbar
    12551260*
    1256 * This function calculates button and separator placement. It first 
    1257 * calculates the button sizes, gets the toolbar window width and then 
    1258 * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap 
     1261* This function calculates button and separator placement. It first
     1262* calculates the button sizes, gets the toolbar window width and then
     1263* calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap
    12591264* on. It assigns a new location to each item and sends this location to
    1260 * the tooltip window if appropriate. Finally, it updates the rcBound 
    1261 * rect and calculates the new required toolbar window height. 
    1262 */ 
     1265* the tooltip window if appropriate. Finally, it updates the rcBound
     1266* rect and calculates the new required toolbar window height.
     1267*/
    12631268
    12641269static void
     
    12971302        {
    12981303            if (usesBitmaps)
    1299                 infoPtr->nButtonHeight = sizeString.cy + 
     1304                infoPtr->nButtonHeight = sizeString.cy +
    13001305                    2 + /* this is the space to separate text from bitmap */
    13011306                  infoPtr->nBitmapHeight + 6;
    1302             else 
     1307            else
    13031308                infoPtr->nButtonHeight = sizeString.cy + 6;
    13041309        }
     
    13231328
    13241329   /*
    1325     * We will set the height below, and we set the width on entry 
    1326     * so we do not reset them here.. 
     1330    * We will set the height below, and we set the width on entry
     1331    * so we do not reset them here..
    13271332    */
    13281333#if 0
     
    13851390        else
    13861391        {
    1387             if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE) 
     1392            if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE)
    13881393            {
    13891394              SIZE sz;
     
    14021407              /* toolbars with native control (v4.71).  -  GA 8/01    */
    14031408              cx = sz.cx + 6 + 5 + 5;
    1404               if ((dwStyle & TBSTYLE_LIST) && 
     1409              if ((dwStyle & TBSTYLE_LIST) &&
    14051410                  (TOOLBAR_TestImageExist (infoPtr, btnPtr, infoPtr->himlDef)))
    14061411                  cx += infoPtr->nBitmapWidth;
     
    14101415
    14111416            if (hasDropDownArrows && (btnPtr->fsStyle & TBSTYLE_DROPDOWN))
    1412               cx += DDARROW_WIDTH; 
     1417              cx += DDARROW_WIDTH;
    14131418        }
    14141419        if (btnPtr->fsState & TBSTATE_WRAP )
     
    14251430
    14261431        /* Set the toolTip only for non-hidden, non-separator button */
    1427         if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) 
     1432        if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP ))
    14281433        {
    14291434            TTTOOLINFOA ti;
     
    14501455            if ( !(btnPtr->fsStyle & TBSTYLE_SEP) )
    14511456                y += cy;
    1452             else 
    1453             {   
     1457            else
     1458            {
    14541459                /* UNDOCUMENTED: If a separator has a non zero bitmap index, */
    14551460                /* it is the actual width of the separator. This is used for */
     
    14571462                if ( !(btnPtr->fsStyle & TBSTYLE_DROPDOWN))
    14581463                    y += cy + ( (btnPtr->iBitmap > 0 ) ?
    1459                                 btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; 
     1464                                btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3;
    14601465                else
    14611466                    y += cy;
    1462              
     1467
    14631468                /* nSepRows is used to calculate the extra height follwoing  */
    14641469                /* the last row.                                             */
     
    14911496    /* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following   */
    14921497    /* the last row.                                                    */
    1493     infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 
     1498    infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight +
    14941499                        nSepRows * (SEPARATOR_WIDTH * 2 / 3) +
    1495                         nSepRows * (infoPtr->nBitmapHeight + 1) + 
    1496                         BOTTOM_BORDER; 
     1500                        nSepRows * (infoPtr->nBitmapHeight + 1) +
     1501                        BOTTOM_BORDER;
    14971502#endif
    14981503
     
    15091514    TBUTTON_INFO *btnPtr;
    15101515    INT i;
    1511    
     1516
    15121517    btnPtr = infoPtr->buttons;
    15131518    for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) {
     
    15891594    nRunIndex = nIndex + 1;
    15901595    while (nRunIndex < infoPtr->nNumButtons) {
    1591         btnPtr = &infoPtr->buttons[nRunIndex]; 
     1596        btnPtr = &infoPtr->buttons[nRunIndex];
    15921597        if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) {
    15931598            if (btnPtr->fsState & TBSTATE_CHECKED)
     
    16441649                int i = 0;
    16451650                int index;
    1646                
     1651
    16471652                infoPtr = custInfo->tbInfo;
    16481653
     
    16641669                    /* send TBN_QUERYDELETE notification */
    16651670                    nmtb.iItem = i;
    1666                     btnInfo->bRemovable = TOOLBAR_SendNotify ((NMHDR *) &nmtb, 
    1667                                                       infoPtr, 
     1671                    btnInfo->bRemovable = TOOLBAR_SendNotify ((NMHDR *) &nmtb,
     1672                                                      infoPtr,
    16681673                                                      TBN_QUERYDELETE);
    16691674
     
    16931698                        break;
    16941699
    1695                     TRACE("style: %x\n", nmtb.tbButton.fsStyle);               
     1700                    TRACE("style: %x\n", nmtb.tbButton.fsStyle);
    16961701
    16971702                    /* insert button into the apropriate list */
     
    17691774                        /* send TBN_QUERYINSERT notification */
    17701775                        nmtb.iItem = index;
    1771                         TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, 
     1776                        TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
    17721777                                        TBN_QUERYINSERT);
    17731778
     
    19871992                RECT rcButton;
    19881993                RECT rcText;
    1989                 HPEN hOldPen;
     1994                HPEN hPen, hOldPen;
    19901995                HBRUSH hOldBrush;
    19911996                COLORREF oldText = 0;
     
    20062011                else
    20072012                   oldText = SetTextColor (lpdis->hDC, (lpdis->itemState & ODS_FOCUS)?comctl32_color.clrHighlightText:comctl32_color.clrWindowText);
    2008                 hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW));
     2013                hPen = CreatePen( PS_SOLID, 1,
     2014                     GetSysColor( (lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW));
     2015                hOldPen = SelectObject (lpdis->hDC, hPen );
    20092016                hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW));
    20102017
     
    20392046                SetBkColor (lpdis->hDC, oldBk);
    20402047                SetTextColor (lpdis->hDC, oldText);
    2041 
     2048                DeleteObject( hPen );
    20422049                return TRUE;
    20432050            }
     
    20762083    HBITMAP hbmLoad;
    20772084
    2078     TRACE("hwnd=%x wParam=%x lParam=%lx\n", hwnd, wParam, lParam);
     2085    TRACE("hwnd=%p wParam=%x lParam=%lx\n", hwnd, wParam, lParam);
    20792086    if (!lpAddBmp)
    20802087        return -1;
     
    20942101
    20952102        /* Windows resize all the buttons to the size of a newly added standard image */
    2096         if (lpAddBmp->nID & 1) 
     2103        if (lpAddBmp->nID & 1)
    20972104        {
    20982105            /* large icons */
    2099             /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap 
    2100              * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this 
     2106            /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap
     2107             * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this
    21012108             */
    21022109            SendMessageA (hwnd, TB_SETBITMAPSIZE, 0,
     
    21042111            SendMessageA (hwnd, TB_SETBUTTONSIZE, 0,
    21052112                          MAKELPARAM((WORD)31, (WORD)30));
    2106         }       
    2107         else 
     2113        }
     2114        else
    21082115        {
    21092116            /* small icons */
     
    21132120                          MAKELPARAM((WORD)22, (WORD)22));
    21142121        }
    2115        
     2122
    21162123        TOOLBAR_CalcToolbar (hwnd);
    21172124    }
     
    21212128        if (nButtons <= 0)
    21222129            return -1;
    2123        
     2130
    21242131        TRACE ("adding %d bitmaps!\n", nButtons);
    21252132    }
    2126    
     2133
    21272134    if (!(infoPtr->himlDef)) {
    21282135        /* create new default image list */
     
    21402147    if (lpAddBmp->hInst == (HINSTANCE)0)
    21412148    {
    2142         nIndex = 
     2149        nIndex =
    21432150            ImageList_AddMasked (infoPtr->himlDef, (HBITMAP)lpAddBmp->nID,
    21442151                                 CLR_DEFAULT);
     
    24702477        {
    24712478            PWSTR p = szString + 1;
    2472                
    2473             nIndex = infoPtr->nNumStrings;
    2474             while (*p != L'|') {
    2475 
    2476             if (infoPtr->nNumStrings == 0) {
    2477                 infoPtr->strings =
    2478                     COMCTL32_Alloc (sizeof(LPWSTR));
    2479             }
    2480             else {
    2481                 LPWSTR *oldStrings = infoPtr->strings;
    2482                 infoPtr->strings =
    2483                     COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
    2484                 memcpy (&infoPtr->strings[0], &oldStrings[0],
    2485                         sizeof(LPWSTR) * infoPtr->nNumStrings);
    2486                 COMCTL32_Free (oldStrings);
    2487             }
    2488 
    2489             len = COMCTL32_StrChrW (p, L'|') - p;
    2490             TRACE("len=%d %s\n", len, debugstr_w(p));
    2491             infoPtr->strings[infoPtr->nNumStrings] =
    2492                 COMCTL32_Alloc (sizeof(WCHAR)*(len+1));
    2493             lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1);
    2494             infoPtr->nNumStrings++;
    2495 
    2496                 p += (len+1);
    2497             }
     2479
     2480            nIndex = infoPtr->nNumStrings;
     2481            while (*p != L'|' && *p != L'\0') {
     2482                PWSTR np;
     2483
     2484                if (infoPtr->nNumStrings == 0) {
     2485                    infoPtr->strings = COMCTL32_Alloc (sizeof(LPWSTR));
     2486                }
     2487                else
     2488                {
     2489                    LPWSTR *oldStrings = infoPtr->strings;
     2490                    infoPtr->strings = COMCTL32_Alloc(sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
     2491                    memcpy(&infoPtr->strings[0], &oldStrings[0],
     2492                           sizeof(LPWSTR) * infoPtr->nNumStrings);
     2493                    COMCTL32_Free(oldStrings);
     2494                }
     2495
     2496                np=COMCTL32_StrChrW (p, L'|');
     2497                if (np!=NULL) {
     2498                    len = np - p;
     2499                    np++;
     2500                } else {
     2501                    len = strlenW(p);
     2502                    np = p + len;
     2503                }
     2504                TRACE("len=%d %s\n", len, debugstr_w(p));
     2505                infoPtr->strings[infoPtr->nNumStrings] =
     2506                    COMCTL32_Alloc (sizeof(WCHAR)*(len+1));
     2507                lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1);
     2508                infoPtr->nNumStrings++;
     2509
     2510                p = np;
     2511            }
    24982512        }
    24992513        else
     
    26352649
    26362650    if (infoPtr == NULL) {
    2637         ERR("(0x%x, 0x%x, 0x%lx)\n", hwnd, wParam, lParam);
     2651        ERR("(%p, 0x%x, 0x%lx)\n", hwnd, wParam, lParam);
    26382652        ERR("infoPtr == NULL!\n");
    26392653        return 0;
     
    26922706    else {
    26932707        if (btnPtr->fsStyle & TBSTYLE_GROUP) {
    2694             nOldIndex = 
     2708            nOldIndex =
    26952709                TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex);
    26962710            if (nOldIndex == nIndex)
     
    27522766        return FALSE;
    27532767
    2754     ret = DialogBoxIndirectParamA (GetWindowLongA (hwnd, GWL_HINSTANCE),
     2768    ret = DialogBoxIndirectParamA ((HINSTANCE)GetWindowLongA(hwnd, GWL_HINSTANCE),
    27552769                                   (LPDLGTEMPLATEA)template,
    27562770                                   hwnd,
     
    27752789        return FALSE;
    27762790
    2777     if ((infoPtr->hwndToolTip) && 
     2791    if ((infoPtr->hwndToolTip) &&
    27782792        !(infoPtr->buttons[nIndex].fsStyle & TBSTYLE_SEP)) {
    27792793        TTTOOLINFOA ti;
     
    29702984        return -1;
    29712985
    2972     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 
     2986    nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam,
    29732987                                     lpTbInfo->dwMask & 0x80000000);
    29742988    if (nIndex == -1)
     
    29762990
    29772991    btnPtr = &infoPtr->buttons[nIndex];
     2992
     2993    if(!btnPtr)
     2994        return -1;
    29782995
    29792996    if (lpTbInfo->dwMask & TBIF_COMMAND)
     
    31283145    if (btnPtr->fsState & TBSTATE_HIDDEN)
    31293146        return FALSE;
    3130    
     3147
    31313148    lpRect->left   = btnPtr->rect.left;
    31323149    lpRect->right  = btnPtr->rect.right;
     
    31893206    if (lpRect == NULL)
    31903207        return FALSE;
    3191    
     3208
    31923209    lpRect->left   = btnPtr->rect.left;
    31933210    lpRect->right  = btnPtr->rect.right;
     
    32583275    if (infoPtr == NULL)
    32593276        return 0;
    3260     return infoPtr->hwndToolTip;
     3277    return (LRESULT)infoPtr->hwndToolTip;
    32613278}
    32623279
     
    32673284    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    32683285
    3269     TRACE("%s hwnd=0x%x stub!\n",
     3286    TRACE("%s hwnd=%p stub!\n",
    32703287           infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);
    32713288
     
    34653482       return FALSE;
    34663483
    3467     /* If the string passed is not an index, assume address of string 
     3484    /* If the string passed is not an index, assume address of string
    34683485       and do our own AddString */
    34693486    if ((HIWORD(lpTbb->iString) != 0) && (lpTbb->iString != -1)) {
     
    36633680    int i = 0, nOldButtons = 0, pos = 0;
    36643681
    3665     TRACE("hInstOld %x nIDOld %x hInstNew %x nIDNew %x nButtons %x\n",
     3682    TRACE("hInstOld %p nIDOld %x hInstNew %p nIDNew %x nButtons %x\n",
    36663683          lpReplace->hInstOld, lpReplace->nIDOld, lpReplace->hInstNew, lpReplace->nIDNew,
    36673684          lpReplace->nButtons);
    36683685
    3669     if (lpReplace->hInstOld == -1)
     3686    if (lpReplace->hInstOld == HINST_COMMCTRL)
    36703687    {
    36713688        FIXME("changing standard bitmaps not implemented\n");
     
    36823699    }
    36833700
    3684     TRACE("To be replaced hInstOld %x nIDOld %x\n", lpReplace->hInstOld, lpReplace->nIDOld);
     3701    TRACE("To be replaced hInstOld %p nIDOld %x\n", lpReplace->hInstOld, lpReplace->nIDOld);
    36853702    for (i = 0; i < infoPtr->nNumBitmapInfos; i++) {
    36863703        TBITMAP_INFO *tbi = &infoPtr->bitmaps[i];
    3687         TRACE("tbimapinfo %d hInstOld %x nIDOld %x\n", i, tbi->hInst, tbi->nID);
     3704        TRACE("tbimapinfo %d hInstOld %p nIDOld %x\n", i, tbi->hInst, tbi->nID);
    36883705        if (tbi->hInst == lpReplace->hInstOld && tbi->nID == lpReplace->nIDOld)
    36893706        {
    3690             TRACE("Found: nButtons %d hInst %x nID %x\n", tbi->nButtons, tbi->hInst, tbi->nID);
     3707            TRACE("Found: nButtons %d hInst %p nID %x\n", tbi->nButtons, tbi->hInst, tbi->nID);
    36913708            nOldButtons = tbi->nButtons;
    36923709            tbi->nButtons = lpReplace->nButtons;
    36933710            tbi->hInst = lpReplace->hInstNew;
    36943711            tbi->nID = lpReplace->nIDNew;
    3695             TRACE("tbimapinfo changed %d hInstOld %x nIDOld %x\n", i, tbi->hInst, tbi->nID);
     3712            TRACE("tbimapinfo changed %d hInstOld %p nIDOld %x\n", i, tbi->hInst, tbi->nID);
    36963713            break;
    36973714        }
     
    37013718    if (nOldButtons == 0)
    37023719    {
    3703         WARN("No hinst/bitmap found! hInst %x nID %x\n", lpReplace->hInstOld, lpReplace->nIDOld);
     3720        WARN("No hinst/bitmap found! hInst %p nID %x\n", lpReplace->hInstOld, lpReplace->nIDOld);
    37043721        return FALSE;
    37053722    }
     
    38333850    if (lptbbi->cbSize < sizeof(TBBUTTONINFOA))
    38343851        return FALSE;
    3835    
     3852
    38363853    nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam,
    38373854                                     lptbbi->dwMask & 0x80000000);
     
    38573874            /* iString is index, zero it to make Str_SetPtr succeed */
    38583875            btnPtr->iString=0;
    3859      
     3876
    38603877         Str_SetPtrAtoW ((LPWSTR *)&btnPtr->iString, lptbbi->pszText);
    38613878    }
     
    39193936
    39203937    /* The documentation claims you can only change the button size before
    3921      * any button has been added. But this is wrong. 
    3922      * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding 
     3938     * any button has been added. But this is wrong.
     3939     * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding
    39233940     * it to the toolbar, and it checks that the return value is nonzero - mjm
    39243941     * Further testing shows that we must actually perform the change too.
     
    39273944     * The documentation also does not mention that if 0 is supplied for
    39283945     * either size, the system changes it to the default of 24 wide and
    3929      * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02 
     3946     * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02
    39303947     */
    39313948    infoPtr->nButtonWidth = (cx) ? cx : 24;
     
    39503967        TRACE("matches current width, min=%d, max=%d, no recalc\n",
    39513968              infoPtr->cxMin, infoPtr->cxMax);
    3952         return TRUE; 
     3969        return TRUE;
    39533970    }
    39543971
     
    39593976    /* if both values are 0 then we are done */
    39603977    if (lParam == 0) {
    3961         TRACE("setting both min and max to 0, norecalc\n"); 
     3978        TRACE("setting both min and max to 0, norecalc\n");
    39623979        return TRUE;
    39633980    }
     
    39663983       recalc the bounding rectangle (does DrawText w/ DT_CALCRECT
    39673984       which doesn't actually draw - GA). */
    3968     TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n", 
     3985    TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n",
    39693986        infoPtr->nNumButtons, infoPtr->cxMin, infoPtr->cxMax);
    39703987
     
    40154032    /* FIXME: redraw ? */
    40164033
    4017     return (LRESULT)himlTemp; 
     4034    return (LRESULT)himlTemp;
    40184035}
    40194036
     
    40544071              (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL));
    40554072
    4056     return (LRESULT)dwTemp; 
     4073    return (LRESULT)dwTemp;
    40574074}
    40584075
     
    40744091    /* FIXME: redraw ? */
    40754092
    4076     return (LRESULT)himlTemp; 
     4093    return (LRESULT)himlTemp;
    40774094}
    40784095
     
    41334150    ImageList_GetIconSize(infoPtr->himlDef, &infoPtr->nBitmapWidth,
    41344151                          &infoPtr->nBitmapHeight);
    4135     TRACE("hwnd %08x, new himl=%08x, count=%d, bitmap w=%d, h=%d\n",
     4152    TRACE("hwnd %p, new himl=%08x, count=%d, bitmap w=%d, h=%d\n",
    41364153          hwnd, (INT)infoPtr->himlDef, infoPtr->nNumBitmaps,
    41374154          infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
     
    41404157    InvalidateRect(hwnd, NULL, TRUE);
    41414158
    4142     return (LRESULT)himlTemp; 
     4159    return (LRESULT)himlTemp;
    41434160}
    41444161
     
    42234240    infoPtr->hwndNotify = (HWND)wParam;
    42244241
    4225     return hwndOldNotify;
     4242    return (LRESULT)hwndOldNotify;
    42264243}
    42274244
     
    43424359    BOOL bTemp;
    43434360
    4344     TRACE("%s hwnd=0x%04x stub!\n",
     4361    TRACE("%s hwnd=%p stub!\n",
    43454362           ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd);
    43464363
     
    43574374    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    43584375
    4359     lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 
    4360                                comctl32_color.clrBtnHighlight : 
     4376    lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
     4377                               comctl32_color.clrBtnHighlight :
    43614378                               infoPtr->clrBtnHighlight;
    4362     lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 
     4379    lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
    43634380                           comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow;
    43644381    return 1;
     
    44204437                infoPtr->buttons[nOldHotItem].idCommand : 0;
    44214438        if ( !(nmhotitem.dwFlags & HICF_LEAVING) )
    4422             nmhotitem.idNew = (infoPtr->nHotItem >= 0) ? 
     4439            nmhotitem.idNew = (infoPtr->nHotItem >= 0) ?
    44234440                infoPtr->buttons[infoPtr->nHotItem].idCommand : 0;
    44244441        no_hi = TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE);
     
    46294646
    46304647        /* FIXME: in general the return flags *can* be or'ed together */
    4631         switch (infoPtr->dwBaseCustDraw) 
     4648        switch (infoPtr->dwBaseCustDraw)
    46324649            {
    46334650            case CDRF_DODEFAULT:
     
    46364653                return TRUE;
    46374654            default:
    4638                 FIXME("[%04x] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",
     4655                FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",
    46394656                      hwnd, ntfret);
    46404657            }
    46414658    }
    46424659
    4643     /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up 
     4660    /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up
    46444661     * to my parent for processing.
    46454662     */
     
    46604677        ret = DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam);
    46614678
    4662     if ((dwStyle & TBSTYLE_CUSTOMERASE) && 
    4663         (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) { 
     4679    if ((dwStyle & TBSTYLE_CUSTOMERASE) &&
     4680        (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) {
    46644681        ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
    46654682        tbcd.nmcd.dwDrawStage = CDDS_POSTERASE;
     
    46674684        ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
    46684685        infoPtr->dwBaseCustDraw = ntfret & 0xffff;
    4669         switch (infoPtr->dwBaseCustDraw) 
     4686        switch (infoPtr->dwBaseCustDraw)
    46704687            {
    46714688            case CDRF_DODEFAULT:
     
    46744691                return TRUE;
    46754692            default:
    4676                 FIXME("[%04x] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",
     4693                FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",
    46774694                      hwnd, ntfret);
    46784695            }
     
    46874704    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
    46884705
    4689     return infoPtr->hFont;
     4706    return (LRESULT)infoPtr->hFont;
    46904707}
    46914708
     
    47434760        RECT arrowRect;
    47444761        btnPtr = &infoPtr->buttons[nHit];
    4745         if (!(btnPtr->fsState & TBSTATE_ENABLED))
    4746             return 0;
    4747 
    47484762        infoPtr->nOldHit = nHit;
    47494763
     
    47524766
    47534767        /* for EX_DRAWDDARROWS style,  click must be in the drop-down arrow rect */
    4754         if ((btnPtr->fsStyle & TBSTYLE_DROPDOWN) &&
     4768        if ((btnPtr->fsState & TBSTATE_ENABLED) && (btnPtr->fsStyle & TBSTYLE_DROPDOWN) &&
    47554769             ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) ||
    47564770              (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))
     
    47834797        btnPtr->bHot = FALSE;
    47844798
    4785         InvalidateRect(hwnd, &btnPtr->rect,
    4786                       TOOLBAR_HasText(infoPtr, btnPtr));
     4799        if (btnPtr->fsState & TBSTATE_ENABLED)
     4800            InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr));
    47874801        UpdateWindow(hwnd);
    47884802        SetCapture (hwnd);
     
    48404854                    if (nOldIndex == nHit)
    48414855                        bSendMessage = FALSE;
    4842                     if ((nOldIndex != nHit) && 
     4856                    if ((nOldIndex != nHit) &&
    48434857                        (nOldIndex != -1))
    48444858                        infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;
     
    48624876         * now we can ReleaseCapture, which triggers CAPTURECHANGED msg,
    48634877         * that resets bCaptured and btn TBSTATE_PRESSED flags,
    4864          * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) 
     4878         * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged)
    48654879         */
    48664880        if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0))
    48674881            ReleaseCapture ();
     4882        infoPtr->nButtonDown = -1;
    48684883
    48694884        /* Issue NM_RELEASEDCAPTURE to parent to let him know it is released */
     
    48714886                        NM_RELEASEDCAPTURE);
    48724887
    4873         /* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the 
     4888        /* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the
    48744889         * TBN_BEGINDRAG
    48754890         */
     
    48864901                        TBN_ENDDRAG);
    48874902
    4888         SendMessageA (infoPtr->hwndNotify, WM_COMMAND,
    4889           MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd);
    4890 
    4891         /* !!! Undocumented - toolbar at 4.71 level and above sends
    4892          * either NMRCLICK or NM_CLICK with the NMMOUSE structure.
    4893          * Only NM_RCLICK is documented.
    4894          */
    4895         nmmouse.dwItemSpec = btnPtr->idCommand;
    4896         nmmouse.dwItemData = btnPtr->dwData;
    4897         TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr,
    4898                         NM_CLICK);
     4903        if (btnPtr->fsState & TBSTATE_ENABLED)
     4904        {
     4905            SendMessageA (infoPtr->hwndNotify, WM_COMMAND,
     4906              MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd);
     4907
     4908            /* !!! Undocumented - toolbar at 4.71 level and above sends
     4909            * either NMRCLICK or NM_CLICK with the NMMOUSE structure.
     4910            * Only NM_RCLICK is documented.
     4911            */
     4912            nmmouse.dwItemSpec = btnPtr->idCommand;
     4913            nmmouse.dwItemData = btnPtr->dwData;
     4914            TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, NM_CLICK);
     4915        }
    48994916    return 0;
    49004917}
     
    49134930        btnPtr->fsState &= ~TBSTATE_PRESSED;
    49144931
    4915         infoPtr->nButtonDown = -1;
    49164932        infoPtr->nOldHit = -1;
    49174933
    4918         InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr,
    4919             btnPtr));
     4934        if (btnPtr->fsState & TBSTATE_ENABLED)
     4935            InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr,
     4936              btnPtr));
    49204937    }
    49214938    return 0;
     
    49865003    if(!(trackinfo.dwFlags & TME_LEAVE)) {
    49875004        trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
    4988  
     5005
    49895006        /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
    49905007        /* and can properly deactivate the hot toolbar button */
     
    50055022        /* Remove the effect of an old hot button if the button was enabled and was
    50065023           drawn with the hot button effect */
    5007         if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem && 
     5024        if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem &&
    50085025                (infoPtr->buttons[infoPtr->nOldHit].fsState & TBSTATE_ENABLED))
    50095026        {
     
    50195036            infoPtr->nHotItem = nHit;
    50205037
    5021             /* only enabled buttons show hot effect */           
     5038            /* only enabled buttons show hot effect */
    50225039            if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED)
    50235040            {
     
    51105127     *    hdc = GetDC(toolbar)
    51115128     *    GetSystemMetrics(0x48)
    5112      *    fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, 
     5129     *    fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2,
    51135130     *                     0, 0, 0, 0, "MARLETT")
    51145131     *    oldfnt = SelectObject(hdc, fnt2)
     
    51995216        if (lppgc->dwFlag == PGF_CALCWIDTH) {
    52005217            lppgc->iWidth = infoPtr->rcBound.right - infoPtr->rcBound.left;
    5201             TRACE("processed PGN_CALCSIZE, returning horz size = %d\n", 
     5218            TRACE("processed PGN_CALCSIZE, returning horz size = %d\n",
    52025219                  lppgc->iWidth);
    52035220        }
    52045221        else {
    52055222            lppgc->iHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top;
    5206             TRACE("processed PGN_CALCSIZE, returning vert size = %d\n", 
     5223            TRACE("processed PGN_CALCSIZE, returning vert size = %d\n",
    52075224                  lppgc->iHeight);
    52085225        }
     5226        return 0;
     5227    }
     5228
     5229    if (lpnmh->code == PGN_SCROLL) {
     5230        LPNMPGSCROLL lppgs = (LPNMPGSCROLL)lParam;
     5231
     5232        lppgs->iScroll = (lppgs->iDir & (PGF_SCROLLLEFT | PGF_SCROLLRIGHT)) ?
     5233                          infoPtr->nButtonWidth : infoPtr->nButtonHeight;
     5234        TRACE("processed PGN_SCROLL, returning scroll=%d, dir=%d\n",
     5235              lppgs->iScroll, lppgs->iDir);
    52095236        return 0;
    52105237    }
     
    52155242    if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) {
    52165243        if (infoPtr->bNtfUnicode)
    5217             return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 
     5244            return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
    52185245                                 wParam, lParam);
    52195246        else
    5220             return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 
     5247            return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
    52215248                                 wParam, lParam);
    52225249
     
    52595286    if (lParam == NF_REQUERY) {
    52605287        i = SendMessageA(GetParent(infoPtr->hwndSelf),
    5261                          WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);
     5288                         WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
    52625289        if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
    52635290            ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
     
    52805307
    52815308    /* fill ps.rcPaint with a default rect */
    5282     memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound)); 
     5309    memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound));
    52835310
    52845311    hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam;
     
    53035330      *
    53045331      * Documentation:
    5305       *  According to testing V4.71 of COMCTL32 returns the 
     5332      *  According to testing V4.71 of COMCTL32 returns the
    53065333      *  *previous* status of the redraw flag (either 0 or 1)
    53075334      *  instead of the MSDN documented value of 0 if handled.
     
    53145341    BOOL oldredraw = infoPtr->bDoRedraw;
    53155342
    5316     TRACE("set to %s\n", 
     5343    TRACE("set to %s\n",
    53175344          (wParam) ? "TRUE" : "FALSE");
    53185345    infoPtr->bDoRedraw = (BOOL) wParam;
     
    53685395             * Calc Toolbar will not adjust it, only the height
    53695396             */
    5370             infoPtr->nWidth = parent_rect.right - parent_rect.left; 
     5397            infoPtr->nWidth = parent_rect.right - parent_rect.left;
    53715398            cy = infoPtr->nHeight;
    53725399            cx = infoPtr->nWidth;
     
    54245451        }
    54255452        infoPtr->bTransparent = (lpStyle->styleNew & TBSTYLE_TRANSPARENT);
    5426         infoPtr->bBtnTranspnt = (lpStyle->styleNew & 
     5453        infoPtr->bBtnTranspnt = (lpStyle->styleNew &
    54275454                                 (TBSTYLE_FLAT | TBSTYLE_LIST));
    54285455        TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew);
     
    54505477ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    54515478{
    5452     TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n",
     5479    TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
    54535480          hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
    54545481
     
    57585785
    57595786        case WM_MOUSELEAVE:
    5760             return TOOLBAR_MouseLeave (hwnd, wParam, lParam);   
     5787            return TOOLBAR_MouseLeave (hwnd, wParam, lParam);
    57615788
    57625789        case WM_CAPTURECHANGED:
    5763             return TOOLBAR_CaptureChanged(hwnd);       
     5790            return TOOLBAR_CaptureChanged(hwnd);
    57645791
    57655792        case WM_NCACTIVATE:
     
    58165843
    58175844        default:
    5818             if (uMsg >= WM_USER)
     5845            if ((uMsg >= WM_USER) && (uMsg < WM_APP))
    58195846                ERR("unknown msg %04x wp=%08x lp=%08lx\n",
    58205847                     uMsg, wParam, lParam);
     
    58385865    wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
    58395866    wndClass.lpszClassName = TOOLBARCLASSNAMEA;
    5840  
     5867
    58415868    RegisterClassA (&wndClass);
    58425869}
Note: See TracChangeset for help on using the changeset viewer.