Ignore:
Timestamp:
Jun 16, 1999, 10:25:45 PM (26 years ago)
Author:
cbratschi
Message:

comctl32 wine conversion bugs fixed
trackbar: TRACKBAR_Draw prototype

File:
1 edited

Legend:

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

    r109 r110  
    1 /* $Id: trackbar.c,v 1.4 1999-06-16 15:29:27 cbratschi Exp $ */
     1/* $Id: trackbar.c,v 1.5 1999-06-16 20:25:44 cbratschi Exp $ */
    22/*
    33 * Trackbar control
     
    1515 *   - better tic handling.
    1616 *   - more notifications.
     17 *   - implement TRACKBAR_Draw with inUpdate
    1718 *
    1819 */
     
    345346}
    346347
    347 
    348 static VOID
    349 TRACKBAR_Refresh (HWND hwnd, HDC hdc)
     348//draw the trackbar
     349
     350static VOID TRACKBAR_Draw(HWND hwnd,HDC hdc,INT lastPos,BOOL inUpdate)
    350351{
    351352    TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
     
    356357
    357358    GetClientRect (hwnd, &rcClient);
    358     hBrush = CreateSolidBrush (infoPtr->clrBk);
    359     FillRect (hdc, &rcClient, hBrush);
    360     DeleteObject (hBrush);
     359    if (!inUpdate)
     360    {
     361      hBrush = CreateSolidBrush (infoPtr->clrBk);
     362      FillRect (hdc, &rcClient, hBrush);
     363      DeleteObject (hBrush);
     364    }
    361365
    362366    if (infoPtr->flags & TB_DRAGPOSVALID)  {
     
    478482}
    479483
     484//update display
     485
     486static VOID TRACKBAR_Update(HWND hwnd,INT lastPos)
     487{
     488   TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
     489   HDC hdc;
     490
     491   if (infoPtr->flags & TB_DRAGPOSVALID && lastPos == infoPtr->dragPos) return;
     492   if (!infoPtr->flags & TB_DRAGPOSVALID && lastPos == infoPtr->nPos) return;
     493   hdc = GetDC(hwnd);
     494   TRACKBAR_Draw(hwnd,hdc,lastPos,TRUE);
     495   ReleaseDC(hwnd,hdc);
     496}
     497
     498//redraw everything
     499
     500static VOID TRACKBAR_Refresh (HWND hwnd)
     501{
     502   HDC hdc;
     503
     504   hdc = GetDC (hwnd);
     505   TRACKBAR_Draw(hwnd,hdc,0,FALSE);
     506   ReleaseDC(hwnd,hdc);
     507}
    480508
    481509static VOID
     
    541569    infoPtr->flags |= TB_SELECTIONCHANGED;
    542570
    543     if ((BOOL)wParam)
    544         InvalidateRect (hwnd, NULL, FALSE);
     571    if ((BOOL)wParam) TRACKBAR_Refresh(hwnd);
    545572
    546573    return 0;
     
    559586    }
    560587
    561     if (wParam)
    562         InvalidateRect (hwnd, NULL, FALSE);
     588    if (wParam) TRACKBAR_Refresh(hwnd);
    563589
    564590    return 0;
     
    811837    TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
    812838
     839    INT lastPos = infoPtr->nPos;
    813840    infoPtr->nPos = (INT)LOWORD(lParam);
    814841
     
    820847    infoPtr->flags |= TB_THUMBPOSCHANGED;
    821848
    822     if (wParam)
    823         InvalidateRect (hwnd, NULL, FALSE);
     849    if (wParam) TRACKBAR_Update(hwnd,lastPos);
    824850
    825851    return 0;
     
    849875    TRACKBAR_RecalculateTics (infoPtr);
    850876
    851     if (wParam)
    852         InvalidateRect (hwnd, NULL, FALSE);
     877    if (wParam) TRACKBAR_Refresh(hwnd);
    853878
    854879    return 0;
     
    872897    TRACKBAR_RecalculateTics (infoPtr);
    873898
    874     if (wParam)
    875         InvalidateRect (hwnd, NULL, FALSE);
     899    if (wParam) TRACKBAR_Refresh(hwnd);
    876900
    877901    return 0;
     
    895919    TRACKBAR_RecalculateTics (infoPtr);
    896920
    897     if (wParam)
    898         InvalidateRect (hwnd, NULL, FALSE);
     921    if (wParam) TRACKBAR_Refresh(hwnd);
    899922
    900923    return 0;
     
    912935    TRACKBAR_RecalculateTics (infoPtr);
    913936
    914     InvalidateRect (hwnd, NULL, FALSE);
     937    TRACKBAR_Refresh(hwnd); //CB: necessary?
    915938
    916939    return 0;
     
    935958        infoPtr->nSelMax = infoPtr->nRangeMax;
    936959
    937     if (wParam)
    938         InvalidateRect (hwnd, NULL, FALSE);
     960    if (wParam) TRACKBAR_Refresh(hwnd);
    939961
    940962
     
    957979        infoPtr->nSelMax = infoPtr->nRangeMax;
    958980
    959     if (wParam)
    960         InvalidateRect (hwnd, NULL, FALSE);
     981    if (wParam) TRACKBAR_Refresh(hwnd);
    961982
    962983    return 0;
     
    978999        infoPtr->nSelMin = infoPtr->nRangeMin;
    9791000
    980     if (wParam)
    981         InvalidateRect (hwnd, NULL, FALSE);
     1001    if (wParam) TRACKBAR_Refresh(hwnd);
    9821002
    9831003    return 0;
     
    9951015    infoPtr->flags |= TB_THUMBSIZECHANGED;
    9961016
    997     InvalidateRect (hwnd, NULL, FALSE);
     1017    TRACKBAR_Refresh(hwnd);
    9981018
    9991019    return 0;
     
    10151035    infoPtr->tics[infoPtr->uNumTics-1]=nPos;
    10161036
    1017     InvalidateRect (hwnd, NULL, FALSE);
     1037    TRACKBAR_Refresh(hwnd);
    10181038
    10191039    return TRUE;
     
    11491169    infoPtr->flags &= ~TB_DRAG_MODE;
    11501170
    1151     InvalidateRect (hwnd, NULL, FALSE);
     1171    TRACKBAR_Refresh(hwnd); //CB: make changes here
    11521172
    11531173    return 0;
     
    12151235    if (prevPos!=infoPtr->nPos) {
    12161236        infoPtr->flags |= TB_THUMBPOSCHANGED;
    1217         InvalidateRect (hwnd, NULL, FALSE);
     1237        TRACKBAR_Update(hwnd,prevPos);
    12181238    }
    12191239
     
    12471267    }
    12481268
    1249     InvalidateRect (hwnd, NULL, FALSE);
     1269    //TRACKBAR_Refresh(hwnd); //CB: nothing changed
    12501270
    12511271    return 0;
     
    12591279
    12601280    if (infoPtr->flags & TB_DRAGPOSVALID) {
     1281        int lastPos = infoPtr->nPos;
    12611282        infoPtr->nPos=infoPtr->dragPos;
    1262         InvalidateRect (hwnd, NULL, FALSE);
     1283        TRACKBAR_Update(hwnd,lastPos);
    12631284    }
    12641285
     
    12771298
    12781299    hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
    1279     TRACKBAR_Refresh (hwnd, hdc);
     1300    TRACKBAR_Draw(hwnd,hdc,0,FALSE);
    12801301    if(!wParam)
    12811302        EndPaint (hwnd, &ps);
     
    12921313    infoPtr->bFocus = TRUE;
    12931314
    1294     InvalidateRect (hwnd, NULL, FALSE);
     1315    TRACKBAR_Refresh(hwnd); //CB: make changes here
    12951316
    12961317    return 0;
     
    13321353    DOUBLE dragPos;
    13331354    char buf[80];
     1355    INT lastDragPos;
    13341356
    13351357//    TRACE (trackbar, "%x\n",wParam);
     
    13441366
    13451367    SetCapture (hwnd);
     1368    lastDragPos = infoPtr->dragPos;
    13461369    dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace,
    13471370                                               dwStyle & TBS_VERT);
     
    13771400    }
    13781401
    1379     InvalidateRect (hwnd, NULL, FALSE);
     1402    TRACKBAR_Update(hwnd,lastDragPos);
    13801403    UpdateWindow (hwnd);
    13811404
     
    14381461    if (pos!=infoPtr->nPos) {
    14391462        infoPtr->flags |=TB_THUMBPOSCHANGED;
    1440         InvalidateRect (hwnd, NULL, FALSE);
     1463        TRACKBAR_Update(hwnd,pos);
    14411464    }
    14421465
Note: See TracChangeset for help on using the changeset viewer.