Changeset 17922


Ignore:
Timestamp:
Nov 16, 2001, 5:11:49 PM (23 years ago)
Author:
sandervl
Message:

listview fix for updating scroll step

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tags/trunk/src/comctl32/listview.c

    r17899 r17922  
    576576 * None
    577577 */
     578#ifdef __WIN32OS2__
     579static VOID LISTVIEW_UpdateScroll(HWND hwnd)
     580{
     581  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
     582  INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;
     583  INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
     584  SCROLLINFO scrollInfo;
     585  LONG dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     586  UINT uView =  dwStyle & LVS_TYPEMASK;
     587
     588  if (dwStyle & LVS_NOSCROLL)
     589  {
     590    infoPtr->lefttop.x = 0;
     591    infoPtr->lefttop.y = 0;
     592    infoPtr->maxScroll = infoPtr->lefttop;
     593    infoPtr->scrollPage = infoPtr->lefttop;
     594    infoPtr->scrollStep = infoPtr->lefttop;
     595    ShowScrollBar(hwnd,SB_BOTH,FALSE);
     596    return;
     597  }
     598
     599  ZeroMemory(&scrollInfo, sizeof(SCROLLINFO));
     600  scrollInfo.cbSize = sizeof(SCROLLINFO);
     601
     602  if (uView == LVS_LIST)
     603  {
     604    /* update horizontal scrollbar */
     605    INT nCountPerColumn = LISTVIEW_GetCountPerColumn(hwnd);
     606    INT nCountPerRow = LISTVIEW_GetCountPerRow(hwnd);
     607    INT nNumOfItems = GETITEMCOUNT(infoPtr);
     608
     609    infoPtr->maxScroll.x = nNumOfItems/nCountPerColumn;
     610    if (nNumOfItems % nCountPerColumn)
     611      infoPtr->maxScroll.x++;
     612
     613    infoPtr->lefttop.x = ListView_GetTopIndex(hwnd)/nCountPerColumn;
     614    infoPtr->scrollPage.x = nCountPerRow;
     615    infoPtr->scrollStep.x = infoPtr->nItemWidth;
     616
     617    scrollInfo.nMin  = 0;
     618    scrollInfo.nMax  = infoPtr->maxScroll.x-1;
     619    scrollInfo.nPos  = infoPtr->lefttop.x;
     620    scrollInfo.nPage = infoPtr->scrollPage.x;
     621    scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
     622    SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE);
     623  } else if (uView == LVS_REPORT)
     624  {
     625    /* update vertical scrollbar */
     626    infoPtr->maxScroll.y = GETITEMCOUNT(infoPtr);
     627    infoPtr->lefttop.y = ListView_GetTopIndex(hwnd);
     628    infoPtr->scrollPage.y = LISTVIEW_GetCountPerColumn(hwnd);
     629    infoPtr->scrollStep.y = infoPtr->nItemHeight;
     630
     631    scrollInfo.nMin  = 0;
     632    scrollInfo.nMax  = infoPtr->maxScroll.y-1;
     633    scrollInfo.nPos  = infoPtr->lefttop.y;
     634    scrollInfo.nPage = infoPtr->scrollPage.y;
     635    scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
     636    SetScrollInfo(hwnd,SB_VERT,&scrollInfo,TRUE);
     637
     638    /* update horizontal scrollbar */
     639    nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
     640    if (!(dwStyle & WS_HSCROLL) || !GETITEMCOUNT(infoPtr))
     641      infoPtr->lefttop.x = 0;
     642
     643    infoPtr->scrollPage.x = nListWidth / LISTVIEW_SCROLL_DIV_SIZE;
     644    infoPtr->maxScroll.x = max(infoPtr->nItemWidth / LISTVIEW_SCROLL_DIV_SIZE, 0);
     645    infoPtr->scrollStep.x = LISTVIEW_SCROLL_DIV_SIZE;
     646
     647    scrollInfo.nMin  = 0;
     648    scrollInfo.nMax  = infoPtr->maxScroll.x-1;
     649    scrollInfo.nPos  = infoPtr->lefttop.x;
     650    scrollInfo.nPage = infoPtr->scrollPage.x;
     651    scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
     652    SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE);
     653
     654    /* Update the Header Control */
     655    LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x);
     656  } else
     657  {
     658    RECT rcView;
     659
     660    if (LISTVIEW_GetViewRect(hwnd,&rcView))
     661    {
     662      INT nViewWidth = rcView.right - rcView.left;
     663      INT nViewHeight = rcView.bottom - rcView.top;
     664
     665      /* Update Horizontal Scrollbar */
     666      if (!(dwStyle & WS_HSCROLL) || !GETITEMCOUNT(infoPtr))
     667        infoPtr->lefttop.x = 0;
     668      infoPtr->maxScroll.x = max(nViewWidth / LISTVIEW_SCROLL_DIV_SIZE, 0);
     669      infoPtr->scrollPage.x = nListWidth / LISTVIEW_SCROLL_DIV_SIZE;
     670      infoPtr->scrollStep.x = LISTVIEW_SCROLL_DIV_SIZE;
     671
     672      scrollInfo.nMin  = 0;
     673      scrollInfo.nMax  = infoPtr->maxScroll.x-1;
     674      scrollInfo.nPos  = infoPtr->lefttop.x;
     675      scrollInfo.nPage = infoPtr->scrollPage.x;
     676      scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
     677      SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE);
     678
     679      /* Update Vertical Scrollbar */
     680      nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;
     681      if (!(dwStyle & WS_VSCROLL) || !GETITEMCOUNT(infoPtr))
     682        infoPtr->lefttop.x = 0;
     683      infoPtr->maxScroll.y = max(nViewHeight / LISTVIEW_SCROLL_DIV_SIZE,0);
     684      infoPtr->scrollPage.y = nListHeight / LISTVIEW_SCROLL_DIV_SIZE;
     685      infoPtr->scrollStep.y = LISTVIEW_SCROLL_DIV_SIZE;
     686
     687      scrollInfo.nMin  = 0;
     688      scrollInfo.nMax  = infoPtr->maxScroll.y-1;
     689      scrollInfo.nPos  = infoPtr->lefttop.y;
     690      scrollInfo.nPage = infoPtr->scrollPage.y;
     691      scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
     692      SetScrollInfo(hwnd,SB_VERT,&scrollInfo,TRUE);
     693    }
     694  }
     695}
     696#else
    578697static VOID LISTVIEW_UpdateScroll(HWND hwnd)
    579698{
     
    584703  INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
    585704  SCROLLINFO scrollInfo;
     705
    586706
    587707  ZeroMemory(&scrollInfo, sizeof(SCROLLINFO));
     
    674794  }
    675795}
     796#endif
    676797
    677798/***
Note: See TracChangeset for help on using the changeset viewer.