- Timestamp:
- Apr 16, 2000, 8:26:59 PM (25 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/CCBase.cpp
r3369 r3409 1 /* $Id: CCBase.cpp,v 1. 7 2000-04-12 16:38:58cbratschi Exp $ */1 /* $Id: CCBase.cpp,v 1.8 2000-04-16 18:26:55 cbratschi Exp $ */ 2 2 /* 3 3 * COMCTL32 Base Functions and Macros for all Controls … … 346 346 } 347 347 348 //NOTE for lstrcmpni*: both buffers must be at least shortLen+1 characters long! 349 350 INT lstrcmpniA(CHAR *textA,CHAR *textB,INT len) 351 { 352 CHAR tmp1,tmp2; 353 INT res; 354 355 tmp1 = textA[len]; 356 textA[len] = 0; 357 tmp2 = textB[len]; 358 textB[len] = 0; 359 360 res = lstrcmpiA(textA,textB); 361 362 textA[len] = tmp1; 363 textB[len] = tmp2; 364 return res; 365 } 366 367 INT lstrcmpniAtoW(CHAR *textA,WCHAR* textB,INT len) 368 { 369 WCHAR *tmp; 370 INT res; 371 372 tmp = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 373 lstrcpynAtoW(tmp,textA,len+1); 374 375 res = lstrcmpniW(tmp,textB,len); 376 377 COMCTL32_Free(tmp); 378 return res; 379 } 380 381 382 INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len) 383 { 384 WCHAR tmp1,tmp2; 385 INT res; 386 387 tmp1 = textA[len]; 388 textA[len] = 0; 389 tmp2 = textB[len]; 390 textB[len] = 0; 391 392 res = lstrcmpiW(textA,textB); 393 394 textA[len] = tmp1; 395 textB[len] = tmp2; 396 return res; 397 } 398 399 INT lstrcmpniAW(WCHAR *textA,BOOL unicodeA,WCHAR *textB,BOOL unicodeB,INT len) 400 { 401 if (unicodeA) 402 { 403 if (unicodeB) 404 { 405 return lstrcmpniW(textA,textB,len); 406 } else 407 { 408 return lstrcmpniAtoW((LPSTR)textB,textA,len); 409 } 410 } else 411 { 412 if (unicodeB) 413 { 414 return lstrcmpniAtoW((LPSTR)textA,textB,len); 415 } else 416 { 417 return lstrcmpniA((LPSTR)textA,(LPSTR)textB,len); 418 } 419 } 420 } 421 348 422 CHAR* lstrstrA(CHAR *text,CHAR *subtext) 349 423 { -
trunk/src/comctl32/CCBase.h
r3369 r3409 1 /* $Id: CCBase.h,v 1. 8 2000-04-12 16:38:58cbratschi Exp $ */1 /* $Id: CCBase.h,v 1.9 2000-04-16 18:26:56 cbratschi Exp $ */ 2 2 /* 3 3 * COMCTL32 Base Functions and Macros for all Controls … … 46 46 VOID drawStubControl(HWND hwnd,HDC hdc); 47 47 48 #define lstrlenAW(text,unicode) (unicode ? lstrlenW((WCHAR*)text):lstrlenA((CHAR*)text)) 49 50 #define lstrcpyAW(textA,unicodeA,textB,unicodeB) (unicodeA ? (unicodeB ? lstrcpyW((WCHAR*)textA,(WCHAR*)textB):lstrcpyAtoW((WCHAR*)textA,(CHAR*)textB)):(unicodeB ? lstrcpyWtoA((CHAR*)textA,(WCHAR*)textB):lstrcpyA((CHAR*)textA,(CHAR*)textB))) 51 48 52 INT lstrcmpAtoW(CHAR *textA,WCHAR *textW); 49 53 INT lstrcmpAW(WCHAR *textA,BOOL textaunicode,WCHAR *textB,BOOL textbunicode); 54 55 //read note in CCBase.cpp! 56 INT lstrcmpniA(CHAR *textA,CHAR *textB,INT len); 57 INT lstrcmpniAtoW(CHAR *textA,WCHAR* textB,INT len); 58 INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len); 59 INT lstrcmpniAW(WCHAR *textA,BOOL unicodeA,WCHAR *textB,BOOL unicodeB,INT len); 50 60 51 61 CHAR* lstrstrA(CHAR *text,CHAR *subtext); … … 55 65 WCHAR* lstrstrAW(WCHAR *text,BOOL textunicode,WCHAR *subtext,BOOL subtextunicode); 56 66 67 #define TICKDIFF(start,end) ((end > start) ? (end-start):(0xFFFFFFFF-start+end)) 68 57 69 #endif -
trunk/src/comctl32/comctl32.cpp
r2875 r3409 1 /* $Id: comctl32.cpp,v 1. 1 2000-02-23 17:09:40cbratschi Exp $ */1 /* $Id: comctl32.cpp,v 1.2 2000-04-16 18:26:57 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 common controls implementation … … 813 813 * 814 814 * NOTES 815 * Returns version of a comctl32.dll from IE4.01 SP1. 815 * IE4.01 SP1: 816 * 4-72-3110-1 817 * 818 * IE5: 819 * 5-80-2014-1 816 820 */ 817 821 … … 826 830 } 827 831 828 pdvi->dwMajorVersion = 4;829 pdvi->dwMinorVersion = 72;830 pdvi->dwBuildNumber = 3110;832 pdvi->dwMajorVersion = 5; 833 pdvi->dwMinorVersion = 80; 834 pdvi->dwBuildNumber = 2014; 831 835 pdvi->dwPlatformID = 1; 832 836 -
trunk/src/comctl32/comctl32.h
r2820 r3409 1 /* $Id: comctl32.h,v 1.1 2 2000-02-18 17:13:37 cbratschi Exp $ */1 /* $Id: comctl32.h,v 1.13 2000-04-16 18:26:57 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 common controls implementation … … 91 91 #define IDB_HIST_LARGE 131 92 92 93 //direction bitmaps 94 #define IDB_DIRECTION_ALL 132 95 #define IDB_DIRECTION_NS 133 96 #define IDB_DIRECTION WE 134 97 98 //Header filter bitmap 99 #define IDB_HEADER_FILTER 140 100 101 //cursors 102 #define IDC_COMCTL32_ERROR 20480 103 #define IDC_COMCTL32_INFORMATION 20481 104 #define IDC_COMCTL32_EXCLAMATION 20482 105 106 #define IDC_COMCTL32_DRAGRECT 102 107 #define IDC_COMCTL32_ARROW1 104 108 #define IDC_COMCTL32_ARROW2 105 109 #define IDC_COMCTL32_DRAGHLINE 106 110 #define IDC_COMCTL32_SPLITHLINE 107 111 #define IDC_COMCTL32_HAND 108 112 #define IDC_COMCTL32_DIRECTION_NS 109 113 #define IDC_COMCTL32_DIRECTION_WE 110 114 #define IDC_COMCTL32_DIRECTION_ALL 111 115 #define IDC_COMCTL32_DIRECTION_N 112 116 #define IDC_COMCTL32_DIRECTION_S 113 117 #define IDC_COMCTL32_DIRECTION_E 114 118 #define IDC_COMCTL32_DIRECTION_W 115 119 #define IDC_COMCTL32_DIRECTION_NE 116 120 #define IDC_COMCTL32_DIRECTION_NW 117 121 #define IDC_COMCTL32_DIRECTION_SE 118 122 #define IDC_COMCTL32_DIRECTION_SW 119 123 124 #define IDC_COMCTL32_SPLITVLINE 135 125 #define IDC_COMCTL32_ENTER 150 93 126 94 127 /* Month calendar month menu popup */ -
trunk/src/comctl32/header.cpp
r3385 r3409 1 /* $Id: header.cpp,v 1. 6 2000-04-15 14:22:15cbratschi Exp $ */1 /* $Id: header.cpp,v 1.7 2000-04-16 18:26:57 cbratschi Exp $ */ 2 2 /* 3 3 * Header control … … 8 8 * 9 9 * TODO: 10 * - Control specific cursors (over dividers)11 *12 10 * - HDS_FILTERBAR 13 11 * - HEADER_SetHotDivider() … … 596 594 *pFlags |= HHT_ONHEADER; 597 595 *pItem = iCount; 598 // TRACE (header, "ON HEADER %d\n", iCount); 596 599 597 return; 600 598 } … … 609 607 *pFlags |= HHT_ONDIVOPEN; 610 608 *pItem = iCount - 1; 611 // TRACE (header, "ON DIVOPEN %d\n", *pItem); 609 612 610 return; 613 611 } else … … 615 613 *pFlags |= HHT_ONDIVIDER; 616 614 *pItem = iCount - 1; 617 // TRACE (header, "ON DIVIDER %d\n", *pItem); 615 618 616 return; 619 617 } … … 626 624 *pFlags |= HHT_ONDIVIDER; 627 625 *pItem = iCount; 628 // TRACE (header, "ON DIVIDER %d\n", *pItem); 626 629 627 return; 630 628 } … … 632 630 *pFlags |= HHT_ONHEADER; 633 631 *pItem = iCount; 634 // TRACE (header, "ON HEADER %d\n", iCount); 632 635 633 return; 636 634 } … … 648 646 *pFlags |= HHT_ONDIVOPEN; 649 647 *pItem = infoPtr->uNumItem - 1; 650 // TRACE (header, "ON DIVOPEN %d\n", *pItem); 648 651 649 return; 652 650 } else … … 654 652 *pFlags |= HHT_ONDIVIDER; 655 653 *pItem = infoPtr->uNumItem-1; 656 // TRACE (header, "ON DIVIDER %d\n", *pItem); 654 657 655 return; 658 656 } … … 661 659 *pFlags |= HHT_NOWHERE; 662 660 *pItem = 1; 663 // TRACE (header, "NOWHERE\n"); 661 664 662 return; 665 663 } … … 668 666 if (lpPt->x < rect.left) 669 667 { 670 // TRACE (header, "TO LEFT\n");671 668 *pFlags |= HHT_TOLEFT; 672 669 } else if (lpPt->x > rect.right) 673 670 { 674 // TRACE (header, "TO LEFT\n");675 671 *pFlags |= HHT_TORIGHT; 676 672 } … … 678 674 if (lpPt->y < rect.top) 679 675 { 680 // TRACE (header, "ABOVE\n");681 676 *pFlags |= HHT_ABOVE; 682 677 } else if (lpPt->y > rect.bottom) 683 678 { 684 // TRACE (header, "BELOW\n");685 679 *pFlags |= HHT_BELOW; 686 680 } … … 688 682 689 683 *pItem = 1; 690 // TRACE (header, "flags=0x%X\n", *pFlags); 684 691 685 return; 692 686 } … … 973 967 HDC hdc; 974 968 975 // TRACE(header, "[iItem=%d]\n", iItem);976 977 969 if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem)) return FALSE; 978 970 … … 989 981 { 990 982 HEADER_ITEM *oldItems = infoPtr->items; 991 // TRACE(header, "Complex delete! [iItem=%d]\n", iItem);992 983 993 984 if (infoPtr->items[iItem].pszText) COMCTL32_Free(infoPtr->items[iItem].pszText); … … 1408 1399 lpLayout->pwpos->flags = SWP_NOZORDER; 1409 1400 1410 // TRACE (header, "Layout x=%d y=%d cx=%d cy=%d\n",1411 // lpLayout->pwpos->x, lpLayout->pwpos->y,1412 // lpLayout->pwpos->cx, lpLayout->pwpos->cy);1413 1414 1401 return TRUE; 1415 1402 } … … 1539 1526 infoPtr->hFont = 0; 1540 1527 infoPtr->items = 0; 1541 infoPtr->hcurArrow = LoadCursorA (0,IDC_ARROWA);1542 infoPtr->hcurDivider = LoadCursorA (0, IDC_SIZEWEA);1543 infoPtr->hcurDivopen = LoadCursorA (0, IDC_SIZENSA);1528 infoPtr->hcurArrow = LoadCursorA(0,IDC_ARROWA); 1529 infoPtr->hcurDivider = LoadCursorA(COMCTL32_hModule,MAKEINTRESOURCEA(IDC_COMCTL32_DRAGHLINE)); 1530 infoPtr->hcurDivopen = LoadCursorA(COMCTL32_hModule,MAKEINTRESOURCEA(IDC_COMCTL32_SPLITHLINE)); 1544 1531 infoPtr->bCaptured = FALSE; 1545 1532 infoPtr->bPressed = FALSE; … … 1659 1646 ReleaseDC (hwnd, hdc); 1660 1647 1661 // TRACE (header, "Pressed item %d!\n", nItem);1662 1648 } else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) 1663 1649 { … … 1680 1666 } 1681 1667 1682 // TRACE (header, "Begin tracking item %d!\n", nItem);1683 1668 } 1684 1669 } … … 1883 1868 } 1884 1869 } 1885 // TRACE (header, "Moving pressed item %d!\n", infoPtr->iMoveItem);1886 1870 } else if (infoPtr->bTracking) 1887 1871 { … … 2083 2067 INT nItem; 2084 2068 2085 // TRACE (header, "code=0x%X id=0x%X\n", LOWORD(lParam), HIWORD(lParam));2086 2087 2069 GetCursorPos (&pt); 2088 2070 ScreenToClient (hwnd, &pt); … … 2263 2245 2264 2246 default: 2265 //if (msg >= WM_USER)2266 //ERR (header, "unknown msg %04x wp=%04x lp=%08lx\n",2267 //msg, wParam, lParam );2247 //if (msg >= WM_USER) 2248 // ERR (header, "unknown msg %04x wp=%04x lp=%08lx\n", 2249 // msg, wParam, lParam ); 2268 2250 return defComCtl32ProcA (hwnd, msg, wParam, lParam); 2269 2251 } -
trunk/src/comctl32/listview.cpp
r3385 r3409 1 /*$Id: listview.cpp,v 1.1 3 2000-04-15 14:22:19cbratschi Exp $*/1 /*$Id: listview.cpp,v 1.14 2000-04-16 18:26:57 cbratschi Exp $*/ 2 2 /* 3 3 * Listview control … … 15 15 * - rcView and origin (need testcase!!!) 16 16 * - 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 17 22 * - LISTVIEW_SetBkImage 18 23 * - LISTVIEW_GetBkImage … … 21 26 * - LVS_OWNERDRAWFIXED 22 27 * - 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 23 39 * - many things untested! 24 40 * … … 26 42 * LISTVIEW_SetItemCount : not completed 27 43 * 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 33 46 */ 34 47 … … 79 92 #define LISTVIEW_SCROLL_DIV_SIZE 1 80 93 94 #define DEFAULT_HOVERTIME 500 95 #define LV_ISEARCH_DELAY 1000 //documented in ListView_Message_Processing.htm 96 81 97 /* 82 98 * macros … … 85 101 /* retrieve the number of items in the listview */ 86 102 #define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount) 87 88 103 89 104 HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y, … … 92 107 93 108 #define LISTVIEW_GetInfoPtr(hwnd) ((LISTVIEW_INFO*)getInfoPtr(hwnd)) 94 95 INT WINAPI COMCTL32_StrCmpNIA(LPCSTR,LPCSTR,INT);96 97 #define strncasecmp COMCTL32_StrCmpNIA98 109 99 110 /* … … 965 976 { 966 977 LISTVIEW_GetItemPosition(hwnd, i, &ptItem); 978 967 979 if (PtInRect(&rcSelRect, ptItem) != FALSE) 968 980 { … … 1014 1026 POINT ptSelMark; 1015 1027 RECT rcSel; 1028 1016 1029 LISTVIEW_GetItemPosition(hwnd, nItem, &ptItem); 1017 1030 LISTVIEW_GetItemPosition(hwnd, infoPtr->nSelectionMark, &ptSelMark); … … 1076 1089 { 1077 1090 if (nItem > 0) 1078 LISTVIEW_RemoveSelections(hwnd, 0, nItem - 1);1091 LISTVIEW_RemoveSelections(hwnd,0,nItem); 1079 1092 1080 1093 if (nItem < GETITEMCOUNT(infoPtr)) 1081 LISTVIEW_RemoveSelections(hwnd, nItem + 1,GETITEMCOUNT(infoPtr));1094 LISTVIEW_RemoveSelections(hwnd,nItem+1,GETITEMCOUNT(infoPtr)); 1082 1095 } else mask |= LVIS_SELECTED; 1083 1096 1084 LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,mask); 1097 1098 if (infoPtr->nFocusedItem != nItem) LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,mask); 1085 1099 LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED); 1086 1100 … … 1200 1214 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 1201 1215 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++; 1206 1226 } 1207 1227 } … … 1657 1677 /* get information needed for drawing the item */ 1658 1678 ZeroMemory(&lvItem, sizeof(LVITEMW)); 1659 lvItem.header.mask = LVIF_TEXT ;1679 lvItem.header.mask = LVIF_TEXT | LVIF_IMAGE; 1660 1680 lvItem.header.iItem = nItem; 1661 1681 lvItem.header.iSubItem = nSubItem; … … 1664 1684 lvItem.mustFree = FALSE; 1665 1685 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 } 1666 1698 1667 1699 /* set item colors */ … … 1915 1947 1916 1948 /* add 1 for displaying a partial item at the bottom */ 1917 nLast = nItem +LISTVIEW_GetCountPerColumn(hwnd)+1;1918 nLast = min(nLast, 1949 nLast = nItem+LISTVIEW_GetCountPerColumn(hwnd)+1; 1950 nLast = min(nLast,GETITEMCOUNT(infoPtr)); 1919 1951 1920 1952 /* send cache hint notification */ … … 1945 1977 } 1946 1978 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++) 1950 1982 { 1951 1983 rcItem = rcHeader[j]; … … 1966 1998 nDrawPosY += infoPtr->nItemHeight; 1967 1999 } 2000 1968 2001 DR_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 1969 2016 COMCTL32_Free(rcHeader); 1970 2017 } … … 3483 3530 } 3484 3531 3485 /* LISTVIEW_GetHoverTime */ 3532 static 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 3539 static 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 } 3486 3549 3487 3550 /*** … … 3755 3818 } 3756 3819 3757 /* LISTVIEW_GetHoverTime */3758 3759 3820 /*** 3760 3821 * DESCRIPTION: … … 3843 3904 } 3844 3905 3906 static 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 3845 3922 /*** 3846 3923 * DESCRIPTION: … … 3858 3935 static LRESULT LISTVIEW_GetItemRect(HWND hwnd,INT nItem,LPRECT lprc,INT code) 3859 3936 { 3860 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 3937 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 3861 3938 BOOL bResult = FALSE; 3862 3939 POINT ptOrigin; … … 4177 4254 } 4178 4255 4256 static 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 4179 4321 /*** 4180 4322 * DESCRIPTION: … … 4220 4362 LRESULT LISTVIEW_GetItemSpacing(HWND hwnd, BOOL bSmall) 4221 4363 { 4222 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 4364 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 4223 4365 LONG lResult; 4224 4366 … … 4450 4592 } 4451 4593 4452 /* LISTVIEW_GetNumberOfWorkAreas */ 4594 static 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 4606 static 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 4620 static 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 4453 4644 4454 4645 /*** … … 4466 4657 static LRESULT LISTVIEW_GetOrigin(HWND hwnd, LPPOINT lpptOrigin) 4467 4658 { 4468 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 4659 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 4469 4660 4470 4661 if ((infoPtr->uView == LVS_SMALLICON) || (infoPtr->uView == LVS_ICON)) … … 4516 4707 static LRESULT LISTVIEW_GetSelectionMark(HWND hwnd) 4517 4708 { 4518 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 4709 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 4519 4710 4520 4711 return infoPtr->nSelectionMark; … … 4597 4788 } 4598 4789 4599 static BOOL LISTVIEW_InternalHitTestItem(HWND hwnd,LISTVIEW_INFO *infoPtr,INT nItem,LPLVHITTESTINFO lpHitTestInfo )4790 static BOOL LISTVIEW_InternalHitTestItem(HWND hwnd,LISTVIEW_INFO *infoPtr,INT nItem,LPLVHITTESTINFO lpHitTestInfo,BOOL checkSubItems) 4600 4791 { 4601 4792 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 } 4602 4834 4603 4835 if (LISTVIEW_GetItemRect(hwnd,nItem,&rcItem,LVIR_BOUNDS)) … … 4657 4889 if (nItem >= GETITEMCOUNT(infoPtr)) return -1; 4658 4890 4659 if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo ))4891 if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,FALSE)) 4660 4892 return nItem; 4661 4893 } else if (infoPtr->uView == LVS_LIST) … … 4668 4900 if (nItem >= GETITEMCOUNT(infoPtr)) return -1; 4669 4901 4670 if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo ))4902 if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,FALSE)) 4671 4903 return nItem; 4672 4904 } else … … 4676 4908 for (i = 0; i < GETITEMCOUNT(infoPtr); i++) 4677 4909 { 4678 if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,i,lpHitTestInfo ))4910 if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,i,lpHitTestInfo,FALSE)) 4679 4911 return i; 4680 4912 } … … 4700 4932 static LRESULT LISTVIEW_HitTest(HWND hwnd, LPLVHITTESTINFO lpHitTestInfo) 4701 4933 { 4702 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 4934 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 4703 4935 INT nItem = -1; 4704 4936 … … 4708 4940 { 4709 4941 lpHitTestInfo->flags = LVHT_TOLEFT; 4710 } 4711 else if (infoPtr->rcList.right < lpHitTestInfo->pt.x) 4942 } else if (infoPtr->rcList.right < lpHitTestInfo->pt.x) 4712 4943 { 4713 4944 lpHitTestInfo->flags = LVHT_TORIGHT; … … 4716 4947 { 4717 4948 lpHitTestInfo->flags |= LVHT_ABOVE; 4718 } 4719 else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y) 4949 } else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y) 4720 4950 { 4721 4951 lpHitTestInfo->flags |= LVHT_BELOW; … … 4729 4959 return nItem; 4730 4960 } 4961 4962 static 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 4731 5000 4732 5001 /*** … … 5418 5687 /* store previous style */ 5419 5688 dwOldStyle = infoPtr->dwExStyle; 5689 5420 5690 /* set new style */ 5421 5691 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; 5423 5717 } 5424 5718 … … 5481 5775 } 5482 5776 5483 /* LISTVIEW_SetIconSpacing */ 5777 static 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 } 5484 5797 5485 5798 /*** … … 5498 5811 static LRESULT LISTVIEW_SetImageList(HWND hwnd, INT nType, HIMAGELIST himl) 5499 5812 { 5500 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 5813 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 5501 5814 HIMAGELIST himlTemp = 0; 5502 5815 … … 5877 6190 5878 6191 infoPtr->nSelectionMark = nIndex; 6192 5879 6193 return nOldIndex; 5880 6194 } … … 5932 6246 /* LISTVIEW_SetToolTips */ 5933 6247 /* LISTVIEW_SetUnicodeFormat */ 5934 /* LISTVIEW_SetWorkAreas */5935 6248 5936 6249 /*** … … 6085 6398 infoPtr->pedititem = NULL; 6086 6399 infoPtr->bDoEditLabel = FALSE; 6400 infoPtr->hoverTime = DEFAULT_HOVERTIME; 6087 6401 6088 6402 /* get default font (icon title) */ … … 6099 6413 6100 6414 /* 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); 6103 6416 6104 6417 if (uView == LVS_ICON) … … 6106 6419 infoPtr->iconSize.cx = GetSystemMetrics(SM_CXICON); 6107 6420 infoPtr->iconSize.cy = GetSystemMetrics(SM_CYICON); 6108 } 6109 else if (uView == LVS_REPORT) 6421 } else if (uView == LVS_REPORT) 6110 6422 { 6111 6423 if (!(LVS_NOCOLUMNHEADER & lpcs->style)) … … 6116 6428 infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON); 6117 6429 infoPtr->iconSize.cy = GetSystemMetrics(SM_CYSMICON); 6118 } 6119 else 6430 } else 6120 6431 { 6121 6432 infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON); … … 6130 6441 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 6131 6442 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 6132 6448 6133 6449 return 0; … … 6479 6795 } 6480 6796 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 } 6797 static 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); 6699 6823 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 6831 static 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 6876 static 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 6940 ISearchDone: 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 6957 static 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 } 6713 6965 6714 6966 /*** … … 6939 7191 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 6940 7192 7193 //destroy tooltip 7194 destroyToolTip(infoPtr->hwndToolTip); 7195 6941 7196 /* delete all items */ 6942 7197 LISTVIEW_DeleteAllItems(hwnd); … … 7202 7457 if (hFont == 0) 7203 7458 { 7459 if (infoPtr->hFont == infoPtr->hDefaultFont) return 0; 7204 7460 infoPtr->hFont = infoPtr->hDefaultFont; 7205 } 7206 else7207 {7461 } else 7462 { 7463 if (infoPtr->hFont == hFont) return 0; 7208 7464 infoPtr->hFont = hFont; 7209 7465 } … … 7212 7468 { 7213 7469 /* 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); 7217 7475 7218 7476 /* invalidate listview control client area */ … … 7735 7993 static LRESULT LISTVIEW_GetISearchString(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode) 7736 7994 { 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 8008 static 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 8015 static 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 8025 static LRESULT LISTVIEW_MouseMove(HWND hwnd,WPARAM wParam,LPARAM lParam) 8026 { 7737 8027 //CB: todo 7738 8028 7739 return 0;8029 return DefWindowProcA(hwnd,WM_MOUSEMOVE,wParam,lParam); 7740 8030 } 7741 8031 … … 7756 8046 return LISTVIEW_Arrange(hwnd, (INT)wParam); 7757 8047 7758 7759 8048 case LVM_CREATEDRAGIMAGE: 7760 8049 return LISTVIEW_CreateDragImage(hwnd,wParam,lParam); … … 7826 8115 return LISTVIEW_GetHotItem(hwnd); 7827 8116 7828 /* case LVM_GETHOVERTIME: */ 8117 case LVM_GETHOVERTIME: 8118 return LISTVIEW_GetHoverTime(hwnd,wParam,lParam); 7829 8119 7830 8120 case LVM_GETIMAGELIST: … … 7867 8157 return LISTVIEW_GetNextItem(hwnd, (INT)wParam, LOWORD(lParam)); 7868 8158 7869 /* case LVM_GETNUMBEROFWORKAREAS: */ 8159 case LVM_GETNUMBEROFWORKAREAS: 8160 return LISTVIEW_GetNumberOfWorkAreas(hwnd,wParam,lParam); 7870 8161 7871 8162 case LVM_GETORIGIN: … … 7884 8175 return LISTVIEW_GetStringWidth(hwnd,0,(LPWSTR)lParam,TRUE); 7885 8176 7886 /* case LVM_GETSUBITEMRECT: */ 8177 case LVM_GETSUBITEMRECT: 8178 return LISTVIEW_GetSubItemRect(hwnd,(INT)wParam,(LPRECT)lParam); 7887 8179 7888 8180 case LVM_GETTEXTBKCOLOR: … … 7892 8184 return LISTVIEW_GetTextColor(hwnd); 7893 8185 7894 /* case LVM_GETTOOLTIPS: */ 8186 case LVM_GETTOOLTIPS: 8187 return LISTVIEW_GetToolTips(hwnd,wParam,lParam); 7895 8188 7896 8189 case LVM_GETTOPINDEX: … … 7900 8193 return LISTVIEW_GetViewRect(hwnd, (LPRECT)lParam); 7901 8194 7902 /* case LVM_GETWORKAREAS: */ 8195 case LVM_GETWORKAREAS: 8196 return LISTVIEW_GetWorkAreas(hwnd,wParam,lParam); 7903 8197 7904 8198 case LVM_HITTEST: 7905 return LISTVIEW_HitTest(hwnd, 8199 return LISTVIEW_HitTest(hwnd,(LPLVHITTESTINFO)lParam); 7906 8200 7907 8201 case LVM_INSERTCOLUMNA: … … 7956 8250 return LISTVIEW_SetHotItem(hwnd, (INT)wParam); 7957 8251 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); 7960 8257 7961 8258 case LVM_SETIMAGELIST: … … 7995 8292 return LISTVIEW_SetTextColor(hwnd, (COLORREF)lParam); 7996 8293 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); 7999 8299 8000 8300 case LVM_SORTITEMS: 8001 8301 return LISTVIEW_SortItems(hwnd, wParam, lParam); 8002 8302 8003 /* case LVM_SUBITEMHITTEST: */ 8303 case LVM_SUBITEMHITTEST: 8304 return LISTVIEW_SubItemHitTest(hwnd,(LPLVHITTESTINFO)lParam); 8004 8305 8005 8306 case LVM_UPDATE: … … 8007 8308 8008 8309 case WM_CHAR: 8009 return LISTVIEW_ ProcessLetterKeys( hwnd, wParam, lParam);8310 return LISTVIEW_Char(hwnd,wParam,lParam); 8010 8311 8011 8312 case WM_COMMAND: … … 8019 8320 8020 8321 case WM_GETDLGCODE: 8021 return DLGC_WANTCHARS | DLGC_WANT ARROWS;8322 return DLGC_WANTCHARS | DLGC_WANTTAB | DLGC_WANTARROWS; 8022 8323 8023 8324 case WM_GETFONT: … … 8042 8343 return LISTVIEW_LButtonUp(hwnd,(WORD)wParam,LOWORD(lParam),HIWORD(lParam)); 8043 8344 8044 /* case WM_MOUSEMOVE: */ 8045 /* return LISTVIEW_MouseMove (hwnd, wParam, lParam); */ 8345 case WM_MOUSEMOVE: 8346 return LISTVIEW_MouseMove (hwnd,wParam,lParam); 8046 8347 8047 8348 case WM_NCCREATE: -
trunk/src/comctl32/rsrc.orc
r3182 r3409 1 /* $Id: rsrc.orc,v 1. 3 2000-03-21 17:30:44cbratschi Exp $ */1 /* $Id: rsrc.orc,v 1.4 2000-04-16 18:26:59 cbratschi Exp $ */ 2 2 #include "winuser.h" 3 3 #include "comctl32.h" … … 104 104 } 105 105 106 /* 120 */ 106 107 IDB_STD_SMALL BITMAP LOADONCALL DISCARDABLE 107 108 { … … 222 223 } 223 224 225 /* 121 */ 224 226 IDB_STD_LARGE BITMAP LOADONCALL DISCARDABLE 225 227 { … … 400 402 } 401 403 402 /* BINRES idb_view_small.bmp*/404 /* 124 */ 403 405 IDB_VIEW_SMALL BITMAP LOADONCALL DISCARDABLE 404 406 { … … 665 667 } 666 668 669 /* 125 */ 667 670 IDB_VIEW_LARGE BITMAP LOADONCALL MOVEABLE DISCARDABLE 668 671 { … … 811 814 } 812 815 816 /* 130 */ 813 817 IDB_HIST_SMALL BITMAP LOADONCALL DISCARDABLE 814 818 { … … 854 858 } 855 859 860 /* 131 */ 856 861 IDB_HIST_LARGE BITMAP LOADONCALL DISCARDABLE 857 862 { … … 928 933 } 929 934 935 /* 132 */ 936 IDB_DIRECTION_ALL BITMAP LOADONCALL DISCARDABLE 937 { 938 '42 4D BC 00 00 00 00 00 00 00 3E 00 00 00 28 00' 939 '00 00 1C 00 00 00 1C 00 00 00 01 00 01 00 00 00' 940 '00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00' 941 '00 00 00 00 00 00 FF FF FF 00 80 80 80 00 00 00' 942 '00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 0F' 943 '00 00 00 1F 80 00 00 3F C0 00 00 7F E0 00 00 00' 944 '00 00 01 00 08 00 03 00 0C 00 07 00 0E 00 0F 06' 945 '0F 00 1F 0F 0F 80 1F 0F 0F 80 0F 06 0F 00 07 00' 946 '0E 00 03 00 0C 00 01 00 08 00 00 00 00 00 00 7F' 947 'E0 00 00 3F C0 00 00 1F 80 00 00 0F 00 00 00 06' 948 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 949 '00 00 00 00 00 00 00 00 00 00 00 00' 950 } 951 952 /* 133 */ 953 IDB_DIRECTION_NS BITMAP LOADONCALL DISCARDABLE 954 { 955 '42 4D BC 00 00 00 00 00 00 00 3E 00 00 00 28 00' 956 '00 00 1C 00 00 00 1C 00 00 00 01 00 01 00 00 00' 957 '00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00' 958 '00 00 00 00 00 00 FF FF FF 00 80 80 80 00 00 00' 959 '00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 0F' 960 '00 00 00 1F 80 00 00 3F C0 00 00 7F E0 00 00 FF' 961 'F0 00 01 FF F8 00 00 00 00 00 00 00 00 00 00 06' 962 '00 00 00 0F 00 00 00 0F 00 00 00 06 00 00 00 00' 963 '00 00 00 00 00 00 01 FF F8 00 00 FF F0 00 00 7F' 964 'E0 00 00 3F C0 00 00 1F 80 00 00 0F 00 00 00 06' 965 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 966 '00 00 00 00 00 00 00 00 00 00 00 00' 967 } 968 969 /* 134 */ 970 IDB_DIRECTION_WE BITMAP LOADONCALL DISCARDABLE 971 { 972 '42 4D BC 00 00 00 00 00 00 00 3E 00 00 00 28 00' 973 '00 00 1C 00 00 00 1C 00 00 00 01 00 01 00 00 00' 974 '00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00' 975 '00 00 00 00 00 00 FF FF FF 00 80 80 80 00 00 00' 976 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 977 '00 00 00 00 00 00 00 00 00 00 00 40 20 00 00 C0' 978 '30 00 01 C0 38 00 03 C0 3C 00 07 C0 3E 00 0F C6' 979 '3F 00 1F CF 3F 80 1F CF 3F 80 0F C6 3F 00 07 C0' 980 '3E 00 03 C0 3C 00 01 C0 38 00 00 C0 30 00 00 40' 981 '20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 982 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 983 '00 00 00 00 00 00 00 00 00 00 00 00' 984 } 985 986 /* 140 */ 987 IDB_HEADER_FILTER BITMAP LOADONCALL DISCARDABLE 988 { 989 '42 4D D6 00 00 00 00 00 00 00 76 00 00 00 28 00' 990 '00 00 0D 00 00 00 0C 00 00 00 01 00 04 00 00 00' 991 '00 00 60 00 00 00 00 00 00 00 00 00 00 00 10 00' 992 '00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 80' 993 '00 00 80 80 00 00 00 00 80 00 80 00 80 00 00 80' 994 '80 00 C0 C0 C0 00 80 80 80 00 FF 00 00 00 00 FF' 995 '00 00 FF FF 00 00 00 00 FF 00 FF 00 FF 00 00 FF' 996 'FF 00 FF FF FF 00 44 44 44 44 44 44 40 00 44 44' 997 '40 00 44 44 40 00 44 44 48 70 44 44 40 00 44 44' 998 '48 70 44 44 40 00 44 44 48 70 44 44 40 00 44 44' 999 '48 70 44 44 40 00 44 44 8F 78 04 44 40 00 44 48' 1000 'F7 77 80 44 40 00 44 8F 77 77 78 04 40 00 48 FF' 1001 'FF FF FF 80 40 00 48 88 88 88 88 80 40 00 44 44' 1002 '44 44 44 44 40 00' 1003 } 1004 1005 /* 1006 #define IDC_COMCTL32_ERROR 20480 1007 #define IDC_COMCTL32_INFORMATION 20481 1008 #define IDC_COMCTL32_EXCLAMATION 20482 1009 */ 1010 1011 /* 102 */ 1012 IDC_COMCTL32_DRAGRECT CURSOR LOADONCALL DISCARDABLE 1013 { 1014 '00 00 02 00 01 00 20 20 02 00 10 00 10 00 30 01' 1015 '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00' 1016 '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00' 1017 '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00' 1018 '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00' 1019 'F8 00 0A AA FA A0 15 54 F9 40 08 01 F8 20 10 03' 1020 'F8 40 08 07 FC 20 10 07 FC 40 08 05 FC 20 10 05' 1021 'F4 40 08 05 54 20 10 01 54 40 08 01 50 20 10 01' 1022 '50 40 08 01 50 20 10 00 40 40 08 00 00 20 10 00' 1023 '00 40 08 00 00 20 10 00 00 40 08 00 00 20 10 00' 1024 '00 40 0A AA AA A0 15 55 55 40 00 00 00 00 00 00' 1025 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 1026 '00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF' 1027 '07 FF F5 55 05 5F EA AB 06 BF F7 FE 07 DF EF FC' 1028 '07 BF F7 F8 03 DF EF F8 03 BF F7 FA 03 DF EF FA' 1029 '0B BF F7 FA AB DF EF FE AB BF F7 FE AF DF EF FE' 1030 'AF BF F7 FE AF DF EF FF BF BF F7 FF FF DF EF FF' 1031 'FF BF F7 FF FF DF EF FF FF BF F7 FF FF DF EF FF' 1032 'FF BF F5 55 55 5F EA AA AA BF FF FF FF FF FF FF' 1033 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF' 1034 'FF FF FF FF FF FF' 1035 } 1036 1037 /* 104 */ 1038 IDC_COMCTL32_ARROW1 CURSOR LOADONCALL DISCARDABLE 1039 { 1040 '00 00 02 00 01 00 20 20 02 00 00 00 00 00 30 01' 1041 '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00' 1042 '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00' 1043 '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00' 1044 '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00' 1045 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 1046 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 1047 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 80' 1048 '00 00 01 80 00 00 03 00 00 00 03 00 00 00 06 00' 1049 '00 00 46 00 00 00 6C 00 00 00 7C 00 00 00 7F 80' 1050 '00 00 7F 00 00 00 7E 00 00 00 7C 00 00 00 78 00' 1051 '00 00 70 00 00 00 60 00 00 00 40 00 00 00 00 00' 1052 '00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF' 1053 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF' 1054 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF' 1055 'FF FF FF FF FF FF FF FF FF FF FE 7F FF FF FC 3F' 1056 'FF FF FC 3F FF FF F8 7F FF FF 78 7F FF FF 30 FF' 1057 'FF FF 10 FF FF FF 01 FF FF FF 00 3F FF FF 00 3F' 1058 'FF FF 00 7F FF FF 00 FF FF FF 01 FF FF FF 03 FF' 1059 'FF FF 07 FF FF FF 0F FF FF FF 1F FF FF FF 3F FF' 1060 'FF FF 7F FF FF FF' 1061 } 1062 1063 /* 105 */ 1064 IDC_COMCTL32_ARROW2 CURSOR LOADONCALL DISCARDABLE 1065 { 1066 '00 00 02 00 01 00 20 20 02 00 00 00 00 00 30 01' 1067 '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00' 1068 '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00' 1069 '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00' 1070 '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00' 1071 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 1072 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 1073 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 80' 1074 '00 00 01 80 00 00 03 00 00 00 03 00 00 00 06 00' 1075 '00 00 46 00 00 00 64 00 00 00 7C 00 00 00 7F 80' 1076 '00 00 7F 00 00 00 7E 00 00 00 7C 00 00 00 78 00' 1077 '00 00 70 00 00 00 60 00 00 00 40 00 00 00 00 00' 1078 '00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF' 1079 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF' 1080 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF' 1081 'FF FF FF FF FF FF FF FF FF FF FE 7F FF FF FC 3F' 1082 'FF FF FC 3F FF FF F8 7F FF FF F8 7F FF FF 30 FF' 1083 'FF FF 10 FF FF FF 01 FF FF FF 00 3F FF FF 00 3F' 1084 'FF FF 00 7F FF FF 00 FF FF FF 01 FF FF FF 03 FF' 1085 'FF FF 07 FF FF FF 0F FF FF FF 1F FF FF FF 3F FF' 1086 'FF FF 7F FF FF FF' 1087 } 1088 1089 /* 106 */ 1090 IDC_COMCTL32_DRAGHLINE CURSOR LOADONCALL DISCARDABLE 1091 { 1092 '00 00 02 00 01 00 20 20 02 00 08 00 08 00 30 01' 1093 '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00' 1094 '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00' 1095 '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00' 1096 '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00' 1097 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 1098 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 1099 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 E0' 1100 '00 00 01 20 00 00 01 20 00 00 01 20 00 00 01 20' 1101 '00 00 19 26 00 00 29 25 00 00 4F 3C 80 00 80 00' 1102 '40 00 80 00 40 00 4F 3C 80 00 29 25 00 00 19 26' 1103 '00 00 01 20 00 00 01 20 00 00 01 20 00 00 01 20' 1104 '00 00 01 E0 00 00 FF FF FF FF FF FF FF FF FF FF' 1105 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF' 1106 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF' 1107 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FE 1F' 1108 'FF FF FE 1F FF FF FE 1F FF FF FE 1F FF FF FE 1F' 1109 'FF FF E6 19 FF FF C6 18 FF FF 80 00 7F FF 00 00' 1110 '3F FF 00 00 3F FF 80 00 7F FF C6 18 FF FF E6 19' 1111 'FF FF FE 1F FF FF FE 1F FF FF FE 1F FF FF FE 1F' 1112 'FF FF FE 1F FF FF' 1113 } 1114 1115 /* 107 */ 1116 IDC_COMCTL32_SPLITHLINE CURSOR LOADONCALL DISCARDABLE 1117 { 1118 '00 00 02 00 01 00 20 20 02 00 08 00 08 00 30 01' 1119 '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00' 1120 '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00' 1121 '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00' 1122 '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00' 1123 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 1124 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' 1125 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 F0' 1126 '00 00 02 D0 00 00 02 D0 00 00 02 D0 00 00 02 D0' 1127 '00 00 1A D6 00 00 2A D5 00 00 4E DC 80 00 80 C0' 1128 '40 00 80 C0 40 00 4E DC 80 00 2A D5 00 00 1A D6' 1129 '00 00 02 D0 00 00 02 D0 00 00 02 D0 00 00 02 D0' 1130 '00 00 03 F0 00 00 FF FF FF FF FF FF FF FF FF FF' 1131 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF' 1132 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF' 1133 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FC 0F' 1134 'FF FF FC 0F FF FF FC 0F FF FF FC 0F FF FF FC 0F' 1135 'FF FF E4 09 FF FF C4 08 FF FF 80 00 7F FF 00 00' 1136 '3F FF 00 00 3F FF 80 00 7F FF C4 08 FF FF E4 09' 1137 'FF FF FC 0F FF FF FC 0F FF FF FC 0F FF FF FC 0F' 1138 'FF FF FC 0F FF FF' 1139 } 1140 1141 /* 1142 #define IDC_COMCTL32_HAND 108 1143 #define IDC_COMCTL32_DIRECTION_NS 109 1144 #define IDC_COMCTL32_DIRECTION_WE 110 1145 #define IDC_COMCTL32_DIRECTION_ALL 111 1146 #define IDC_COMCTL32_DIRECTION_N 112 1147 #define IDC_COMCTL32_DIRECTION_S 113 1148 #define IDC_COMCTL32_DIRECTION_E 114 1149 #define IDC_COMCTL32_DIRECTION_W 115 1150 #define IDC_COMCTL32_DIRECTION_NE 116 1151 #define IDC_COMCTL32_DIRECTION_NW 117 1152 #define IDC_COMCTL32_DIRECTION_SE 118 1153 #define IDC_COMCTL32_DIRECTION_SW 119 1154 1155 #define IDC_COMCTL32_SPLITVLINE 135 1156 #define IDC_COMCTL32_ENTER 150 1157 */ 1158 930 1159 ///////////////////////////////////////////////////////////////////////////// 931 1160 // 932 // Version (based on NT 4 SP3 user32.dll) 1161 // Version of the week 1162 // 1163 // based on NT 4 SP3 user32.dll: 1164 // ProductVersion: 4.72.3110.1 1165 // FileVersion: 4.72 1166 // 1167 // Windows 2000 (or IE 5 on any system): 1168 // ProductVersion: 5.00.2014.216 1169 // FileVersion: 5.80 933 1170 // 934 1171 … … 948 1185 VALUE "Comments", "Odin32 System Dll\0" 949 1186 VALUE "CompanyName", "Odin Team\0" 950 VALUE "FileDescription", "C OMCTL32 System Dll\0"951 VALUE "FileVersion", " 4.72.3110.1\0"1187 VALUE "FileDescription", "Common Controls Library\0" 1188 VALUE "FileVersion", "5.80\0" 952 1189 VALUE "InternalName", "COMCTL32\0" 953 1190 VALUE "LegalCopyright", "Copyright (C) 1999-2000\0" … … 955 1192 VALUE "OriginalFilename", "COMCTL32.DLL\0" 956 1193 VALUE "ProductName", "Odin32 - COMCTL32\0" 957 VALUE "ProductVersion", " 4.72.3110.1\0"1194 VALUE "ProductVersion", "5.00.2014.216\0" 958 1195 END 959 1196 END -
trunk/src/comctl32/treeview.cpp
r3385 r3409 1 /* $Id: treeview.cpp,v 1. 9 2000-04-15 14:22:31cbratschi Exp $ */1 /* $Id: treeview.cpp,v 1.10 2000-04-16 18:26:59 cbratschi Exp $ */ 2 2 /* Treeview control 3 3 * … … 1702 1702 return 0; 1703 1703 1704 case TV_ISEARCH_TIMER:1705 KillTimer(hwnd,TV_ISEARCH_TIMER);1706 infoPtr->Timer &= ~TV_ISEARCH_TIMER_SET;1707 return 0;1708 1709 1704 case TV_INFOTIP_TIMER: 1710 1705 TREEVIEW_CheckInfoTip(hwnd); … … 2760 2755 infoPtr = (TREEVIEW_INFO*)initControl(hwnd,sizeof(TREEVIEW_INFO)); 2761 2756 2762 if ( infoPtr == NULL) return 0;2757 if (!infoPtr) return 0; 2763 2758 2764 2759 hdc = GetDC(hwnd); … … 4385 4380 TREEVIEW_SelectItem (HWND hwnd, WPARAM wParam, LPARAM lParam) 4386 4381 { 4387 return TREEVIEW_DoSelectItem (hwnd, wParam, (HTREEITEM) lParam,TVC_UNKNOWN);4382 return TREEVIEW_DoSelectItem(hwnd,wParam,(HTREEITEM)lParam,TVC_UNKNOWN); 4388 4383 } 4389 4384 … … 4842 4837 } 4843 4838 4844 static BOOL TREEVIEW_Compare(HWND hwnd,TREEVIEW_ITEM *item,LPWSTR text,INT textlen )4839 static BOOL TREEVIEW_Compare(HWND hwnd,TREEVIEW_ITEM *item,LPWSTR text,INT textlen,BOOL *matchLast) 4845 4840 { 4846 4841 WCHAR* itemtext; 4847 4842 BOOL mustFree = FALSE,res; 4843 INT itemlen; 4848 4844 4849 4845 if (item->pszText == LPSTR_TEXTCALLBACKW) … … 4852 4848 itemtext = item->pszText; 4853 4849 4854 //simulate lstrcmpniW 4855 res = (CompareStringW(LOCALE_SYSTEM_DEFAULT,NORM_IGNORECASE,itemtext,MIN(lstrlenW(itemtext),textlen),text,textlen) == 2); 4850 itemlen = lstrlenW(itemtext); 4851 if (itemlen < textlen) 4852 { 4853 res = FALSE; 4854 } else 4855 { 4856 res = (lstrcmpniW(itemtext,text,textlen) == 0); 4857 } 4858 if (!res && matchLast) 4859 { 4860 textlen--; 4861 if ((textlen > 0) && (itemlen >= textlen)) 4862 *matchLast = (lstrcmpniW(itemtext,text,textlen) == 0); 4863 else 4864 *matchLast = FALSE; 4865 } 4856 4866 if (mustFree) COMCTL32_Free(itemtext); 4857 4867 … … 4859 4869 } 4860 4870 4861 static TREEVIEW_ITEM* TREEVIEW_Search(HWND hwnd,TREEVIEW_INFO *infoPtr,INT iItem,LPWSTR text,INT textlen )4871 static TREEVIEW_ITEM* TREEVIEW_Search(HWND hwnd,TREEVIEW_INFO *infoPtr,INT iItem,LPWSTR text,INT textlen,TREEVIEW_ITEM **nearest) 4862 4872 { 4863 4873 TREEVIEW_ITEM *item,*start; 4864 BOOL found = FALSE;4874 BOOL bMatchLast; 4865 4875 4866 4876 item = start = &infoPtr->items[iItem]; 4877 if (nearest) *nearest = NULL; 4867 4878 4868 4879 //search start to end 4869 4880 while (item) 4870 4881 { 4871 if (TREEVIEW_Compare(hwnd,item,text,textlen)) return item; 4882 if (nearest) 4883 { 4884 if (TREEVIEW_Compare(hwnd,item,text,textlen,(!*nearest) ? &bMatchLast:NULL)) 4885 return item; 4886 else if (!*nearest && bMatchLast) 4887 *nearest = item; 4888 } else 4889 { 4890 if (TREEVIEW_Compare(hwnd,item,text,textlen,NULL)) 4891 return item; 4892 } 4872 4893 item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item); 4873 4894 } 4874 if (!found) 4875 { 4876 iItem = (INT)infoPtr->TopRootItem; 4877 item = &infoPtr->items[iItem]; 4878 4879 //search first to start 4880 while (item != start) 4881 { 4882 if (TREEVIEW_Compare(hwnd,item,text,textlen)) return item; 4883 item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item); 4895 4896 iItem = (INT)infoPtr->TopRootItem; 4897 item = &infoPtr->items[iItem]; 4898 4899 //search first to start 4900 while (item != start) 4901 { 4902 if (nearest) 4903 { 4904 if (TREEVIEW_Compare(hwnd,item,text,textlen,(!*nearest) ? &bMatchLast:NULL)) 4905 return item; 4906 else if (!*nearest && bMatchLast) 4907 *nearest = item; 4908 } else 4909 { 4910 if (TREEVIEW_Compare(hwnd,item,text,textlen,NULL)) 4911 return item; 4884 4912 } 4913 item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item); 4885 4914 } 4886 4915 … … 4888 4917 } 4889 4918 4890 // CB: this method is CPU intense: optimize it and use a secondary thread4919 //NOTE: sister function in listview control -> sync changes 4891 4920 4892 4921 static VOID TREEVIEW_ISearch(HWND hwnd,CHAR ch) … … 4896 4925 INT len,iItem; 4897 4926 CHAR ch2[2]; 4898 TREEVIEW_ITEM *item; 4927 TREEVIEW_ITEM *item,*nearest = NULL; 4928 DWORD dwISearchTime; 4929 BOOL checkNearest = TRUE; 4899 4930 4900 4931 //check timer 4901 if (infoPtr->Timer & TV_ISEARCH_TIMER_SET) 4902 { 4903 KillTimer(hwnd,TV_ISEARCH_TIMER); 4904 infoPtr->Timer &= ~TV_ISEARCH_TIMER_SET; 4905 } else if (infoPtr->uISearchLen > 0) 4932 dwISearchTime = GetTickCount(); 4933 if ((infoPtr->uISearchLen > 0) && (TICKDIFF(infoPtr->dwISearchTime,dwISearchTime) > TV_ISEARCH_DELAY)) 4906 4934 { 4907 4935 COMCTL32_Free(infoPtr->pszISearch); … … 4919 4947 ch2[1] = 0; 4920 4948 lstrcpyAtoW((LPWSTR)&newString[len-1],(LPSTR)&ch2); 4949 for (INT x = 1;x < len;x++) 4950 { 4951 if (newString[0] != newString[x]) 4952 { 4953 checkNearest = FALSE; 4954 break; 4955 } 4956 } 4921 4957 4922 4958 //search 4923 4959 4924 iItem = infoPtr->selectedItem ? (INT)infoPtr->selectedItem:(INT)infoPtr->TopRootItem; 4925 4960 //start with selected item or root 4926 4961 if (infoPtr->selectedItem) 4927 4962 { 4963 iItem = (INT)infoPtr->selectedItem; 4928 4964 item = &infoPtr->items[iItem]; 4965 4966 //check if new string is valid for old selection 4967 if (TREEVIEW_Compare(hwnd,item,newString,len,NULL)) 4968 goto ISearchDone; 4969 4970 //no match, continue with next item 4929 4971 item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item); 4930 4972 if (!item) item = &infoPtr->items[(INT)infoPtr->TopRootItem]; … … 4932 4974 } else iItem = (INT)infoPtr->TopRootItem; 4933 4975 4934 item = TREEVIEW_Search(hwnd,infoPtr,iItem,newString,len); 4935 if (!item && infoPtr->selectedItem && infoPtr->pszISearch) 4936 { 4937 TREEVIEW_ITEM *next; 4938 4939 item = &infoPtr->items[iItem]; 4940 next = TREEVIEW_Search(hwnd,infoPtr,(INT)item->hItem,infoPtr->pszISearch,infoPtr->uISearchLen); 4941 if (next) 4942 { 4943 TREEVIEW_SelectItem(hwnd,(WPARAM)TVGN_CARET,(LPARAM)next->hItem); 4944 TREEVIEW_EnsureVisible(hwnd,next->hItem); 4945 } 4976 //scan 4977 item = TREEVIEW_Search(hwnd,infoPtr,iItem,newString,len,checkNearest ? &nearest:NULL); 4978 4979 if (!item && nearest) 4980 { 4981 TREEVIEW_SelectItem(hwnd,(WPARAM)TVGN_CARET,(LPARAM)nearest->hItem); 4982 TREEVIEW_EnsureVisible(hwnd,nearest->hItem); 4983 infoPtr->dwISearchTime = GetTickCount(); 4984 4946 4985 COMCTL32_Free(newString); 4947 4986 return; 4948 4987 } 4949 4988 4989 ISearchDone: 4950 4990 //done 4951 4991 if (item) … … 4956 4996 TREEVIEW_SelectItem(hwnd,(WPARAM)TVGN_CARET,(LPARAM)item->hItem); 4957 4997 TREEVIEW_EnsureVisible(hwnd,item->hItem); 4958 SetTimer(hwnd,TV_ISEARCH_TIMER,TV_ISEARCH_DELAY,0); 4959 infoPtr->Timer |= TV_ISEARCH_TIMER_SET; 4998 infoPtr->dwISearchTime = GetTickCount(); 4960 4999 } else 4961 5000 {
Note:
See TracChangeset
for help on using the changeset viewer.