- Timestamp:
- Feb 22, 2000, 6:11:41 PM (26 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/animate.c
r1431 r2858 1 /* $Id: animate.c,v 1. 6 1999-10-24 22:49:42 sandervlExp $ */1 /* $Id: animate.c,v 1.7 2000-02-22 17:11:38 cbratschi Exp $ */ 2 2 /* 3 3 * Animation control … … 446 446 WNDCLASSA wndClass; 447 447 448 //SvL: Don't check this now449 // if (GlobalFindAtomA (ANIMATE_CLASSA)) return;450 451 448 ZeroMemory (&wndClass, sizeof(WNDCLASSA)); 452 449 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; … … 465 462 ANIMATE_Unregister (VOID) 466 463 { 467 if (GlobalFindAtomA (ANIMATE_CLASSA)) 468 UnregisterClassA (ANIMATE_CLASSA, (HINSTANCE)NULL); 469 } 470 464 UnregisterClassA (ANIMATE_CLASSA, (HINSTANCE)NULL); 465 } 466 -
trunk/src/comctl32/comctl32undoc.c
r2820 r2858 1 /* $Id: comctl32undoc.c,v 1.1 8 2000-02-18 17:13:37cbratschi Exp $ */1 /* $Id: comctl32undoc.c,v 1.19 2000-02-22 17:11:38 cbratschi Exp $ */ 2 2 /* 3 3 * Undocumented functions from COMCTL32.DLL … … 12 12 */ 13 13 14 /* WINE 20000130 level */ 14 /* 15 - Corel 20000212 level 16 - WINE 20000130 level 17 */ 15 18 16 19 /* CB: todo … … 1485 1488 INT i, j; 1486 1489 1487 // TRACE (commctrl,"l=%i r=%i\n", l, r);1490 //TRACE("l=%i r=%i\n", l, r); 1488 1491 1489 1492 i = l; 1490 1493 j = r; 1494 1495 if ( i >= j ) 1496 return; 1497 else if ( i == (j - 1) ) 1498 { 1499 if ( (pfnCompare)( lpPtrs[i], lpPtrs[j], lParam ) > 0 ) 1500 { 1501 t = lpPtrs[i]; 1502 lpPtrs[i] = lpPtrs[j]; 1503 lpPtrs[j] = t; 1504 } 1505 return; 1506 } 1507 1491 1508 v = lpPtrs[(int)(l+r)/2]; 1492 do { 1493 while ((pfnCompare)(lpPtrs[i], v, lParam) < 0) i++; 1494 while ((pfnCompare)(lpPtrs[j], v, lParam) > 0) j--; 1495 if (i <= j) 1509 1510 while ( i < j) 1511 { 1512 while ( (pfnCompare)( lpPtrs[i], v, lParam ) <= 0 && i < j ) 1513 i++; 1514 1515 while ( (pfnCompare)( v, lpPtrs[j], lParam ) <= 0 && i < j ) 1516 j--; 1517 1518 if ( i < j ) 1496 1519 { 1520 /* Swap the values; increment i and decrement j to avoid 1521 infinite conditions where i and j swap forever */ 1497 1522 t = lpPtrs[i]; 1498 1523 lpPtrs[i++] = lpPtrs[j]; 1499 1524 lpPtrs[j--] = t; 1500 1525 } 1501 } while (i <= j); 1502 if (l < j) DPA_QuickSort (lpPtrs, l, j, pfnCompare, lParam); 1503 if (i < r) DPA_QuickSort (lpPtrs, i, r, pfnCompare, lParam); 1526 } 1527 1528 if ( i - 1 > l ) 1529 DPA_QuickSort (lpPtrs, l, i - 1, pfnCompare, lParam); 1530 if ( j + 1 < r ) 1531 DPA_QuickSort (lpPtrs, j + 1, r, pfnCompare, lParam); 1504 1532 } 1505 1533 -
trunk/src/comctl32/listview.c
r2740 r2858 1 /*$Id: listview.c,v 1.2 2 2000-02-10 18:51:17cbratschi Exp $*/1 /*$Id: listview.c,v 1.23 2000-02-22 17:11:38 cbratschi Exp $*/ 2 2 /* 3 3 * Listview control … … 45 45 */ 46 46 47 /* WINE 20000130 level */ 47 /* 48 - Corel 20000212 level 49 - WINE 20000130 level 50 */ 48 51 49 52 #include <string.h> … … 59 62 60 63 /* maximum size of a label */ 61 #define DISP_TEXT_SIZE 51264 #define DISP_TEXT_SIZE 128 62 65 63 66 /* padding for items in list and small icon display modes */ … … 105 108 * forward declarations 106 109 */ 107 static LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem, BOOL internal); 110 108 111 static INT LISTVIEW_HitTestItem(HWND, LPLVHITTESTINFO); 109 112 static INT LISTVIEW_GetCountPerRow(HWND); … … 144 147 static BOOL LISTVIEW_EndEditLabel(HWND hwnd, LPSTR pszText, DWORD nItem); 145 148 static LRESULT LISTVIEW_Command(HWND hwnd, WPARAM wParam, LPARAM lParam); 149 static LRESULT LISTVIEW_SortItems(HWND hwnd, WPARAM wParam, LPARAM lParam); 146 150 147 151 /************************************************************************* … … 209 213 INT nCountPerColumn = LISTVIEW_GetCountPerColumn(hwnd); 210 214 INT nCountPerRow = LISTVIEW_GetCountPerRow(hwnd); 211 INT nCountPerPage = nCountPerRow * nCountPerColumn;212 215 INT nNumOfItems = GETITEMCOUNT(infoPtr); 213 216 214 if (nCountPerPage < GETITEMCOUNT(infoPtr)) 215 { 216 scrollInfo.nMax = nNumOfItems / nCountPerColumn; 217 if((nNumOfItems % nCountPerColumn) == 0) 218 { 219 scrollInfo.nMax--; 220 } 221 scrollInfo.nPos = ListView_GetTopIndex(hwnd) / nCountPerColumn; 222 scrollInfo.nPage = nCountPerRow; 223 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 224 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 225 } 226 else 227 { 228 /* hide scrollbar */ 229 if (lStyle & WS_HSCROLL) 230 { 231 ShowScrollBar(hwnd, SB_HORZ, FALSE); 232 } 233 } 217 scrollInfo.nMax = nNumOfItems / nCountPerColumn; 218 if((nNumOfItems % nCountPerColumn) == 0) 219 { 220 scrollInfo.nMax--; 221 } 222 scrollInfo.nPos = ListView_GetTopIndex(hwnd) / nCountPerColumn; 223 scrollInfo.nPage = nCountPerRow; 224 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 225 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 234 226 } 235 227 else if (uView == LVS_REPORT) … … 244 236 245 237 /* update horizontal scrollbar */ 246 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE) 238 nListWidth = infoPtr->rcList.right - infoPtr->rcList.left; 239 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE 240 || GETITEMCOUNT(infoPtr) == 0) 247 241 { 248 242 scrollInfo.nPos = 0; … … 269 263 INT nViewHeight = rcView.bottom - rcView.top; 270 264 271 if (nViewWidth > nListWidth) 272 { 273 scrollInfo.fMask = SIF_POS; 274 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE) 275 { 276 scrollInfo.nPos = 0; 277 } 278 scrollInfo.nMax = max(nViewWidth / LISTVIEW_SCROLL_DIV_SIZE, 0)-1; 279 scrollInfo.nMin = 0; 280 scrollInfo.nPage = nListWidth / LISTVIEW_SCROLL_DIV_SIZE; 281 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 282 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 283 } 284 else 285 { 286 if (lStyle & WS_HSCROLL) 287 { 288 ShowScrollBar(hwnd, SB_HORZ, FALSE); 289 } 290 } 291 292 if (nViewHeight > nListHeight) 293 { 294 scrollInfo.fMask = SIF_POS; 295 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) == FALSE) 296 { 297 scrollInfo.nPos = 0; 298 } 299 scrollInfo.nMax = max(nViewHeight / LISTVIEW_SCROLL_DIV_SIZE,0)-1; 300 scrollInfo.nMin = 0; 301 scrollInfo.nPage = nListHeight / LISTVIEW_SCROLL_DIV_SIZE; 302 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 303 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 304 } 305 else 306 { 307 if (lStyle & WS_VSCROLL) 308 { 309 ShowScrollBar(hwnd, SB_VERT, FALSE); 310 } 311 } 265 /* Update Horizontal Scrollbar */ 266 scrollInfo.fMask = SIF_POS; 267 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE 268 || GETITEMCOUNT(infoPtr) == 0) 269 { 270 scrollInfo.nPos = 0; 271 } 272 scrollInfo.nMax = max(nViewWidth / LISTVIEW_SCROLL_DIV_SIZE, 0)-1; 273 scrollInfo.nMin = 0; 274 scrollInfo.nPage = nListWidth / LISTVIEW_SCROLL_DIV_SIZE; 275 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 276 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 277 278 /* Update Vertical Scrollbar */ 279 nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; 280 scrollInfo.fMask = SIF_POS; 281 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) == FALSE 282 || GETITEMCOUNT(infoPtr) == 0) 283 { 284 scrollInfo.nPos = 0; 285 } 286 scrollInfo.nMax = max(nViewHeight / LISTVIEW_SCROLL_DIV_SIZE,0)-1; 287 scrollInfo.nMin = 0; 288 scrollInfo.nPage = nListHeight / LISTVIEW_SCROLL_DIV_SIZE; 289 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 290 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 312 291 } 313 292 } … … 654 633 } 655 634 } 635 } 636 637 if(nItemWidth == 0) 638 { 639 /* nItemWidth Cannot be Zero */ 640 nItemWidth = 1; 656 641 } 657 642 … … 1779 1764 lvItem.cchTextMax = DISP_TEXT_SIZE; 1780 1765 lvItem.pszText = szDispText; 1781 L ISTVIEW_GetItemA(hwnd,&lvItem,TRUE);1766 ListView_GetItemA(hwnd,&lvItem); 1782 1767 1783 1768 /* set item colors */ … … 1823 1808 lvItem.cchTextMax = DISP_TEXT_SIZE; 1824 1809 lvItem.pszText = szDispText; 1825 L ISTVIEW_GetItemA(hwnd,&lvItem,TRUE);1810 ListView_GetItemA(hwnd,&lvItem); 1826 1811 1827 1812 /* state icons */ … … 1888 1873 nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); 1889 1874 if (rcItem.left + nLabelWidth < rcItem.right) 1890 {1891 1875 rcItem.right = rcItem.left + nLabelWidth; 1892 }1893 1876 1894 1877 /* draw label */ … … 1944 1927 lvItem.cchTextMax = DISP_TEXT_SIZE; 1945 1928 lvItem.pszText = szDispText; 1946 L ISTVIEW_GetItemA(hwnd, &lvItem,TRUE);1929 ListView_GetItemA(hwnd, &lvItem); 1947 1930 1948 1931 if (lvItem.state & LVIS_SELECTED) … … 2764 2747 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 2765 2748 HDPA hdpaSubItems; 2749 BOOL bUpdateItemText; 2766 2750 2767 2751 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); … … 2784 2768 dispInfo.item.iImage = lpItem->iImage; 2785 2769 dispInfo.item.lParam = lpItem->lParam; 2786 2787 ListView_Notify(GetParent(hwnd), nCtrlId, &dispInfo);2788 2770 infoPtr->hwndEdit = 0; 2771 2772 bUpdateItemText = ListView_Notify(GetParent(hwnd), nCtrlId, &dispInfo); 2773 2774 /* Do we need to update the Item Text */ 2775 if(bUpdateItemText) 2776 { 2777 if(lpItem->pszText != LPSTR_TEXTCALLBACKA) 2778 { 2779 Str_SetPtrA(&lpItem->pszText, pszText); 2780 } 2781 } 2789 2782 2790 2783 return TRUE; … … 2814 2807 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 2815 2808 HDPA hdpaSubItems; 2809 CHAR szDispText[DISP_TEXT_SIZE]; 2810 LVITEMA lvItem; 2811 2816 2812 2817 2813 if (~GetWindowLongA(hwnd, GWL_STYLE) & LVS_EDITLABELS) 2818 2814 return FALSE; 2815 2816 /* Is the EditBox still there, if so remove it */ 2817 if(infoPtr->hwndEdit != 0) 2818 { 2819 SetFocus(hwnd); 2820 } 2819 2821 2820 2822 LISTVIEW_SetSelection(hwnd, nItem); … … 2827 2829 if (NULL == (lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0))) 2828 2830 return 0; 2831 2832 /* get information needed for drawing the item */ 2833 ZeroMemory(&lvItem, sizeof(LVITEMA)); 2834 lvItem.mask = LVIF_TEXT; 2835 lvItem.iItem = nItem; 2836 lvItem.iSubItem = 0; 2837 lvItem.cchTextMax = DISP_TEXT_SIZE; 2838 lvItem.pszText = szDispText; 2839 ListView_GetItemA(hwnd, &lvItem); 2829 2840 2830 2841 dispInfo.hdr.hwndFrom = hwnd; … … 2835 2846 dispInfo.item.state = lpItem->state; 2836 2847 dispInfo.item.stateMask = 0; 2837 dispInfo.item.pszText = l pItem->pszText;2838 dispInfo.item.cchTextMax = strlen(l pItem->pszText);2848 dispInfo.item.pszText = lvItem.pszText; 2849 dispInfo.item.cchTextMax = strlen(lvItem.pszText); 2839 2850 dispInfo.item.iImage = lpItem->iImage; 2840 2851 dispInfo.item.lParam = lpItem->lParam; … … 2847 2858 return 0; 2848 2859 2849 if (!(hedit = CreateEditLabel(dispInfo.item.pszText , WS_VISIBLE,2850 rect.left , rect.top, rect.right - rect.left + 15,2851 rect.bottom - rect.top ,2860 if (!(hedit = CreateEditLabel(szDispText , WS_VISIBLE, 2861 rect.left-2, rect.top-1, 0, 2862 rect.bottom - rect.top+2, 2852 2863 hwnd, hinst, LISTVIEW_EndEditLabel, nItem))) 2853 2864 return 0; … … 2877 2888 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 2878 2889 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2879 INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;2880 INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;2881 2890 INT nScrollPosHeight = 0; 2882 2891 INT nScrollPosWidth = 0; … … 2905 2914 else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 2906 2915 { 2907 nScrollPosWidth = max(1, nListWidth / LISTVIEW_SCROLL_DIV_SIZE);2916 nScrollPosWidth = LISTVIEW_SCROLL_DIV_SIZE; 2908 2917 rcItem.left += infoPtr->rcList.left; 2909 2918 } 2910 2919 2911 if (rcItem.left % nScrollPosWidth == 0) 2912 { 2913 scrollInfo.nPos += rcItem.left / nScrollPosWidth; 2914 } 2915 else 2916 { 2917 scrollInfo.nPos += rcItem.left / nScrollPosWidth - 1; 2918 } 2919 2920 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 2920 /* When in LVS_REPORT view, the scroll position should 2921 not be updated. */ 2922 if (nScrollPosWidth != 0) 2923 { 2924 if (rcItem.left % nScrollPosWidth == 0) 2925 { 2926 scrollInfo.nPos += rcItem.left / nScrollPosWidth; 2927 } 2928 else 2929 { 2930 scrollInfo.nPos += rcItem.left / nScrollPosWidth - 1; 2931 } 2932 2933 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 2934 } 2921 2935 } 2922 2936 } … … 2934 2948 { 2935 2949 rcItem.right -= infoPtr->rcList.right; 2936 nScrollPosWidth = max(1, nListWidth / LISTVIEW_SCROLL_DIV_SIZE); 2937 } 2938 2939 if (rcItem.right % nScrollPosWidth == 0) 2940 { 2941 scrollInfo.nPos += rcItem.right / nScrollPosWidth; 2942 } 2943 else 2944 { 2945 scrollInfo.nPos += rcItem.right / nScrollPosWidth + 1; 2946 } 2947 2948 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 2950 nScrollPosWidth = LISTVIEW_SCROLL_DIV_SIZE; 2951 } 2952 2953 /* When in LVS_REPORT view, the scroll position should 2954 not be updated. */ 2955 if (nScrollPosWidth != 0) 2956 { 2957 if (rcItem.right % nScrollPosWidth == 0) 2958 { 2959 scrollInfo.nPos += rcItem.right / nScrollPosWidth; 2960 } 2961 else 2962 { 2963 scrollInfo.nPos += rcItem.right / nScrollPosWidth + 1; 2964 } 2965 2966 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 2967 } 2949 2968 } 2950 2969 } … … 2962 2981 else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) 2963 2982 { 2964 nScrollPosHeight = max(1, nListHeight / LISTVIEW_SCROLL_DIV_SIZE);2983 nScrollPosHeight = LISTVIEW_SCROLL_DIV_SIZE; 2965 2984 rcItem.top += infoPtr->rcList.top; 2966 2985 } … … 2990 3009 else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) 2991 3010 { 2992 nScrollPosHeight = max(1, nListHeight / LISTVIEW_SCROLL_DIV_SIZE);3011 nScrollPosHeight = LISTVIEW_SCROLL_DIV_SIZE; 2993 3012 rcItem.bottom -= infoPtr->rcList.bottom; 2994 3013 } … … 3154 3173 lvItem.iItem = nItem; 3155 3174 lvItem.iSubItem = 0; 3156 if (L ISTVIEW_GetItemA(hwnd, &lvItem,TRUE) != FALSE)3175 if (ListView_GetItemA(hwnd, &lvItem) != FALSE) 3157 3176 { 3158 3177 if (lvItem.mask & LVIF_TEXT) … … 3284 3303 if (lpColumn->mask & LVCF_TEXT) 3285 3304 { 3286 hdi.mask |= (HDI_TEXT | HDI_FORMAT); 3305 hdi.mask |= HDI_TEXT; 3306 hdi.cchTextMax = lpColumn->cchTextMax; 3307 hdi.pszText = lpColumn->pszText; 3287 3308 } 3288 3309 … … 3326 3347 { 3327 3348 lpColumn->cx = hdi.cxy; 3328 }3329 3330 if ((lpColumn->mask & LVCF_TEXT) && (lpColumn->pszText) && (hdi.pszText))3331 {3332 lstrcpynA (lpColumn->pszText, hdi.pszText, lpColumn->cchTextMax);3333 3349 } 3334 3350 … … 3532 3548 * FAILURE : FALSE 3533 3549 */ 3534 static LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem , BOOL internal)3550 static LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem) 3535 3551 { 3536 3552 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 3537 3553 LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); 3554 BOOL bResult = FALSE; 3538 3555 NMLVDISPINFOA dispInfo; 3539 3556 LISTVIEW_SUBITEM *lpSubItem; 3540 3557 LISTVIEW_ITEM *lpItem; 3541 INT* piImage;3542 LPSTR* ppszText;3543 3558 HDPA hdpaSubItems; 3544 3559 3545 /* In the following:3546 * lpLVItem describes the information requested by the user3547 * lpItem/lpSubItem is what we have3548 * dispInfo is a structure we use to request the missing3549 * information from the application3550 */3551 3552 3560 //TRACE("(hwnd=%x, lpLVItem=%p)\n", hwnd, lpLVItem); 3553 if ((lpLVItem == NULL) || 3554 (lpLVItem->iItem < 0) || 3555 (lpLVItem->iItem >= GETITEMCOUNT(infoPtr)) 3556 ) 3557 return FALSE; 3558 3559 hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); 3560 if (hdpaSubItems == NULL) 3561 return FALSE; 3562 3563 lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0); 3564 if (lpItem == NULL) 3565 return FALSE; 3566 3567 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); 3568 if (lpLVItem->iSubItem == 0) 3569 { 3570 piImage=&lpItem->iImage; 3571 ppszText=&lpItem->pszText; 3572 if ((infoPtr->uCallbackMask != 0) && (lpLVItem->mask & LVIF_STATE)) 3573 { 3574 dispInfo.item.mask |= LVIF_STATE; 3575 dispInfo.item.stateMask = infoPtr->uCallbackMask; 3576 } 3577 } 3578 else 3579 { 3580 lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, lpLVItem->iSubItem); 3581 if (lpSubItem != NULL) 3582 { 3583 piImage=&lpItem->iImage; 3584 ppszText=&lpItem->pszText; 3585 } 3586 else 3587 { 3588 piImage=NULL; 3589 ppszText=NULL; 3590 } 3591 } 3592 if ((lpLVItem->mask & LVIF_IMAGE) && 3593 ((piImage==NULL) || (*piImage == I_IMAGECALLBACK))) 3594 { 3595 dispInfo.item.mask |= LVIF_IMAGE; 3596 } 3597 if ((lpLVItem->mask & LVIF_TEXT) && 3598 ((ppszText==NULL) || (*ppszText == LPSTR_TEXTCALLBACKA))) 3599 { 3600 dispInfo.item.mask |= LVIF_TEXT; 3601 dispInfo.item.pszText = lpLVItem->pszText; 3602 dispInfo.item.cchTextMax = lpLVItem->cchTextMax; 3603 } 3604 if (dispInfo.item.mask != 0) 3605 { 3606 /* We don't have all the requested info, query the application */ 3607 dispInfo.hdr.hwndFrom = hwnd; 3608 dispInfo.hdr.idFrom = lCtrlId; 3609 dispInfo.hdr.code = LVN_GETDISPINFOA; 3610 dispInfo.item.iItem = lpLVItem->iItem; 3611 dispInfo.item.iSubItem = lpLVItem->iSubItem; 3612 dispInfo.item.lParam = lpItem->lParam; 3613 ListView_Notify(GetParent(hwnd), lCtrlId, &dispInfo); 3614 } 3615 if (dispInfo.item.mask & LVIF_IMAGE) 3616 { 3617 lpLVItem->iImage = dispInfo.item.iImage; 3618 } 3619 else if (lpLVItem->mask & LVIF_IMAGE) 3620 { 3621 lpLVItem->iImage = *piImage; 3622 } 3623 if (dispInfo.item.mask & LVIF_TEXT) 3624 { 3625 if ((dispInfo.item.mask & LVIF_DI_SETITEM) && (ppszText != NULL)) 3626 { 3627 Str_SetPtrA(ppszText, dispInfo.item.pszText); 3628 } 3629 /* Here lpLVItem->pszText==dispInfo.item.pszText so a copy is unnecessary */ 3630 } 3631 else if (lpLVItem->mask & LVIF_TEXT) 3632 { 3633 if (internal==TRUE) 3634 { 3635 lpLVItem->pszText=*ppszText; 3636 } else { 3637 lstrcpynA(lpLVItem->pszText, *ppszText, lpLVItem->cchTextMax); 3638 } 3639 } 3640 3641 if (lpLVItem->iSubItem == 0) 3642 { 3643 if (dispInfo.item.mask & LVIF_STATE) 3644 { 3645 lpLVItem->state = lpItem->state; 3646 lpLVItem->state &= ~dispInfo.item.stateMask; 3647 lpLVItem->state |= (dispInfo.item.state & dispInfo.item.stateMask); 3648 } 3649 else if (lpLVItem->mask & LVIF_STATE) 3650 { 3651 lpLVItem->state = lpItem->state & lpLVItem->stateMask; 3652 } 3653 3654 if (lpLVItem->mask & LVIF_PARAM) 3655 { 3656 lpLVItem->lParam = lpItem->lParam; 3657 } 3658 3659 if (lpLVItem->mask & LVIF_INDENT) 3660 { 3661 lpLVItem->iIndent = lpItem->iIndent; 3662 } 3663 } 3664 3665 return TRUE; 3561 3562 if (lpLVItem != NULL) 3563 { 3564 if ((lpLVItem->iItem >= 0) && (lpLVItem->iItem < GETITEMCOUNT(infoPtr))) 3565 { 3566 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); 3567 hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); 3568 if (hdpaSubItems != NULL) 3569 { 3570 lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0); 3571 if (lpItem != NULL) 3572 { 3573 bResult = TRUE; 3574 if (lpLVItem->iSubItem == 0) 3575 { 3576 if ((lpItem->iImage == I_IMAGECALLBACK) && 3577 (lpLVItem->mask & LVIF_IMAGE)) 3578 { 3579 dispInfo.item.mask |= LVIF_IMAGE; 3580 } 3581 3582 if ((lpItem->pszText == LPSTR_TEXTCALLBACKA) && 3583 (lpLVItem->mask & LVIF_TEXT)) 3584 { 3585 dispInfo.item.mask |= LVIF_TEXT; 3586 ZeroMemory(lpLVItem->pszText, sizeof(CHAR)*lpLVItem->cchTextMax); 3587 dispInfo.item.pszText = lpLVItem->pszText; 3588 dispInfo.item.cchTextMax = lpLVItem->cchTextMax; 3589 } 3590 3591 if ((infoPtr->uCallbackMask != 0) && (lpLVItem->mask & LVIF_STATE)) 3592 { 3593 dispInfo.item.mask |= LVIF_STATE; 3594 dispInfo.item.stateMask = infoPtr->uCallbackMask; 3595 } 3596 3597 if (dispInfo.item.mask != 0) 3598 { 3599 dispInfo.hdr.hwndFrom = hwnd; 3600 dispInfo.hdr.idFrom = lCtrlId; 3601 dispInfo.hdr.code = LVN_GETDISPINFOA; 3602 dispInfo.item.iItem = lpLVItem->iItem; 3603 dispInfo.item.iSubItem = 0; 3604 dispInfo.item.lParam = lpItem->lParam; 3605 ListView_Notify(GetParent(hwnd), lCtrlId, &dispInfo); 3606 } 3607 3608 if (dispInfo.item.mask & LVIF_IMAGE) 3609 { 3610 lpLVItem->iImage = dispInfo.item.iImage; 3611 } 3612 else if (lpLVItem->mask & LVIF_IMAGE) 3613 { 3614 lpLVItem->iImage = lpItem->iImage; 3615 } 3616 3617 if (dispInfo.item.mask & LVIF_TEXT) 3618 { 3619 if (dispInfo.item.mask & LVIF_DI_SETITEM) 3620 { 3621 Str_SetPtrA(&lpItem->pszText, dispInfo.item.pszText); 3622 } 3623 /* Make sure the source string is valid */ 3624 if (dispInfo.item.pszText == NULL) 3625 lpLVItem->pszText[0] = '\0'; 3626 else 3627 { 3628 strncpy(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3629 lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; 3630 } 3631 } 3632 else if (lpLVItem->mask & LVIF_TEXT) 3633 { 3634 if (lpItem->pszText != NULL) 3635 { 3636 strncpy(lpLVItem->pszText, lpItem->pszText, 3637 lpLVItem->cchTextMax); 3638 lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; 3639 } 3640 else 3641 { 3642 ZeroMemory(lpLVItem->pszText, sizeof(char)* 3643 lpLVItem->cchTextMax); 3644 } 3645 } 3646 3647 if (dispInfo.item.mask & LVIF_STATE) 3648 { 3649 lpLVItem->state = lpItem->state; 3650 lpLVItem->state &= ~dispInfo.item.stateMask; 3651 lpLVItem->state |= (dispInfo.item.state & 3652 dispInfo.item.stateMask); 3653 } 3654 else if (lpLVItem->mask & LVIF_STATE) 3655 { 3656 lpLVItem->state = lpItem->state & lpLVItem->stateMask; 3657 } 3658 3659 if (lpLVItem->mask & LVIF_PARAM) 3660 { 3661 lpLVItem->lParam = lpItem->lParam; 3662 } 3663 3664 if (lpLVItem->mask & LVIF_INDENT) 3665 { 3666 lpLVItem->iIndent = lpItem->iIndent; 3667 } 3668 } 3669 else 3670 { 3671 lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, 3672 lpLVItem->iSubItem); 3673 if (lpSubItem != NULL) 3674 { 3675 if ((lpSubItem->iImage == I_IMAGECALLBACK) && 3676 (lpLVItem->mask & LVIF_IMAGE)) 3677 { 3678 dispInfo.item.mask |= LVIF_IMAGE; 3679 } 3680 3681 if ((lpSubItem->pszText == LPSTR_TEXTCALLBACKA) && 3682 (lpLVItem->mask & LVIF_TEXT)) 3683 { 3684 dispInfo.item.mask |= LVIF_TEXT; 3685 ZeroMemory(lpLVItem->pszText, 3686 sizeof(CHAR)*lpLVItem->cchTextMax); 3687 dispInfo.item.pszText = lpLVItem->pszText; 3688 dispInfo.item.cchTextMax = lpLVItem->cchTextMax; 3689 } 3690 } 3691 else 3692 { 3693 if (lpLVItem->mask & LVIF_IMAGE) 3694 { 3695 dispInfo.item.mask |= LVIF_IMAGE; 3696 } 3697 3698 if (lpLVItem->mask & LVIF_TEXT) 3699 { 3700 dispInfo.item.mask |= LVIF_TEXT; 3701 ZeroMemory(lpLVItem->pszText, 3702 sizeof(CHAR)*lpLVItem->cchTextMax); 3703 dispInfo.item.pszText = lpLVItem->pszText; 3704 dispInfo.item.cchTextMax = lpLVItem->cchTextMax; 3705 } 3706 } 3707 3708 if (dispInfo.item.mask != 0) 3709 { 3710 dispInfo.hdr.hwndFrom = hwnd; 3711 dispInfo.hdr.idFrom = lCtrlId; 3712 dispInfo.hdr.code = LVN_GETDISPINFOA; 3713 dispInfo.item.iItem = lpLVItem->iItem; 3714 dispInfo.item.iSubItem = lpLVItem->iSubItem; 3715 dispInfo.item.lParam = lpItem->lParam; 3716 ListView_Notify(GetParent(hwnd), lCtrlId, &dispInfo); 3717 } 3718 3719 if (dispInfo.item.mask & LVIF_IMAGE) 3720 { 3721 lpLVItem->iImage = dispInfo.item.iImage; 3722 } 3723 else if (lpLVItem->mask & LVIF_IMAGE) 3724 { 3725 lpLVItem->iImage = lpItem->iImage; 3726 } 3727 3728 if (dispInfo.item.mask & LVIF_PARAM) 3729 { 3730 lpLVItem->lParam = dispInfo.item.lParam; 3731 } 3732 else if (lpLVItem->mask & LVIF_PARAM) 3733 { 3734 lpLVItem->lParam = lpItem->lParam; 3735 } 3736 3737 if (dispInfo.item.mask & LVIF_TEXT) 3738 { 3739 if (dispInfo.item.mask & LVIF_DI_SETITEM) 3740 { 3741 if (lpSubItem) 3742 Str_SetPtrA(&lpSubItem->pszText, dispInfo.item.pszText); 3743 } 3744 /* Make sure the source string is valid */ 3745 if (dispInfo.item.pszText == NULL) 3746 lpLVItem->pszText[0] = '\0'; 3747 else 3748 { 3749 strncpy(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3750 lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; 3751 } 3752 } 3753 else if (lpLVItem->mask & LVIF_TEXT) 3754 { 3755 if (lpItem->pszText != NULL) 3756 { 3757 strncpy(lpLVItem->pszText, lpSubItem->pszText, 3758 lpLVItem->cchTextMax); 3759 lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; 3760 } 3761 else 3762 { 3763 ZeroMemory(lpLVItem->pszText, sizeof(char)* 3764 lpLVItem->cchTextMax); 3765 } 3766 } 3767 } 3768 } 3769 } 3770 } 3771 } 3772 3773 return bResult; 3666 3774 } 3667 3775 … … 4140 4248 lvItem.cchTextMax = DISP_TEXT_SIZE; 4141 4249 lvItem.pszText = szDispText; 4142 if (LISTVIEW_GetItemA(hwnd, &lvItem ,TRUE) != FALSE)4250 if (LISTVIEW_GetItemA(hwnd, &lvItem) != FALSE) 4143 4251 { 4144 4252 nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); … … 4201 4309 lvItem.stateMask = uMask; 4202 4310 lvItem.mask = LVIF_STATE; 4203 if (LISTVIEW_GetItemA(hwnd, &lvItem ,TRUE) != FALSE)4311 if (LISTVIEW_GetItemA(hwnd, &lvItem) != FALSE) 4204 4312 { 4205 4313 uState = lvItem.state; … … 4234 4342 lpLVItem->mask = LVIF_TEXT; 4235 4343 lpLVItem->iItem = nItem; 4236 if (LISTVIEW_GetItemA(hwnd, lpLVItem ,FALSE) != FALSE)4344 if (LISTVIEW_GetItemA(hwnd, lpLVItem) != FALSE) 4237 4345 { 4238 4346 nLength = lstrlenA(lpLVItem->pszText); … … 4789 4897 HeapFree(GetProcessHeap(),0,lvca.pszText); 4790 4898 return lres; 4899 } 4900 4901 /* LISTVIEW_InsertCompare: callback routine for comparing pszText members of the LV_ITEMS 4902 in a LISTVIEW on insert. Passed to DPA_Sort in LISTVIEW_InsertItem. 4903 This function should only be used for inserting items into a sorted list (LVM_INSERTITEM) 4904 and not during the processing of a LVM_SORTITEMS message. Applications should provide 4905 their own sort proc. when sending LVM_SORTITEMS. 4906 */ 4907 /* Platform SDK: 4908 (remarks on LVITEM: LVM_INSERTITEM will insert the new item in the proper sort postion... 4909 if: 4910 LVS_SORTXXX must be specified, 4911 LVS_OWNERDRAW is not set, 4912 <item>.pszText is not LPSTR_TEXTCALLBACK. 4913 4914 (LVS_SORT* flags): "For the LVS_SORTASCENDING... styles, item indices 4915 are sorted based on item text..." 4916 */ 4917 static INT WINAPI LISTVIEW_InsertCompare( LPVOID first, LPVOID second, LPARAM lParam) 4918 { 4919 HDPA hdpa_first = (HDPA) first; 4920 HDPA hdpa_second = (HDPA) second; 4921 LISTVIEW_ITEM* lv_first = (LISTVIEW_ITEM*) DPA_GetPtr( hdpa_first, 0 ); 4922 LISTVIEW_ITEM* lv_second = (LISTVIEW_ITEM*) DPA_GetPtr( hdpa_second, 0 ); 4923 LONG lStyle = GetWindowLongA((HWND) lParam, GWL_STYLE); 4924 INT cmpv = lstrcmpA( lv_first->pszText, lv_second->pszText ); 4925 /* if we're sorting descending, negate the return value */ 4926 return (lStyle & LVS_SORTDESCENDING) ? -cmpv : cmpv; 4791 4927 } 4792 4928 … … 4835 4971 if (nItem != -1) 4836 4972 { 4837 nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem, 4973 if ( ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) 4974 && !(lStyle & LVS_OWNERDRAWFIXED) 4975 && (LPSTR_TEXTCALLBACKA != lpLVItem->pszText) ) 4976 { 4977 /* Insert the item in the proper sort order based on the pszText 4978 member. See comments for LISTVIEW_InsertCompare() for greater detail */ 4979 nItem = DPA_InsertPtr( infoPtr->hdpaItems, 4980 GETITEMCOUNT( infoPtr ) + 1, hdpaSubItems ); 4981 DPA_Sort( infoPtr->hdpaItems, LISTVIEW_InsertCompare, hwnd ); 4982 nItem = DPA_GetPtrIndex( infoPtr->hdpaItems, hdpaSubItems ); 4983 } 4984 else 4985 { 4986 nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem, 4838 4987 hdpaSubItems); 4988 } 4989 4839 4990 if (nItem != -1) 4840 4991 { … … 5585 5736 { 5586 5737 /* Forward the call to the client defined callback */ 5738 INT rv; 5587 5739 HWND hwnd = (HWND)lParam; 5588 5740 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 5589 5741 5590 r eturn (infoPtr->pfnCompare)(5591 ((LISTVIEW_ITEM *)first)->lParam,5592 ((LISTVIEW_ITEM *)second)->lParam, 5593 infoPtr->lParamSort);5742 rv = (infoPtr->pfnCompare)( ((LISTVIEW_ITEM*) first)->lParam, 5743 ((LISTVIEW_ITEM*) second)->lParam, infoPtr->lParamSort ); 5744 5745 return rv; 5594 5746 } 5595 5747 … … 5747 5899 infoPtr->hwndEdit = 0; 5748 5900 infoPtr->pedititem = NULL; 5901 infoPtr->bDoEditLabel = FALSE; 5749 5902 5750 5903 /* get default font (icon title) */ … … 5924 6077 case SB_THUMBTRACK: 5925 6078 scrollInfo.nPos = nCurrentPos; 6079 if (scrollInfo.nPos > scrollInfo.nMax) 6080 scrollInfo.nPos=scrollInfo.nMax; 6081 6082 if (scrollInfo.nPos < scrollInfo.nMin) 6083 scrollInfo.nPos=scrollInfo.nMin; 6084 5926 6085 break; 5927 6086 } … … 6011 6170 case SB_THUMBTRACK: 6012 6171 scrollInfo.nPos = nCurrentPos; 6172 6173 if (scrollInfo.nPos > scrollInfo.nMax) 6174 scrollInfo.nPos=scrollInfo.nMax; 6175 6176 if (scrollInfo.nPos < scrollInfo.nMin) 6177 scrollInfo.nPos=scrollInfo.nMin; 6178 6013 6179 break; 6014 6180 } … … 6030 6196 6031 6197 return 0; 6198 } 6199 6200 static LRESULT LISTVIEW_MouseWheel(HWND hwnd, INT wheelDelta) 6201 { 6202 INT gcWheelDelta = 0; 6203 UINT pulScrollLines = 3; 6204 SCROLLINFO scrollInfo; 6205 6206 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 6207 6208 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0); 6209 gcWheelDelta -= wheelDelta; 6210 6211 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 6212 scrollInfo.cbSize = sizeof(SCROLLINFO); 6213 scrollInfo.fMask = SIF_POS | SIF_RANGE; 6214 6215 switch(uView) 6216 { 6217 case LVS_ICON: 6218 case LVS_SMALLICON: 6219 /* 6220 * listview should be scrolled by a multiple of 37 dependently on its dimension or its visible item number 6221 * should be fixed in the future. 6222 */ 6223 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE) 6224 LISTVIEW_VScroll(hwnd, SB_THUMBPOSITION, scrollInfo.nPos + (gcWheelDelta < 0) ? 37 : -37, 0); 6225 break; 6226 6227 case LVS_REPORT: 6228 if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines) 6229 { 6230 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE) 6231 { 6232 int cLineScroll = min(LISTVIEW_GetCountPerColumn(hwnd), pulScrollLines); 6233 cLineScroll *= (gcWheelDelta / WHEEL_DELTA); 6234 LISTVIEW_VScroll(hwnd, SB_THUMBPOSITION, scrollInfo.nPos + cLineScroll, 0); 6235 } 6236 } 6237 break; 6238 6239 case LVS_LIST: 6240 LISTVIEW_HScroll(hwnd, (gcWheelDelta < 0) ? SB_LINELEFT : SB_LINERIGHT, 0, 0); 6241 break; 6242 } 6243 return 0; 6032 6244 } 6033 6245 … … 6184 6396 LONG nCtrlId = GetWindowLongA(hwnd, GWL_ID); 6185 6397 NMHDR nmh; 6398 LVHITTESTINFO htInfo; 6186 6399 6187 6400 // TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); … … 6193 6406 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6194 6407 6195 /* send LVN_ITEMACTIVATE notification */ 6196 nmh.code = LVN_ITEMACTIVATE; 6197 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6408 /* To send the LVN_ITEMACTIVATE, it must be on an Item */ 6409 ZeroMemory(&htInfo, sizeof(LVHITTESTINFO)); 6410 htInfo.pt.x = wPosX; 6411 htInfo.pt.y = wPosY; 6412 if(LISTVIEW_HitTest(hwnd, &htInfo) != -1) 6413 { 6414 /* send LVN_ITEMACTIVATE notification */ 6415 nmh.code = LVN_ITEMACTIVATE; 6416 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6417 } 6198 6418 6199 6419 return 0; … … 6248 6468 if (lStyle & LVS_SINGLESEL) 6249 6469 { 6250 LISTVIEW_SetSelection(hwnd, nItem); 6470 if ((ListView_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED) 6471 && infoPtr->bDoEditLabel != TRUE) 6472 { 6473 infoPtr->bDoEditLabel = TRUE; 6474 } 6475 else 6476 { 6477 LISTVIEW_SetSelection(hwnd, nItem); 6478 } 6251 6479 } 6252 6480 else … … 6273 6501 else 6274 6502 { 6275 LISTVIEW_SetSelection(hwnd, nItem); 6503 if (ListView_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED 6504 && infoPtr->bDoEditLabel != TRUE) 6505 { 6506 infoPtr->bDoEditLabel = TRUE; 6507 } 6508 else 6509 { 6510 LISTVIEW_SetSelection(hwnd, nItem); 6511 } 6276 6512 } 6277 6513 } … … 6321 6557 /* set left button flag */ 6322 6558 infoPtr->bLButtonDown = FALSE; 6559 6560 if(infoPtr->bDoEditLabel) 6561 { 6562 LVHITTESTINFO htInfo; 6563 int nItem; 6564 ZeroMemory(&htInfo, sizeof(LVHITTESTINFO)); 6565 htInfo.pt.x = wPosX; 6566 htInfo.pt.y = wPosY; 6567 nItem = LISTVIEW_HitTest(hwnd, &htInfo); 6568 if(nItem != -1 && htInfo.flags == LVHT_ONITEMLABEL) 6569 { 6570 LISTVIEW_EditLabelA(hwnd, nItem); 6571 } 6572 infoPtr->bDoEditLabel = FALSE; 6573 } 6323 6574 } 6324 6575 … … 6633 6884 if (infoPtr->bRButtonDown != FALSE) 6634 6885 { 6886 LPARAM lParam; 6887 6635 6888 /* send NM_RClICK notification */ 6636 6889 ZeroMemory(&nmh, sizeof(NMHDR)); … … 6642 6895 /* set button flag */ 6643 6896 infoPtr->bRButtonDown = FALSE; 6897 6898 lParam = MAKELPARAM(wPosX, wPosY); 6899 ClientToScreen(hwnd, (LPPOINT)&lParam); 6900 6901 SendMessageA( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, lParam); 6644 6902 } 6645 6903 … … 6723 6981 6724 6982 return 0; 6983 } 6984 6985 /*** 6986 * DESCRIPTION: 6987 * Message handling for WM_SETREDRAW. 6988 * For the Listview, it invalidates the entire window (the doc specifies otherwise) 6989 * 6990 * PARAMETER(S): 6991 * [I] HWND : window handle 6992 * [I] bRedraw: state of redraw flag 6993 * 6994 * RETURN: 6995 * DefWinProc return value 6996 */ 6997 static LRESULT LISTVIEW_SetRedraw(HWND hwnd, BOOL bRedraw) 6998 { 6999 LRESULT lResult; 7000 lResult = DefWindowProcA(hwnd, WM_SETREDRAW, bRedraw, 0); 7001 if(bRedraw) 7002 { 7003 RedrawWindow(hwnd, NULL, 0, 7004 RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN | RDW_ERASENOW); 7005 } 7006 return lResult; 6725 7007 } 6726 7008 … … 7022 7304 7023 7305 case LVM_GETITEMA: 7024 return LISTVIEW_GetItemA(hwnd, (LPLVITEMA)lParam ,FALSE);7306 return LISTVIEW_GetItemA(hwnd, (LPLVITEMA)lParam); 7025 7307 7026 7308 /* case LVM_GETITEMW: */ … … 7257 7539 return LISTVIEW_SetFont(hwnd, (HFONT)wParam, (WORD)lParam); 7258 7540 7259 /* case WM_SETREDRAW: */ 7541 case WM_SETREDRAW: 7542 return LISTVIEW_SetRedraw(hwnd, (BOOL)wParam); 7260 7543 7261 7544 case WM_SIZE: … … 7270 7553 return LISTVIEW_VScroll(hwnd, (INT)LOWORD(wParam), 7271 7554 (INT)HIWORD(wParam), (HWND)lParam); 7555 7556 case WM_MOUSEWHEEL: 7557 if (wParam & (MK_SHIFT | MK_CONTROL)) 7558 return DefWindowProcA( hwnd, uMsg, wParam, lParam ); 7559 return LISTVIEW_MouseWheel(hwnd, (short int)HIWORD(wParam)); 7272 7560 7273 7561 /* case WM_WINDOWPOSCHANGED: */ … … 7302 7590 WNDCLASSA wndClass; 7303 7591 7304 //SvL: Don't check this now 7305 // if (!GlobalFindAtomA(WC_LISTVIEWA)) 7306 // { 7307 ZeroMemory(&wndClass, sizeof(WNDCLASSA)); 7308 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; 7309 wndClass.lpfnWndProc = (WNDPROC)LISTVIEW_WindowProc; 7310 wndClass.cbClsExtra = 0; 7311 wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *); 7312 wndClass.hCursor = LoadCursorA(0, IDC_ARROWA); 7313 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 7314 wndClass.lpszClassName = WC_LISTVIEWA; 7315 RegisterClassA(&wndClass); 7316 // } 7592 ZeroMemory(&wndClass, sizeof(WNDCLASSA)); 7593 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; 7594 wndClass.lpfnWndProc = (WNDPROC)LISTVIEW_WindowProc; 7595 wndClass.cbClsExtra = 0; 7596 wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *); 7597 wndClass.hCursor = LoadCursorA(0, IDC_ARROWA); 7598 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 7599 wndClass.lpszClassName = WC_LISTVIEWA; 7600 RegisterClassA(&wndClass); 7317 7601 } 7318 7602 … … 7329 7613 VOID LISTVIEW_Unregister(VOID) 7330 7614 { 7331 if (GlobalFindAtomA(WC_LISTVIEWA)) 7332 { 7333 UnregisterClassA(WC_LISTVIEWA, (HINSTANCE)NULL); 7334 } 7615 UnregisterClassA(WC_LISTVIEWA, (HINSTANCE)NULL); 7335 7616 } 7336 7617 … … 7355 7636 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 7356 7637 HDC hdc = GetDC(infoPtr->hwndEdit); 7638 HFONT hFont, hOldFont = 0; 7357 7639 RECT rect; 7358 7640 SIZE sz; 7359 7360 GetWindowTextA(infoPtr->hwndEdit, buffer, 1024); 7641 int len; 7642 7643 len = GetWindowTextA(infoPtr->hwndEdit, buffer, 1023); 7361 7644 GetWindowRect(infoPtr->hwndEdit, &rect); 7645 7646 /* Select font to get the right dimension of the string */ 7647 hFont = SendMessageA(infoPtr->hwndEdit, WM_GETFONT, 0, 0); 7648 if(hFont != 0) 7649 { 7650 hOldFont = SelectObject(hdc, hFont); 7651 } 7652 7362 7653 if (GetTextExtentPoint32A(hdc, buffer, strlen(buffer), &sz)) 7363 7654 { 7364 SetWindowPos ( 7365 infoPtr->hwndEdit, 7366 HWND_TOP, 7367 0, 7368 0, 7369 sz.cx + 15, 7370 rect.bottom - rect.top, 7371 SWP_DRAWFRAME|SWP_NOMOVE); 7655 TEXTMETRICA textMetric; 7656 7657 /* Add Extra spacing for the next character */ 7658 GetTextMetricsA(hdc, &textMetric); 7659 sz.cx += (textMetric.tmMaxCharWidth * 2); 7660 7661 SetWindowPos ( 7662 infoPtr->hwndEdit, 7663 HWND_TOP, 7664 0, 7665 0, 7666 sz.cx, 7667 rect.bottom - rect.top, 7668 SWP_DRAWFRAME|SWP_NOMOVE); 7372 7669 } 7670 if(hFont != 0) 7671 { 7672 SelectObject(hdc, hOldFont); 7673 } 7674 7373 7675 ReleaseDC(hwnd, hdc); 7374 7676 … … 7383 7685 } 7384 7686 7385 7386 7687 /*** 7387 7688 * DESCRIPTION: … … 7395 7696 WPARAM wParam, LPARAM lParam) 7396 7697 { 7397 BOOL cancel = TRUE;7698 BOOL cancel = FALSE; 7398 7699 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(GetParent(hwnd), 0); 7399 7700 EDITLABEL_ITEM *einfo = infoPtr->pedititem; 7701 static BOOL bIgnoreKillFocus = FALSE; 7400 7702 7401 7703 switch (uMsg) … … 7405 7707 7406 7708 case WM_KILLFOCUS: 7709 if(bIgnoreKillFocus) 7710 { 7711 return TRUE; 7712 } 7407 7713 break; 7408 7714 … … 7417 7723 7418 7724 case WM_CHAR: 7419 if (VK_ RETURN== (INT)wParam)7725 if (VK_ESCAPE == (INT)wParam) 7420 7726 { 7421 cancel = FALSE;7727 cancel = TRUE; 7422 7728 break; 7423 7729 } 7424 else if (VK_ ESCAPE== (INT)wParam)7730 else if (VK_RETURN == (INT)wParam) 7425 7731 break; 7426 7732 … … 7446 7752 } 7447 7753 } 7448 7754 /* Processing LVN_ENDLABELEDIT message could kill the focus */ 7755 /* eg. Using a messagebox */ 7756 bIgnoreKillFocus = TRUE; 7449 7757 einfo->EditLblCb(GetParent(hwnd), buffer, einfo->param); 7450 7758 … … 7453 7761 7454 7762 einfo->EditLblCb = NULL; 7763 bIgnoreKillFocus = FALSE; 7455 7764 } 7456 7765 … … 7458 7767 return TRUE; 7459 7768 } 7460 7461 7769 7462 7770 /*** … … 7473 7781 { 7474 7782 HWND hedit; 7783 SIZE sz; 7784 HDC hdc; 7785 HDC hOldFont=0; 7786 TEXTMETRICA textMetric; 7475 7787 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(parent, 0); 7788 7476 7789 if (NULL == (infoPtr->pedititem = COMCTL32_Alloc(sizeof(EDITLABEL_ITEM)))) 7477 7790 return 0; 7478 7791 7479 7792 style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|WS_BORDER; 7480 if (!(hedit = CreateWindowA("Edit", text, style, x, y, width, height, 7793 hdc = GetDC(parent); 7794 7795 /* Select the font to get appropriate metric dimensions */ 7796 if(infoPtr->hFont != 0) 7797 { 7798 hOldFont = SelectObject(hdc, infoPtr->hFont); 7799 } 7800 7801 /*Get String Lenght in pixels */ 7802 GetTextExtentPoint32A(hdc, text, strlen(text), &sz); 7803 7804 /*Add Extra spacing for the next character */ 7805 GetTextMetricsA(hdc, &textMetric); 7806 sz.cx += (textMetric.tmMaxCharWidth * 2); 7807 7808 if(infoPtr->hFont != 0) 7809 { 7810 SelectObject(hdc, hOldFont); 7811 } 7812 7813 ReleaseDC(parent, hdc); 7814 if (!(hedit = CreateWindowA("Edit", text, style, x, y, sz.cx, height, 7481 7815 parent, 0, hinst, 0))) 7482 7816 { … … 7490 7824 GWL_WNDPROC, (LONG) EditLblWndProc); 7491 7825 7826 SendMessageA(hedit, WM_SETFONT, infoPtr->hFont, FALSE); 7827 7492 7828 return hedit; 7493 7829 } -
trunk/src/comctl32/makefile
r2712 r2858 1 # $Id: makefile,v 1.2 1 2000-02-09 23:46:53 birdExp $1 # $Id: makefile,v 1.22 2000-02-22 17:11:40 cbratschi Exp $ 2 2 # 3 3 # PD-Win32 API … … 24 24 nativefont.obj pager.obj tab.obj status.obj header.obj updown.obj \ 25 25 rebar.obj cache.obj trackbar.obj tooltips.obj toolbar.obj treeview.obj \ 26 propsheet.obj listview.obj draglist.obj ipaddress.obj resource.obj 26 propsheet.obj listview.obj draglist.obj ipaddress.obj resource.obj \ 27 ccbase.obj 27 28 28 29 all: $(TARGET).dll $(TARGET).lib -
trunk/src/comctl32/toolbar.c
r2523 r2858 1 /* $Id: toolbar.c,v 1.2 5 2000-01-26 18:04:30 cbratschi Exp $ */1 /* $Id: toolbar.c,v 1.26 2000-02-22 17:11:40 cbratschi Exp $ */ 2 2 /* 3 3 * Toolbar control … … 28 28 */ 29 29 30 /* WINE 991212 level */ 30 /* 31 - Corel 20000212 level 32 - WINE 991212 level 33 */ 31 34 32 35 /* CB: Odin32/WINE bugs … … 616 619 /* the last row. */ 617 620 infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 618 nSepRows * SEPARATOR_WIDTH * 2 / 3+621 nSepRows * (SEPARATOR_WIDTH * 2 / 3) + 619 622 nSepRows * (infoPtr->nBitmapHeight + 1) + 620 623 BOTTOM_BORDER; … … 2197 2200 RECT parent_rect; 2198 2201 HWND parent; 2199 /* INT32 x, y; */2202 INT x, y; 2200 2203 INT cx, cy; 2201 2204 UINT uPosFlags = 0; 2202 2205 2203 // TRACE (toolbar, "resize forced!\n"); 2204 2206 //TRACE (toolbar, "resize forced!\n"); 2207 2208 x = y = 0; 2205 2209 parent = GetParent (hwnd); 2206 2210 GetClientRect(parent, &parent_rect); … … 2225 2229 cy += GetSystemMetrics(SM_CYEDGE); 2226 2230 2231 if (dwStyle & WS_BORDER) 2232 { 2233 x = y = 1; 2234 cy += GetSystemMetrics(SM_CYEDGE); 2235 cx += GetSystemMetrics(SM_CYEDGE); 2236 } 2237 2227 2238 infoPtr->bAutoSize = TRUE; 2228 SetWindowPos (hwnd, HWND_TOP, parent_rect.left , parent_rect.top,2239 SetWindowPos (hwnd, HWND_TOP, parent_rect.left - x, parent_rect.top - y, 2229 2240 cx, cy, uPosFlags); 2230 2241 … … 2290 2301 INT nIndex; 2291 2302 INT nOldIndex = -1; 2303 BOOL bChecked = FALSE; 2292 2304 2293 2305 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); … … 2299 2311 if (!(btnPtr->fsStyle & TBSTYLE_CHECK)) 2300 2312 return FALSE; 2313 2314 bChecked = (btnPtr->fsState & TBSTATE_CHECKED) ? TRUE : FALSE; 2301 2315 2302 2316 if (LOWORD(lParam) == FALSE) … … 2314 2328 } 2315 2329 2316 hdc = GetDC (hwnd); 2317 if (nOldIndex != -1) 2318 TOOLBAR_DrawButton (hwnd, &infoPtr->buttons[nOldIndex], hdc); 2319 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2320 ReleaseDC (hwnd, hdc); 2330 if( bChecked != LOWORD(lParam) ) 2331 { 2332 hdc = GetDC (hwnd); 2333 if (nOldIndex != -1) 2334 TOOLBAR_DrawButton (hwnd, &infoPtr->buttons[nOldIndex], hdc); 2335 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2336 ReleaseDC (hwnd, hdc); 2337 } 2321 2338 2322 2339 /* FIXME: Send a WM_NOTIFY?? */ … … 2439 2456 HDC hdc; 2440 2457 INT nIndex; 2458 BOOL bEnabled = FALSE; 2441 2459 2442 2460 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); … … 2445 2463 2446 2464 btnPtr = &infoPtr->buttons[nIndex]; 2465 bEnabled = (btnPtr->fsState & TBSTATE_ENABLED )? TRUE : FALSE ; 2466 2447 2467 if (LOWORD(lParam) == FALSE) 2448 2468 btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED); … … 2450 2470 btnPtr->fsState |= TBSTATE_ENABLED; 2451 2471 2452 hdc = GetDC (hwnd); 2453 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2454 ReleaseDC (hwnd, hdc); 2472 if( bEnabled != LOWORD(lParam) ) 2473 { 2474 hdc = GetDC (hwnd); 2475 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2476 ReleaseDC (hwnd, hdc); 2477 } 2455 2478 2456 2479 return TRUE; … … 3230 3253 if (((INT)LOWORD(lParam) <= 0) || ((INT)HIWORD(lParam) <= 0)) return FALSE; 3231 3254 3255 /* Bitmap size can only be set before adding any button to the toolbar 3256 according to the documentation. */ 3257 if( infoPtr->nNumButtons != 0 ) 3258 return FALSE; 3259 3232 3260 infoPtr->nBitmapWidth = (INT)LOWORD(lParam); 3233 3261 infoPtr->nBitmapHeight = (INT)HIWORD(lParam); … … 3339 3367 if (((INT)LOWORD(lParam) <= 0) || ((INT)HIWORD(lParam) <= 0)) return FALSE; 3340 3368 3369 /* Button size can only be set before adding any button to the toolbar 3370 according to the documentation. */ 3371 if( infoPtr->nNumButtons != 0 ) 3372 return FALSE; 3373 3341 3374 infoPtr->nButtonWidth = (INT)LOWORD(lParam); 3342 3375 infoPtr->nButtonHeight = (INT)HIWORD(lParam); … … 3670 3703 /* initialize info structure */ 3671 3704 infoPtr->nButtonHeight = 22; 3672 infoPtr->nButtonWidth = 2 3;3705 infoPtr->nButtonWidth = 24; 3673 3706 infoPtr->nBitmapHeight = 15; 3674 3707 infoPtr->nBitmapWidth = 16; … … 4101 4134 GetWindowRect (hwnd, &rcWindow); 4102 4135 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); 4136 if( dwStyle & WS_BORDER ) 4137 OffsetRect (&rcWindow, 1, 1); 4103 4138 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP); 4104 4139 } … … 4162 4197 RECT parent_rect; 4163 4198 HWND parent; 4164 INT x ,y,cx,cy;4199 INT x = 0,y = 0,cx,cy; 4165 4200 INT flags; 4166 4201 UINT uPosFlags = 0; … … 4213 4248 cy += GetSystemMetrics(SM_CYEDGE); 4214 4249 4215 SetWindowPos (hwnd, 0, x, y, 4250 if (dwStyle & WS_BORDER) 4251 { 4252 x = y = 1; 4253 cy += GetSystemMetrics(SM_CYEDGE); 4254 cx += GetSystemMetrics(SM_CYEDGE); 4255 } 4256 4257 SetWindowPos (hwnd, 0, parent_rect.left - x, parent_rect.top - y, 4216 4258 cx, cy, uPosFlags | SWP_NOZORDER); 4217 4259 } … … 4587 4629 { 4588 4630 WNDCLASSA wndClass; 4589 4590 //SvL: Don't check this now4591 // if (GlobalFindAtomA (TOOLBARCLASSNAMEA)) return;4592 4631 4593 4632 ZeroMemory (&wndClass, sizeof(WNDCLASSA)); … … 4607 4646 TOOLBAR_Unregister (VOID) 4608 4647 { 4609 if (GlobalFindAtomA (TOOLBARCLASSNAMEA)) 4610 UnregisterClassA (TOOLBARCLASSNAMEA, (HINSTANCE)NULL); 4611 } 4612 4648 UnregisterClassA (TOOLBARCLASSNAMEA, (HINSTANCE)NULL); 4649 } 4650 -
trunk/src/comctl32/treeview.c
r2835 r2858 1 /* $Id: treeview.c,v 1. 29 2000-02-20 18:29:58cbratschi Exp $ */1 /* $Id: treeview.c,v 1.30 2000-02-22 17:11:41 cbratschi Exp $ */ 2 2 /* Treeview control 3 3 * … … 47 47 #include "commctrl.h" 48 48 #include "comctl32.h" 49 #include "ccbase.h" 49 50 #include "treeview.h" 50 51 … … 2002 2003 INT cChildren; 2003 2004 HTREEITEM hti; 2004 BOOL root ;2005 BOOL root = FALSE; 2005 2006 2006 2007 /* Obtain the TVSORTBC struct */ … … 2690 2691 2691 2692 /* allocate memory for info structure */ 2692 infoPtr = (TREEVIEW_INFO *) COMCTL32_Alloc (sizeof(TREEVIEW_INFO)); 2693 2694 SetWindowLongA( hwnd, 0, (DWORD)infoPtr); 2693 infoPtr = (TREEVIEW_INFO*)initControl(hwnd,sizeof(TREEVIEW_INFO)); 2695 2694 2696 2695 if (infoPtr == NULL) return 0; 2697 2698 if ((TREEVIEW_INFO*)GetWindowLongA(hwnd,0) != infoPtr) return 0;2699 2696 2700 2697 hdc = GetDC(hwnd); … … 2702 2699 /* set default settings */ 2703 2700 infoPtr->uInternalStatus = TV_CALCALL; 2704 if (IsWindowUnicode(hwnd)) infoPtr->uInternalStatus |= TV_UNICODE;2705 2701 infoPtr->uNumItems = 0; 2706 2702 infoPtr->clrBk = GetSysColor (COLOR_WINDOW); … … 2809 2805 DeleteObject(infoPtr->hBoldFont); 2810 2806 COMCTL32_Free(infoPtr->pszISearch); 2811 COMCTL32_Free (infoPtr);2807 doneControl(hwnd); 2812 2808 2813 2809 return 0; … … 2906 2902 TREEVIEW_ITEM *wineItem; 2907 2903 HWND parent = GetParent(hwnd); 2908 BOOL unicode = IsWindowUnicode(parent),rc;2909 2904 CHAR *oldText = NULL,*newText = NULL; 2905 BOOL rc; 2910 2906 2911 2907 ZeroMemory(&nmhdr,sizeof(NMTREEVIEWW)); … … 2923 2919 nmhdr.itemOld.stateMask = wineItem->stateMask; 2924 2920 nmhdr.itemOld.iImage = wineItem->iImage; 2925 if ( !unicode)2921 if (infoPtr->header.uNotifyFormat == NFR_ANSI) 2926 2922 { 2927 2923 if (!wineItem->pszText) nmhdr.itemOld.pszText = NULL; else … … 2949 2945 nmhdr.itemNew.stateMask = wineItem->stateMask; 2950 2946 nmhdr.itemNew.iImage = wineItem->iImage; 2951 if ( !unicode)2947 if (infoPtr->header.uNotifyFormat == NFR_ANSI) 2952 2948 { 2953 2949 if (!wineItem->pszText) nmhdr.itemOld.pszText = NULL; else … … 2970 2966 nmhdr.ptDrag.y = 0; 2971 2967 2972 if (unicode) 2973 rc = (BOOL)SendMessageW(parent,WM_NOTIFY,(WPARAM)GetWindowLongW(hwnd,GWL_ID),(LPARAM)&nmhdr); 2974 else 2975 rc = (BOOL)SendMessageA(parent,WM_NOTIFY,(WPARAM)GetWindowLongA(hwnd,GWL_ID),(LPARAM)&nmhdr); 2968 rc = (BOOL)SendMessageA(parent,WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 2976 2969 2977 2970 if (oldText) COMCTL32_Free(oldText); … … 3010 3003 TREEVIEW_SendDispInfoNotify (HWND hwnd, TREEVIEW_ITEM *wineItem, UINT code, UINT what) 3011 3004 { 3005 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 3012 3006 NMTVDISPINFOW tvdi; 3013 3007 BOOL retval; 3014 3008 WCHAR *buf; 3015 3009 HWND parent = GetParent(hwnd); 3016 BOOL unicode = IsWindowUnicode(parent);3017 3010 3018 3011 tvdi.hdr.hwndFrom = hwnd; … … 3023 3016 tvdi.item.state = wineItem->state; 3024 3017 tvdi.item.lParam = wineItem->lParam; 3025 tvdi.item.pszText = COMCTL32_Alloc(128*( unicode? sizeof(WCHAR):sizeof(char)));3018 tvdi.item.pszText = COMCTL32_Alloc(128*((infoPtr->header.uNotifyFormat == NFR_UNICODE) ? sizeof(WCHAR):sizeof(char))); 3026 3019 tvdi.item.cchTextMax = 128; 3027 3020 buf = tvdi.item.pszText; 3028 3021 3029 if (unicode) 3030 retval = (BOOL)SendMessageW(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi); 3031 else 3032 retval = (BOOL)SendMessageA(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi); 3022 retval = (BOOL)SendMessageA(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi); 3033 3023 3034 3024 /* Ignore posible changes */ … … 3038 3028 if (what & TVIF_TEXT) 3039 3029 { 3040 if ( unicode)3030 if (infoPtr->header.uNotifyFormat == NFR_UNICODE) 3041 3031 { 3042 3032 wineItem->pszText = tvdi.item.pszText; … … 3069 3059 3070 3060 if (what & TVIF_SELECTEDIMAGE) 3071 3061 wineItem->iSelectedImage = tvdi.item.iSelectedImage; 3072 3062 if (what & TVIF_IMAGE) 3073 3063 wineItem->iImage = tvdi.item.iImage; 3074 3064 if (what & TVIF_CHILDREN) 3075 3076 3077 return retval;3065 wineItem->cChildren = tvdi.item.cChildren; 3066 3067 return retval; 3078 3068 } 3079 3069 … … 3086 3076 LPNMCUSTOMDRAW nmcd; 3087 3077 3088 nmcd =& nmcdhdr.nmcd;3078 nmcd =& nmcdhdr.nmcd; 3089 3079 nmcd->hdr.hwndFrom = hwnd; 3090 3080 nmcd->hdr.idFrom = GetWindowLongA( hwnd, GWL_ID); … … 3452 3442 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 3453 3443 HWND parent = GetParent(hwnd); 3454 BOOL unicode = IsWindowUnicode(parent);3455 3444 BOOL bCommit; 3456 3445 WCHAR *textW = NULL; … … 3479 3468 //} 3480 3469 3481 if ( unicode) tvdi.item.pszText = textW; else3470 if (infoPtr->header.uNotifyFormat == NFR_UNICODE) tvdi.item.pszText = textW; else 3482 3471 { 3483 3472 INT len = iLength+1; … … 3495 3484 } 3496 3485 3497 if (unicode) 3498 bCommit=(BOOL)SendMessageW(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi); 3499 else 3500 bCommit=(BOOL)SendMessageA(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi); 3486 bCommit = (BOOL)SendMessageA(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi); 3501 3487 3502 3488 if (!bCancel && bCommit) /* Apply the changes */ 3503 3489 { 3504 if ( !unicode)3490 if (infoPtr->header.uNotifyFormat == NFR_ANSI) 3505 3491 lstrcpynAtoW(textW,textA,iLength+1); 3506 3492 if (lstrcmpW(textW,editedItem->pszText) != 0) … … 3646 3632 NMTVGETINFOTIPW tvgit; 3647 3633 HWND parent = GetParent(hwnd); 3648 BOOL unicode = IsWindowUnicode(parent);3649 3634 3650 3635 tvgit.hdr.hwndFrom = hwnd; 3651 3636 tvgit.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); 3652 tvgit.hdr.code = unicode? TVN_GETINFOTIPW:TVN_GETINFOTIPA;3653 tvgit.pszText = COMCTL32_Alloc( unicode? INFOTIPSIZE*sizeof(WCHAR):INFOTIPSIZE*sizeof(CHAR));3637 tvgit.hdr.code = (infoPtr->header.uNotifyFormat == NFR_UNICODE) ? TVN_GETINFOTIPW:TVN_GETINFOTIPA; 3638 tvgit.pszText = COMCTL32_Alloc((infoPtr->header.uNotifyFormat == NFR_UNICODE) ? INFOTIPSIZE*sizeof(WCHAR):INFOTIPSIZE*sizeof(CHAR)); 3654 3639 tvgit.cchTextMax = INFOTIPSIZE; 3655 3640 tvgit.hItem = item->hItem; 3656 3641 tvgit.lParam = item->lParam; 3657 3642 3658 if (unicode) 3643 SendMessageA(parent,WM_NOTIFY,(WPARAM)tvgit.hdr.idFrom,(LPARAM)&tvgit); 3644 if (infoPtr->header.uNotifyFormat == NFR_UNICODE) 3659 3645 { 3660 SendMessageW(parent,WM_NOTIFY,(WPARAM)tvgit.hdr.idFrom,(LPARAM)&tvgit);3661 3646 text = tvgit.pszText; 3662 3647 } else 3663 3648 { 3664 SendMessageA(parent,WM_NOTIFY,(WPARAM)tvgit.hdr.idFrom,(LPARAM)&tvgit);3665 3649 text = COMCTL32_Alloc(tvgit.cchTextMax*sizeof(WCHAR)); 3666 3650 lstrcpyAtoW(text,(LPSTR)tvgit.pszText); … … 4598 4582 } 4599 4583 4600 static LRESULT TREEVIEW_GetUnicodeFormat(HWND hwnd,WPARAM wParam,LPARAM lParam)4601 {4602 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);4603 4604 return infoPtr->uInternalStatus & TV_UNICODE;4605 }4606 4607 static LRESULT TREEVIEW_SetUnicodeFormat(HWND hwnd,WPARAM wParam,LPARAM lParam)4608 {4609 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);4610 BOOL oldFormat = infoPtr->uInternalStatus & TV_UNICODE;4611 4612 if (wParam)4613 infoPtr->uInternalStatus |= TV_UNICODE;4614 else4615 infoPtr->uInternalStatus &= ~TV_UNICODE;4616 4617 return oldFormat;4618 }4619 4620 4584 static LRESULT WINAPI 4621 4585 TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) … … 4760 4724 case TVM_GETINSERTMARKCOLOR: 4761 4725 return TREEVIEW_GetInsertMarkColor (hwnd,wParam, lParam); 4762 4763 case TVM_GETUNICODEFORMAT:4764 return TREEVIEW_GetUnicodeFormat(hwnd,wParam,lParam);4765 4766 case TVM_SETUNICODEFORMAT:4767 return TREEVIEW_SetUnicodeFormat(hwnd,wParam,lParam);4768 4726 4769 4727 case WM_COMMAND: … … 4853 4811 // FIXME (treeview, "Unknown msg %04x wp=%08x lp=%08lx\n", 4854 4812 // uMsg, wParam, lParam); 4855 return DefWindowProcA (hwnd, uMsg, wParam,lParam);4813 return defComCtl32ProcA(hwnd,uMsg,wParam,lParam); 4856 4814 } 4857 4815 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.