Ignore:
Timestamp:
Apr 16, 2000, 8:26:59 PM (25 years ago)
Author:
cbratschi
Message:

new listview messages and styles, new resources

File:
1 edited

Legend:

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

    r3385 r3409  
    1 /*$Id: listview.cpp,v 1.13 2000-04-15 14:22:19 cbratschi Exp $*/
     1/*$Id: listview.cpp,v 1.14 2000-04-16 18:26:57 cbratschi Exp $*/
    22/*
    33 * Listview control
     
    1515 *   - rcView and origin (need testcase!!!)
    1616 *   - rcView not updated in LVM_SETITEMPOSITION and other messages
     17 *   - many position bugs
     18 *   - work area not used
     19 *   - custom draw
     20 *   - drag'n'drop (-> treeview)
     21 *   - edit timer
    1722 *   - LISTVIEW_SetBkImage
    1823 *   - LISTVIEW_GetBkImage
     
    2126 *   - LVS_OWNERDRAWFIXED
    2227 *   - LVS_EX_*
     28 *       LVS_EX_CHECKBOXES
     29 *       LVS_EX_TRACKSELECT
     30 *       LVS_EX_FULLROWSELECT
     31 *       LVS_EX_ONECLICKACTIVATE
     32 *       LVS_EX_TWOCLICKACTIVATE
     33 *       LVS_EX_FLATSB
     34 *       LVS_EX_REGIONAL
     35 *       LVS_EX_INFOTIP
     36 *       LVS_EX_UNDERLINEHOT
     37 *       LVS_EX_UNDERLINECOLD
     38 *       LVS_EX_MULTIWORKAREAS
    2339 *   - many things untested!
    2440 *
     
    2642 *   LISTVIEW_SetItemCount : not completed
    2743 *
    28  * Advanced functionality:
    29  *   LISTVIEW_GetNumberOfWorkAreas : not implemented
    30  *   LISTVIEW_GetHoverTime : not implemented
    31  *   LISTVIEW_GetISearchString : not implemented
    32  *
     44 * Status: all messages done, many styles not (yet) implemented
     45 * Version: 5.80
    3346 */
    3447
     
    7992#define LISTVIEW_SCROLL_DIV_SIZE 1
    8093
     94#define DEFAULT_HOVERTIME    500
     95#define LV_ISEARCH_DELAY     1000 //documented in ListView_Message_Processing.htm
     96
    8197/*
    8298 * macros
     
    85101/* retrieve the number of items in the listview */
    86102#define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount)
    87 
    88103
    89104HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y,
     
    92107
    93108#define LISTVIEW_GetInfoPtr(hwnd) ((LISTVIEW_INFO*)getInfoPtr(hwnd))
    94 
    95 INT WINAPI COMCTL32_StrCmpNIA(LPCSTR,LPCSTR,INT);
    96 
    97 #define strncasecmp COMCTL32_StrCmpNIA
    98109
    99110/*
     
    965976  {
    966977    LISTVIEW_GetItemPosition(hwnd, i, &ptItem);
     978
    967979    if (PtInRect(&rcSelRect, ptItem) != FALSE)
    968980    {
     
    10141026    POINT ptSelMark;
    10151027    RECT rcSel;
     1028
    10161029    LISTVIEW_GetItemPosition(hwnd, nItem, &ptItem);
    10171030    LISTVIEW_GetItemPosition(hwnd, infoPtr->nSelectionMark, &ptSelMark);
     
    10761089  {
    10771090    if (nItem > 0)
    1078       LISTVIEW_RemoveSelections(hwnd, 0, nItem - 1);
     1091      LISTVIEW_RemoveSelections(hwnd,0,nItem);
    10791092
    10801093    if (nItem < GETITEMCOUNT(infoPtr))
    1081       LISTVIEW_RemoveSelections(hwnd, nItem + 1, GETITEMCOUNT(infoPtr));
     1094      LISTVIEW_RemoveSelections(hwnd,nItem+1,GETITEMCOUNT(infoPtr));
    10821095  } else mask |= LVIS_SELECTED;
    10831096
    1084   LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,mask);
     1097
     1098  if (infoPtr->nFocusedItem != nItem) LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,mask);
    10851099  LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED);
    10861100
     
    12001214  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    12011215  LISTVIEW_ITEM *lpItem;
    1202 
    1203   while ((lpItem = (LISTVIEW_ITEM*)DPA_GetPtr(infoPtr->hdpaSelItems,0)) != NULL)
    1204   {
    1205     LISTVIEW_SetItemState(hwnd,DPA_GetPtrIndex(infoPtr->hdpaItems,lpItem),0,LVIS_SELECTED);
     1216  INT pos = 0;
     1217
     1218  while ((lpItem = (LISTVIEW_ITEM*)DPA_GetPtr(infoPtr->hdpaSelItems,pos)) != NULL)
     1219  {
     1220    INT nItem = DPA_GetPtrIndex(infoPtr->hdpaItems,lpItem);
     1221
     1222    if ((nItem >= nFirst) && (nItem < nLast))
     1223      LISTVIEW_SetItemState(hwnd,nItem,0,LVIS_SELECTED);
     1224    else
     1225      pos++;
    12061226  }
    12071227}
     
    16571677  /* get information needed for drawing the item */
    16581678  ZeroMemory(&lvItem, sizeof(LVITEMW));
    1659   lvItem.header.mask = LVIF_TEXT;
     1679  lvItem.header.mask = LVIF_TEXT | LVIF_IMAGE;
    16601680  lvItem.header.iItem = nItem;
    16611681  lvItem.header.iSubItem = nSubItem;
     
    16641684  lvItem.mustFree = FALSE;
    16651685  LISTVIEW_GetItem(hwnd,(LPLVITEMW)&lvItem,TRUE,TRUE);
     1686
     1687  if (infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES)
     1688  {
     1689    /* small icons */
     1690    if (infoPtr->himlSmall)
     1691    {
     1692      ImageList_SetBkColor(infoPtr->himlSmall,CLR_NONE);
     1693      ImageList_Draw(infoPtr->himlSmall,lvItem.header.iImage,hdc,rcItem.left,rcItem.top,ILD_NORMAL);
     1694
     1695      rcItem.left += infoPtr->iconSize.cx;
     1696    }
     1697  }
    16661698
    16671699  /* set item colors */
     
    19151947
    19161948  /* add 1 for displaying a partial item at the bottom */
    1917   nLast = nItem + LISTVIEW_GetCountPerColumn(hwnd)+1;
    1918   nLast = min(nLast, GETITEMCOUNT(infoPtr));
     1949  nLast = nItem+LISTVIEW_GetCountPerColumn(hwnd)+1;
     1950  nLast = min(nLast,GETITEMCOUNT(infoPtr));
    19191951
    19201952  /* send cache hint notification */
     
    19451977  }
    19461978
    1947   for (; nItem < nLast; nItem++)
    1948   {
    1949     for (j = 0; j < nColumnCount; j++)
     1979  for (;nItem < nLast;nItem++)
     1980  {
     1981    for (j = 0;j < nColumnCount;j++)
    19501982    {
    19511983      rcItem = rcHeader[j];
     
    19661998    nDrawPosY += infoPtr->nItemHeight;
    19671999  }
     2000
    19682001DR_END:
     2002  if (infoPtr->dwExStyle & LVS_EX_GRIDLINES)
     2003  {
     2004    HPEN hOldPen;
     2005
     2006    hOldPen = SelectObject(hdc,GetStockObject(BLACK_BRUSH));
     2007    for (j = 0;j < nColumnCount-1;j++)
     2008    {
     2009      MoveToEx(hdc,rcHeader[j].right+REPORT_MARGINX-1,infoPtr->rcList.top,NULL);
     2010      LineTo(hdc,rcHeader[j].right+REPORT_MARGINX-1,infoPtr->rcList.bottom);
     2011    }
     2012    SelectObject(hdc,hOldPen);
     2013  }
     2014
     2015
    19692016  COMCTL32_Free(rcHeader);
    19702017}
     
    34833530}
    34843531
    3485 /* LISTVIEW_GetHoverTime */
     3532static LRESULT LISTVIEW_GetHoverTime(HWND hwnd,WPARAM wParam,LPARAM lParam)
     3533{
     3534  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     3535
     3536  return (LRESULT)infoPtr->hoverTime;
     3537}
     3538
     3539static LRESULT LISTVIEW_SetHoverTime(HWND hwnd,WPARAM wParam,LPARAM lParam)
     3540{
     3541  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     3542  INT oldTime = infoPtr->hoverTime;
     3543
     3544  infoPtr->hoverTime = (INT)lParam;
     3545  if (infoPtr->hoverTime == -1) infoPtr->hoverTime = DEFAULT_HOVERTIME;
     3546
     3547  return (LRESULT)oldTime;
     3548}
    34863549
    34873550/***
     
    37553818}
    37563819
    3757 /* LISTVIEW_GetHoverTime */
    3758 
    37593820/***
    37603821 * DESCRIPTION:
     
    38433904}
    38443905
     3906static BOOL LISTVIEW_GetSubItemPosition(HWND hwnd,INT nItem,INT nSubItem,LPPOINT lpptPosition)
     3907{
     3908  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     3909  RECT rect;
     3910
     3911  if (Header_GetItemRect(infoPtr->hwndHeader,nSubItem,&rect))
     3912  {
     3913    lpptPosition->x = rect.left+REPORT_MARGINX;
     3914    lpptPosition->y = ((nItem-LISTVIEW_GetTopIndex(hwnd))*infoPtr->nItemHeight)+infoPtr->rcList.top;
     3915
     3916    return TRUE;
     3917  }
     3918
     3919  return FALSE;
     3920}
     3921
    38453922/***
    38463923 * DESCRIPTION:
     
    38583935static LRESULT LISTVIEW_GetItemRect(HWND hwnd,INT nItem,LPRECT lprc,INT code)
    38593936{
    3860   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     3937  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    38613938  BOOL bResult = FALSE;
    38623939  POINT ptOrigin;
     
    41774254}
    41784255
     4256static LRESULT LISTVIEW_GetSubItemRect(HWND hwnd,INT nItem,LPRECT lprc)
     4257{
     4258  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4259  INT nSubItem,code,nLabelWidth;
     4260  POINT ptItem;
     4261
     4262  if (!lprc || (infoPtr->uView != LVS_REPORT) || (nItem < 0) || (nItem >= GETITEMCOUNT(infoPtr))) return FALSE;
     4263
     4264  nSubItem = lprc->top;
     4265  if ((nSubItem < 0) || (nSubItem >= Header_GetItemCount(infoPtr->hwndHeader))) return FALSE;
     4266  if (!LISTVIEW_GetSubItemPosition(hwnd,nItem,nSubItem,&ptItem)) return FALSE;
     4267
     4268  code = lprc->left;
     4269
     4270  switch (code)
     4271  {
     4272    case LVIR_BOUNDS:
     4273      lprc->left = ptItem.x;
     4274      lprc->right = lprc->left;
     4275      lprc->top = ptItem.y;
     4276      lprc->bottom = lprc->top+infoPtr->nItemHeight;
     4277
     4278      if ((infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES) && infoPtr->himlSmall)
     4279      {
     4280        lprc->right += infoPtr->iconSize.cx;
     4281      }
     4282
     4283      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd,nItem,nSubItem);
     4284      lprc->right += nLabelWidth;
     4285      break;
     4286
     4287    case LVIR_ICON:
     4288      if (infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES)
     4289      {
     4290        lprc->left = ptItem.x;
     4291        lprc->top = ptItem.y;
     4292        lprc->bottom = lprc->top+infoPtr->nItemHeight;
     4293
     4294        if (infoPtr->himlSmall)
     4295        {
     4296          lprc->right = lprc->left+infoPtr->iconSize.cx;
     4297        } else
     4298        {
     4299          lprc->right = lprc->left;
     4300        }
     4301        break;
     4302      } else return FALSE;
     4303
     4304    case LVIR_LABEL:
     4305      lprc->left = ptItem.x;
     4306      lprc->right = lprc->left;
     4307      lprc->top = ptItem.y;
     4308      lprc->bottom = lprc->top+infoPtr->nItemHeight;
     4309
     4310      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd,nItem,nSubItem);
     4311      lprc->right += nLabelWidth;
     4312      break;
     4313
     4314    default:
     4315      return FALSE;
     4316  }
     4317
     4318  return TRUE;
     4319}
     4320
    41794321/***
    41804322 * DESCRIPTION:
     
    42204362LRESULT LISTVIEW_GetItemSpacing(HWND hwnd, BOOL bSmall)
    42214363{
    4222   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     4364  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    42234365  LONG lResult;
    42244366
     
    44504592}
    44514593
    4452 /* LISTVIEW_GetNumberOfWorkAreas */
     4594static LRESULT LISTVIEW_GetNumberOfWorkAreas(HWND hwnd,WPARAM wParam,LPARAM lParam)
     4595{
     4596  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4597  LPINT lpuWorkAreas = (LPINT)lParam;
     4598
     4599  if (!lpuWorkAreas) return FALSE;
     4600
     4601  *lpuWorkAreas = infoPtr->nWorkAreas;
     4602
     4603  return TRUE;
     4604}
     4605
     4606static LRESULT LISTVIEW_GetWorkAreas(HWND hwnd,WPARAM wParam,LPARAM lParam)
     4607{
     4608  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4609  INT nWorkAreas = (INT)wParam;
     4610  LPRECT lprc = (LPRECT)lParam;
     4611
     4612  if ((nWorkAreas <= 0) || (nWorkAreas > infoPtr->nWorkAreas) || !lprc) return FALSE;
     4613
     4614  for (INT x = 0;x < nWorkAreas;x++)
     4615    lprc[x] = infoPtr->rcWorkAreas[x];
     4616
     4617  return TRUE;
     4618}
     4619
     4620static LRESULT LISTVIEW_SetWorkAreas(HWND hwnd,WPARAM wParam,LPARAM lParam)
     4621{
     4622  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4623  INT nWorkAreas = (INT)wParam;
     4624  LPRECT lprc = (LPRECT)lParam;
     4625
     4626  if ((nWorkAreas < 0) || (nWorkAreas > LV_MAX_WORKAREAS)) return FALSE;
     4627
     4628  COMCTL32_Free(infoPtr->rcWorkAreas);
     4629  if ((nWorkAreas == 0) || !lprc)
     4630  {
     4631    infoPtr->nWorkAreas = 0;
     4632    infoPtr->rcWorkAreas = NULL;
     4633  } else
     4634  {
     4635    infoPtr->nWorkAreas = nWorkAreas;
     4636    infoPtr->rcWorkAreas = (LPRECT)COMCTL32_Alloc(nWorkAreas*sizeof(RECT));
     4637    for (INT x = 0;x < nWorkAreas;x++)
     4638     infoPtr->rcWorkAreas[x] = lprc[x];
     4639  }
     4640
     4641  return TRUE;
     4642}
     4643
    44534644
    44544645/***
     
    44664657static LRESULT LISTVIEW_GetOrigin(HWND hwnd, LPPOINT lpptOrigin)
    44674658{
    4468   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     4659  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    44694660
    44704661  if ((infoPtr->uView == LVS_SMALLICON) || (infoPtr->uView == LVS_ICON))
     
    45164707static LRESULT LISTVIEW_GetSelectionMark(HWND hwnd)
    45174708{
    4518   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     4709  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    45194710
    45204711  return infoPtr->nSelectionMark;
     
    45974788}
    45984789
    4599 static BOOL LISTVIEW_InternalHitTestItem(HWND hwnd,LISTVIEW_INFO *infoPtr,INT nItem,LPLVHITTESTINFO lpHitTestInfo)
     4790static BOOL LISTVIEW_InternalHitTestItem(HWND hwnd,LISTVIEW_INFO *infoPtr,INT nItem,LPLVHITTESTINFO lpHitTestInfo,BOOL checkSubItems)
    46004791{
    46014792  RECT rcItem;
     4793
     4794  if (checkSubItems && (infoPtr->uView == LVS_REPORT))
     4795  {
     4796    INT nColumnCount = Header_GetItemCount(infoPtr->hwndHeader);
     4797    INT xDiff = -infoPtr->lefttop.x*infoPtr->scrollStep.x;
     4798
     4799    rcItem.top = infoPtr->rcList.top+(nItem-LISTVIEW_GetTopIndex(hwnd))*infoPtr->nItemHeight;
     4800    rcItem.bottom = rcItem.top+infoPtr->nItemHeight;
     4801    for (INT x = 0;x < nColumnCount;x++)
     4802    {
     4803      RECT rcColumn;
     4804
     4805      Header_GetItemRect(infoPtr->hwndHeader,x,&rcColumn);
     4806      rcItem.left = xDiff+REPORT_MARGINX+rcColumn.left;
     4807      rcItem.right = xDiff+rcColumn.right-REPORT_MARGINX;
     4808      if (PtInRect(&rcItem,lpHitTestInfo->pt))
     4809      {
     4810        rcItem.top = x;
     4811        rcItem.left = LVIR_BOUNDS;
     4812        if (LISTVIEW_GetSubItemRect(hwnd,nItem,&rcItem) && PtInRect(&rcItem,lpHitTestInfo->pt))
     4813        {
     4814          rcItem.top = x;
     4815          rcItem.left = LVIR_ICON;
     4816          if (LISTVIEW_GetSubItemRect(hwnd,nItem,&rcItem) && PtInRect(&rcItem,lpHitTestInfo->pt))
     4817          {
     4818            lpHitTestInfo->flags = LVHT_ONITEMICON;
     4819            lpHitTestInfo->iItem = nItem;
     4820            lpHitTestInfo->iSubItem = x;
     4821            return TRUE;
     4822          }
     4823
     4824          lpHitTestInfo->flags = LVHT_ONITEMLABEL;
     4825          lpHitTestInfo->iItem = nItem;
     4826          lpHitTestInfo->iSubItem = x;
     4827
     4828          return TRUE;
     4829        }
     4830      }
     4831    }
     4832    return FALSE;
     4833  }
    46024834
    46034835  if (LISTVIEW_GetItemRect(hwnd,nItem,&rcItem,LVIR_BOUNDS))
     
    46574889    if (nItem >= GETITEMCOUNT(infoPtr)) return -1;
    46584890
    4659     if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo))
     4891    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,FALSE))
    46604892      return nItem;
    46614893  } else if (infoPtr->uView == LVS_LIST)
     
    46684900    if (nItem >= GETITEMCOUNT(infoPtr)) return -1;
    46694901
    4670     if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo))
     4902    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,FALSE))
    46714903      return nItem;
    46724904  } else
     
    46764908    for (i = 0; i < GETITEMCOUNT(infoPtr); i++)
    46774909    {
    4678       if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,i,lpHitTestInfo))
     4910      if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,i,lpHitTestInfo,FALSE))
    46794911        return i;
    46804912    }
     
    47004932static LRESULT LISTVIEW_HitTest(HWND hwnd, LPLVHITTESTINFO lpHitTestInfo)
    47014933{
    4702   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     4934  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    47034935  INT nItem = -1;
    47044936
     
    47084940  {
    47094941    lpHitTestInfo->flags = LVHT_TOLEFT;
    4710   }
    4711   else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
     4942  } else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
    47124943  {
    47134944    lpHitTestInfo->flags = LVHT_TORIGHT;
     
    47164947  {
    47174948    lpHitTestInfo->flags |= LVHT_ABOVE;
    4718   }
    4719   else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
     4949  } else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
    47204950  {
    47214951    lpHitTestInfo->flags |= LVHT_BELOW;
     
    47294959  return nItem;
    47304960}
     4961
     4962static LRESULT LISTVIEW_SubItemHitTest(HWND hwnd,LPLVHITTESTINFO lpHitTestInfo)
     4963{
     4964  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4965  INT nItem = -1;
     4966  INT nSubItem = -1;
     4967
     4968  lpHitTestInfo->flags = 0;
     4969  if (infoPtr->uView != LVS_REPORT) return -1;
     4970
     4971  if (infoPtr->rcList.left > lpHitTestInfo->pt.x)
     4972  {
     4973    lpHitTestInfo->flags = LVHT_TOLEFT;
     4974  } else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
     4975  {
     4976    lpHitTestInfo->flags = LVHT_TORIGHT;
     4977  }
     4978  if (infoPtr->rcList.top > lpHitTestInfo->pt.y)
     4979  {
     4980    lpHitTestInfo->flags |= LVHT_ABOVE;
     4981  } else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
     4982  {
     4983    lpHitTestInfo->flags |= LVHT_BELOW;
     4984  }
     4985
     4986  if (lpHitTestInfo->flags == 0)
     4987  {
     4988    INT nTop = LISTVIEW_GetTopIndex(hwnd),nItem;
     4989
     4990    nItem = nTop+((lpHitTestInfo->pt.y-infoPtr->rcList.top)/infoPtr->nItemHeight);
     4991    if (nItem >= GETITEMCOUNT(infoPtr)) return -1;
     4992
     4993    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,TRUE))
     4994      return lpHitTestInfo->iSubItem;
     4995  }
     4996
     4997  return nSubItem;
     4998}
     4999
    47315000
    47325001/***
     
    54185687  /* store previous style */
    54195688  dwOldStyle = infoPtr->dwExStyle;
     5689
    54205690  /* set new style */
    54215691  infoPtr->dwExStyle = (dwOldStyle & ~dwMask) | (dwStyle & dwMask);
    5422   return (dwOldStyle);
     5692
     5693  //update report view
     5694  if ((((dwOldStyle & LVS_EX_GRIDLINES) != (infoPtr->dwExStyle & LVS_EX_GRIDLINES)) ||
     5695       ((dwOldStyle & LVS_EX_SUBITEMIMAGES) != (infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES))) &&
     5696      (infoPtr->uView == LVS_REPORT))
     5697  {
     5698    LISTVIEW_Refresh(hwnd);
     5699  }
     5700
     5701  //update header
     5702  if ((dwOldStyle & LVS_EX_HEADERDRAGDROP) != (infoPtr->dwExStyle & LVS_EX_HEADERDRAGDROP))
     5703  {
     5704    if (infoPtr->hwndHeader)
     5705    {
     5706      DWORD dwStyle = GetWindowLongA(infoPtr->hwndHeader,GWL_STYLE);
     5707
     5708      if (infoPtr->dwExStyle & LVS_EX_HEADERDRAGDROP)
     5709        dwStyle |= HDS_DRAGDROP;
     5710      else
     5711        dwStyle &= ~HDS_DRAGDROP;
     5712      SetWindowLongA(infoPtr->hwndHeader,GWL_STYLE,dwStyle);
     5713    }
     5714  }
     5715
     5716  return dwOldStyle;
    54235717}
    54245718
     
    54815775}
    54825776
    5483 /* LISTVIEW_SetIconSpacing */
     5777static LRESULT LISTVIEW_SetIconSpacing(HWND hwnd,WPARAM wParam,LPARAM lParam)
     5778{
     5779  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     5780  DWORD oldIS = MAKELONG(infoPtr->iconSpacing.cx,infoPtr->iconSpacing.cy);
     5781  INT cx = LOWORD(lParam),cy = HIWORD(lParam);
     5782
     5783  if (cx == -1) cx = GetSystemMetrics(SM_CXICONSPACING);
     5784  if (cy == -1) cy = GetSystemMetrics(SM_CYICONSPACING);
     5785  if ((cx != infoPtr->iconSpacing.cx) || (cy != infoPtr->iconSpacing.cy))
     5786  {
     5787    infoPtr->iconSpacing.cx = cx;
     5788    infoPtr->iconSpacing.cy = cy;
     5789    if (((infoPtr->uView == LVS_ICON) || (infoPtr->uView == LVS_SMALLICON)) && (infoPtr->dwStyle & LVS_AUTOARRANGE))
     5790    {
     5791      LISTVIEW_Arrange(hwnd,LVA_DEFAULT);
     5792    }
     5793  }
     5794
     5795  return oldIS;
     5796}
    54845797
    54855798/***
     
    54985811static LRESULT LISTVIEW_SetImageList(HWND hwnd, INT nType, HIMAGELIST himl)
    54995812{
    5500   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     5813  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    55015814  HIMAGELIST himlTemp = 0;
    55025815
     
    58776190
    58786191  infoPtr->nSelectionMark = nIndex;
     6192
    58796193  return nOldIndex;
    58806194}
     
    59326246/* LISTVIEW_SetToolTips */
    59336247/* LISTVIEW_SetUnicodeFormat */
    5934 /* LISTVIEW_SetWorkAreas */
    59356248
    59366249/***
     
    60856398  infoPtr->pedititem = NULL;
    60866399  infoPtr->bDoEditLabel = FALSE;
     6400  infoPtr->hoverTime = DEFAULT_HOVERTIME;
    60876401
    60886402  /* get default font (icon title) */
     
    60996413
    61006414  /* set header font */
    6101   SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont,
    6102                (LPARAM)TRUE);
     6415  SendMessageA(infoPtr->hwndHeader,WM_SETFONT,(WPARAM)infoPtr->hFont,(LPARAM)TRUE);
    61036416
    61046417  if (uView == LVS_ICON)
     
    61066419    infoPtr->iconSize.cx = GetSystemMetrics(SM_CXICON);
    61076420    infoPtr->iconSize.cy = GetSystemMetrics(SM_CYICON);
    6108   }
    6109   else if (uView == LVS_REPORT)
     6421  } else if (uView == LVS_REPORT)
    61106422  {
    61116423    if (!(LVS_NOCOLUMNHEADER & lpcs->style))
     
    61166428    infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON);
    61176429    infoPtr->iconSize.cy = GetSystemMetrics(SM_CYSMICON);
    6118   }
    6119   else
     6430  } else
    61206431  {
    61216432    infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON);
     
    61306441  infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
    61316442  infoPtr->nItemHeight = LISTVIEW_GetItemHeight(hwnd);
     6443
     6444  //create tooltip
     6445  infoPtr->hwndToolTip = createToolTip(hwnd,TTF_TRACK | TTF_ABSOLUTE | TTF_TRANSPARENT,TRUE);
     6446  SendMessageA(infoPtr->hwndToolTip,WM_SETFONT,infoPtr->hFont,0);
     6447
    61326448
    61336449  return 0;
     
    64796795}
    64806796
    6481 /************************ Defines that LISTVIEW_ProcessLetterKeys uses *******************************/
    6482 #define KEY_DELAY       900
    6483 #define LISTVIEW_InitLvItemStruct(item,idx,TEXT)  \
    6484                     ZeroMemory(&(item), sizeof(LVITEMA)); \
    6485                     (item).mask = LVIF_TEXT; \
    6486                     (item).iItem = (idx); \
    6487                     (item).iSubItem = 0; \
    6488                     (item).pszText = (CHAR*)&(TEXT); \
    6489                     (item).cchTextMax = MAX_PATH
    6490 
    6491 /************************************************************************************************************************
    6492 * DESCRIPTION:
    6493 *       Processes keyboard messages generated by pressing the letter keys on the keyboard.
    6494 *       Assumes the list is sorted alphabetically, without regard to case.
    6495 *
    6496 * PARAMETERS:
    6497 *       [ I ]   HWND: handle to the window
    6498 *       [ I ]   WPARAM: the character code, the actual character
    6499 *       [ I ]   LPARAM: key data
    6500 *
    6501 *
    6502 * RETURN:
    6503 *       Zero.
    6504 *
    6505 * CHANGE LOG:
    6506 *       Feb 17, 2000 -------------> Creation of function.
    6507 *       Feb 22, 2000 -------------> Added macros.
    6508 * TODO:
    6509 *
    6510 *
    6511 ************************************************************************************************************************/
    6512 static INT LISTVIEW_ProcessLetterKeys( HWND hwnd, WPARAM charCode, LPARAM keyData )
    6513 {
    6514     LISTVIEW_INFO *infoPtr = NULL;
    6515     INT nItem = -1;
    6516     INT nSize = 0;
    6517     INT idx = 0;
    6518     BOOL bFoundMatchingFiles = FALSE;
    6519     LVITEMA item;
    6520     CHAR TEXT[ MAX_PATH ];
    6521     CHAR szCharCode[ 2 ];
    6522     DWORD timeSinceLastKeyPress = 0;
    6523 
    6524     sprintf( szCharCode, "%c", charCode );
    6525 
    6526     /* simple parameter checking  */
    6527     if ( !hwnd || !charCode || !keyData )
    6528         return 0;
    6529 
    6530     infoPtr = (LISTVIEW_INFO*)getInfoPtr(hwnd);
    6531 
    6532     if ( !infoPtr )
    6533         return 0;
    6534 
    6535     /* only allow the valid WM_CHARs through */
    6536     if ( isalnum( charCode ) || charCode == '.' || charCode == '`' || charCode == '!'
    6537           || charCode == '@' || charCode == '#' || charCode == '$' || charCode == '%'
    6538           || charCode == '^' || charCode == '&' || charCode == '*' || charCode == '('
    6539           || charCode == ')' || charCode == '-' || charCode == '_' || charCode == '+'
    6540           || charCode == '=' || charCode == '\\'|| charCode == ']' || charCode == '}'
    6541           || charCode == '[' || charCode == '{' || charCode == '/' || charCode == '?'
    6542           || charCode == '>' || charCode == '<' || charCode == ',' || charCode == '~')
    6543     {
    6544         timeSinceLastKeyPress = GetTickCount();
    6545 
    6546         nSize = GETITEMCOUNT( infoPtr );
    6547         /* if there are 0 items, there is no where to go */
    6548         if ( nSize == 0 )
    6549             return 0;
    6550         /*
    6551          * If the last charCode equals the current charCode then look
    6552          * to the next element in list to see if it matches the previous
    6553          * charCode.
    6554          */
    6555         if ( infoPtr->charCode == charCode )
    6556         {
    6557             if ( timeSinceLastKeyPress - infoPtr->timeSinceLastKeyPress < KEY_DELAY )
    6558             {    /* append new character to search string */
    6559                 lstrcatA( infoPtr->szSearchParam, szCharCode );
    6560                 infoPtr->nSearchParamLength++;
    6561 
    6562                 /* loop from start of list view */
    6563                 for( idx = infoPtr->nFocusedItem; idx < nSize; idx++ )
    6564                 {   /* get item */
    6565                     LISTVIEW_InitLvItemStruct( item, idx, TEXT );
    6566                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6567 
    6568                     /* compare items */
    6569                     if ( strncasecmp( item.pszText, infoPtr->szSearchParam,
    6570                                       infoPtr->nSearchParamLength ) == 0 )
    6571                     {
    6572                         nItem = idx;
    6573                         break;
    6574                     }
    6575                 }
    6576             }
    6577             else if ( infoPtr->timeSinceLastKeyPress > timeSinceLastKeyPress )
    6578             { /* The DWORD went over it's boundery?? Ergo assuming too slow??. */
    6579                 for ( idx = 0; idx < nSize; idx++ )
    6580                 {
    6581                     LISTVIEW_InitLvItemStruct( item, idx, TEXT );
    6582                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6583 
    6584                     if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6585                     {
    6586                         nItem = idx;
    6587                         break;
    6588                     }
    6589                 }
    6590                 lstrcpyA( infoPtr->szSearchParam, szCharCode );
    6591                 infoPtr->nSearchParamLength = 1;
    6592             }
    6593             else
    6594             {   /* Save szCharCode for use in later searches */
    6595                 lstrcpyA( infoPtr->szSearchParam, szCharCode );
    6596                 infoPtr->nSearchParamLength = 1;
    6597 
    6598                 LISTVIEW_InitLvItemStruct( item, infoPtr->nFocusedItem + 1, TEXT );
    6599                 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6600 
    6601                 if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6602                     nItem = infoPtr->nFocusedItem + 1;
    6603                 else
    6604                 {   /*
    6605                      * Ok so there are no more folders that match
    6606                      * now we look for files.
    6607                      */
    6608                     for ( idx = infoPtr->nFocusedItem + 1; idx < nSize; idx ++ )
    6609                     {
    6610                         LISTVIEW_InitLvItemStruct( item, idx, TEXT );
    6611                         LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6612 
    6613                         if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6614                         {
    6615                             nItem = idx;
    6616                             bFoundMatchingFiles = TRUE;
    6617                             break;
    6618                         }
    6619                     }
    6620                     if ( !bFoundMatchingFiles )
    6621                     {  /* go back to first instance */
    6622                         for ( idx = 0; idx < nSize; idx ++ )
    6623                         {
    6624                             LISTVIEW_InitLvItemStruct( item,idx, TEXT );
    6625                             LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6626 
    6627                             if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6628                             {
    6629                                 nItem = idx;
    6630                                 break;
    6631                             }
    6632                         }
    6633                     }
    6634                 }
    6635             }
    6636         } /*END: if ( infoPtr->charCode == charCode )*/
    6637 
    6638         else /* different keypressed */
    6639         {
    6640             /* could be that they are spelling the file/directory for us */
    6641             if ( timeSinceLastKeyPress - infoPtr->timeSinceLastKeyPress > KEY_DELAY )
    6642             {   /*
    6643                  * Too slow, move to the first instance of the
    6644                  * charCode.
    6645                  */
    6646                 for ( idx = 0; idx < nSize; idx++ )
    6647                 {
    6648                     LISTVIEW_InitLvItemStruct( item,idx, TEXT );
    6649                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6650 
    6651                     if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6652                     {
    6653                         nItem = idx;
    6654                         break;
    6655                     }
    6656                 }
    6657                 lstrcpyA( infoPtr->szSearchParam, szCharCode );
    6658                 infoPtr->nSearchParamLength = 1;
    6659             }
    6660             else if ( infoPtr->timeSinceLastKeyPress > timeSinceLastKeyPress )
    6661             {  /* The DWORD went over it's boundery?? Ergo assuming too slow??. */
    6662                 for ( idx = 0; idx < nSize; idx++ )
    6663                 {
    6664                     LISTVIEW_InitLvItemStruct( item,idx, TEXT );
    6665                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6666 
    6667                     if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6668                     {
    6669                         nItem = idx;
    6670                         break;
    6671                     }
    6672                 }
    6673                 lstrcpyA( infoPtr->szSearchParam, szCharCode );
    6674                 infoPtr->nSearchParamLength = 1;
    6675             }
    6676             else /* Search for the string the user is typing */
    6677             {
    6678                 /* append new character to search string */
    6679                 lstrcatA( infoPtr->szSearchParam, szCharCode );
    6680                 infoPtr->nSearchParamLength++;
    6681 
    6682                 /* loop from start of list view */
    6683                 for( idx = 0; idx < nSize; idx++ )
    6684                 {   /* get item */
    6685                     LISTVIEW_InitLvItemStruct( item, idx, TEXT );
    6686                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6687 
    6688                     /* compare items */
    6689                     if ( strncasecmp( item.pszText, infoPtr->szSearchParam,
    6690                                       infoPtr->nSearchParamLength ) == 0 )
    6691                     {
    6692                         nItem = idx;
    6693                         break;
    6694                     }
    6695                 }
    6696             }
    6697         }/*END: else */
    6698     }
     6797static BOOL LISTVIEW_Compare(HWND hwnd,INT nItem,LPWSTR text,INT textlen,BOOL *matchLast)
     6798{
     6799  BOOL res;
     6800  INT itemlen;
     6801  LVINTERNALITEMW lvItem;
     6802
     6803  ZeroMemory(&lvItem,sizeof(LVITEMW));
     6804  lvItem.header.mask = LVIF_TEXT;
     6805  lvItem.header.iItem = nItem;
     6806  lvItem.header.cchTextMax = DISP_TEXT_SIZE;
     6807  lvItem.mustFree = FALSE;
     6808  LISTVIEW_GetItem(hwnd,(LPLVITEMW)&lvItem,TRUE,TRUE);
     6809
     6810  itemlen = lstrlenAW(lvItem.header.pszText,lvItem.unicode);
     6811  if (itemlen < textlen)
     6812  {
     6813    res = FALSE;
     6814  } else
     6815  {
     6816    res = (lstrcmpniAW(lvItem.header.pszText,lvItem.unicode,text,TRUE,textlen) == 0);
     6817  }
     6818  if (!res && matchLast)
     6819  {
     6820    textlen--;
     6821    if ((textlen > 0) && (itemlen >= textlen))
     6822      *matchLast = (lstrcmpniAW(lvItem.header.pszText,lvItem.unicode,text,TRUE,textlen) == 0);
    66996823    else
    6700         return 0;
    6701 
    6702     LISTVIEW_KeySelection(hwnd, nItem );
    6703 
    6704     /* Store the WM_CHAR for next time */
    6705     infoPtr->charCode = charCode;
    6706 
    6707     /* Store time */
    6708     infoPtr->timeSinceLastKeyPress = timeSinceLastKeyPress;
    6709 
    6710     return 0;
    6711 
    6712 }/*END:LISTVIEW_ProcessLetterKeys( HWND hwndParent, INT nVirtualKey, LONG lKeyData ) */
     6824      *matchLast = FALSE;
     6825  }
     6826  if (lvItem.mustFree) COMCTL32_Free(lvItem.header.pszText);
     6827
     6828  return res;
     6829}
     6830
     6831static INT LISTVIEW_Search(HWND hwnd,LISTVIEW_INFO *infoPtr,INT iItem,LPWSTR text,INT textlen,INT *nearest)
     6832{
     6833  INT start,item;
     6834  BOOL bMatchLast;
     6835
     6836  start = iItem;
     6837  if (nearest) *nearest = -1;
     6838
     6839  //search start to end
     6840  for (item = start;item < GETITEMCOUNT(infoPtr);item++)
     6841  {
     6842    if (nearest)
     6843    {
     6844      if (LISTVIEW_Compare(hwnd,item,text,textlen,(*nearest == -1) ? &bMatchLast:NULL))
     6845        return item;
     6846      else if ((*nearest == -1) && bMatchLast)
     6847        *nearest = item;
     6848    } else
     6849    {
     6850      if (LISTVIEW_Compare(hwnd,item,text,textlen,NULL))
     6851        return item;
     6852    }
     6853  }
     6854
     6855  //search first to start
     6856  for (item = 0;item < start;item++)
     6857  {
     6858    if (nearest)
     6859    {
     6860      if (LISTVIEW_Compare(hwnd,item,text,textlen,(*nearest == -1) ? &bMatchLast:NULL))
     6861        return item;
     6862      else if ((*nearest == -1) && bMatchLast)
     6863        *nearest = item;
     6864    } else
     6865    {
     6866      if (LISTVIEW_Compare(hwnd,item,text,textlen,NULL))
     6867        return item;
     6868    }
     6869  }
     6870
     6871  return -1;
     6872}
     6873
     6874//NOTE: sister function in treeview control -> sync changes
     6875
     6876static VOID LISTVIEW_ISearch(HWND hwnd,CHAR ch)
     6877{
     6878  LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(hwnd);
     6879  LPWSTR newString;
     6880  INT len,item,nearest = -1;
     6881  CHAR ch2[2];
     6882  DWORD dwISearchTime;
     6883  BOOL checkNearest = TRUE;
     6884
     6885  //check timer
     6886  dwISearchTime = GetTickCount();
     6887  if ((infoPtr->uISearchLen > 0) && (TICKDIFF(infoPtr->dwISearchTime,dwISearchTime) > LV_ISEARCH_DELAY))
     6888  {
     6889    COMCTL32_Free(infoPtr->pszISearch);
     6890    infoPtr->pszISearch = NULL;
     6891    infoPtr->uISearchLen = 0;
     6892  }
     6893
     6894  //prepare new search string
     6895  len = infoPtr->uISearchLen+1;
     6896  newString = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR));
     6897
     6898  if (infoPtr->uISearchLen > 0) lstrcpyW(newString,infoPtr->pszISearch);
     6899
     6900  ch2[0] = ch;
     6901  ch2[1] = 0;
     6902  lstrcpyAtoW((LPWSTR)&newString[len-1],(LPSTR)&ch2);
     6903  for (INT x = 1;x < len;x++)
     6904  {
     6905    if (newString[0] != newString[x])
     6906    {
     6907      checkNearest = FALSE;
     6908      break;
     6909    }
     6910  }
     6911
     6912  //search
     6913
     6914  //start with selected item or root
     6915  if (infoPtr->nFocusedItem != -1)
     6916  {
     6917    item = infoPtr->nFocusedItem;
     6918
     6919    //check if new string is valid for old selection
     6920    if (LISTVIEW_Compare(hwnd,item,newString,len,NULL))
     6921      goto ISearchDone;
     6922
     6923    //no match, continue with next item
     6924    item++;
     6925  } else item = 0;
     6926
     6927  //scan
     6928  item = LISTVIEW_Search(hwnd,infoPtr,item,newString,len,checkNearest ? &nearest:NULL);
     6929
     6930  if ((item == -1) && (nearest != -1))
     6931  {
     6932    LISTVIEW_SetSelection(hwnd,nearest);
     6933    LISTVIEW_EnsureVisible(hwnd,nearest,FALSE);
     6934    infoPtr->dwISearchTime = GetTickCount();
     6935
     6936    COMCTL32_Free(newString);
     6937    return;
     6938  }
     6939
     6940ISearchDone:
     6941  //done
     6942  if (item != -1)
     6943  {
     6944    COMCTL32_Free(infoPtr->pszISearch);
     6945    infoPtr->pszISearch = newString;
     6946    infoPtr->uISearchLen = len;
     6947    LISTVIEW_SetSelection(hwnd,item);
     6948    LISTVIEW_EnsureVisible(hwnd,item,FALSE);
     6949    infoPtr->dwISearchTime = GetTickCount();
     6950  } else
     6951  {
     6952    COMCTL32_Free(newString);
     6953    MessageBeep(0xFFFFFFFF);
     6954  }
     6955}
     6956
     6957static LRESULT LISTVIEW_Char(HWND hwnd,WPARAM wParam,LPARAM lParam)
     6958{
     6959  CHAR ch = (CHAR)wParam;
     6960
     6961  LISTVIEW_ISearch(hwnd,ch);
     6962
     6963  return 0;
     6964}
    67136965
    67146966/***
     
    69397191  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    69407192
     7193  //destroy tooltip
     7194  destroyToolTip(infoPtr->hwndToolTip);
     7195
    69417196  /* delete all items */
    69427197  LISTVIEW_DeleteAllItems(hwnd);
     
    72027457  if (hFont == 0)
    72037458  {
     7459    if (infoPtr->hFont == infoPtr->hDefaultFont) return 0;
    72047460    infoPtr->hFont = infoPtr->hDefaultFont;
    7205   }
    7206   else
    7207   {
     7461  } else
     7462  {
     7463    if (infoPtr->hFont == hFont) return 0;
    72087464    infoPtr->hFont = hFont;
    72097465  }
     
    72127468  {
    72137469    /* set header font */
    7214     SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont,
    7215                    MAKELPARAM(fRedraw, 0));
    7216   }
     7470    SendMessageA(infoPtr->hwndHeader,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(fRedraw,0));
     7471  }
     7472
     7473  //set tooltip font
     7474  SendMessageA(infoPtr->hwndToolTip,WM_SETFONT,(WPARAM)hFont,fRedraw);
    72177475
    72187476  /* invalidate listview control client area */
     
    77357993static LRESULT LISTVIEW_GetISearchString(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode)
    77367994{
     7995  LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(hwnd);
     7996  LPWSTR lpsz = (LPWSTR)lParam;
     7997
     7998  if (infoPtr->uISearchLen == 0) return 0;
     7999
     8000  if (unicode)
     8001    lstrcpyW(lpsz,infoPtr->pszISearch);
     8002  else
     8003    lstrcpyWtoA((LPSTR)lpsz,infoPtr->pszISearch);
     8004
     8005  return infoPtr->uISearchLen;
     8006}
     8007
     8008static LRESULT LISTVIEW_GetToolTips(HWND hwnd,WPARAM wParam,LPARAM lParam)
     8009{
     8010  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     8011
     8012  return infoPtr->hwndToolTip;
     8013}
     8014
     8015static LRESULT LISTVIEW_SetToolTips(HWND hwnd,WPARAM wParam,LPARAM lParam)
     8016{
     8017  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     8018  HWND oldToolTip = infoPtr->hwndToolTip;
     8019
     8020  infoPtr->hwndToolTip = (HWND)lParam;
     8021
     8022  return oldToolTip;
     8023}
     8024
     8025static LRESULT LISTVIEW_MouseMove(HWND hwnd,WPARAM wParam,LPARAM lParam)
     8026{
    77378027  //CB: todo
    77388028
    7739   return 0;
     8029  return DefWindowProcA(hwnd,WM_MOUSEMOVE,wParam,lParam);
    77408030}
    77418031
     
    77568046      return LISTVIEW_Arrange(hwnd, (INT)wParam);
    77578047
    7758 
    77598048    case LVM_CREATEDRAGIMAGE:
    77608049      return LISTVIEW_CreateDragImage(hwnd,wParam,lParam);
     
    78268115      return LISTVIEW_GetHotItem(hwnd);
    78278116
    7828 /*      case LVM_GETHOVERTIME: */
     8117    case LVM_GETHOVERTIME:
     8118      return LISTVIEW_GetHoverTime(hwnd,wParam,lParam);
    78298119
    78308120    case LVM_GETIMAGELIST:
     
    78678157      return LISTVIEW_GetNextItem(hwnd, (INT)wParam, LOWORD(lParam));
    78688158
    7869 /*      case LVM_GETNUMBEROFWORKAREAS: */
     8159    case LVM_GETNUMBEROFWORKAREAS:
     8160      return LISTVIEW_GetNumberOfWorkAreas(hwnd,wParam,lParam);
    78708161
    78718162    case LVM_GETORIGIN:
     
    78848175      return LISTVIEW_GetStringWidth(hwnd,0,(LPWSTR)lParam,TRUE);
    78858176
    7886 /*      case LVM_GETSUBITEMRECT: */
     8177    case LVM_GETSUBITEMRECT:
     8178      return LISTVIEW_GetSubItemRect(hwnd,(INT)wParam,(LPRECT)lParam);
    78878179
    78888180    case LVM_GETTEXTBKCOLOR:
     
    78928184      return LISTVIEW_GetTextColor(hwnd);
    78938185
    7894 /*      case LVM_GETTOOLTIPS: */
     8186    case LVM_GETTOOLTIPS:
     8187      return LISTVIEW_GetToolTips(hwnd,wParam,lParam);
    78958188
    78968189    case LVM_GETTOPINDEX:
     
    79008193      return LISTVIEW_GetViewRect(hwnd, (LPRECT)lParam);
    79018194
    7902 /*      case LVM_GETWORKAREAS: */
     8195    case LVM_GETWORKAREAS:
     8196      return LISTVIEW_GetWorkAreas(hwnd,wParam,lParam);
    79038197
    79048198    case LVM_HITTEST:
    7905       return LISTVIEW_HitTest(hwnd, (LPLVHITTESTINFO)lParam);
     8199      return LISTVIEW_HitTest(hwnd,(LPLVHITTESTINFO)lParam);
    79068200
    79078201    case LVM_INSERTCOLUMNA:
     
    79568250      return LISTVIEW_SetHotItem(hwnd, (INT)wParam);
    79578251
    7958 /*      case LVM_SETHOVERTIME: */
    7959 /*      case LVM_SETICONSPACING: */
     8252    case LVM_SETHOVERTIME:
     8253      return LISTVIEW_SetHoverTime(hwnd,wParam,lParam);
     8254
     8255    case LVM_SETICONSPACING:
     8256      return LISTVIEW_SetIconSpacing(hwnd,wParam,lParam);
    79608257
    79618258    case LVM_SETIMAGELIST:
     
    79958292      return LISTVIEW_SetTextColor(hwnd, (COLORREF)lParam);
    79968293
    7997 /*      case LVM_SETTOOLTIPS: */
    7998 /*      case LVM_SETWORKAREAS: */
     8294    case LVM_SETTOOLTIPS:
     8295      return LISTVIEW_SetToolTips(hwnd,wParam,lParam);
     8296
     8297    case LVM_SETWORKAREAS:
     8298      return LISTVIEW_SetWorkAreas(hwnd,wParam,lParam);
    79998299
    80008300    case LVM_SORTITEMS:
    80018301      return LISTVIEW_SortItems(hwnd, wParam, lParam);
    80028302
    8003 /*      case LVM_SUBITEMHITTEST: */
     8303    case LVM_SUBITEMHITTEST:
     8304      return LISTVIEW_SubItemHitTest(hwnd,(LPLVHITTESTINFO)lParam);
    80048305
    80058306    case LVM_UPDATE:
     
    80078308
    80088309    case WM_CHAR:
    8009       return LISTVIEW_ProcessLetterKeys( hwnd, wParam, lParam );
     8310      return LISTVIEW_Char(hwnd,wParam,lParam);
    80108311
    80118312    case WM_COMMAND:
     
    80198320
    80208321    case WM_GETDLGCODE:
    8021       return DLGC_WANTCHARS | DLGC_WANTARROWS;
     8322      return DLGC_WANTCHARS | DLGC_WANTTAB | DLGC_WANTARROWS;
    80228323
    80238324    case WM_GETFONT:
     
    80428343      return LISTVIEW_LButtonUp(hwnd,(WORD)wParam,LOWORD(lParam),HIWORD(lParam));
    80438344
    8044 /*      case WM_MOUSEMOVE: */
    8045 /*          return LISTVIEW_MouseMove (hwnd, wParam, lParam); */
     8345    case WM_MOUSEMOVE:
     8346      return LISTVIEW_MouseMove (hwnd,wParam,lParam);
    80468347
    80478348    case WM_NCCREATE:
Note: See TracChangeset for help on using the changeset viewer.