Changeset 2895 for trunk/src/comctl32/treeview.cpp
- Timestamp:
- Feb 25, 2000, 6:00:18 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/treeview.cpp
r2875 r2895 1 /* $Id: treeview.cpp,v 1. 1 2000-02-23 17:09:50cbratschi Exp $ */1 /* $Id: treeview.cpp,v 1.2 2000-02-25 17:00:18 cbratschi Exp $ */ 2 2 /* Treeview control 3 3 * … … 32 32 /* CB: todo 33 33 - bug in SetScrollInfo/ShowScrollBar: WM_SIZE and WM_NCPAINT problems (i.e. RegEdit) 34 - VK_LEFT in WinHlp32 displays expanded icon 34 35 - tooltips not finished 35 36 - expand not finished … … 325 326 if (killItem->pszText != LPSTR_TEXTCALLBACKW) 326 327 COMCTL32_Free (killItem->pszText); 328 killItem->pszText = NULL; 327 329 TREEVIEW_SendTreeviewNotify (hwnd, TVN_DELETEITEM, 0, (HTREEITEM)kill, 0); 328 330 if (killItem->firstChild) … … 351 353 if (wineItem->pszText != LPSTR_TEXTCALLBACKW) 352 354 COMCTL32_Free (wineItem->pszText); 355 wineItem->pszText = NULL; 353 356 354 357 TREEVIEW_SendTreeviewNotify (hwnd, TVN_DELETEITEM, 0, (HTREEITEM)iItem, 0); … … 397 400 if (killItem->pszText != LPSTR_TEXTCALLBACKW) 398 401 COMCTL32_Free (killItem->pszText); 402 killItem->pszText = NULL; 403 399 404 TREEVIEW_SendTreeviewNotify 400 405 (hwnd, TVN_DELETEITEM, 0, killItem->hItem, 0); … … 2847 2852 NMTREEVIEWW nmhdr; 2848 2853 TREEVIEW_ITEM *wineItem; 2849 HWND parent = GetParent(hwnd);2850 2854 CHAR *oldText = NULL,*newText = NULL; 2851 2855 BOOL rc; … … 2853 2857 ZeroMemory(&nmhdr,sizeof(NMTREEVIEWW)); 2854 2858 2855 nmhdr.hdr.hwndFrom = hwnd;2856 nmhdr.hdr.idFrom = GetWindowLongW( hwnd, GWL_ID);2857 nmhdr.hdr.code = code;2858 2859 nmhdr.action = action; 2859 2860 if (oldItem) 2860 2861 { 2861 wineItem =&infoPtr->items[(INT)oldItem];2862 nmhdr.itemOld.mask 2863 nmhdr.itemOld.hItem 2864 nmhdr.itemOld.state 2862 wineItem = &infoPtr->items[(INT)oldItem]; 2863 nmhdr.itemOld.mask = wineItem->mask; 2864 nmhdr.itemOld.hItem = wineItem->hItem; 2865 nmhdr.itemOld.state = wineItem->state; 2865 2866 nmhdr.itemOld.stateMask = wineItem->stateMask; 2866 2867 nmhdr.itemOld.iImage = wineItem->iImage; 2867 if ( infoPtr->header.uNotifyFormat == NFR_ANSI)2868 if (!isUnicodeNotify(&infoPtr->header)) 2868 2869 { 2869 2870 if (!wineItem->pszText) nmhdr.itemOld.pszText = NULL; else … … 2885 2886 if (newItem) 2886 2887 { 2887 wineItem =&infoPtr->items[(INT)newItem];2888 wineItem = &infoPtr->items[(INT)newItem]; 2888 2889 nmhdr.itemNew.mask = wineItem->mask; 2889 2890 nmhdr.itemNew.hItem = wineItem->hItem; … … 2891 2892 nmhdr.itemNew.stateMask = wineItem->stateMask; 2892 2893 nmhdr.itemNew.iImage = wineItem->iImage; 2893 if ( infoPtr->header.uNotifyFormat == NFR_ANSI)2894 { 2895 if (!wineItem->pszText) nmhdr.item Old.pszText = NULL; else2894 if (!isUnicodeNotify(&infoPtr->header)) 2895 { 2896 if (!wineItem->pszText) nmhdr.itemNew.pszText = NULL; else 2896 2897 { 2897 2898 INT len = lstrlenW(wineItem->pszText)+1; … … 2899 2900 newText = (CHAR*)COMCTL32_Alloc(len); 2900 2901 lstrcpyWtoA(newText,wineItem->pszText); 2901 nmhdr.item Old.pszText = (WCHAR*)newText;2902 nmhdr.itemNew.pszText = (WCHAR*)newText; 2902 2903 } 2903 2904 } else nmhdr.itemNew.pszText = wineItem->pszText; … … 2912 2913 nmhdr.ptDrag.y = 0; 2913 2914 2914 rc = (BOOL) SendMessageA(parent,WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr);2915 rc = (BOOL)sendNotify(hwnd,code,&nmhdr.hdr); 2915 2916 2916 2917 if (oldText) COMCTL32_Free(oldText); … … 2928 2929 TREEVIEW_ITEM *wineItem; 2929 2930 2930 nmhdr.hdr.hwndFrom = hwnd;2931 nmhdr.hdr.idFrom = GetWindowLongA( hwnd, GWL_ID);2932 nmhdr.hdr.code = code;2933 2931 nmhdr.action = 0; 2934 2932 wineItem=& infoPtr->items[(INT)dragItem]; … … 2941 2939 nmhdr.ptDrag.y = pt.y; 2942 2940 2943 return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY, 2944 (WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmhdr); 2941 return (BOOL)sendNotify(hwnd,code,&nmhdr.hdr); 2945 2942 2946 2943 } … … 2953 2950 BOOL retval; 2954 2951 WCHAR *buf; 2955 HWND parent = GetParent(hwnd); 2956 2957 tvdi.hdr.hwndFrom = hwnd; 2958 tvdi.hdr.idFrom = GetWindowLongA( hwnd, GWL_ID); 2959 tvdi.hdr.code = code; 2952 2960 2953 tvdi.item.mask = what; 2961 2954 tvdi.item.hItem = wineItem->hItem; 2962 2955 tvdi.item.state = wineItem->state; 2963 2956 tvdi.item.lParam = wineItem->lParam; 2964 tvdi.item.pszText = (WCHAR*)COMCTL32_Alloc(128*( (infoPtr->header.uNotifyFormat == NFR_UNICODE) ? sizeof(WCHAR):sizeof(char)));2957 tvdi.item.pszText = (WCHAR*)COMCTL32_Alloc(128*(isUnicodeNotify(&infoPtr->header) ? sizeof(WCHAR):sizeof(char))); 2965 2958 tvdi.item.cchTextMax = 128; 2966 2959 buf = tvdi.item.pszText; 2967 2960 2968 retval = (BOOL) SendMessageA(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi);2961 retval = (BOOL)sendNotify(hwnd,code,&tvdi.hdr); 2969 2962 2970 2963 /* Ignore posible changes */ … … 2974 2967 if (what & TVIF_TEXT) 2975 2968 { 2976 if (i nfoPtr->header.uNotifyFormat == NFR_UNICODE)2969 if (isUnicodeNotify(&infoPtr->header)) 2977 2970 { 2978 2971 wineItem->pszText = tvdi.item.pszText; … … 3022 3015 LPNMCUSTOMDRAW nmcd; 3023 3016 3024 nmcd =& nmcdhdr.nmcd; 3025 nmcd->hdr.hwndFrom = hwnd; 3026 nmcd->hdr.idFrom = GetWindowLongA( hwnd, GWL_ID); 3027 nmcd->hdr.code = NM_CUSTOMDRAW; 3017 nmcd = &nmcdhdr.nmcd; 3028 3018 nmcd->dwDrawStage= dwDrawStage; 3029 3019 nmcd->hdc = hdc; … … 3039 3029 nmcdhdr.iLevel = 0; 3040 3030 3041 return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY, 3042 (WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmcdhdr); 3031 return (BOOL)sendNotify(hwnd,NM_CUSTOMDRAW,&nmcdhdr.nmcd.hdr); 3043 3032 } 3044 3033 … … 3067 3056 3068 3057 nmcd= & nmcdhdr.nmcd; 3069 nmcd->hdr.hwndFrom = hwnd;3070 nmcd->hdr.idFrom = GetWindowLongA( hwnd, GWL_ID);3071 nmcd->hdr.code = NM_CUSTOMDRAW;3072 3058 nmcd->dwDrawStage= dwDrawStage; 3073 3059 nmcd->hdc = hdc; … … 3087 3073 // dwDrawStage, hdc, dwItemSpec, uItemState); 3088 3074 3089 retval=SendMessageA (GetParent (hwnd), WM_NOTIFY, 3090 (WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmcdhdr); 3075 retval = sendNotify(hwnd,NM_CUSTOMDRAW,&nmcdhdr.nmcd.hdr); 3091 3076 3092 3077 infoPtr->clrText=nmcdhdr.clrText; … … 3100 3085 NMTVKEYDOWN nmkdhdr; 3101 3086 3102 nmkdhdr.hdr.hwndFrom = hwnd;3103 nmkdhdr.hdr.idFrom = GetWindowLongA( hwnd, GWL_ID);3104 nmkdhdr.hdr.code = code;3105 3087 nmkdhdr.wVKey = wVKey; 3106 3088 nmkdhdr.flags = 0; 3107 3089 3108 SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmkdhdr.hdr.idFrom,(LPARAM)&nmkdhdr);3090 sendNotify(hwnd,code,&nmkdhdr.hdr); 3109 3091 } 3110 3092 … … 3387 3369 NMTVDISPINFOW tvdi; 3388 3370 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 3389 HWND parent = GetParent(hwnd);3390 3371 BOOL bCommit; 3391 3372 WCHAR *textW = NULL; … … 3396 3377 return FALSE; 3397 3378 3398 tvdi.hdr.hwndFrom = hwnd;3399 tvdi.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID);3400 tvdi.hdr.code = TVN_ENDLABELEDIT;3401 3379 tvdi.item.mask = 0; 3402 3380 tvdi.item.hItem = editedItem->hItem; … … 3414 3392 //} 3415 3393 3416 if (i nfoPtr->header.uNotifyFormat == NFR_UNICODE) tvdi.item.pszText = textW; else3394 if (isUnicodeNotify(&infoPtr->header)) tvdi.item.pszText = textW; else 3417 3395 { 3418 3396 INT len = iLength+1; … … 3430 3408 } 3431 3409 3432 bCommit = (BOOL) SendMessageA(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi);3410 bCommit = (BOOL)sendNotify(hwnd,TVN_ENDLABELEDIT,&tvdi.hdr); 3433 3411 3434 3412 if (!bCancel && bCommit) /* Apply the changes */ 3435 3413 { 3436 if ( infoPtr->header.uNotifyFormat == NFR_ANSI)3414 if (!isUnicodeNotify(&infoPtr->header)) 3437 3415 lstrcpynAtoW(textW,textA,iLength+1); 3438 3416 if (lstrcmpW(textW,editedItem->pszText) != 0) … … 3577 3555 { 3578 3556 NMTVGETINFOTIPW tvgit; 3579 HWND parent = GetParent(hwnd); 3580 3581 tvgit.hdr.hwndFrom = hwnd; 3582 tvgit.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); 3583 tvgit.hdr.code = (infoPtr->header.uNotifyFormat == NFR_UNICODE) ? TVN_GETINFOTIPW:TVN_GETINFOTIPA; 3584 tvgit.pszText = (WCHAR*)COMCTL32_Alloc((infoPtr->header.uNotifyFormat == NFR_UNICODE) ? INFOTIPSIZE*sizeof(WCHAR):INFOTIPSIZE*sizeof(CHAR)); 3557 3558 tvgit.pszText = (WCHAR*)COMCTL32_Alloc(isUnicodeNotify(&infoPtr->header) ? INFOTIPSIZE*sizeof(WCHAR):INFOTIPSIZE*sizeof(CHAR)); 3585 3559 tvgit.cchTextMax = INFOTIPSIZE; 3586 3560 tvgit.hItem = item->hItem; 3587 3561 tvgit.lParam = item->lParam; 3588 3562 3589 SendMessageA(parent,WM_NOTIFY,(WPARAM)tvgit.hdr.idFrom,(LPARAM)&tvgit);3590 if (i nfoPtr->header.uNotifyFormat == NFR_UNICODE)3563 sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_GETINFOTIPW:TVN_GETINFOTIPA,&tvgit.hdr); 3564 if (isUnicodeNotify(&infoPtr->header)) 3591 3565 { 3592 3566 text = tvgit.pszText; … … 4010 3984 4011 3985 case SB_PAGEUP: 4012 newY = infoPtr->lefttop.y-MAX(((INT)(infoPtr->uVisibleHeight/infoPtr->uVScrollStep))*infoPtr->uVScrollStep,infoPtr->uV isibleHeight);3986 newY = infoPtr->lefttop.y-MAX(((INT)(infoPtr->uVisibleHeight/infoPtr->uVScrollStep))*infoPtr->uVScrollStep,infoPtr->uVScrollStep); 4013 3987 if (newY < 0) newY = 0; 4014 3988 break; 4015 3989 4016 3990 case SB_PAGEDOWN: 4017 newY = infoPtr->lefttop.y+MAX(((INT)(infoPtr->uVisibleHeight/infoPtr->uVScrollStep))*infoPtr->uVScrollStep,infoPtr->uV isibleHeight);3991 newY = infoPtr->lefttop.y+MAX(((INT)(infoPtr->uVisibleHeight/infoPtr->uVScrollStep))*infoPtr->uVScrollStep,infoPtr->uVScrollStep); 4018 3992 if (newY > maxY) newY = maxY; 4019 3993 break;
Note:
See TracChangeset
for help on using the changeset viewer.