Ignore:
Timestamp:
Sep 5, 2001, 2:05:03 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

File:
1 edited

Legend:

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

    r6380 r6644  
     1/* $Id: pager.c,v 1.9 2001-09-05 12:05:01 bird Exp $ */
    12/*
    23 * Pager control
     
    3940    INT    nPos;       /* scroll position */
    4041    INT    nWidth;     /* from child wnd's response to PGN_CALCSIZE */
    41     INT    nHeight;    /* from child wnd's response to PGN_CALCSIZE */ 
     42    INT    nHeight;    /* from child wnd's response to PGN_CALCSIZE */
    4243    BOOL   bForward;   /* forward WM_MOUSEMOVE msgs to the contained wnd */
    4344    INT    TLbtnState; /* state of top or left btn */
     
    5758#define REPEAT_DELAY     50
    5859
    59 /* the horizontal arrows are: 
     60/* the horizontal arrows are:
    6061 *
    6162 * 01234    01234
     
    6667 * 5 **      **
    6768 * 6  *      *
    68  * 7 
     69 * 7
    6970 *
    7071 */
     
    7475    INT x, y, w, h;
    7576    HPEN hOldPen;
    76    
     77
    7778    w = r.right - r.left + 1;
    7879    h = r.bottom - r.top + 1;
     
    107108}
    108109
    109 /* the vertical arrows are: 
     110/* the vertical arrows are:
    110111 *
    111112 * 01234567    01234567
    112  * 1******        ** 
     113 * 1******        **
    113114 * 2 ****        ****
    114115 * 3  **        ******
     
    121122    INT x, y, w, h;
    122123    HPEN hOldPen;
    123    
     124
    124125    w = r.right - r.left + 1;
    125126    h = r.bottom - r.top + 1;
     
    165166
    166167    if ((rc.right - rc.left <= 0) || (rc.bottom - rc.top <= 0))
    167         return; 
     168        return;
    168169
    169170    hBrush = CreateSolidBrush(clrBk);
     
    172173    FillRect(hdc, &rc, hBrush);
    173174
    174     if (btnState == PGF_HOT) 
     175    if (btnState == PGF_HOT)
    175176    {
    176177       DrawEdge( hdc, &rc, BDR_RAISEDINNER, BF_RECT);
     
    180181           PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
    181182    }
    182     else if (btnState == PGF_NORMAL) 
     183    else if (btnState == PGF_NORMAL)
    183184    {
    184185       DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT);
     
    188189           PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
    189190    }
    190     else if (btnState == PGF_DEPRESSED) 
     191    else if (btnState == PGF_DEPRESSED)
    191192    {
    192193       DrawEdge( hdc, &rc, BDR_SUNKENOUTER, BF_RECT);
     
    196197           PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
    197198    }
    198     else if (btnState == PGF_GRAYED) 
     199    else if (btnState == PGF_GRAYED)
    199200    {
    200201       DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT);
     
    233234PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam)
    234235{
    235     PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
     236    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
    236237    LRESULT btnState = PGF_INVISIBLE;
    237238    INT btn = (INT)lParam;
     
    250251PAGER_GetPos(HWND hwnd)
    251252{
    252     PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
     253    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
    253254    TRACE("[%04x] returns %d\n", hwnd, infoPtr->nPos);
    254255    return (LRESULT)infoPtr->nPos;
     
    258259PAGER_GetButtonSize(HWND hwnd)
    259260{
    260     PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
     261    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
    261262    TRACE("[%04x] returns %d\n", hwnd, infoPtr->nButtonSize);
    262263    return (LRESULT)infoPtr->nButtonSize;
     
    266267PAGER_GetBorder(HWND hwnd)
    267268{
    268     PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
     269    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
    269270    TRACE("[%04x] returns %d\n", hwnd, infoPtr->nBorder);
    270271    return (LRESULT)infoPtr->nBorder;
     
    274275PAGER_GetBkColor(HWND hwnd)
    275276{
    276     PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 
     277    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
    277278    TRACE("[%04x] returns %06lx\n", hwnd, infoPtr->clrBk);
    278279    return (LRESULT)infoPtr->clrBk;
    279280}
    280281
    281 static void 
    282 PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) 
     282static void
     283PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth)
    283284{
    284285    NMPGCALCSIZE nmpgcs;
     
    333334                infoPtr->nHeight = wndSize;
    334335
    335             TRACE("[%04x] SWP %dx%d at (%d,%d)\n", hwnd, 
     336            TRACE("[%04x] SWP %dx%d at (%d,%d)\n", hwnd,
    336337                         infoPtr->nWidth, infoPtr->nHeight,
    337338                         0, -nPos);
     
    379380}
    380381
    381 static void 
     382static void
    382383PAGER_GrayAndRestoreBtns(PAGER_INFO* infoPtr, INT scrollRange,
    383384                         BOOL* needsResize, BOOL* needsRepaint)
     
    416417
    417418
    418 static void 
     419static void
    419420PAGER_NormalizeBtns(PAGER_INFO* infoPtr, BOOL* needsRepaint)
    420421{
     
    432433}
    433434
    434 static void 
     435static void
    435436PAGER_HideGrayBtns(PAGER_INFO* infoPtr, BOOL* needsResize)
    436437{
     
    464465
    465466    if (resizeClient) /* initiate NCCalcSize to resize client wnd */
    466         SetWindowPos(hwnd, 0,0,0,0,0, 
     467        SetWindowPos(hwnd, 0,0,0,0,0,
    467468                     SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
    468469                     SWP_NOZORDER | SWP_NOACTIVATE);
    469470
    470471    if (repaintBtns)
    471         SendMessageA(hwnd, WM_NCPAINT, 0, 0); 
    472 }
    473 
    474 static LRESULT 
     472        SendMessageA(hwnd, WM_NCPAINT, 0, 0);
     473}
     474
     475static LRESULT
    475476PAGER_SetPos(HWND hwnd, INT newPos, BOOL fromBtnPress)
    476477{
     
    518519}
    519520
    520 static void 
     521static void
    521522PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr)
    522523{
     
    544545
    545546    /* adjust non-scrollable dimension to fit the child */
    546     SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, h, 
     547    SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, h,
    547548                 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER);
    548549
    549550
    550551    TRACE("[%04x] infoPtr->nWidth set to %d\n",
    551                hwnd, infoPtr->nWidth);
    552 }
    553 
    554 static void 
     552           hwnd, infoPtr->nWidth);
     553}
     554
     555static void
    555556PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr)
    556557{
     
    578579
    579580    /* adjust non-scrollable dimension to fit the child */
    580     SetWindowPos(hwnd, 0, 0,0, w, infoPtr->nHeight, 
     581    SetWindowPos(hwnd, 0, 0,0, w, infoPtr->nHeight,
    581582                 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER);
    582583
    583584    TRACE("[%04x] infoPtr->nHeight set to %d\n",
    584                hwnd, infoPtr->nHeight);
     585           hwnd, infoPtr->nHeight);
    585586}
    586587
     
    601602            PAGER_SetPos(hwnd, 0, FALSE);
    602603        }
    603         else 
     604        else
    604605        {
    605606            PAGER_UpdateBtns(hwnd, infoPtr, scrollRange, TRUE);
     
    700701        nmpgScroll.hdr.code = PGN_SCROLL;
    701702
    702         GetWindowRect(hwnd, &rcWnd); 
    703         GetClientRect(hwnd, &nmpgScroll.rcParent); 
     703        GetWindowRect(hwnd, &rcWnd);
     704        GetClientRect(hwnd, &nmpgScroll.rcParent);
    704705        nmpgScroll.iXpos = nmpgScroll.iYpos = 0;
    705706        nmpgScroll.iDir = dir;
     
    716717        }
    717718        nmpgScroll.iScroll -= 2*infoPtr->nButtonSize;
    718  
     719
    719720        SendMessageA (hwnd, WM_NOTIFY,
    720721                    (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll);
    721  
     722
    722723        TRACE("[%04x] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll);
    723724
     
    769770        FIXME("[%04x] Drag and Drop style is not implemented yet.\n", hwnd);
    770771    /*
    771         * If neither horizontal nor vertical style specified, default to vertical.
    772         * This is probably not necessary, since the style may be set later on as
    773         * the control is initialized, but just in case it isn't, set it here.
    774         */
     772    * If neither horizontal nor vertical style specified, default to vertical.
     773    * This is probably not necessary, since the style may be set later on as
     774    * the control is initialized, but just in case it isn't, set it here.
     775    */
    775776    if (!(dwStyle & PGS_HORZ) && !(dwStyle & PGS_VERT))
    776777    {
     
    800801    /*
    801802     * lParam points to a RECT struct.  On entry, the struct
    802      * contains the proposed wnd rectangle for the window. 
     803     * contains the proposed wnd rectangle for the window.
    803804     * On exit, the struct should contain the screen
    804805     * coordinates of the corresponding window's client area.
    805806     */
    806        
     807
    807808    if (PAGER_IsHorizontal(hwnd))
    808809    {
    809810        if (infoPtr->TLbtnState) /* != PGF_INVISIBLE */
    810811            lpRect->left += infoPtr->nButtonSize;
    811         if (infoPtr->BRbtnState) 
     812        if (infoPtr->BRbtnState)
    812813            lpRect->right -= infoPtr->nButtonSize;
    813814    }
     
    863864                     bHorizontal, TRUE, infoPtr->TLbtnState);
    864865    PAGER_DrawButton(hdc, infoPtr->clrBk, rcBottomRight,
    865                      bHorizontal, FALSE, infoPtr->BRbtnState); 
     866                     bHorizontal, FALSE, infoPtr->BRbtnState);
    866867
    867868    ReleaseDC( hwnd, hdc );
     
    869870}
    870871
    871 static INT 
     872static INT
    872873PAGER_HitTest (HWND hwnd, LPPOINT pt)
    873874{
     
    976977        if(!(trackinfo.dwFlags & TME_LEAVE)) {
    977978            trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
    978  
     979
    979980           /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
    980981           /* and can properly deactivate the hot button */
     
    982983        }
    983984
    984         SendMessageA(hwnd, WM_NCPAINT, 0, 0); 
     985        SendMessageA(hwnd, WM_NCPAINT, 0, 0);
    985986    }
    986987
     
    10251026
    10261027    TRACE("[%04x]\n", hwnd);
    1027        
     1028
    10281029    hit = PAGER_HitTest(hwnd, &pt);
    10291030
     
    10331034        repaintBtns = infoPtr->TLbtnState != PGF_DEPRESSED;
    10341035        infoPtr->TLbtnState = PGF_DEPRESSED;
    1035         SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 
     1036        SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0);
    10361037    }
    10371038    else if (hit == HTRIGHT || hit == HTBOTTOM)
     
    10391040        repaintBtns = infoPtr->BRbtnState != PGF_DEPRESSED;
    10401041        infoPtr->BRbtnState = PGF_DEPRESSED;
    1041         SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 
     1042        SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0);
    10421043    }
    10431044
    10441045    if (repaintBtns)
    1045         SendMessageA(hwnd, WM_NCPAINT, 0, 0); 
     1046        SendMessageA(hwnd, WM_NCPAINT, 0, 0);
    10461047
    10471048    switch(hit)
     
    11301131
    11311132    if (!infoPtr && (uMsg != WM_CREATE))
    1132         return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     1133    return DefWindowProcA (hwnd, uMsg, wParam, lParam);
    11331134
    11341135    switch (uMsg)
     
    11561157        case PGM_RECALCSIZE:
    11571158            return PAGER_RecalcSize(hwnd);
    1158    
     1159
    11591160        case PGM_SETBKCOLOR:
    11601161            return PAGER_SetBkColor (hwnd, wParam, lParam);
     
    12041205            if (infoPtr->bForward && infoPtr->hwndChild)
    12051206                PostMessageA(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam);
    1206             return TRUE;                       
     1207            return TRUE;
    12071208
    12081209        case WM_MOUSELEAVE:
    1209             return PAGER_MouseLeave (hwnd, wParam, lParam);     
     1210            return PAGER_MouseLeave (hwnd, wParam, lParam);
    12101211
    12111212        case WM_LBUTTONDOWN:
     
    12191220/*
    12201221        case WM_PAINT:
    1221             return PAGER_Paint (hwnd, wParam); 
     1222            return PAGER_Paint (hwnd, wParam);
    12221223*/
    12231224        case WM_TIMER:
     
    12331234            {
    12341235                PAGER_Scroll(hwnd, infoPtr->direction);
    1235                 SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0);         
     1236                SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0);
    12361237            }
    12371238            break;
     
    12661267    wndClass.hbrBackground = 0;
    12671268    wndClass.lpszClassName = WC_PAGESCROLLERA;
    1268  
     1269
    12691270    RegisterClassA (&wndClass);
    12701271}
Note: See TracChangeset for help on using the changeset viewer.