Ignore:
Timestamp:
Dec 8, 2002, 8:54:46 PM (23 years ago)
Author:
umoeller
Message:

Minor changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/cctl_toolbar.c

    r232 r233  
    6565#include "helpers\linklist.h"
    6666#include "helpers\standards.h"
     67#include "helpers\stringh.h"
    6768#include "helpers\winh.h"
     69#include "helpers\xstring.h"
    6870
    6971#include "helpers\comctl.h"
     
    102104    DEFWINDATA  dwd;
    103105
    104     HWND        hwndControlsOwner;
     106    HWND        hwndControlsOwner,
     107                hwndToolTip;        // != NULLHANDLE if TBS_TOOLTIPS is set
    105108
    106109    LONG        lSpacing,
     
    111114    ULONG       flReformat;
    112115        #define RFFL_HEIGHT         0x0001      // height changed, needs complete resize
     116
     117    XSTRING     strToolTipBuf;
    113118
    114119} TOOLBARDATA, *PTOOLBARDATA;
     
    169174 *@@changed V0.9.20 (2002-08-04) [umoeller]: fixed button offset, depressed color
    170175 *@@changed V1.0.1 (2002-11-30) [umoeller]: moved this here from comctl.c, renamed
     176 *@@changed V1.0.1 (2002-12-08) [umoeller]: added support for WS_DISABLED
    171177 */
    172178
     
    212218        lRight = G_lcol3DDark;
    213219
    214         if (!lBorder)
    215             if (pbs->fMouseOver)
    216                 lBorder = 1;
     220        if (    (!lBorder)
     221             && (pbs->fMouseOver)
     222             && (fl & TBBS_HILITE)
     223           )
     224            lBorder = 1;
    217225    }
    218226
     
    310318                          0,
    311319                          0,
    312                           DBM_NORMAL);
     320                          (fl & WS_DISABLED)
     321                               ? DBM_HALFTONE
     322                               : DBM_NORMAL);
    313323        else
     324        {
     325            ULONG   fl2 = DP_NORMAL;     // 0x0000
     326
     327            if (!(fl & TBBS_BIGICON))
     328                fl2 = DP_MINI;
     329            if (fl & WS_DISABLED)       // V1.0.1 (2002-12-08) [umoeller]
     330                fl2 |= DP_HALFTONED;    // I love this... DBM_HALFTONE, but DP_HALFTONED!
     331                                        // PM is just so half-toned itself...
    314332            WinDrawPointer(hps,
    315                            // center this in remaining rectl
    316333                           ptl.x,
    317334                           ptl.y,
    318335                           pbd->hptr,
    319                            (fl & TBBS_BIGICON)
    320                                ? DP_NORMAL
    321                                : DP_MINI);
     336                           fl2);
     337        }
    322338
    323339        rclTemp.yTop -= pbd->szlIconOrBitmap.cy;
     
    747763                {
    748764                    pData->bs.fMouseOver = fMouseOver;
    749                     WinInvalidateRect(hwndButton, NULL, FALSE);
     765
     766                    if (winhQueryWindowStyle(hwndButton) & TBBS_HILITE)
     767                        WinInvalidateRect(hwndButton, NULL, FALSE);
    750768                }
    751769            }
     
    763781                    gpihSwitchToRGB(hps);
    764782                    ctlPaintTBButton(hps,
    765                                      winhQueryWindowStyle(hwndButton) | TBBS_BACKGROUND,
     783                                     winhQueryWindowStyle(hwndButton)
     784                                        | TBBS_BACKGROUND,
    766785                                     &pData->bd,
    767786                                     &pData->bs);
     
    865884    {
    866885        *px += pControl->cx + pData->lSpacing;
     886
     887        if (pData->hwndToolTip)
     888        {
     889            TOOLINFO    ti = {0};
     890            ti.ulFlags = TTF_CENTER_X_ON_TOOL | TTF_POS_Y_BELOW_TOOL | TTF_SUBCLASS;
     891            ti.hwndToolOwner = pData->dwd.hwnd;
     892            ti.pszText = PSZ_TEXTCALLBACK;
     893            ti.hwndTool = hwndControl;
     894            WinSendMsg(pData->hwndToolTip,
     895                       TTM_ADDTOOL,
     896                       (MPARAM)0,
     897                       &ti);
     898        }
    867899    }
    868900
     
    10851117    lstInit(&pData->llControls, FALSE);
    10861118
     1119    xstrInit(&pData->strToolTipBuf, 0);
     1120
     1121    if (((PCREATESTRUCT)mp2)->flStyle & TBS_TOOLTIPS)
     1122    {
     1123        pData->hwndToolTip = WinCreateWindow(HWND_DESKTOP,
     1124                                             WC_CCTL_TOOLTIP,
     1125                                             NULL,
     1126                                             TTS_ALWAYSTIP,
     1127                                             0, 0, 0, 0,    // window pos and size, ignored
     1128                                             hwndToolBar,
     1129                                             NULLHANDLE,    // hwndInsertBehind, ignored
     1130                                             0,
     1131                                             NULL,          // control data
     1132                                             NULL);         // presparams
     1133    }
     1134
    10871135    if (    (ptbcd->cControls)
    10881136         && (ptbcd->patbc)
     
    11091157    {
    11101158        PLISTNODE pNode;
     1159
     1160        if (pData->hwndToolTip)
     1161            WinDestroyWindow(pData->hwndToolTip);
     1162
    11111163        FOR_ALL_NODES(&pData->llControls, pNode)
    11121164        {
     
    11141166        }
    11151167        lstClear(&pData->llControls);
     1168
     1169        xstrClear(&pData->strToolTipBuf);
     1170
    11161171        free(pData);
    11171172    }
     
    11711226        break;
    11721227
     1228        case WM_CONTROL:
     1229            if (    (pData = (PTOOLBARDATA)WinQueryWindowPtr(hwndToolBar, QWL_USER + 1))
     1230                 && (pData->hwndToolTip)
     1231                 && (SHORT2FROMMP(mp1) == TTN_NEEDTEXT)
     1232               )
     1233            {
     1234                PTOOLTIPTEXT pttt = (PTOOLTIPTEXT)mp2;
     1235                PSZ psz;
     1236                xstrClear(&pData->strToolTipBuf);
     1237
     1238                if (psz = winhQueryWindowText(pttt->hwndTool))
     1239                    xstrset(&pData->strToolTipBuf, psz);
     1240
     1241                pttt->ulFormat = TTFMT_PSZ;
     1242                pttt->pszText = pData->strToolTipBuf.psz;
     1243            }
     1244        break;
     1245
    11731246        case WM_PAINT:
    11741247        {
     
    12861359                           NULL);
    12871360}
     1361
Note: See TracChangeset for help on using the changeset viewer.