Changeset 1774 for trunk/src


Ignore:
Timestamp:
Nov 19, 1999, 5:07:29 PM (26 years ago)
Author:
achimha
Message:

comctl32 wine 991114 merge

File:
1 edited

Legend:

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

    r1730 r1774  
    88 *
    99 * NOTES
    10  * Listview control implementation.
     10 * Listview control implementation. 
    1111 *
    1212 * TODO:
     
    1919 *
    2020 * Data structure:
    21  *   LISTVIEW_SetItemCount : empty stub
    22  *
     21 *   LISTVIEW_SetItemCount : empty stub 
     22 * 
    2323 * Unicode:
    2424 *   LISTVIEW_SetItemW : no unicode support
     
    3232 *   LISTVIEW_GetHotCursor : not implemented
    3333 *   LISTVIEW_GetHoverTime : not implemented
    34  *   LISTVIEW_GetISearchString : not implemented
     34 *   LISTVIEW_GetISearchString : not implemented 
    3535 *   LISTVIEW_GetBkImage : not implemented
    3636 *   LISTVIEW_GetColumnOrderArray : not implemented
     
    3838 *   LISTVIEW_Arrange : empty stub
    3939 *   LISTVIEW_ApproximateViewRect : incomplete
    40  *   LISTVIEW_Scroll : not implemented
     40 *   LISTVIEW_Scroll : not implemented 
    4141 *   LISTVIEW_RedrawItems : empty stub
    4242 *   LISTVIEW_Update : not completed
     
    8282
    8383/* Increment size of the horizontal scroll bar */
    84 #define REPORT_HSCROLL_INC_SIZE 10
     84#define LISTVIEW_SCROLL_DIV_SIZE 10
    8585
    8686/*
     
    9595#define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount)
    9696
    97 /* Some definitions for inline edit control */   
    98 typedef BOOL (*EditlblCallback)(HWND, LPSTR, DWORD);
    9997
    10098HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y,
     
    102100        EditlblCallback EditLblCb, DWORD param);
    103101 
    104 typedef struct tagEDITLABEL_ITEM
    105 {
    106     WNDPROC EditWndProc;
    107     DWORD param;
    108     EditlblCallback EditLblCb;
    109 } EDITLABEL_ITEM;
    110 
    111102/*
    112103 * forward declarations
     
    127118static INT LISTVIEW_GetLabelWidth(HWND, INT);
    128119static LRESULT LISTVIEW_GetOrigin(HWND, LPPOINT);
     120static INT LISTVIEW_CalculateWidth(HWND hwnd, INT nItem);
    129121static LISTVIEW_SUBITEM* LISTVIEW_GetSubItem(HDPA, INT);
    130122static LRESULT LISTVIEW_GetViewRect(HWND, LPRECT);
     
    158150 *     hwnd             [I] handle to a window
    159151 *     nNewScrollPos    [I] Scroll Pos to Set
    160  *     nOldScrollPos    [I] Previous Scroll Pos
    161152 *
    162153 * RETURNS
     
    165156 * NOTES
    166157 */
    167 static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos, INT nOldScrollPos)
     158static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos)
    168159{
    169160    LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    170     INT nDiff = nOldScrollPos-nNewScrollPos;
    171161    RECT winRect;
    172162    POINT point[2];
     
    179169
    180170    MapWindowPoints(HWND_DESKTOP, hwnd, point, 2);
    181     point[0].x += (nDiff * REPORT_HSCROLL_INC_SIZE );
    182     point[1].x -= point[0].x;
     171    point[0].x = -(nNewScrollPos * LISTVIEW_SCROLL_DIV_SIZE);
     172    point[1].x += (nNewScrollPos * LISTVIEW_SCROLL_DIV_SIZE);
    183173
    184174    SetWindowPos(infoPtr->hwndHeader,0,
     
    212202  if (uView == LVS_LIST)
    213203  {
     204    /* update horizontal scrollbar */
     205
    214206    INT nCountPerColumn = LISTVIEW_GetCountPerColumn(hwnd);
    215     INT nCountPerPage = LISTVIEW_GetCountPerRow(hwnd) * nCountPerColumn;
     207    INT nCountPerRow = LISTVIEW_GetCountPerRow(hwnd);
     208    INT nCountPerPage = nCountPerRow * nCountPerColumn;
     209    INT nNumOfItems = GETITEMCOUNT(infoPtr);
     210
    216211    if (nCountPerPage < GETITEMCOUNT(infoPtr))
    217212    {
    218       /* calculate new scrollbar range */
    219       if((GETITEMCOUNT(infoPtr) % nCountPerPage) == 0)
    220       {
    221           scrollInfo.nMax = GETITEMCOUNT(infoPtr) / nCountPerPage * LISTVIEW_GetCountPerRow(hwnd)-1;
    222       }
    223       else
    224       {
    225           scrollInfo.nMax = (GETITEMCOUNT(infoPtr) / nCountPerPage)* LISTVIEW_GetCountPerRow(hwnd);
    226       }
    227      
     213      scrollInfo.nMax = nNumOfItems / nCountPerColumn;
     214      if((nNumOfItems % nCountPerColumn) == 0)
     215      {
     216          scrollInfo.nMax--;
     217      }
    228218      scrollInfo.nPos = ListView_GetTopIndex(hwnd) / nCountPerColumn;
    229       scrollInfo.nPage = LISTVIEW_GetCountPerRow(hwnd);
     219      scrollInfo.nPage = nCountPerRow;
    230220      scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
    231221      SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
     
    242232  else if (uView == LVS_REPORT)
    243233  {
    244     RECT clientRect;
    245234    /* update vertical scrollbar */
    246235    scrollInfo.nMin = 0;
     
    252241
    253242    /* update horizontal scrollbar */
    254     infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
    255     GetClientRect(hwnd, &clientRect);
    256 
    257243    if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE)
    258244    {
     
    261247    scrollInfo.nMin = 0;
    262248    scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE  ;
    263     scrollInfo.nPage = (clientRect.right - clientRect.left) / REPORT_HSCROLL_INC_SIZE;
    264     scrollInfo.nMax = infoPtr->nItemWidth;
    265 
    266     /* Check to see if we need the scroll bar */
    267     if(scrollInfo.nMax < 0)
    268     {
    269       scrollInfo.nMax = 0;
    270     }
    271     else
    272     {
    273       /* Even up the max */
    274       scrollInfo.nMax -= (scrollInfo.nMax % REPORT_HSCROLL_INC_SIZE);
    275       scrollInfo.nMax = (scrollInfo.nMax / REPORT_HSCROLL_INC_SIZE)-1;
    276     }
    277     /* Set the scroll pos to the max if the current scroll pos is greater */
    278     if((scrollInfo.nPos+scrollInfo.nPage) > scrollInfo.nMax
    279         && scrollInfo.nMax > scrollInfo.nPage)
    280     {
    281       UINT nOldScrollPos = scrollInfo.nPos;
    282       scrollInfo.nPos = scrollInfo.nMax;
    283       SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
    284       GetScrollInfo(hwnd, SB_HORZ, &scrollInfo);
    285       LISTVIEW_UpdateHeaderSize(hwnd, scrollInfo.nPos, nOldScrollPos);
    286     }
    287     else
    288     {
    289         SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
    290     }
     249    scrollInfo.nPage = nListWidth / LISTVIEW_SCROLL_DIV_SIZE;
     250    scrollInfo.nMax = max(infoPtr->nItemWidth / LISTVIEW_SCROLL_DIV_SIZE, 0)-1;
     251    SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
     252
     253    /* Update the Header Control */
     254    scrollInfo.fMask = SIF_POS;
     255    GetScrollInfo(hwnd, SB_HORZ, &scrollInfo);
     256    LISTVIEW_UpdateHeaderSize(hwnd, scrollInfo.nPos);
     257
    291258  }
    292259  else
     
    301268      if (nViewWidth > nListWidth)
    302269      {
    303         INT nHiddenWidth;
    304         INT nScrollPosWidth = nListWidth / 10;
    305 
    306         if (nScrollPosWidth == 0)
    307         {
    308           nScrollPosWidth = 1;
    309           nHiddenWidth = nViewWidth - nListWidth;
    310         }
    311         else
    312         {
    313           nHiddenWidth = nViewWidth - nScrollPosWidth * 10;
    314         }
    315 
    316270        scrollInfo.fMask = SIF_POS;
    317271        if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE)
     
    319273          scrollInfo.nPos = 0;
    320274        }
    321  
    322         if (nHiddenWidth % nScrollPosWidth == 0)
    323         {
    324           scrollInfo.nMax = nHiddenWidth / nScrollPosWidth;
    325         }
    326         else
    327         {
    328           scrollInfo.nMax = nHiddenWidth / nScrollPosWidth + 1;
    329         }
    330          
     275        scrollInfo.nMax = max(nViewWidth / LISTVIEW_SCROLL_DIV_SIZE, 0)-1;
    331276        scrollInfo.nMin = 0;
    332         scrollInfo.nPage = 10;
     277        scrollInfo.nPage = nListWidth / LISTVIEW_SCROLL_DIV_SIZE;
    333278        scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
    334279        SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
     
    344289      if (nViewHeight > nListHeight)
    345290      {
    346         INT nHiddenHeight;
    347         INT nScrollPosHeight = nListHeight / 10;
    348 
    349         if (nScrollPosHeight == 0)
    350         {
    351           nScrollPosHeight = 1;
    352           nHiddenHeight = nViewHeight - nListHeight;
    353         }
    354         else
    355         {
    356           nHiddenHeight = nViewHeight - nScrollPosHeight * 10;
    357         }
    358 
    359291        scrollInfo.fMask = SIF_POS;
    360292        if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) == FALSE)
     
    362294          scrollInfo.nPos = 0;
    363295        }
    364 
    365         if (nHiddenHeight % nScrollPosHeight == 0)
    366         {
    367           scrollInfo.nMax = nHiddenHeight / nScrollPosHeight;
    368         }
    369         else
    370         {
    371           scrollInfo.nMax = nHiddenHeight / nScrollPosHeight + 1;
    372         }
    373 
     296        scrollInfo.nMax = max(nViewHeight / LISTVIEW_SCROLL_DIV_SIZE,0)-1;
    374297        scrollInfo.nMin = 0;
    375         scrollInfo.nPage = 10;
     298        scrollInfo.nPage = nListHeight / LISTVIEW_SCROLL_DIV_SIZE;
    376299        scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
    377300        SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE);
     
    662585 * DESCRIPTION:
    663586 * Calculates the width of an item.
    664  *
     587 * 
    665588 * PARAMETER(S):
    666589 * [I] HWND : window handle
     
    701624  {
    702625    for (i = 0; i < GETITEMCOUNT(infoPtr); i++)
    703     {
     626    { 
    704627      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, i);
    705628      nItemWidth = max(nItemWidth, nLabelWidth);
    706629    }
    707 
     630   
    708631    /* default label size */
    709632    if (GETITEMCOUNT(infoPtr) == 0)
     
    721644        /* add padding */
    722645        nItemWidth += WIDTH_PADDING;
    723 
     646     
    724647        if (infoPtr->himlSmall != NULL)
    725648        {
     
    734657    }
    735658  }
    736 
     659 
     660  return nItemWidth;
     661}
     662
     663/***
     664 * DESCRIPTION:
     665 * Calculates the width of a specific item.
     666 *
     667 * PARAMETER(S):
     668 * [I] HWND : window handle
     669 * [I] LPSTR : string 
     670 *
     671 * RETURN:
     672 * Returns the width of an item width a specified string.
     673 */
     674static INT LISTVIEW_CalculateWidth(HWND hwnd, INT nItem)
     675{
     676  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
     677  UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK;
     678  INT nHeaderItemCount;
     679  RECT rcHeaderItem;
     680  INT nItemWidth = 0;
     681  INT i;
     682
     683//  TRACE("(hwnd=%x)\n", hwnd);
     684
     685  if (uView == LVS_ICON)
     686  {
     687    nItemWidth = infoPtr->iconSpacing.cx;
     688  }
     689  else if (uView == LVS_REPORT)
     690  {
     691    /* calculate width of header */
     692    nHeaderItemCount = Header_GetItemCount(infoPtr->hwndHeader);
     693    for (i = 0; i < nHeaderItemCount; i++)
     694    {
     695      if (Header_GetItemRect(infoPtr->hwndHeader, i, &rcHeaderItem) != 0)
     696      {
     697        nItemWidth += (rcHeaderItem.right - rcHeaderItem.left);
     698      }
     699    }
     700  }
     701  else
     702  {
     703    /* get width of string */
     704    nItemWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
     705
     706    /* default label size */
     707    if (GETITEMCOUNT(infoPtr) == 0)
     708    {
     709      nItemWidth = DEFAULT_COLUMN_WIDTH;
     710    }
     711    else
     712    {
     713      if (nItemWidth == 0)
     714      {
     715        nItemWidth = DEFAULT_LABEL_WIDTH;
     716      }
     717      else
     718      {
     719        /* add padding */
     720        nItemWidth += WIDTH_PADDING;
     721     
     722        if (infoPtr->himlSmall != NULL)
     723        {
     724          nItemWidth += infoPtr->iconSize.cx;
     725        }
     726
     727        if (infoPtr->himlState != NULL)
     728        {
     729          nItemWidth += infoPtr->iconSize.cx;
     730        }
     731      }
     732    }
     733  }
     734 
    737735  return nItemWidth;
    738736}
     
    18621860
    18631861  /* Don't bother painting item being edited */
    1864   if (infoPtr->lpeditItem && lvItem.state & LVIS_FOCUSED)
     1862  if (infoPtr->hwndEdit && lvItem.state & LVIS_FOCUSED)
    18651863      return;
    18661864
     
    20542052      if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE)
    20552053      {
    2056         rcItem.left -= (scrollInfo.nPos * REPORT_HSCROLL_INC_SIZE);
    2057         rcItem.right -= (scrollInfo.nPos * REPORT_HSCROLL_INC_SIZE);
     2054        rcItem.left -= (scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE);
     2055        rcItem.right -= (scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE);
    20582056      }
    20592057
     
    26912689    }
    26922690
     2691    /* If this item had focus change focus to next or previous item */
     2692    if (GETITEMCOUNT(infoPtr) > 0)
     2693    {
     2694       int sItem = nItem < GETITEMCOUNT(infoPtr) ? nItem : nItem - 1;
     2695       if (infoPtr->nFocusedItem == nItem)
     2696           LISTVIEW_SetItemFocus(hwnd, sItem);
     2697    }
     2698    else
     2699          infoPtr->nFocusedItem = -1;
     2700
    26932701    LISTVIEW_UpdateScroll(hwnd);
    26942702
     
    27622770  ListView_Notify(GetParent(hwnd), nCtrlId, &dispInfo);
    27632771  infoPtr->hwndEdit = 0;
    2764   infoPtr->lpeditItem = NULL;
    27652772
    27662773  return TRUE;
     
    27932800  if (~GetWindowLongA(hwnd, GWL_STYLE) & LVS_EDITLABELS)
    27942801      return FALSE;
     2802
     2803  LISTVIEW_SetSelection(hwnd, nItem);
     2804  LISTVIEW_SetItemFocus(hwnd, nItem);
    27952805
    27962806  ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA));
     
    28272837
    28282838  infoPtr->hwndEdit = hedit;
    2829   infoPtr->lpeditItem = lpItem;
    28302839  SetFocus(hedit);
    28312840  SendMessageA(hedit, EM_SETSEL, 0, -1);
     
    28792888        else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON))
    28802889        {
    2881           nScrollPosWidth = max(1, nListWidth / 10);
     2890          nScrollPosWidth = max(1, nListWidth / LISTVIEW_SCROLL_DIV_SIZE);
    28822891          rcItem.left += infoPtr->rcList.left;
    28832892        }
     
    29082917        {
    29092918          rcItem.right -= infoPtr->rcList.right;
    2910           nScrollPosWidth = max(1, nListWidth / 10);
     2919          nScrollPosWidth = max(1, nListWidth / LISTVIEW_SCROLL_DIV_SIZE);
    29112920        }
    29122921
     
    29362945        else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON))
    29372946        {
    2938           nScrollPosHeight = max(1, nListHeight / 10);
     2947          nScrollPosHeight = max(1, nListHeight / LISTVIEW_SCROLL_DIV_SIZE);
    29392948          rcItem.top += infoPtr->rcList.top;
    29402949        }
     
    29642973        else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON))
    29652974        {
    2966           nScrollPosHeight = max(1, nListHeight / 10);
     2975          nScrollPosHeight = max(1, nListHeight / LISTVIEW_SCROLL_DIV_SIZE);
    29672976          rcItem.bottom -= infoPtr->rcList.bottom;
    29682977        }
     
    44044413 * DESCRIPTION:
    44054414 * Retrieves the origin coordinates when in icon or small icon display mode.
    4406  *
     4415 * 
    44074416 * PARAMETER(S):
    44084417 * [I] HWND : window handle
    44094418 * [O] LPPOINT : coordinate information
    4410  *
     4419 * 
    44114420 * RETURN:
    44124421 *   SUCCESS : TRUE
     
    44154424static LRESULT LISTVIEW_GetOrigin(HWND hwnd, LPPOINT lpptOrigin)
    44164425{
    4417   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    44184426  LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    44194427  UINT uView = lStyle & LVS_TYPEMASK;
    4420   INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
    4421   INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;
    44224428  BOOL bResult = FALSE;
    4423 
     4429 
    44244430//  TRACE("(hwnd=%x, lpptOrigin=%p)\n", hwnd, lpptOrigin);
    44254431
     
    44344440    {
    44354441      scrollInfo.fMask = SIF_POS;
    4436       if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE)
    4437       {
    4438         lpptOrigin->x = -scrollInfo.nPos * max(nListWidth / 10, 1);
     4442      if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 
     4443      {
     4444        lpptOrigin->x = -scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE;
    44394445      }
    44404446    }
     
    44454451      if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE)
    44464452      {
    4447         lpptOrigin->y = -scrollInfo.nPos * max(nListHeight / 10, 1);
    4448       }
    4449     }
    4450 
     4453        lpptOrigin->y = -scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE;
     4454      }
     4455    }
     4456     
    44514457    bResult = TRUE;
    44524458  }
    4453 
     4459 
    44544460  return bResult;
    44554461}
     
    48044810 * DESCRIPTION:
    48054811 * Inserts a new item in the listview control.
    4806  *
     4812 * 
    48074813 * PARAMETER(S):
    48084814 * [I] HWND : window handle
     
    48224828  INT nItem = -1;
    48234829  HDPA hdpaSubItems;
     4830  INT nItemWidth = 0;
    48244831  LISTVIEW_ITEM *lpItem = NULL;
    48254832
     
    48444851            if (nItem != -1)
    48454852            {
    4846               nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem,
     4853              nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem, 
    48474854                                    hdpaSubItems);
    48484855              if (nItem != -1)
     
    48544861                  {
    48554862                    LISTVIEW_SetItemFocus(hwnd, nItem);
    4856                   }
     4863                  }           
    48574864                }
    4858 
     4865               
    48594866                /* send LVN_INSERTITEM notification */
    48604867                ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
     
    48654872                nmlv.lParam = lpItem->lParam;;
    48664873                ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv);
     4874               
     4875                if ((uView == LVS_SMALLICON) || (uView == LVS_LIST))
     4876                {
     4877                  nItemWidth = LISTVIEW_CalculateWidth(hwnd, lpLVItem->iItem);
     4878                  if (nItemWidth > infoPtr->nItemWidth)
     4879                  {
     4880                    infoPtr->nItemWidth = nItemWidth;
     4881                  }
     4882                }
    48674883
    48684884                /* align items (set position of each item) */
     
    48784894                  }
    48794895                }
    4880 
     4896               
    48814897                LISTVIEW_UpdateScroll(hwnd);
    48824898                /* refresh client area */
     
    48954911    COMCTL32_Free(lpItem);
    48964912  }
    4897 
     4913 
    48984914  return nItem;
    48994915}
     
    53125328{
    53135329  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongA(hwnd, 0);
    5314   FIXME("(%d %08lx)empty stub!\n", nItems, dwFlags);
     5330//  FIXME("(%d %08lx)empty stub!\n", nItems, dwFlags);
    53155331  if (nItems == 0)
    53165332    return LISTVIEW_DeleteAllItems (hwnd);
     
    53185334{
    53195335    /* append items */
    5320     FIXME("append items\n");
     5336//    FIXME("append items\n");
    53215337  }
    53225338  else if (nItems < GETITEMCOUNT(infoPtr))
    53235339  {
    53245340    /* remove items */
    5325     FIXME("remove items\n");
     5341//    FIXME("remove items\n");
    53265342  }
    53275343  return TRUE;
     
    57005716  ZeroMemory(&infoPtr->rcList, sizeof(RECT));
    57015717  infoPtr->hwndEdit = 0;
    5702   infoPtr->lpeditItem = NULL;
     5718  infoPtr->pedititem = NULL;
    57035719
    57045720  /* get default font (icon title) */
     
    59725988      scrollInfo.fMask = SIF_POS;
    59735989      SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
    5974       scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
    5975       GetScrollInfo(hwnd, SB_HORZ, &scrollInfo);
    59765990      if(uView == LVS_REPORT)
    59775991      {
    5978           LISTVIEW_UpdateHeaderSize(hwnd, scrollInfo.nPos, nOldScrollPos);
     5992          scrollInfo.fMask = SIF_POS;
     5993          GetScrollInfo(hwnd, SB_HORZ, &scrollInfo);
     5994          LISTVIEW_UpdateHeaderSize(hwnd, scrollInfo.nPos);
    59795995      }
    59805996      InvalidateRect(hwnd, NULL, TRUE);
     
    63996415       * no need to disturb it)
    64006416       */
     6417      infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
    64016418      LISTVIEW_UpdateScroll(hwnd);
    64026419      InvalidateRect(hwnd, NULL, TRUE);
     
    73407357{
    73417358    BOOL cancel = TRUE;
    7342     EDITLABEL_ITEM *einfo =
    7343     (EDITLABEL_ITEM *) GetWindowLongA(hwnd, GWL_USERDATA);
     7359    LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(GetParent(hwnd), 0);
     7360    EDITLABEL_ITEM *einfo = infoPtr->pedititem;
    73447361
    73457362    switch (uMsg)
    73467363    {
     7364        case WM_GETDLGCODE:
     7365          return DLGC_WANTARROWS | DLGC_WANTALLKEYS;
     7366                       
    73477367        case WM_KILLFOCUS:
    73487368            break;
     7369
     7370        case WM_DESTROY:
     7371            {
     7372                WNDPROC editProc = einfo->EditWndProc;
     7373                SetWindowLongA(hwnd, GWL_WNDPROC, (LONG)editProc);
     7374                COMCTL32_Free(einfo);
     7375                infoPtr->pedititem = NULL;
     7376                return CallWindowProcA(editProc, hwnd, uMsg, wParam, lParam);
     7377            }
    73497378
    73507379        case WM_CHAR:
     
    73627391    }
    73637392
    7364     SetWindowLongA(hwnd, GWL_WNDPROC, (LONG)einfo->EditWndProc);
    73657393    if (einfo->EditLblCb)
    73667394    {
     
    73847412        if (buffer)
    73857413            COMCTL32_Free(buffer);
    7386     }
    7387 
    7388     COMCTL32_Free(einfo);
    7389     PostMessageA(hwnd, WM_CLOSE, 0, 0);
     7414
     7415        einfo->EditLblCb = NULL;
     7416    }
     7417
     7418    SendMessageA(hwnd, WM_CLOSE, 0, 0);
    73907419    return TRUE;
    73917420}
     
    74057434{
    74067435    HWND hedit;
    7407     EDITLABEL_ITEM *einfo;
    7408  
    7409     if (NULL == (einfo = COMCTL32_Alloc(sizeof(EDITLABEL_ITEM))))
     7436    LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(parent, 0);
     7437    if (NULL == (infoPtr->pedititem = COMCTL32_Alloc(sizeof(EDITLABEL_ITEM))))
    74107438        return 0;
    74117439
     
    74147442                    parent, 0, hinst, 0)))
    74157443    {
    7416         COMCTL32_Free(einfo);
     7444        COMCTL32_Free(infoPtr->pedititem);
    74177445        return 0;
    74187446    }
    74197447
    7420     einfo->param = param;
    7421     einfo->EditLblCb = EditLblCb;
    7422     einfo->EditWndProc = (WNDPROC)SetWindowLongA(hedit,
     7448    infoPtr->pedititem->param = param;
     7449    infoPtr->pedititem->EditLblCb = EditLblCb;
     7450    infoPtr->pedititem->EditWndProc = (WNDPROC)SetWindowLongA(hedit,
    74237451          GWL_WNDPROC, (LONG) EditLblWndProc);
    74247452
    7425     SetWindowLongA(hedit, GWL_USERDATA, (LONG)einfo);
    7426 
    74277453    return hedit;
    74287454}
Note: See TracChangeset for help on using the changeset viewer.