Changeset 3585 for trunk/src/comctl32/listview.cpp
- Timestamp:
- May 22, 2000, 7:25:13 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/listview.cpp
r3520 r3585 1 /*$Id: listview.cpp,v 1.1 8 2000-05-10 19:50:32cbratschi Exp $*/1 /*$Id: listview.cpp,v 1.19 2000-05-22 17:25:08 cbratschi Exp $*/ 2 2 /* 3 3 * Listview control … … 50 50 /* 51 51 Most identical with: 52 - Corel 20000 317level52 - Corel 20000513 level 53 53 - (WINE 20000130 level) 54 54 */ … … 831 831 } 832 832 833 static BOOL LISTVIEW_IsItemSelected(LISTVIEW_INFO *infoPtr,INT nItem) 834 { 835 LISTVIEW_ITEM *lpItem; 836 INT pos = 0; 837 838 while ((lpItem = (LISTVIEW_ITEM*)DPA_GetPtr(infoPtr->hdpaSelItems,pos)) != NULL) 839 { 840 if (DPA_GetPtrIndex(infoPtr->hdpaItems,lpItem) == nItem) return TRUE; 841 pos++; 842 } 843 844 return FALSE; 845 } 846 833 847 /*** 834 848 * DESCRIPTION: … … 851 865 for (i = nFirst; i <= nLast; i++) 852 866 { 853 LISTVIEW_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 867 if (!LISTVIEW_IsItemSelected(infoPtr,nItem)) 868 { 869 LISTVIEW_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 870 } 854 871 } 855 872 856 873 LISTVIEW_SetItemFocus(hwnd, nItem); 857 infoPtr->nSelectionMark = nItem;858 874 } 859 875 … … 873 889 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 874 890 875 LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED,LVIS_SELECTED); 891 if (!LISTVIEW_IsItemSelected(infoPtr,nItem)) 892 { 893 LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED,LVIS_SELECTED); 894 } 876 895 877 896 LISTVIEW_SetItemFocus(hwnd, nItem); 878 infoPtr->nSelectionMark = nItem;879 897 } 880 898 … … 894 912 { 895 913 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 896 BOOL bResult; 897 898 if (LISTVIEW_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED) 899 { 900 LISTVIEW_SetItemState(hwnd,nItem,0,LVIS_SELECTED); 901 bResult = FALSE; 902 } 903 else 904 { 905 LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED,LVIS_SELECTED); 914 BOOL bResult = FALSE; 915 DWORD state = 0,stateMask = 0; 916 917 if (nItem != infoPtr->nFocusedItem) 918 { 919 stateMask = LVIS_FOCUSED; 920 LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,state,stateMask); 921 } 922 923 stateMask = LVIS_SELECTED; 924 if (!LISTVIEW_IsItemSelected(infoPtr,nItem)) 925 { 906 926 bResult = TRUE; 907 } 908 909 LISTVIEW_SetItemFocus(hwnd, nItem); 927 state = LVIS_SELECTED; 928 } 910 929 infoPtr->nSelectionMark = nItem; 930 LISTVIEW_SetItemState(hwnd,nItem,state,stateMask); 931 932 if (nItem != infoPtr->nFocusedItem) 933 { 934 state = LVIS_FOCUSED; 935 stateMask = LVIS_FOCUSED; 936 infoPtr->nFocusedItem = nItem; 937 LISTVIEW_SetItemState(hwnd,nItem,state,stateMask); 938 } 911 939 912 940 return bResult; … … 970 998 if ((i < nFirst) || (i > nLast)) 971 999 { 972 LISTVIEW_SetItemState(hwnd,i,0,LVIS_SELECTED); 1000 if (LISTVIEW_IsItemSelected(infoPtr,i)) 1001 { 1002 LISTVIEW_SetItemState(hwnd,i,0,LVIS_SELECTED); 1003 } 973 1004 } 974 1005 else 975 1006 { 976 LISTVIEW_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 977 } 978 } 1007 if (!LISTVIEW_IsItemSelected(infoPtr,i)) 1008 { 1009 LISTVIEW_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 1010 } 1011 } 1012 } 1013 LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,LVIS_FOCUSED); 1014 1015 infoPtr->nFocusedItem = nItem; 1016 LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED); 1017 979 1018 } 980 1019 else … … 991 1030 rcSel.bottom = max(ptSelMark.y, ptItem.y) + infoPtr->nItemHeight; 992 1031 LISTVIEW_SetSelectionRect(hwnd, rcSel); 993 } 994 995 LISTVIEW_SetItemFocus(hwnd, nItem); 1032 LISTVIEW_SetItemFocus(hwnd, nItem); 1033 } 996 1034 } 997 1035 … … 3639 3677 if (isUnicodeNotify(&infoPtr->header)) 3640 3678 { 3641 Str_SetPtrW(&lpItemData->pszText, dispInfo.item.pszText);3679 Str_SetPtrW(&lpItemData->pszText,(dispInfo.item.pszText == LPSTR_TEXTCALLBACKW) ? NULL:dispInfo.item.pszText); 3642 3680 } else 3643 3681 { 3644 INT len = dispInfo.item.pszText? lstrlenA((LPSTR)dispInfo.item.pszText):0;3682 INT len = (dispInfo.item.pszText && (dispInfo.item.pszText != LPSTR_TEXTCALLBACKW)) ? lstrlenA((LPSTR)dispInfo.item.pszText):0; 3645 3683 3646 3684 if (lpItemData->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpItemData->pszText); … … 3654 3692 } 3655 3693 /* Make sure the source string is valid */ 3656 if (!dispInfo.item.pszText )3694 if (!dispInfo.item.pszText || (dispInfo.item.pszText == LPSTR_TEXTCALLBACKW)) 3657 3695 { 3658 3696 if (!internal) … … 6486 6524 INT maxY = infoPtr->maxScroll.y-infoPtr->scrollPage.y,oldY = infoPtr->lefttop.y; 6487 6525 6526 if (infoPtr->hwndEdit) 6527 { 6528 SendMessageA(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); 6529 } 6530 6488 6531 switch (nScrollCode) 6489 6532 { … … 6567 6610 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 6568 6611 INT maxX = infoPtr->maxScroll.x-infoPtr->scrollPage.x,oldX = infoPtr->lefttop.x; 6612 6613 if (infoPtr->hwndEdit) 6614 { 6615 SendMessageA(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); 6616 } 6569 6617 6570 6618 switch (nScrollCode) … … 6743 6791 break; 6744 6792 6793 case VK_NEXT: 6794 if (infoPtr->uView == LVS_REPORT) 6795 { 6796 nItem = infoPtr->nFocusedItem + LISTVIEW_GetCountPerColumn(hwnd); 6797 } 6798 else 6799 { 6800 nItem = infoPtr->nFocusedItem + LISTVIEW_GetCountPerColumn(hwnd) * LISTVIEW_GetCountPerRow(hwnd); 6801 } 6802 if(nItem >= GETITEMCOUNT(infoPtr)) nItem = GETITEMCOUNT(infoPtr) - 1; 6803 break; 6804 6745 6805 case VK_PRIOR: 6746 /* TO DO */ 6747 break; 6748 6749 case VK_NEXT: 6750 /* TO DO */ 6806 if (infoPtr->uView == LVS_REPORT) 6807 { 6808 nItem = infoPtr->nFocusedItem - LISTVIEW_GetCountPerColumn(hwnd); 6809 } 6810 else 6811 { 6812 nItem = infoPtr->nFocusedItem - LISTVIEW_GetCountPerColumn(hwnd) * LISTVIEW_GetCountPerRow(hwnd); 6813 } 6814 if(nItem < 0) nItem = 0; 6751 6815 break; 6752 6816 } … … 7011 7075 sendNotify(hwnd,NM_RELEASEDCAPTURE); 7012 7076 7013 if ( infoPtr->bFocus == FALSE)7077 if (!infoPtr->bFocus) 7014 7078 SetFocus(hwnd); 7015 7079 … … 7024 7088 if (infoPtr->dwStyle & LVS_SINGLESEL) 7025 7089 { 7026 if ( (LISTVIEW_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED) && infoPtr->bDoEditLabel != TRUE)7090 if (LISTVIEW_IsItemSelected(infoPtr,nItem) && !infoPtr->bDoEditLabel) 7027 7091 infoPtr->bDoEditLabel = TRUE; 7028 7092 else … … 7033 7097 if ((wKey & MK_CONTROL) && (wKey & MK_SHIFT)) 7034 7098 { 7035 if (bGroupSelect != FALSE)7099 if (bGroupSelect) 7036 7100 { 7037 7101 LISTVIEW_AddGroupSelection(hwnd, nItem); … … 7052 7116 else 7053 7117 { 7054 if ( (LISTVIEW_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED) && (infoPtr->bDoEditLabel != TRUE))7118 if (LISTVIEW_IsItemSelected(infoPtr,nItem) && !infoPtr->bDoEditLabel) 7055 7119 infoPtr->bDoEditLabel = TRUE; 7056 7120 else
Note:
See TracChangeset
for help on using the changeset viewer.