Ignore:
Timestamp:
Mar 17, 2000, 6:13:26 PM (25 years ago)
Author:
cbratschi
Message:

trackbar buddy fix, tooltip enhancements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/tooltips.cpp

    r2893 r3145  
    1 /* $Id: tooltips.cpp,v 1.2 2000-02-25 09:57:19 achimha Exp $ */
     1/* $Id: tooltips.cpp,v 1.3 2000-03-17 17:13:26 cbratschi Exp $ */
    22/*
    33 * Tool tip control
     
    4242
    4343
    44 static VOID
    45 TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
     44static VOID TOOLTIPS_Draw (HWND hwnd, HDC hdc)
    4645{
    4746    TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd);
     
    170169    }
    171170    if (GetWindowLongA(hwnd,GWL_STYLE) & TTS_NOPREFIX) uFlags |= DT_NOPREFIX;
    172 //    TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
     171    //TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
    173172
    174173    hdc = GetDC(hwnd);
     
    181180    size.cy = rc.bottom-rc.top+4+infoPtr->rcMargin.bottom+infoPtr->rcMargin.top;
    182181
    183     //CB: optimize
    184 
    185182    if (toolPtr->uFlags & TTF_ABSOLUTE)
    186183    {
     
    188185      rc.top  = infoPtr->yTrackPos;
    189186
    190       if (toolPtr->uFlags & TTF_CENTERTIP)
     187      if (toolPtr->uFlags & TTF_ALIGNMASK)
    191188      {
    192         rc.left -= (size.cx/2);
    193         rc.top  -= (size.cy/2);
     189        //CB: Odin only (Win32 does something similar but with an undocumented mechanism)
     190
     191        if (toolPtr->uFlags & TTF_ALIGNLEFT)
     192          rc.left -= size.cx;
     193        else if (toolPtr->uFlags & TTF_HCENTER)
     194          rc.left -= size.cx/2;
     195
     196        if (toolPtr->uFlags & TTF_ALIGNTOP)
     197          rc.top -= size.cy;
     198        else if (toolPtr->uFlags & TTF_VCENTER)
     199          rc.top -= size.cy/2;
     200
     201      } else
     202      {
     203        if (toolPtr->uFlags & TTF_CENTERTIP)
     204        {
     205          rc.left -= (size.cx/2);
     206          rc.top  -= (size.cy/2);
     207        }
    194208      }
    195209    } else
     
    235249    }
    236250
    237 //    TRACE (tooltips, "pos %d - %d\n", rect.left, rect.top);
     251    //TRACE (tooltips, "pos %d - %d\n", rect.left, rect.top);
    238252
    239253    rc.right = rc.left+size.cx;
     
    260274    if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX)
    261275        uFlags |= DT_NOPREFIX;
    262 //    TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText));
     276    //TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText));
    263277
    264278    hdc = GetDC (hwnd);
     
    364378    /* repaint the tooltip */
    365379    hdc = GetDC (hwnd);
    366     TOOLTIPS_Refresh (hwnd, hdc);
     380    TOOLTIPS_Draw(hwnd, hdc);
    367381    ReleaseDC (hwnd, hdc);
    368382
     
    407421    if (infoPtr->nTrackTool == -1)
    408422    {
    409 //    TRACE (tooltips, "invalid tracking tool (-1)!\n");
     423      //TRACE (tooltips, "invalid tracking tool (-1)!\n");
    410424      return;
    411425    }
    412426
    413 //    TRACE (tooltips, "show tracking tooltip pre %d!\n", infoPtr->nTrackTool);
     427    //TRACE (tooltips, "show tracking tooltip pre %d!\n", infoPtr->nTrackTool);
    414428
    415429    TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nTrackTool);
     
    421435    }
    422436
    423 //    TRACE (tooltips, "show tracking tooltip %d!\n", infoPtr->nTrackTool);
     437    //TRACE (tooltips, "show tracking tooltip %d!\n", infoPtr->nTrackTool);
    424438    toolPtr = &infoPtr->tools[infoPtr->nTrackTool];
    425439
     
    429443    SendMessageA(toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&hdr);
    430444
    431 //    TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
     445    //TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
    432446
    433447    TOOLTIPS_CalcTipRect(hwnd,infoPtr,toolPtr,&rect);
     
    438452
    439453    hdc = GetDC (hwnd);
    440     TOOLTIPS_Refresh (hwnd, hdc);
     454    TOOLTIPS_Draw(hwnd, hdc);
    441455    ReleaseDC (hwnd, hdc);
    442456}
     
    17401754      if (infoPtr->nTrackTool != -1)
    17411755      {
    1742 //      TRACE (tooltips, "activated!\n");
     1756        //TRACE (tooltips, "activated!\n");
    17431757        infoPtr->bTrackActive = TRUE;
    17441758        TOOLTIPS_TrackShow(hwnd,infoPtr);
     
    17521766      infoPtr->nTrackTool = -1;
    17531767
    1754 //      TRACE (tooltips, "deactivated!\n");
     1768      //TRACE (tooltips, "deactivated!\n");
    17551769    }
    17561770
     
    20902104
    20912105    hdc = (wParam == 0) ? BeginPaint (hwnd, &ps) : (HDC)wParam;
    2092     TOOLTIPS_Refresh (hwnd, hdc);
     2106    TOOLTIPS_Draw(hwnd, hdc);
    20932107    if (!wParam)
    20942108        EndPaint (hwnd, &ps);
     
    24612475    WNDCLASSA wndClass;
    24622476
    2463 //SvL: Don't check this now
    2464 //    if (GlobalFindAtomA (TOOLTIPS_CLASSA)) return;
    2465 
    24662477    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
    24672478    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
     
    24802491TOOLTIPS_Unregister (VOID)
    24812492{
    2482     if (GlobalFindAtomA (TOOLTIPS_CLASSA))
    2483         UnregisterClassA (TOOLTIPS_CLASSA, (HINSTANCE)NULL);
    2484 }
    2485 
     2493    UnregisterClassA (TOOLTIPS_CLASSA, (HINSTANCE)NULL);
     2494}
     2495
Note: See TracChangeset for help on using the changeset viewer.