- Timestamp:
- Feb 25, 2000, 6:00:18 PM (26 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/CCBase.cpp
r2875 r2895 1 /* $Id: CCBase.cpp,v 1. 1 2000-02-23 17:09:39cbratschi Exp $ */1 /* $Id: CCBase.cpp,v 1.2 2000-02-25 17:00:15 cbratschi Exp $ */ 2 2 /* 3 3 * COMCTL32 Base Functions and Macros for all Controls … … 30 30 31 31 setInfoPtr(hwnd,infoPtr); 32 ZeroMemory(infoPtr,dwSize); 32 33 infoPtr->dwSize = dwSize; 33 34 infoPtr->iVersion = 0; … … 90 91 } else return IsWindowUnicode(hwnd); 91 92 92 case WM_NOTIFY :93 case WM_NOTIFYFORMAT: 93 94 { 94 95 infoPtr = getInfoPtr(hwnd); … … 128 129 //Notifications 129 130 131 BOOL isUnicodeNotify(COMCTL32_HEADER *infoPtr) 132 { 133 if (!infoPtr) return FALSE; 134 135 return infoPtr->uNotifyFormat == NFR_UNICODE; 136 } 137 138 BOOL isUnicodeNotify(HWND hwnd) 139 { 140 COMCTL32_HEADER *infoPtr = getInfoPtr(hwnd); 141 142 return isUnicodeNotify(infoPtr); 143 } 144 130 145 LRESULT sendNotify(HWND hwnd,UINT code) 131 146 { … … 136 151 nmhdr.code = code; 137 152 138 return SendMessageA( hwnd,WM_NOTIFY,nmhdr.idFrom,(LPARAM)&nmhdr);153 return SendMessageA(GetParent(hwnd),WM_NOTIFY,nmhdr.idFrom,(LPARAM)&nmhdr); 139 154 } 140 155 … … 147 162 nmhdr->code = code; 148 163 149 return SendMessageA( hwnd,WM_NOTIFY,nmhdr->idFrom,(LPARAM)nmhdr);164 return SendMessageA(GetParent(hwnd),WM_NOTIFY,nmhdr->idFrom,(LPARAM)nmhdr); 150 165 } 151 166 -
trunk/src/comctl32/CCBase.h
r2875 r2895 1 /* $Id: CCBase.h,v 1. 2 2000-02-23 17:09:40cbratschi Exp $ */1 /* $Id: CCBase.h,v 1.3 2000-02-25 17:00:15 cbratschi Exp $ */ 2 2 /* 3 3 * COMCTL32 Base Functions and Macros for all Controls … … 25 25 LRESULT defComCtl32ProcW(HWND hwnd,UINT Msg,WPARAM wParam,LPARAM lParam); 26 26 27 BOOL isUnicodeNotify(COMCTL32_HEADER *infoPtr); 28 BOOL isUnicodeNotify(HWND hwnd); 29 27 30 LRESULT sendNotify(HWND hwnd,UINT code); 28 31 LRESULT sendNotify(HWND hwnd,UINT code,LPNMHDR nmhdr); -
trunk/src/comctl32/comboex.cpp
r2875 r2895 1 /* $Id: comboex.cpp,v 1. 1 2000-02-23 17:09:40cbratschi Exp $ */1 /* $Id: comboex.cpp,v 1.2 2000-02-25 17:00:15 cbratschi Exp $ */ 2 2 /* 3 3 * ComboBoxEx control … … 311 311 WNDCLASSA wndClass; 312 312 313 //SvL: Don't check this now314 // if (GlobalFindAtomA (WC_COMBOBOXEXA)) return;315 316 313 ZeroMemory (&wndClass, sizeof(WNDCLASSA)); 317 314 wndClass.style = CS_GLOBALCLASS; … … 330 327 COMBOEX_Unregister (VOID) 331 328 { 332 if (GlobalFindAtomA (WC_COMBOBOXEXA)) 333 UnregisterClassA (WC_COMBOBOXEXA, (HINSTANCE)NULL); 334 } 335 329 UnregisterClassA (WC_COMBOBOXEXA, (HINSTANCE)NULL); 330 } 331 -
trunk/src/comctl32/datetime.cpp
r2875 r2895 1 /* $Id: datetime.cpp,v 1. 1 2000-02-23 17:09:41cbratschi Exp $ */1 /* $Id: datetime.cpp,v 1.2 2000-02-25 17:00:15 cbratschi Exp $ */ 2 2 /* 3 3 * Date and time picker control … … 19 19 #include "winbase.h" 20 20 #include "commctrl.h" 21 #include "ccbase.h" 21 22 #include "datetime.h" 22 23 #include "monthcal.h" … … 25 26 26 27 27 #define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0)) 28 static BOOL 29 30 DATETIME_SendSimpleNotify (HWND hwnd, UINT code); 28 #define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO*)getInfoPtr(hwnd)) 31 29 32 30 static char *days[] = {"Sunday", "Monday", "Tuesday", "Wednesday", … … 282 280 283 281 SetFocus (hwnd); 284 DATETIME_SendSimpleNotify (hwnd,DTN_DROPDOWN);282 sendNotify(hwnd,DTN_DROPDOWN); 285 283 } 286 284 return 0; … … 335 333 336 334 if (infoPtr->select) { 337 DATETIME_SendSimpleNotify (hwnd,NM_KILLFOCUS);335 sendNotify(hwnd,NM_KILLFOCUS); 338 336 infoPtr->select&= ~DTHT_GOTFOCUS; 339 337 } … … 356 354 357 355 if (infoPtr->select) { 358 DATETIME_SendSimpleNotify (hwnd,NM_SETFOCUS);356 sendNotify(hwnd,NM_SETFOCUS); 359 357 infoPtr->select|=DTHT_GOTFOCUS; 360 358 } … … 367 365 368 366 369 static BOOL370 DATETIME_SendSimpleNotify (HWND hwnd, UINT code)371 {372 NMHDR nmhdr;373 374 //TRACE("%x\n",code);375 nmhdr.hwndFrom = hwnd;376 nmhdr.idFrom = GetWindowLongA( hwnd, GWL_ID);377 nmhdr.code = code;378 379 return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,380 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);381 }382 383 384 385 386 387 388 367 static LRESULT 389 368 DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) … … 393 372 394 373 /* allocate memory for info structure */ 395 infoPtr = (DATETIME_INFO *)COMCTL32_Alloc (sizeof(DATETIME_INFO));374 infoPtr = (DATETIME_INFO*)initControl(hwnd,sizeof(DATETIME_INFO)); 396 375 if (infoPtr == NULL) { 397 376 //ERR("could not allocate info memory!\n"); 398 377 return 0; 399 378 } 400 401 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);402 379 403 380 if (dwStyle & DTS_SHOWNONE) { … … 431 408 DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) 432 409 { 433 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 434 435 COMCTL32_Free (infoPtr); 410 doneControl(hwnd); 411 436 412 return 0; 437 413 } … … 513 489 //ERR("unknown msg %04x wp=%08x lp=%08lx\n", 514 490 // uMsg, wParam, lParam); 515 return DefWindowProcA (hwnd, uMsg, wParam, lParam);491 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 516 492 } 517 493 return 0; … … 523 499 { 524 500 WNDCLASSA wndClass; 525 526 //SvL: Don't check this now527 // if (GlobalFindAtomA (DATETIMEPICK_CLASSA)) return;528 501 529 502 ZeroMemory (&wndClass, sizeof(WNDCLASSA)); … … 543 516 DATETIME_Unregister (void) 544 517 { 545 if (GlobalFindAtomA (DATETIMEPICK_CLASSA)) 546 UnregisterClassA (DATETIMEPICK_CLASSA, (HINSTANCE)NULL); 547 } 548 518 UnregisterClassA (DATETIMEPICK_CLASSA, (HINSTANCE)NULL); 519 } 520 -
trunk/src/comctl32/flatsb.cpp
r2875 r2895 1 /* $Id: flatsb.cpp,v 1. 1 2000-02-23 17:09:41cbratschi Exp $ */1 /* $Id: flatsb.cpp,v 1.2 2000-02-25 17:00:15 cbratschi Exp $ */ 2 2 /* 3 3 * Flat Scrollbar control … … 20 20 #include "winbase.h" 21 21 #include "commctrl.h" 22 #include "ccbase.h" 22 23 #include "flatsb.h" 23 24 24 25 25 #define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*) GetWindowLongA (hwnd, 0))26 #define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)getInfoPtr(hwnd)) 26 27 27 28 … … 144 145 // ERR_(datetime)("unknown msg %04x wp=%08x lp=%08lx\n", 145 146 // uMsg, wParam, lParam); 146 return DefWindowProcA (hwnd, uMsg, wParam, lParam);147 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 147 148 } 148 149 return 0; … … 154 155 { 155 156 WNDCLASSA wndClass; 156 157 //SvL: Don't check this now158 // if (GlobalFindAtomA (FLATSB_CLASSA)) return;159 157 160 158 ZeroMemory (&wndClass, sizeof(WNDCLASSA)); … … 174 172 FLATSB_Unregister (VOID) 175 173 { 176 if (GlobalFindAtomA (FLATSB_CLASSA)) 177 UnregisterClassA (FLATSB_CLASSA, (HINSTANCE)NULL); 174 UnregisterClassA (FLATSB_CLASSA, (HINSTANCE)NULL); 178 175 } 179 176 -
trunk/src/comctl32/header.cpp
r2875 r2895 1 /* $Id: header.cpp,v 1. 1 2000-02-23 17:09:42cbratschi Exp $ */1 /* $Id: header.cpp,v 1.2 2000-02-25 17:00:15 cbratschi Exp $ */ 2 2 /* 3 3 * Header control … … 21 21 #include "winbase.h" 22 22 #include "commctrl.h" 23 #include "ccbase.h" 23 24 #include "header.h" 24 25 #include "comctl32.h" … … 33 34 #define TIMER_MS 200 34 35 35 #define HEADER_GetInfoPtr(hwnd) ((HEADER_INFO *)GetWindowLongA(hwnd,0))36 #define HEADER_GetInfoPtr(hwnd) ((HEADER_INFO*)getInfoPtr(hwnd)) 36 37 37 38 static VOID … … 46 47 if (phdi->iImage == I_IMAGECALLBACK) 47 48 { 48 if (IsWindowUnicode(GetParent(hwnd))) 49 { 50 NMHDDISPINFOW nmhdr; 51 52 nmhdr.hdr.hwndFrom = hwnd; 53 nmhdr.hdr.idFrom = GetWindowLongW(hwnd,GWL_ID); 54 nmhdr.hdr.code = HDN_GETDISPINFOW; 55 nmhdr.iItem = iItem; 56 nmhdr.mask = HDI_IMAGE; 57 nmhdr.iImage = 0; 58 nmhdr.lParam = phdi->lParam; 59 60 SendMessageW(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 61 62 iImage = nmhdr.iImage; 63 if (nmhdr.mask & HDI_DI_SETITEM) phdi->iImage = iImage; 64 } else 65 { 66 NMHDDISPINFOA nmhdr; 67 68 nmhdr.hdr.hwndFrom = hwnd; 69 nmhdr.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); 70 nmhdr.hdr.code = HDN_GETDISPINFOA; 71 nmhdr.iItem = iItem; 72 nmhdr.mask = HDI_IMAGE; 73 nmhdr.iImage = 0; 74 nmhdr.lParam = phdi->lParam; 75 76 SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 77 78 iImage = nmhdr.iImage; 79 if (nmhdr.mask & HDI_DI_SETITEM) phdi->iImage = iImage; 80 } 49 NMHDDISPINFOW nmhdr; 50 51 nmhdr.iItem = iItem; 52 nmhdr.mask = HDI_IMAGE; 53 nmhdr.iImage = 0; 54 nmhdr.lParam = phdi->lParam; 55 sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? HDN_GETDISPINFOW:HDN_GETDISPINFOA,&nmhdr.hdr); 56 57 iImage = nmhdr.iImage; 58 if (nmhdr.mask & HDI_DI_SETITEM) phdi->iImage = iImage; 81 59 } else iImage = phdi->iImage; 82 60 … … 280 258 if (phdi->pszText == LPSTR_TEXTCALLBACKW) 281 259 { 282 if (IsWindowUnicode(GetParent(hwnd))) 283 { 284 NMHDDISPINFOW nmhdr; 285 286 nmhdr.hdr.hwndFrom = hwnd; 287 nmhdr.hdr.idFrom = GetWindowLongW(hwnd,GWL_ID); 288 nmhdr.hdr.code = HDN_GETDISPINFOW; 289 nmhdr.iItem = iItem; 290 nmhdr.mask = HDI_TEXT; 291 nmhdr.cchTextMax = phdi->cchTextMax; 260 NMHDDISPINFOW nmhdr; 261 262 nmhdr.iItem = iItem; 263 nmhdr.mask = HDI_TEXT; 264 nmhdr.cchTextMax = phdi->cchTextMax; 265 if (isUnicodeNotify(&infoPtr->header)) 266 { 292 267 nmhdr.pszText = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(WCHAR)); 293 268 if (nmhdr.pszText) nmhdr.pszText[0] = 0; 294 nmhdr.lParam = phdi->lParam; 295 296 SendMessageW(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 297 298 pszText = nmhdr.pszText; 299 if (nmhdr.mask & HDI_DI_SETITEM) 269 } else 270 { 271 nmhdr.pszText = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(CHAR)); 272 if (nmhdr.pszText) ((LPSTR)nmhdr.pszText)[0] = 0; 273 } 274 nmhdr.lParam = phdi->lParam; 275 sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? HDN_GETDISPINFOW:HDN_GETDISPINFOA,&nmhdr.hdr); 276 277 pszText = nmhdr.pszText; 278 if (nmhdr.mask & HDI_DI_SETITEM) 279 { 280 if (isUnicodeNotify(&infoPtr->header)) 300 281 { 301 282 INT len = pszText ? lstrlenW(pszText):0; … … 308 289 COMCTL32_Free(pszText); 309 290 pszText = phdi->pszText; 291 } else 292 { 293 INT len = nmhdr.pszText ? lstrlenA((LPSTR)nmhdr.pszText):0; 294 295 if (len) 296 { 297 pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 298 lstrcpyAtoW(pszText,(LPSTR)nmhdr.pszText); 299 } else pszText = NULL; 300 COMCTL32_Free(nmhdr.pszText); 301 302 if (nmhdr.mask & HDI_DI_SETITEM) 303 phdi->pszText = pszText; 310 304 } 311 } else312 {313 NMHDDISPINFOA nmhdr;314 INT len;315 316 nmhdr.hdr.hwndFrom = hwnd;317 nmhdr.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID);318 nmhdr.hdr.code = HDN_GETDISPINFOA;319 nmhdr.iItem = iItem;320 nmhdr.mask = HDI_TEXT;321 nmhdr.cchTextMax = phdi->cchTextMax;322 nmhdr.pszText = (CHAR*)COMCTL32_Alloc(phdi->cchTextMax);323 if (nmhdr.pszText) nmhdr.pszText[0] = 0;324 nmhdr.lParam = phdi->lParam;325 326 SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr);327 328 len = nmhdr.pszText ? lstrlenA(nmhdr.pszText):0;329 330 if (len)331 {332 pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR));333 lstrcpyAtoW(pszText,nmhdr.pszText);334 } else pszText = NULL;335 COMCTL32_Free(nmhdr.pszText);336 337 if (nmhdr.mask & HDI_DI_SETITEM)338 phdi->pszText = pszText;339 305 } 340 306 } … … 395 361 396 362 //Custom draw 397 cdraw.hdr.hwndFrom = hwnd;398 cdraw.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID);399 cdraw.hdr.code = NM_CUSTOMDRAW;400 363 cdraw.dwDrawStage = CDDS_PREPAINT; 401 364 cdraw.hdc = hdc; … … 405 368 cdraw.lItemlParam = 0; 406 369 407 cdctlres = SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);370 cdctlres = sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr); 408 371 409 372 if (cdctlres & CDRF_SKIPDEFAULT) return; … … 426 389 cdraw.rc = infoPtr->items[x].rect; 427 390 428 cdres = SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);391 cdres = sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr); 429 392 } else cdres = 0; 430 393 … … 442 405 cdraw.dwDrawStage = CDDS_ITEMPOSTPAINT; 443 406 444 SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);407 sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr); 445 408 } 446 409 } 447 410 } 448 411 449 if ( x != -1&& (x <= rect.right) && (infoPtr->uNumItem > 0))412 if ((x != -1) && (x <= rect.right) && (infoPtr->uNumItem > 0)) 450 413 { 451 414 rect.left = x; … … 462 425 if (infoPtr->bDragDrop) 463 426 { 464 if ( infoPtr->iDragItem != infoPtr->iMoveItem && infoPtr->iDragItem != infoPtr->iMoveItem+1 && infoPtr->iDragItem != -1)427 if ((infoPtr->iDragItem != infoPtr->iMoveItem) && (infoPtr->iDragItem != infoPtr->iMoveItem+1) && (infoPtr->iDragItem != -1)) 465 428 { 466 429 INT x,y,width; … … 502 465 GetClientRect(hwnd,&cdraw.rc); 503 466 504 SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)cdraw.hdr.idFrom,(LPARAM)&cdraw);467 sendNotify(hwnd,NM_CUSTOMDRAW,&cdraw.hdr); 505 468 } 506 469 } … … 699 662 } 700 663 701 static BOOL 702 HEADER_SendSimpleNotify (HWND hwnd, UINT code) 703 { 704 NMHDR nmhdr; 705 706 nmhdr.hwndFrom = hwnd; 707 nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 708 nmhdr.code = code; 709 710 return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY, 711 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); 712 } 713 714 static BOOL 715 HEADER_SendHeaderNotifyA(HWND hwnd,UINT code,INT iItem,INT iButton) 664 static BOOL HEADER_SendHeaderNotify(HWND hwnd,UINT code,INT iItem,INT iButton,BOOL unicode) 716 665 { 717 666 HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd); 718 NMHEADER Anmhdr;719 HDITEM Anmitem;720 char* text ;667 NMHEADERW nmhdr; 668 HDITEMW nmitem; 669 char* text = NULL; 721 670 BOOL res; 722 671 723 if (infoPtr->items[iItem].pszText) 724 { 725 INT len = lstrlenW(infoPtr->items[iItem].pszText); 726 727 if (len > 0) 728 { 729 text = (CHAR*)COMCTL32_Alloc(len+1); 730 lstrcpyWtoA(text,infoPtr->items[iItem].pszText); 731 } else text = NULL; 732 } else text = NULL; 733 734 nmhdr.hdr.hwndFrom = hwnd; 735 nmhdr.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); 736 nmhdr.hdr.code = code; 672 673 if (unicode) 674 { 675 nmitem.pszText = infoPtr->items[iItem].pszText; 676 } else 677 { 678 if (infoPtr->items[iItem].pszText) 679 { 680 INT len = lstrlenW(infoPtr->items[iItem].pszText); 681 682 if (len > 0) 683 { 684 text = (CHAR*)COMCTL32_Alloc(len+1); 685 lstrcpyWtoA(text,infoPtr->items[iItem].pszText); 686 } 687 } 688 nmitem.pszText = (LPWSTR)text; 689 } 690 737 691 nmhdr.iItem = iItem; 738 692 nmhdr.iButton = 0; … … 742 696 nmitem.cxy = infoPtr->items[iItem].cxy; 743 697 nmitem.hbm = infoPtr->items[iItem].hbm; 744 nmitem.pszText = text;745 698 nmitem.cchTextMax = infoPtr->items[iItem].cchTextMax; 746 699 nmitem.fmt = infoPtr->items[iItem].fmt; … … 751 704 nmitem.pvFilter = infoPtr->items[iItem].pvFilter; 752 705 753 res = (BOOL) SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr);706 res = (BOOL)sendNotify(hwnd,code,&nmhdr.hdr); 754 707 755 708 if (text) COMCTL32_Free(text); … … 758 711 } 759 712 760 static BOOL 761 HEADER_SendHeaderNotifyW(HWND hwnd,UINT code,INT iItem,INT iButton) 762 { 763 HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd); 764 NMHEADERW nmhdr; 765 HDITEMW nmitem; 766 767 nmhdr.hdr.hwndFrom = hwnd; 768 nmhdr.hdr.idFrom = GetWindowLongW(hwnd,GWL_ID); 769 nmhdr.hdr.code = code; 770 nmhdr.iItem = iItem; 771 nmhdr.iButton = 0; 772 nmhdr.pitem = &nmitem; 773 774 nmitem.mask = 0; 775 nmitem.cxy = infoPtr->items[iItem].cxy; 776 nmitem.hbm = infoPtr->items[iItem].hbm; 777 nmitem.pszText = infoPtr->items[iItem].pszText; 778 nmitem.cchTextMax = infoPtr->items[iItem].cchTextMax; 779 nmitem.fmt = infoPtr->items[iItem].fmt; 780 nmitem.lParam = infoPtr->items[iItem].lParam; 781 nmitem.iImage = infoPtr->items[iItem].iImage; 782 nmitem.iOrder = infoPtr->items[iItem].iOrder; 783 nmitem.type = infoPtr->items[iItem].type; 784 nmitem.pvFilter = infoPtr->items[iItem].pvFilter; 785 786 return (BOOL)SendMessageW(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 787 } 788 789 static BOOL 790 HEADER_SendItemChanging(HWND hwnd,INT iItem) 791 { 792 if (IsWindowUnicode(GetParent(hwnd))) 793 return HEADER_SendHeaderNotifyA(hwnd,HDN_ITEMCHANGINGA,iItem,0); 794 else 795 return HEADER_SendHeaderNotifyW(hwnd,HDN_ITEMCHANGINGW,iItem,0); 796 } 797 798 static BOOL 799 HEADER_SendItemChanged(HWND hwnd,INT iItem) 800 { 801 if (IsWindowUnicode(GetParent(hwnd))) 802 return HEADER_SendHeaderNotifyA(hwnd,HDN_ITEMCHANGEDA,iItem,0); 803 else 804 return HEADER_SendHeaderNotifyW(hwnd,HDN_ITEMCHANGEDW,iItem,0); 805 } 806 807 static BOOL 808 HEADER_SendItemDblClick(HWND hwnd,INT iItem,INT iButton) 809 { 810 if (IsWindowUnicode(GetParent(hwnd))) 811 return HEADER_SendHeaderNotifyA(hwnd,HDN_ITEMDBLCLICKA,iItem,iButton); 812 else 813 return HEADER_SendHeaderNotifyW(hwnd,HDN_ITEMDBLCLICKW,iItem,iButton); 814 } 815 816 static BOOL 817 HEADER_SendDividerDblClick(HWND hwnd,INT iItem,INT iButton) 818 { 819 if (IsWindowUnicode(GetParent(hwnd))) 820 return HEADER_SendHeaderNotifyA(hwnd,HDN_DIVIDERDBLCLICKA,iItem,iButton); 821 else 822 return HEADER_SendHeaderNotifyW(hwnd,HDN_DIVIDERDBLCLICKW,iItem,iButton); 823 } 824 825 static BOOL 826 HEADER_SendBeginTrack(HWND hwnd,INT iItem,INT iButton) 827 { 828 if (IsWindowUnicode(GetParent(hwnd))) 829 return HEADER_SendHeaderNotifyA(hwnd,HDN_BEGINTRACKA,iItem,iButton); 830 else 831 return HEADER_SendHeaderNotifyW(hwnd,HDN_BEGINTRACKW,iItem,iButton); 832 } 833 834 static BOOL 835 HEADER_SendEndTrack(HWND hwnd,INT iItem,INT iButton) 836 { 837 if (IsWindowUnicode(GetParent(hwnd))) 838 return HEADER_SendHeaderNotifyA(hwnd,HDN_ENDTRACKA,iItem,iButton); 839 else 840 return HEADER_SendHeaderNotifyW(hwnd,HDN_ENDTRACKW,iItem,iButton); 841 } 842 843 static BOOL 844 HEADER_SendTrack(HWND hwnd,INT iItem) 845 { 846 if (IsWindowUnicode(GetParent(hwnd))) 847 return HEADER_SendHeaderNotifyA(hwnd,HDN_TRACKA,iItem,0); 848 else 849 return HEADER_SendHeaderNotifyW(hwnd,HDN_TRACKW,iItem,0); 850 } 851 852 static BOOL 853 HEADER_SendClickNotifyA(HWND hwnd,UINT code,INT iItem,INT iButton) 854 { 855 NMHEADERA nmhdr; 856 857 nmhdr.hdr.hwndFrom = hwnd; 858 nmhdr.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); 859 nmhdr.hdr.code = code; 860 nmhdr.iItem = iItem; 861 nmhdr.iButton = iButton; 862 nmhdr.pitem = NULL; 863 864 return (BOOL)SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 865 } 866 867 static BOOL 868 HEADER_SendClickNotifyW(HWND hwnd,UINT code,INT iItem,INT iButton) 869 { 870 NMHEADERW nmhdr; 871 872 nmhdr.hdr.hwndFrom = hwnd; 873 nmhdr.hdr.idFrom = GetWindowLongW(hwnd,GWL_ID); 874 nmhdr.hdr.code = code; 875 nmhdr.iItem = iItem; 876 nmhdr.iButton = iButton; 877 nmhdr.pitem = NULL; 878 879 return (BOOL)SendMessageW(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 880 } 881 882 static BOOL 883 HEADER_SendItemClick(HWND hwnd,INT iItem,INT iButton) 884 { 885 if (IsWindowUnicode(GetParent(hwnd))) 886 return HEADER_SendClickNotifyA(hwnd,HDN_ITEMCLICKA,iItem,iButton); 887 else 888 return HEADER_SendClickNotifyW(hwnd,HDN_ITEMCLICKW,iItem,iButton); 889 } 890 891 static BOOL 892 HEADER_SendDragNotify(HWND hwnd,UINT code,INT iItem,INT iButton) 893 { 894 NMHEADERA nmhdr; 895 896 nmhdr.hdr.hwndFrom = hwnd; 897 nmhdr.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); 898 nmhdr.hdr.code = code; 899 nmhdr.iItem = iItem; 900 nmhdr.iButton = iButton; 901 nmhdr.pitem = NULL; 902 903 return (BOOL)SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 904 } 905 906 static BOOL 907 HEADER_SendFilterBtnClick(HWND hwnd,INT iItem,RECT iRect) 908 { 909 NMHDFILTERBTNCLICK nmhdr; 910 911 nmhdr.hdr.hwndFrom = hwnd; 912 nmhdr.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); 913 nmhdr.hdr.code = HDN_FILTERBTNCLICK; 914 nmhdr.iItem = iItem; 915 nmhdr.rc = iRect; 916 917 return (BOOL)SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 713 static BOOL HEADER_SendItemChanging(HWND hwnd,INT iItem) 714 { 715 BOOL unicode = isUnicodeNotify(hwnd); 716 717 return HEADER_SendHeaderNotify(hwnd,unicode ? HDN_ITEMCHANGINGW:HDN_ITEMCHANGINGA,iItem,0,unicode); 718 } 719 720 static BOOL HEADER_SendItemChanged(HWND hwnd,INT iItem) 721 { 722 BOOL unicode = isUnicodeNotify(hwnd); 723 724 return HEADER_SendHeaderNotify(hwnd,unicode ? HDN_ITEMCHANGEDW:HDN_ITEMCHANGEDA,iItem,0,unicode); 725 } 726 727 static BOOL HEADER_SendItemDblClick(HWND hwnd,INT iItem,INT iButton) 728 { 729 BOOL unicode = isUnicodeNotify(hwnd); 730 731 return HEADER_SendHeaderNotify(hwnd,unicode ? HDN_ITEMDBLCLICKW:HDN_ITEMDBLCLICKA,iItem,iButton,unicode); 732 } 733 734 static BOOL HEADER_SendDividerDblClick(HWND hwnd,INT iItem,INT iButton) 735 { 736 BOOL unicode = isUnicodeNotify(hwnd); 737 738 return HEADER_SendHeaderNotify(hwnd,unicode ? HDN_DIVIDERDBLCLICKW:HDN_DIVIDERDBLCLICKA,iItem,iButton,unicode); 739 } 740 741 static BOOL HEADER_SendBeginTrack(HWND hwnd,INT iItem,INT iButton) 742 { 743 BOOL unicode = isUnicodeNotify(hwnd); 744 745 return HEADER_SendHeaderNotify(hwnd,unicode ? HDN_BEGINTRACKW:HDN_BEGINTRACKA,iItem,iButton,unicode); 746 } 747 748 static BOOL HEADER_SendEndTrack(HWND hwnd,INT iItem,INT iButton) 749 { 750 BOOL unicode = isUnicodeNotify(hwnd); 751 752 return HEADER_SendHeaderNotify(hwnd,unicode ? HDN_ENDTRACKW:HDN_ENDTRACKA,iItem,iButton,unicode); 753 } 754 755 static BOOL HEADER_SendTrack(HWND hwnd,INT iItem) 756 { 757 BOOL unicode = isUnicodeNotify(hwnd); 758 759 return HEADER_SendHeaderNotify(hwnd,unicode ? HDN_TRACKW:HDN_TRACKA,iItem,0,unicode); 760 } 761 762 static BOOL HEADER_SendClickNotify(HWND hwnd,UINT code,INT iItem,INT iButton,BOOL unicode) 763 { 764 NMHEADERW nmhdr; 765 766 nmhdr.iItem = iItem; 767 nmhdr.iButton = iButton; 768 nmhdr.pitem = NULL; 769 770 return (BOOL)sendNotify(hwnd,code,&nmhdr.hdr); 771 } 772 773 static BOOL HEADER_SendItemClick(HWND hwnd,INT iItem,INT iButton) 774 { 775 BOOL unicode = isUnicodeNotify(hwnd); 776 777 return HEADER_SendClickNotify(hwnd,unicode ? HDN_ITEMCLICKW:HDN_ITEMCLICKA,iItem,iButton,unicode); 778 } 779 780 static BOOL HEADER_SendDragNotify(HWND hwnd,UINT code,INT iItem,INT iButton) 781 { 782 NMHEADERW nmhdr; 783 784 nmhdr.iItem = iItem; 785 nmhdr.iButton = iButton; 786 nmhdr.pitem = NULL; 787 788 return (BOOL)sendNotify(hwnd,code,&nmhdr.hdr); 789 } 790 791 static BOOL HEADER_SendFilterBtnClick(HWND hwnd,INT iItem,RECT iRect) 792 { 793 NMHDFILTERBTNCLICK nmhdr; 794 795 nmhdr.iItem = iItem; 796 nmhdr.rc = iRect; 797 798 return (BOOL)sendNotify(hwnd,HDN_FILTERBTNCLICK,&nmhdr.hdr); 918 799 } 919 800 … … 921 802 HEADER_SendFilterChange(HWND hwnd,INT iItem) 922 803 { 923 NMHEADERA nmhdr; 924 925 nmhdr.hdr.hwndFrom = hwnd; 926 nmhdr.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); 927 nmhdr.hdr.code = HDN_FILTERCHANGE; 928 nmhdr.iItem = iItem; 929 nmhdr.iButton = 0; 930 nmhdr.pitem = NULL; 931 932 return (BOOL)SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr); 804 NMHEADERW nmhdr; 805 806 nmhdr.iItem = iItem; 807 nmhdr.iButton = 0; 808 nmhdr.pitem = NULL; 809 810 return (BOOL)sendNotify(hwnd,HDN_FILTERCHANGE,&nmhdr.hdr); 933 811 } 934 812 … … 1138 1016 1139 1017 1140 static LRESULT 1141 HEADER_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1018 static LRESULT HEADER_GetItem(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode) 1142 1019 { 1143 1020 HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd); 1144 HDITEM A *phdi = (HDITEMA*)lParam;1145 INT nItem = (INT)wParam;1021 HDITEMW *phdi = (HDITEMW*)lParam; 1022 INT nItem = (INT)wParam; 1146 1023 HEADER_ITEM *lpItem; 1147 1024 … … 1149 1026 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) return FALSE; 1150 1027 1151 // TRACE (header, "[nItem=%d]\n", nItem);1152 1153 1028 if (phdi->mask == 0) return TRUE; 1154 1029 … … 1178 1053 { 1179 1054 if (lpItem->pszText) 1180 lstrcpynWtoA (phdi->pszText,lpItem->pszText,phdi->cchTextMax); 1181 else 1182 phdi->pszText = NULL; 1183 } else phdi->pszText = LPSTR_TEXTCALLBACKA; 1055 { 1056 if (unicode) 1057 lstrcpynW (phdi->pszText,lpItem->pszText,phdi->cchTextMax); 1058 else 1059 lstrcpynWtoA((LPSTR)phdi->pszText,lpItem->pszText,phdi->cchTextMax); 1060 } else phdi->pszText = NULL; 1061 } else 1062 { 1063 phdi->pszText = unicode ? LPSTR_TEXTCALLBACKW:(LPWSTR)LPSTR_TEXTCALLBACKA; 1064 } 1184 1065 } 1185 1066 1186 1067 return TRUE; 1187 1068 } 1188 1189 static LRESULT1190 HEADER_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)1191 {1192 HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);1193 HDITEMW *phdi = (HDITEMW*)lParam;1194 INT nItem = (INT)wParam;1195 HEADER_ITEM *lpItem;1196 1197 if (!phdi) return FALSE;1198 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) return FALSE;1199 1200 // TRACE (header, "[nItem=%d]\n", nItem);1201 1202 if (phdi->mask == 0) return TRUE;1203 1204 lpItem = (HEADER_ITEM*)&infoPtr->items[nItem];1205 1206 if (phdi->mask & HDI_BITMAP) phdi->hbm = lpItem->hbm;1207 1208 if (phdi->mask & HDI_FORMAT) phdi->fmt = lpItem->fmt;1209 1210 if (phdi->mask & HDI_FILTER)1211 {1212 phdi->type = lpItem->type;1213 phdi->pvFilter = lpItem->pvFilter;1214 }1215 1216 if (phdi->mask & (HDI_WIDTH | HDI_HEIGHT)) phdi->cxy = lpItem->cxy;1217 1218 if (phdi->mask & HDI_IMAGE) phdi->iImage = lpItem->iImage;1219 1220 if (phdi->mask & HDI_LPARAM) phdi->lParam = lpItem->lParam;1221 1222 if (phdi->mask & HDI_ORDER) phdi->iOrder = lpItem->iOrder;1223 1224 if (phdi->mask & HDI_TEXT)1225 {1226 if (lpItem->pszText != LPSTR_TEXTCALLBACKW)1227 {1228 if (lpItem->pszText)1229 lstrcpynW (phdi->pszText,lpItem->pszText,phdi->cchTextMax);1230 else1231 phdi->pszText = NULL;1232 } else phdi->pszText = LPSTR_TEXTCALLBACKW;1233 }1234 1235 return TRUE;1236 }1237 1238 1069 1239 1070 static LRESULT … … 1338 1169 1339 1170 static LRESULT 1340 HEADER_GetUnicodeFormat (HWND hwnd)1341 {1342 HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);1343 1344 return infoPtr->bUnicode;1345 }1346 1347 1348 static LRESULT1349 1171 HEADER_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) 1350 1172 { … … 1357 1179 1358 1180 1359 static LRESULT 1360 HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1181 static LRESULT HEADER_InsertItem(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode) 1361 1182 { 1362 1183 HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); 1363 HDITEM A *phdi = (HDITEMA*)lParam;1364 INT nItem = (INT)wParam;1184 HDITEMW *phdi = (HDITEMW*)lParam; 1185 INT nItem = (INT)wParam; 1365 1186 HEADER_ITEM *lpItem; 1366 1187 … … 1397 1218 lpItem->bDown = FALSE; 1398 1219 1399 lpItem->cxy = ( phdi->mask & HDI_WIDTH || phdi->mask & HDI_HEIGHT) ? phdi->cxy:0;1220 lpItem->cxy = ((phdi->mask & HDI_WIDTH) || (phdi->mask & HDI_HEIGHT)) ? phdi->cxy:0; 1400 1221 1401 1222 if (phdi->mask & HDI_TEXT) 1402 1223 { 1403 1224 if (!phdi->pszText) lpItem->pszText = NULL; 1404 else if (phdi->pszText != LPSTR_TEXTCALLBACKA) 1405 { 1406 INT len; 1407 1408 len = lstrlenA(phdi->pszText); 1409 if (len == 0) lpItem->pszText = NULL; else 1410 { 1411 lpItem->pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 1412 lstrcpyAtoW(lpItem->pszText,phdi->pszText); 1413 } 1414 } else lpItem->pszText = LPSTR_TEXTCALLBACKW; 1225 else if (unicode) 1226 { 1227 if (phdi->pszText != LPSTR_TEXTCALLBACKW) 1228 { 1229 INT len; 1230 1231 len = lstrlenW(phdi->pszText); 1232 if (len == 0) lpItem->pszText = NULL; else 1233 { 1234 lpItem->pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 1235 lstrcpyW(lpItem->pszText,phdi->pszText); 1236 } 1237 } else lpItem->pszText = LPSTR_TEXTCALLBACKW; 1238 } else 1239 { 1240 if ((LPSTR)phdi->pszText != LPSTR_TEXTCALLBACKA) 1241 { 1242 INT len; 1243 1244 len = lstrlenA((LPSTR)phdi->pszText); 1245 if (len == 0) lpItem->pszText = NULL; else 1246 { 1247 lpItem->pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 1248 lstrcpyAtoW(lpItem->pszText,(LPSTR)phdi->pszText); 1249 } 1250 } else lpItem->pszText = LPSTR_TEXTCALLBACKW; 1251 } 1415 1252 lpItem->cchTextMax = phdi->cchTextMax; 1416 1253 } else … … 1442 1279 return nItem; 1443 1280 } 1444 1445 static LRESULT1446 HEADER_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)1447 {1448 HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);1449 HDITEMW *phdi = (HDITEMW*)lParam;1450 INT nItem = (INT)wParam;1451 HEADER_ITEM *lpItem;1452 1453 if ((phdi == NULL) || (nItem < 0)) return -1;1454 1455 if (nItem > infoPtr->uNumItem) nItem = infoPtr->uNumItem;1456 1457 if (infoPtr->uNumItem == 0)1458 {1459 infoPtr->items = (HEADER_ITEM*)COMCTL32_Alloc(sizeof(HEADER_ITEM));1460 infoPtr->uNumItem++;1461 } else1462 {1463 HEADER_ITEM *oldItems = infoPtr->items;1464 1465 infoPtr->uNumItem++;1466 infoPtr->items = (HEADER_ITEM*)COMCTL32_Alloc(sizeof(HEADER_ITEM)*infoPtr->uNumItem);1467 if (nItem == 0)1468 memcpy (&infoPtr->items[1],&oldItems[0],(infoPtr->uNumItem-1)*sizeof(HEADER_ITEM));1469 else1470 {1471 /* pre insert copy */1472 memcpy (&infoPtr->items[0],&oldItems[0],nItem*sizeof(HEADER_ITEM));1473 1474 /* post insert copy */1475 if (nItem < infoPtr->uNumItem-1)1476 memcpy (&infoPtr->items[nItem+1],&oldItems[nItem],(infoPtr->uNumItem - nItem)*sizeof(HEADER_ITEM));1477 }1478 1479 COMCTL32_Free (oldItems);1480 }1481 1482 lpItem = (HEADER_ITEM*)&infoPtr->items[nItem];1483 lpItem->bDown = FALSE;1484 1485 lpItem->cxy = (phdi->mask & HDI_WIDTH || phdi->mask & HDI_HEIGHT) ? phdi->cxy:0;1486 1487 if (phdi->mask & HDI_TEXT)1488 {1489 if (!phdi->pszText) lpItem->pszText = NULL;1490 else if (phdi->pszText != LPSTR_TEXTCALLBACKW)1491 {1492 INT len;1493 1494 len = lstrlenW(phdi->pszText);1495 if (len == 0) lpItem->pszText = NULL; else1496 {1497 lpItem->pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR));1498 lstrcpyW(lpItem->pszText,phdi->pszText);1499 }1500 } else lpItem->pszText = LPSTR_TEXTCALLBACKW;1501 lpItem->cchTextMax = phdi->cchTextMax;1502 } else1503 {1504 lpItem->pszText = NULL;1505 lpItem->cchTextMax = 0;1506 }1507 1508 lpItem->fmt = (phdi->mask & HDI_FORMAT) ? phdi->fmt:HDF_LEFT;1509 if (lpItem->fmt == 0) lpItem->fmt = HDF_LEFT;1510 1511 lpItem->lParam = (phdi->mask & HDI_LPARAM) ? phdi->lParam:0;1512 1513 lpItem->iImage = (phdi->mask & HDI_IMAGE) ? phdi->iImage:0;1514 1515 lpItem->iOrder = (phdi->mask & HDI_ORDER) ? phdi->iOrder:-1;1516 1517 lpItem->hbm = (phdi->mask & HDI_BITMAP) ? phdi->hbm:0;1518 1519 if (phdi->mask & HDI_FILTER)1520 {1521 lpItem->type = phdi->type;1522 lpItem->pvFilter = phdi->pvFilter;1523 }1524 1525 HEADER_SetItemBounds (hwnd,nItem);1526 HEADER_Refresh(hwnd);1527 1528 return nItem;1529 }1530 1531 1281 1532 1282 static LRESULT … … 1572 1322 1573 1323 1574 static LRESULT 1575 HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1324 static LRESULT HEADER_SetItem(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode) 1576 1325 { 1577 1326 HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); 1578 HDITEM A *phdi = (HDITEMA*)lParam;1579 INT nItem = (INT)wParam;1327 HDITEMW *phdi = (HDITEMW*)lParam; 1328 INT nItem = (INT)wParam; 1580 1329 HEADER_ITEM *lpItem; 1581 1330 HDC hdc; … … 1585 1334 if (phdi->mask == 0) return TRUE; 1586 1335 1587 // TRACE (header, "[nItem=%d]\n", nItem);1588 1336 if (HEADER_SendItemChanging(hwnd,nItem)) return FALSE; 1589 1337 … … 1610 1358 if (phdi->mask & HDI_TEXT) 1611 1359 { 1612 if (phdi->pszText != LPSTR_TEXTCALLBACKA) 1613 { 1614 if (lpItem->pszText) 1615 { 1616 COMCTL32_Free (lpItem->pszText); 1617 lpItem->pszText = NULL; 1618 } 1619 if (phdi->pszText) 1620 { 1621 INT len = lstrlenA (phdi->pszText); 1622 1623 if (len) 1360 if (unicode) 1361 { 1362 if (phdi->pszText != LPSTR_TEXTCALLBACKW) 1363 { 1364 if (lpItem->pszText) 1624 1365 { 1625 lpItem->pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR));1626 l strcpyAtoW(lpItem->pszText,phdi->pszText);1366 COMCTL32_Free(lpItem->pszText); 1367 lpItem->pszText = NULL; 1627 1368 } 1369 if (phdi->pszText) 1370 { 1371 INT len = lstrlenW(phdi->pszText); 1372 1373 if (len) 1374 { 1375 lpItem->pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 1376 lstrcpyW(lpItem->pszText,phdi->pszText); 1377 } 1378 } 1379 } else 1380 { 1381 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpItem->pszText); 1382 lpItem->pszText = LPSTR_TEXTCALLBACKW; 1628 1383 } 1629 1384 } else 1630 1385 { 1631 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpItem->pszText); 1632 lpItem->pszText = LPSTR_TEXTCALLBACKW; 1386 if ((LPSTR)phdi->pszText != LPSTR_TEXTCALLBACKA) 1387 { 1388 if (lpItem->pszText) 1389 { 1390 COMCTL32_Free (lpItem->pszText); 1391 lpItem->pszText = NULL; 1392 } 1393 if (phdi->pszText) 1394 { 1395 INT len = lstrlenA((LPSTR)phdi->pszText); 1396 1397 if (len) 1398 { 1399 lpItem->pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 1400 lstrcpyAtoW(lpItem->pszText,(LPSTR)phdi->pszText); 1401 } 1402 } 1403 } else 1404 { 1405 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpItem->pszText); 1406 lpItem->pszText = LPSTR_TEXTCALLBACKW; 1407 } 1633 1408 } 1634 1409 } … … 1641 1416 return TRUE; 1642 1417 } 1643 1644 1645 static LRESULT1646 HEADER_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)1647 {1648 HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);1649 HDITEMW *phdi = (HDITEMW*)lParam;1650 INT nItem = (INT)wParam;1651 HEADER_ITEM *lpItem;1652 HDC hdc;1653 1654 if (phdi == NULL) return FALSE;1655 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) return FALSE;1656 if (phdi->mask == 0) return TRUE;1657 1658 // TRACE (header, "[nItem=%d]\n", nItem);1659 1660 if (HEADER_SendItemChanging(hwnd,nItem)) return FALSE;1661 1662 lpItem = (HEADER_ITEM*)&infoPtr->items[nItem];1663 1664 if (phdi->mask & HDI_BITMAP) lpItem->hbm = phdi->hbm;1665 1666 if (phdi->mask & HDI_FORMAT) lpItem->fmt = phdi->fmt;1667 1668 if (phdi->mask & HDI_FILTER)1669 {1670 lpItem->type = lpItem->type;1671 lpItem->pvFilter = lpItem->pvFilter;1672 }1673 1674 if (phdi->mask & (HDI_WIDTH | HDI_WIDTH)) lpItem->cxy = phdi->cxy;1675 1676 if (phdi->mask & HDI_IMAGE) lpItem->iImage = phdi->iImage;1677 1678 if (phdi->mask & HDI_LPARAM) lpItem->lParam = phdi->lParam;1679 1680 if (phdi->mask & HDI_ORDER) lpItem->iOrder = phdi->iOrder;1681 1682 if (phdi->mask & HDI_TEXT)1683 {1684 if (phdi->pszText != LPSTR_TEXTCALLBACKW)1685 {1686 if (lpItem->pszText)1687 {1688 COMCTL32_Free(lpItem->pszText);1689 lpItem->pszText = NULL;1690 }1691 if (phdi->pszText)1692 {1693 INT len = lstrlenW(phdi->pszText);1694 1695 if (len)1696 {1697 lpItem->pszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR));1698 lstrcpyW(lpItem->pszText,phdi->pszText);1699 }1700 }1701 } else1702 {1703 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpItem->pszText);1704 lpItem->pszText = LPSTR_TEXTCALLBACKW;1705 }1706 }1707 1708 HEADER_SendItemChanged(hwnd,nItem);1709 1710 HEADER_SetItemBounds(hwnd,0);1711 HEADER_Refresh(hwnd);1712 1713 return TRUE;1714 }1715 1716 static LRESULT1717 HEADER_SetUnicodeFormat (HWND hwnd, WPARAM wParam)1718 {1719 HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);1720 BOOL bTemp = infoPtr->bUnicode;1721 1722 infoPtr->bUnicode = (BOOL)wParam;1723 1724 return bTemp;1725 }1726 1727 1418 1728 1419 static LRESULT … … 1734 1425 HDC hdc; 1735 1426 1736 infoPtr = (HEADER_INFO *)COMCTL32_Alloc (sizeof(HEADER_INFO)); 1737 SetWindowLongA (hwnd, 0, (DWORD)infoPtr); 1427 infoPtr = (HEADER_INFO*)initControl(hwnd,sizeof(HEADER_INFO)); 1738 1428 1739 1429 infoPtr->uNumItem = 0; … … 1753 1443 infoPtr->iHotItem = -1; 1754 1444 infoPtr->xBmpMargin = 3*GetSystemMetrics(SM_CXEDGE); 1755 infoPtr->bUnicode = IsWindowUnicode(hwnd); 1756 1757 hdc = GetDC (0); 1445 1446 hdc = GetDC (hwnd); 1758 1447 hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT)); 1759 1448 GetTextMetricsA (hdc, &tm); 1760 1449 infoPtr->nHeight = tm.tmHeight + VERT_BORDER; 1761 1450 SelectObject (hdc, hOldFont); 1762 ReleaseDC ( 0, hdc);1451 ReleaseDC (hwnd, hdc); 1763 1452 1764 1453 return 0; … … 1785 1474 ImageList_Destroy (infoPtr->himl); 1786 1475 1787 COMCTL32_Free (infoPtr);1476 doneControl(hwnd); 1788 1477 1789 1478 return 0; … … 1913 1602 infoPtr->dragImage = NULL; 1914 1603 1915 if (!HEADER_SendDragNotify(hwnd,HDN_ENDDRAG,infoPtr->iMoveItem,0) && infoPtr->iDragItem != infoPtr->iMoveItem && infoPtr->iDragItem != infoPtr->iMoveItem+1 && infoPtr->iDragItem != -1)1604 if (!HEADER_SendDragNotify(hwnd,HDN_ENDDRAG,infoPtr->iMoveItem,0) && (infoPtr->iDragItem != infoPtr->iMoveItem) && (infoPtr->iDragItem != infoPtr->iMoveItem+1) && (infoPtr->iDragItem != -1)) 1916 1605 { 1917 1606 HEADER_ITEM tmpItem = infoPtr->items[infoPtr->iMoveItem];; … … 1987 1676 infoPtr->bCaptured = FALSE; 1988 1677 ReleaseCapture(); 1989 HEADER_SendSimpleNotify(hwnd,NM_RELEASEDCAPTURE);1678 sendNotify(hwnd,NM_RELEASEDCAPTURE); 1990 1679 } 1991 1680 … … 2008 1697 for (x = 0;x < infoPtr->uNumItem;x++) 2009 1698 { 2010 if ( xDrag >= infoPtr->items[x].rect.left && xDrag <= infoPtr->items[x].rect.right) return x;1699 if ((xDrag >= infoPtr->items[x].rect.left) && (xDrag <= infoPtr->items[x].rect.right)) return x; 2011 1700 } 2012 1701 … … 2028 1717 HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem); 2029 1718 2030 if ( dwStyle & HDS_BUTTONS && dwStyle & HDS_HOTTRACK)1719 if ((dwStyle & HDS_BUTTONS) && (dwStyle & HDS_HOTTRACK)) 2031 1720 { 2032 1721 INT newItem; … … 2046 1735 HEADER_Refresh(hwnd); 2047 1736 } 2048 if (!infoPtr->bTimer && infoPtr->iHotItem != -1)1737 if (!infoPtr->bTimer && (infoPtr->iHotItem != -1)) 2049 1738 { 2050 1739 infoPtr->bTimer = TRUE; 2051 1740 SetTimer(hwnd,TIMER_ID,TIMER_MS,NULL); 2052 } else if (infoPtr->bTimer && infoPtr->iHotItem == -1)1741 } else if (infoPtr->bTimer && (infoPtr->iHotItem == -1)) 2053 1742 { 2054 1743 KillTimer(hwnd,TIMER_ID); … … 2061 1750 if (infoPtr->bPressed) 2062 1751 { 2063 if ( dwStyle & HDS_DRAGDROP && infoPtr->uNumItem > 1&& (infoPtr->bDragDrop || !HEADER_SendDragNotify(hwnd,HDN_BEGINDRAG,infoPtr->iMoveItem,0)))1752 if ((dwStyle & HDS_DRAGDROP) && (infoPtr->uNumItem > 1) && (infoPtr->bDragDrop || !HEADER_SendDragNotify(hwnd,HDN_BEGINDRAG,infoPtr->iMoveItem,0))) 2064 1753 { 2065 1754 if (!infoPtr->bDragDrop) … … 2168 1857 HDC hdc; 2169 1858 2170 if ( wParam == VK_ESCAPE&& infoPtr->bCaptured)1859 if ((wParam == VK_ESCAPE) && infoPtr->bCaptured) 2171 1860 { 2172 1861 if (infoPtr->bPressed && infoPtr->bDragDrop) … … 2201 1890 infoPtr->bCaptured = FALSE; 2202 1891 ReleaseCapture(); 2203 HEADER_SendSimpleNotify(hwnd,NM_RELEASEDCAPTURE);1892 sendNotify(hwnd,NM_RELEASEDCAPTURE); 2204 1893 2205 1894 return TRUE; … … 2275 1964 HEADER_RButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) 2276 1965 { 2277 HEADER_SendSimpleNotify(hwnd,NM_RCLICK);1966 sendNotify(hwnd,NM_RCLICK); 2278 1967 2279 1968 return DefWindowProcA(hwnd,WM_RBUTTONUP,wParam,lParam); … … 2330 2019 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT); 2331 2020 2332 hdc = GetDC ( 0);2021 hdc = GetDC (hwnd); 2333 2022 hOldFont = SelectObject (hdc, hFont); 2334 2023 GetTextMetricsA (hdc, &tm); 2335 2024 infoPtr->nHeight = tm.tmHeight + VERT_BORDER; 2336 2025 SelectObject (hdc, hOldFont); 2337 ReleaseDC ( 0, hdc);2026 ReleaseDC (hwnd, hdc); 2338 2027 2339 2028 if (lParam) HEADER_Refresh(hwnd); … … 2367 2056 2368 2057 case HDM_GETITEMA: 2369 return HEADER_GetItem A (hwnd, wParam, lParam);2058 return HEADER_GetItem(hwnd,wParam,lParam,FALSE); 2370 2059 2371 2060 case HDM_GETITEMW: 2372 return HEADER_GetItem W (hwnd, wParam, lParam);2061 return HEADER_GetItem(hwnd,wParam,lParam,TRUE); 2373 2062 2374 2063 case HDM_GETITEMCOUNT: … … 2381 2070 return HEADER_GetOrderArray(hwnd,wParam,lParam); 2382 2071 2383 case HDM_GETUNICODEFORMAT:2384 return HEADER_GetUnicodeFormat (hwnd);2385 2386 2072 case HDM_HITTEST: 2387 2073 return HEADER_HitTest (hwnd, wParam, lParam); 2388 2074 2389 2075 case HDM_INSERTITEMA: 2390 return HEADER_InsertItem A (hwnd, wParam, lParam);2076 return HEADER_InsertItem(hwnd,wParam,lParam,FALSE); 2391 2077 2392 2078 case HDM_INSERTITEMW: 2393 return HEADER_InsertItem W (hwnd, wParam, lParam);2079 return HEADER_InsertItem(hwnd,wParam,lParam,TRUE); 2394 2080 2395 2081 case HDM_LAYOUT: … … 2412 2098 2413 2099 case HDM_SETITEMA: 2414 return HEADER_SetItem A (hwnd, wParam, lParam);2100 return HEADER_SetItem(hwnd,wParam,lParam,FALSE); 2415 2101 2416 2102 case HDM_SETITEMW: 2417 return HEADER_SetItem W (hwnd, wParam, lParam);2103 return HEADER_SetItem(hwnd,wParam,lParam,TRUE); 2418 2104 2419 2105 case HDM_SETORDERARRAY: 2420 2106 return HEADER_SetOrderArray(hwnd,wParam,lParam); 2421 2107 2422 case HDM_SETUNICODEFORMAT:2423 return HEADER_SetUnicodeFormat (hwnd, wParam);2424 2425 2108 case WM_CAPTURECHANGED: 2426 2109 return HEADER_CaptureChanged(hwnd,wParam,lParam); … … 2455 2138 case WM_MOUSEMOVE: 2456 2139 return HEADER_MouseMove (hwnd, wParam, lParam); 2457 2458 /* case WM_NOTIFYFORMAT: */2459 2140 2460 2141 case WM_PAINT: … … 2480 2161 // ERR (header, "unknown msg %04x wp=%04x lp=%08lx\n", 2481 2162 // msg, wParam, lParam ); 2482 return DefWindowProcA (hwnd, msg, wParam, lParam);2163 return defComCtl32ProcA (hwnd, msg, wParam, lParam); 2483 2164 } 2484 2165 return 0; … … 2490 2171 { 2491 2172 WNDCLASSA wndClass; 2492 2493 //SvL: Don't check this now2494 // if (GlobalFindAtomA (WC_HEADERA)) return;2495 2173 2496 2174 ZeroMemory (&wndClass, sizeof(WNDCLASSA)); … … 2509 2187 HEADER_Unregister (VOID) 2510 2188 { 2511 if (GlobalFindAtomA (WC_HEADERA)) 2512 UnregisterClassA (WC_HEADERA, (HINSTANCE)NULL); 2513 } 2514 2189 UnregisterClassA (WC_HEADERA, (HINSTANCE)NULL); 2190 } 2191 -
trunk/src/comctl32/hotkey.cpp
r2875 r2895 1 /* $Id: hotkey.cpp,v 1. 1 2000-02-23 17:09:42cbratschi Exp $ */1 /* $Id: hotkey.cpp,v 1.2 2000-02-25 17:00:15 cbratschi Exp $ */ 2 2 /* 3 3 * Hotkey control … … 7 7 * Copyright 1999 Christoph Bratschi 8 8 * 9 * Status: Complete (perhaps some bugs)9 * Status: Complete 10 10 * Version: 5.00 11 11 */ … … 13 13 #include "winbase.h" 14 14 #include "commctrl.h" 15 #include "ccbase.h" 15 16 #include "hotkey.h" 16 17 #include <string.h> 17 18 18 #define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO*) GetWindowLongA(hwnd,0))19 #define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO*)getInfoPtr(hwnd)) 19 20 20 21 static VOID … … 23 24 InvalidateRect(hwnd,NULL,FALSE); 24 25 25 if (notify) SendMessageA(GetParent(hwnd),WM_COMMAND,MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID),EN_CHANGE),hwnd);26 if (notify) sendCommand(hwnd,EN_CHANGE); 26 27 } 27 28 … … 299 300 BYTE mods = bfMods & ~HOTKEYF_EXT; 300 301 301 if (( infoPtr->fwCombInv & HKCOMB_A && mods == HOTKEYF_ALT) ||302 ( infoPtr->fwCombInv & HKCOMB_C && mods == HOTKEYF_CONTROL) ||303 ( infoPtr->fwCombInv & HKCOMB_CA && mods == HOTKEYF_CONTROL | HOTKEYF_ALT) ||304 ( infoPtr->fwCombInv & HKCOMB_NONE && mods == 0) ||305 ( infoPtr->fwCombInv & HKCOMB_S && mods == HOTKEYF_SHIFT) ||306 ( infoPtr->fwCombInv & HKCOMB_SA && mods == HOTKEYF_SHIFT | HOTKEYF_ALT) ||307 ( infoPtr->fwCombInv & HKCOMB_SC && mods == HOTKEYF_SHIFT | HOTKEYF_CONTROL) ||308 ( infoPtr->fwCombInv & HKCOMB_SCA && mods == HOTKEYF_SHIFT | HOTKEYF_CONTROL | HOTKEYF_ALT))302 if (((infoPtr->fwCombInv & HKCOMB_A) && (mods == HOTKEYF_ALT)) || 303 ((infoPtr->fwCombInv & HKCOMB_C) && (mods == HOTKEYF_CONTROL)) || 304 ((infoPtr->fwCombInv & HKCOMB_CA) && (mods == HOTKEYF_CONTROL | HOTKEYF_ALT)) || 305 ((infoPtr->fwCombInv & HKCOMB_NONE) && (mods == 0)) || 306 ((infoPtr->fwCombInv & HKCOMB_S) && (mods == HOTKEYF_SHIFT)) || 307 ((infoPtr->fwCombInv & HKCOMB_SA) && (mods == HOTKEYF_SHIFT | HOTKEYF_ALT)) || 308 ((infoPtr->fwCombInv & HKCOMB_SC) && (mods == HOTKEYF_SHIFT | HOTKEYF_CONTROL)) || 309 ((infoPtr->fwCombInv & HKCOMB_SCA) && (mods == HOTKEYF_SHIFT | HOTKEYF_CONTROL | HOTKEYF_ALT))) 309 310 return infoPtr->fwModInv | bfMods; 310 311 else … … 378 379 379 380 /* allocate memory for info structure */ 380 infoPtr = (HOTKEY_INFO *)COMCTL32_Alloc (sizeof(HOTKEY_INFO));381 SetWindowLongA(hwnd,0,(DWORD)infoPtr);381 infoPtr = (HOTKEY_INFO*)initControl(hwnd,sizeof(HOTKEY_INFO)); 382 if (!infoPtr) return (LRESULT)-1; 382 383 383 384 /* initialize info structure */ … … 408 409 HOTKEY_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) 409 410 { 410 HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd);411 412 411 /* free hotkey info data */ 413 COMCTL32_Free (infoPtr);412 doneControl(hwnd); 414 413 415 414 return 0; … … 472 471 473 472 default: 474 if ( newKey != wParam&& HOTKEY_ExtKey2Name(wParam))473 if ((newKey != wParam) && HOTKEY_ExtKey2Name(wParam)) 475 474 { 476 475 infoPtr ->bVKHotKey = wParam & 0xFF; … … 763 762 // ERR (hotkey, "unknown msg %04x wp=%08x lp=%08lx\n", 764 763 // uMsg, wParam, lParam); 765 return DefWindowProcA (hwnd, uMsg, wParam, lParam);764 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 766 765 } 767 766 return 0; … … 773 772 { 774 773 WNDCLASSA wndClass; 775 776 //SvL: Don't check this now777 // if (GlobalFindAtomA (HOTKEY_CLASSA)) return;778 774 779 775 ZeroMemory (&wndClass, sizeof(WNDCLASSA)); … … 793 789 HOTKEY_Unregister (VOID) 794 790 { 795 if (GlobalFindAtomA (HOTKEY_CLASSA)) 796 UnregisterClassA (HOTKEY_CLASSA, (HINSTANCE)NULL); 797 } 798 791 UnregisterClassA (HOTKEY_CLASSA, (HINSTANCE)NULL); 792 } 793 -
trunk/src/comctl32/ipaddress.cpp
r2875 r2895 1 /* $Id: ipaddress.cpp,v 1. 1 2000-02-23 17:09:43cbratschi Exp $ */1 /* $Id: ipaddress.cpp,v 1.2 2000-02-25 17:00:16 cbratschi Exp $ */ 2 2 /* 3 3 * IP Address control … … 30 30 #include "winbase.h" 31 31 #include "commctrl.h" 32 #include "ccbase.h" 32 33 #include "ipaddress.h" 33 34 //#include "heap.h" 34 35 35 36 36 #define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongA (hwnd, 0)) 37 38 39 static BOOL 40 IPADDRESS_SendNotify (HWND hwnd, UINT command); 37 #define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO*)getInfoPtr(hwnd)) 38 39 41 40 static BOOL 42 41 IPADDRESS_SendIPAddressNotify (HWND hwnd, UINT field, BYTE newValue); … … 89 88 90 89 91 infoPtr = (IPADDRESS_INFO *)COMCTL32_Alloc (sizeof(IPADDRESS_INFO));92 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);90 infoPtr = (IPADDRESS_INFO*)initControl(hwnd,sizeof(IPADDRESS_INFO)); 91 if (!infoPtr) return (LRESULT)-1; 93 92 94 93 GetClientRect (hwnd, &rcClient); … … 135 134 IPADDRESS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) 136 135 { 137 136 int i; 138 137 IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd); 139 LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) 138 LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) 139 140 140 GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP); 141 141 … … 145 145 } 146 146 147 COMCTL32_Free (infoPtr);147 doneControl(hwnd); 148 148 return 0; 149 149 } … … 161 161 162 162 IPADDRESS_SendIPAddressNotify (hwnd, 0, 0); /* FIXME: should use -1 */ 163 IPADDRESS_SendNotify (hwnd,EN_KILLFOCUS);163 sendCommand(hwnd,EN_KILLFOCUS); 164 164 InvalidateRect (hwnd, NULL, TRUE); 165 165 … … 207 207 208 208 static BOOL 209 IPADDRESS_SendNotify (HWND hwnd, UINT command)210 211 {212 // TRACE (ipaddress, "%x\n",command);213 return (BOOL)SendMessageA (GetParent (hwnd), WM_COMMAND,214 MAKEWPARAM (GetWindowLongA (hwnd, GWL_ID),command), (LPARAM)hwnd);215 }216 217 218 static BOOL219 209 IPADDRESS_SendIPAddressNotify (HWND hwnd, UINT field, BYTE newValue) 220 210 { 221 NMIPADDRESS nmip; 222 223 // TRACE (ipaddress, "%x %x\n",field,newValue); 224 nmip.hdr.hwndFrom = hwnd; 225 nmip.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 226 nmip.hdr.code = IPN_FIELDCHANGED; 227 228 nmip.iField=field; 229 nmip.iValue=newValue; 230 231 return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY, 232 (WPARAM)nmip.hdr.idFrom, (LPARAM)&nmip); 211 NMIPADDRESS nmip; 212 213 nmip.iField=field; 214 nmip.iValue=newValue; 215 216 return (BOOL)sendNotify(hwnd,IPN_FIELDCHANGED,&nmip.hdr); 233 217 } 234 218 … … 347 331 sprintf (buf,"%d",value); 348 332 SetWindowTextA (lpipsi->hwndIP[i],buf); 349 IPADDRESS_SendNotify (hwnd,EN_CHANGE);333 sendCommand(hwnd,EN_CHANGE); 350 334 } 351 335 ip_address/=256; … … 386 370 387 371 SetFocus (hwnd); 388 IPADDRESS_SendNotify (hwnd,EN_SETFOCUS);372 sendCommand(hwnd,EN_SETFOCUS); 389 373 IPADDRESS_SetFocusToField (hwnd, 0, 0); 390 374 … … 648 632 // ERR (ipaddress, "unknown msg %04x wp=%08x lp=%08lx\n", 649 633 // uMsg, wParam, lParam); 650 return DefWindowProcA (hwnd, uMsg, wParam, lParam);634 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 651 635 } 652 636 return 0; … … 658 642 { 659 643 WNDCLASSA wndClass; 660 661 //SvL: Don't check this now662 // if (GlobalFindAtomA (WC_IPADDRESSA)) return;663 644 664 645 ZeroMemory (&wndClass, sizeof(WNDCLASSA)); … … 677 658 IPADDRESS_Unregister (VOID) 678 659 { 679 if (GlobalFindAtomA (WC_IPADDRESSA))680 660 UnregisterClassA (WC_IPADDRESSA, (HINSTANCE)NULL); 681 661 } -
trunk/src/comctl32/listview.cpp
r2875 r2895 1 /*$Id: listview.cpp,v 1. 1 2000-02-23 17:09:43cbratschi Exp $*/1 /*$Id: listview.cpp,v 1.2 2000-02-25 17:00:16 cbratschi Exp $*/ 2 2 /* 3 3 * Listview control … … 21 21 * Data structure: 22 22 * LISTVIEW_SetItemCount : not completed 23 *24 * Unicode:25 * LISTVIEW_SetItemW : no unicode support26 * LISTVIEW_InsertItemW : no unicode support27 * LISTVIEW_InsertColumnW : no unicode support28 * LISTVIEW_GetColumnW : no unicode support29 * LISTVIEW_SetColumnW : no unicode support30 23 * 31 24 * Advanced functionality: … … 51 44 52 45 #include <string.h> 46 #include <wcstr.h> 53 47 #include "winbase.h" 54 48 #include "commctrl.h" 49 #include "ccbase.h" 55 50 #include "listview.h" 56 //#include "debugtools.h"57 51 #include "comctl32.h" 58 52 … … 93 87 */ 94 88 #define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount) 95 #define ListView_LVNotify(hwnd,lCtrlId,plvnm) \96 (BOOL)SendMessageA((hwnd),WM_NOTIFY,(WPARAM)(INT)lCtrlId,(LPARAM)(LPNMLISTVIEW)(plvnm))97 #define ListView_Notify(hwnd,lCtrlId,pnmh) \98 (BOOL)SendMessageA((hwnd),WM_NOTIFY,(WPARAM)(INT)lCtrlId,(LPARAM)(LPNMHDR)(pnmh))99 89 /* retrieve the number of items in the listview */ 100 90 #define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount) … … 104 94 INT width, INT height, HWND parent, HINSTANCE hinst, 105 95 EditlblCallback EditLblCb, DWORD param); 96 97 #define LISTVIEW_GetInfoPtr(hwnd) ((LISTVIEW_INFO*)getInfoPtr(hwnd)) 106 98 107 99 /* … … 116 108 static VOID LISTVIEW_AddGroupSelection(HWND, INT); 117 109 static VOID LISTVIEW_AddSelection(HWND, INT); 118 static BOOL LISTVIEW_AddSubItem(HWND, LPLVITEM A);110 static BOOL LISTVIEW_AddSubItem(HWND, LPLVITEMW,BOOL); 119 111 static INT LISTVIEW_FindInsertPosition(HDPA, INT); 120 112 static INT LISTVIEW_GetItemHeight(HWND); … … 127 119 static LISTVIEW_SUBITEM* LISTVIEW_GetSubItem(HDPA, INT); 128 120 static LRESULT LISTVIEW_GetViewRect(HWND, LPRECT); 129 static BOOL LISTVIEW_InitItem(HWND, LISTVIEW_ITEM *, LPLVITEM A);130 static BOOL LISTVIEW_InitSubItem(HWND, LISTVIEW_SUBITEM *, LPLVITEMA);121 static BOOL LISTVIEW_InitItem(HWND, LISTVIEW_ITEM *, LPLVITEMW,BOOL); 122 static BOOL LISTVIEW_InitSubItem(HWND,LISTVIEW_SUBITEM*,LPLVITEMW,BOOL); 131 123 static LRESULT LISTVIEW_MouseSelection(HWND, POINT); 132 124 static BOOL LISTVIEW_RemoveColumn(HDPA, INT); … … 134 126 static BOOL LISTVIEW_RemoveSubItem(HDPA, INT); 135 127 static VOID LISTVIEW_SetGroupSelection(HWND, INT); 136 static BOOL LISTVIEW_SetItem(HWND, LPLVITEM A);128 static BOOL LISTVIEW_SetItem(HWND, LPLVITEMW,BOOL); 137 129 static BOOL LISTVIEW_SetItemFocus(HWND, INT); 138 130 static BOOL LISTVIEW_SetItemPosition(HWND, INT, INT, INT); … … 140 132 static VOID LISTVIEW_SetSelection(HWND, INT); 141 133 static VOID LISTVIEW_UpdateSize(HWND); 142 static BOOL LISTVIEW_SetSubItem(HWND, LPLVITEM A);134 static BOOL LISTVIEW_SetSubItem(HWND, LPLVITEMW,BOOL); 143 135 static LRESULT LISTVIEW_SetViewRect(HWND, LPRECT); 144 136 static BOOL LISTVIEW_ToggleSelection(HWND, INT); 145 137 static VOID LISTVIEW_UnsupportedStyles(LONG lStyle); 146 static HWND LISTVIEW_EditLabel A(HWND hwnd, INT nItem);147 static BOOL LISTVIEW_EndEditLabel(HWND hwnd, LPSTR pszText,DWORD nItem);138 static HWND LISTVIEW_EditLabel(HWND hwnd,INT nItem,BOOL unicode); 139 static BOOL LISTVIEW_EndEditLabel(HWND hwnd,LPSTR pszText,DWORD nItem); 148 140 static LRESULT LISTVIEW_Command(HWND hwnd, WPARAM wParam, LPARAM lParam); 149 141 static LRESULT LISTVIEW_SortItems(HWND hwnd, WPARAM wParam, LPARAM lParam); … … 165 157 static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos) 166 158 { 167 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);159 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 168 160 RECT winRect; 169 161 POINT point[2]; … … 197 189 static VOID LISTVIEW_UpdateScroll(HWND hwnd) 198 190 { 199 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);191 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 200 192 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 201 193 UINT uView = lStyle & LVS_TYPEMASK; … … 354 346 static VOID LISTVIEW_AlignTop(HWND hwnd) 355 347 { 356 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);348 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 357 349 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 358 350 INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left; … … 411 403 static VOID LISTVIEW_AlignLeft(HWND hwnd) 412 404 { 413 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);405 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 414 406 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 415 407 INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; … … 470 462 static LRESULT LISTVIEW_SetViewRect(HWND hwnd, LPRECT lprcView) 471 463 { 472 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*) GetWindowLongA(hwnd, 0);464 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 473 465 BOOL bResult = FALSE; 474 466 … … 502 494 static LRESULT LISTVIEW_GetViewRect(HWND hwnd, LPRECT lprcView) 503 495 { 504 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*) GetWindowLongA(hwnd, 0);496 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 505 497 BOOL bResult = FALSE; 506 498 POINT ptOrigin; … … 572 564 static INT LISTVIEW_GetItemWidth(HWND hwnd) 573 565 { 574 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);566 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 575 567 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 576 568 INT nHeaderItemCount; … … 657 649 static INT LISTVIEW_CalculateWidth(HWND hwnd, INT nItem) 658 650 { 659 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);651 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 660 652 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 661 653 INT nHeaderItemCount; … … 732 724 static INT LISTVIEW_GetItemHeight(HWND hwnd) 733 725 { 734 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);726 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 735 727 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 736 728 INT nItemHeight = 0; … … 767 759 static VOID LISTVIEW_AddGroupSelection(HWND hwnd, INT nItem) 768 760 { 769 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);761 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 770 762 INT nFirst = min(infoPtr->nSelectionMark, nItem); 771 763 INT nLast = max(infoPtr->nSelectionMark, nItem); 772 LVITEMA lvItem;773 764 INT i; 774 765 775 lvItem.state = LVIS_SELECTED;776 lvItem.stateMask= LVIS_SELECTED;777 778 766 for (i = nFirst; i <= nLast; i++) 779 767 { 780 ListView_SetItemState(hwnd, i, &lvItem);768 ListView_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 781 769 } 782 770 … … 798 786 static VOID LISTVIEW_AddSelection(HWND hwnd, INT nItem) 799 787 { 800 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 801 LVITEMA lvItem; 802 803 lvItem.state = LVIS_SELECTED; 804 lvItem.stateMask= LVIS_SELECTED; 805 806 ListView_SetItemState(hwnd, nItem, &lvItem); 788 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 789 790 ListView_SetItemState(hwnd,nItem,LVIS_SELECTED,LVIS_SELECTED); 807 791 808 792 LISTVIEW_SetItemFocus(hwnd, nItem); … … 824 808 static BOOL LISTVIEW_ToggleSelection(HWND hwnd, INT nItem) 825 809 { 826 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);810 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 827 811 BOOL bResult; 828 LVITEMA lvItem;829 830 lvItem.stateMask= LVIS_SELECTED;831 812 832 813 if (ListView_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED) 833 814 { 834 lvItem.state = 0; 835 ListView_SetItemState(hwnd, nItem, &lvItem); 815 ListView_SetItemState(hwnd,nItem,0,LVIS_SELECTED); 836 816 bResult = FALSE; 837 817 } 838 818 else 839 819 { 840 lvItem.state = LVIS_SELECTED; 841 ListView_SetItemState(hwnd, nItem, &lvItem); 820 ListView_SetItemState(hwnd,nItem,LVIS_SELECTED,LVIS_SELECTED); 842 821 bResult = TRUE; 843 822 } … … 862 841 static VOID LISTVIEW_SetSelectionRect(HWND hwnd, RECT rcSelRect) 863 842 { 864 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 865 LVITEMA lvItem; 843 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 866 844 POINT ptItem; 867 845 INT i; 868 846 869 lvItem.stateMask = LVIS_SELECTED;870 871 847 for (i = 0; i < GETITEMCOUNT(infoPtr); i++) 872 848 { … … 874 850 if (PtInRect(&rcSelRect, ptItem) != FALSE) 875 851 { 876 lvItem.state = LVIS_SELECTED;852 ListView_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 877 853 } 878 854 else 879 855 { 880 lvItem.state = 0; 881 } 882 883 ListView_SetItemState(hwnd, i, &lvItem); 856 ListView_SetItemState(hwnd,i,0,LVIS_SELECTED); 857 } 884 858 } 885 859 } … … 898 872 static VOID LISTVIEW_SetGroupSelection(HWND hwnd, INT nItem) 899 873 { 900 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);874 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 901 875 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 902 LVITEMA lvItem;903 876 904 877 if ((uView == LVS_LIST) || (uView == LVS_REPORT)) … … 907 880 INT nFirst = min(infoPtr->nSelectionMark, nItem); 908 881 INT nLast = max(infoPtr->nSelectionMark, nItem); 909 lvItem.stateMask = LVIS_SELECTED;910 882 911 883 for (i = 0; i <= GETITEMCOUNT(infoPtr); i++) … … 913 885 if ((i < nFirst) || (i > nLast)) 914 886 { 915 lvItem.state = 0;887 ListView_SetItemState(hwnd,i,0,LVIS_SELECTED); 916 888 } 917 889 else 918 890 { 919 lvItem.state = LVIS_SELECTED; 920 } 921 922 ListView_SetItemState(hwnd, i, &lvItem); 891 ListView_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 892 } 923 893 } 924 894 } … … 954 924 static BOOL LISTVIEW_SetItemFocus(HWND hwnd, INT nItem) 955 925 { 956 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);926 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 957 927 BOOL bResult = FALSE; 958 LVITEMA lvItem;959 928 960 929 if (infoPtr->nFocusedItem != nItem) 961 930 { 962 931 bResult = TRUE; 963 ZeroMemory(&lvItem, sizeof(LVITEMA)); 964 lvItem.stateMask = LVIS_FOCUSED; 965 ListView_SetItemState(hwnd, infoPtr->nFocusedItem, &lvItem); 966 967 lvItem.state = LVIS_FOCUSED; 968 lvItem.stateMask = LVIS_FOCUSED; 969 ListView_SetItemState(hwnd, nItem, &lvItem); 932 933 ListView_SetItemState(hwnd,infoPtr->nFocusedItem,0,LVIS_FOCUSED); 934 ListView_SetItemState(hwnd,nItem,LVIS_FOCUSED,LVIS_FOCUSED); 970 935 971 936 infoPtr->nFocusedItem = nItem; … … 989 954 static VOID LISTVIEW_SetSelection(HWND hwnd, INT nItem) 990 955 { 991 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 992 LVITEMA lvItem; 956 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 993 957 994 958 if (nItem > 0) … … 1002 966 } 1003 967 1004 ZeroMemory(&lvItem, sizeof(LVITEMA)); 1005 lvItem.stateMask = LVIS_FOCUSED; 1006 ListView_SetItemState(hwnd, infoPtr->nFocusedItem, &lvItem); 1007 1008 lvItem.state = LVIS_SELECTED | LVIS_FOCUSED; 1009 lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED; 1010 ListView_SetItemState(hwnd, nItem, &lvItem); 968 ListView_SetItemState(hwnd,infoPtr->nFocusedItem,0,LVIS_FOCUSED); 969 ListView_SetItemState(hwnd,nItem,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED); 1011 970 1012 971 infoPtr->nFocusedItem = nItem; … … 1028 987 static BOOL LISTVIEW_KeySelection(HWND hwnd, INT nItem) 1029 988 { 1030 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);989 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1031 990 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 1032 991 WORD wShift = HIWORD(GetKeyState(VK_SHIFT)); … … 1079 1038 static LRESULT LISTVIEW_MouseSelection(HWND hwnd, POINT pt) 1080 1039 { 1081 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);1040 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1082 1041 RECT rcItem; 1083 1042 INT i; … … 1112 1071 static VOID LISTVIEW_RemoveSelections(HWND hwnd, INT nFirst, INT nLast) 1113 1072 { 1114 LVITEMA lvItem;1115 1073 INT i; 1116 1074 1117 lvItem.state = 0;1118 lvItem.stateMask = LVIS_SELECTED;1119 1120 1075 for (i = nFirst; i <= nLast; i++) 1121 1076 { 1122 ListView_SetItemState(hwnd, i, &lvItem);1077 ListView_SetItemState(hwnd,i,0,LVIS_SELECTED); 1123 1078 } 1124 1079 } … … 1183 1138 /* free string */ 1184 1139 if ((lpSubItem->pszText != NULL) && 1185 (lpSubItem->pszText != LPSTR_TEXTCALLBACK A))1140 (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) 1186 1141 { 1187 1142 COMCTL32_Free(lpSubItem->pszText); … … 1219 1174 * FAILURE : FALSE (NOT EQUAL) 1220 1175 */ 1221 static UINT LISTVIEW_GetItemChanges(LISTVIEW_ITEM *lpItem, LPLVITEMA lpLVItem)1176 static UINT LISTVIEW_GetItemChanges(LISTVIEW_ITEM *lpItem,LPLVITEMW lpLVItem,BOOL unicode) 1222 1177 { 1223 1178 UINT uChanged = 0; … … 1260 1215 if (lpLVItem->mask & LVIF_TEXT) 1261 1216 { 1262 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1263 { 1264 if (lpItem->pszText != LPSTR_TEXTCALLBACKA) 1265 { 1266 uChanged |= LVIF_TEXT; 1267 } 1268 } 1269 else 1270 { 1271 if (lpItem->pszText == LPSTR_TEXTCALLBACKA) 1272 { 1273 uChanged |= LVIF_TEXT; 1217 if (unicode) 1218 { 1219 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) 1220 { 1221 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) 1222 { 1223 uChanged |= LVIF_TEXT; 1224 } 1225 1274 1226 } 1275 1227 else 1276 1228 { 1277 if (lp LVItem->pszText)1229 if (lpItem->pszText == LPSTR_TEXTCALLBACKW) 1278 1230 { 1279 if (lpItem->pszText) 1231 uChanged |= LVIF_TEXT; 1232 } 1233 else 1234 { 1235 if (lpLVItem->pszText) 1280 1236 { 1281 if (strcmp(lpLVItem->pszText, lpItem->pszText) != 0) 1237 if (lpItem->pszText) 1238 { 1239 if (lstrcmpW(lpLVItem->pszText, lpItem->pszText) != 0) 1240 { 1241 uChanged |= LVIF_TEXT; 1242 } 1243 } 1244 else 1282 1245 { 1283 1246 uChanged |= LVIF_TEXT; … … 1286 1249 else 1287 1250 { 1288 uChanged |= LVIF_TEXT; 1251 if (lpItem->pszText) 1252 { 1253 uChanged |= LVIF_TEXT; 1254 } 1289 1255 } 1256 } 1257 } 1258 } else //!unicode 1259 { 1260 if ((LPSTR)lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1261 { 1262 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) 1263 { 1264 uChanged |= LVIF_TEXT; 1265 } 1266 1267 } 1268 else 1269 { 1270 if (lpItem->pszText == LPSTR_TEXTCALLBACKW) 1271 { 1272 uChanged |= LVIF_TEXT; 1290 1273 } 1291 1274 else 1292 1275 { 1293 if (lp Item->pszText)1276 if (lpLVItem->pszText) 1294 1277 { 1295 uChanged |= LVIF_TEXT; 1278 if (lpItem->pszText) 1279 { 1280 LPWSTR textW = HEAP_strdupAtoW(GetProcessHeap(),0,(LPSTR)lpLVItem->pszText); 1281 1282 //CB: need a lstrcmpAtoW 1283 if (lstrcmpW(textW,lpItem->pszText) != 0) 1284 { 1285 uChanged |= LVIF_TEXT; 1286 } 1287 FreeAsciiString((LPSTR)textW); 1288 } 1289 else 1290 { 1291 uChanged |= LVIF_TEXT; 1292 } 1293 } 1294 else 1295 { 1296 if (lpItem->pszText) 1297 { 1298 uChanged |= LVIF_TEXT; 1299 } 1296 1300 } 1297 1301 } … … 1316 1320 * FAILURE : FALSE 1317 1321 */ 1318 static BOOL LISTVIEW_InitItem(HWND hwnd, LISTVIEW_ITEM *lpItem, 1319 LPLVITEMA lpLVItem) 1322 static BOOL LISTVIEW_InitItem(HWND hwnd,LISTVIEW_ITEM *lpItem,LPLVITEMW lpLVItem,BOOL unicode) 1320 1323 { 1321 1324 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); … … 1349 1352 if (lpLVItem->mask & LVIF_TEXT) 1350 1353 { 1351 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1352 { 1353 if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) 1354 { 1355 return FALSE; 1356 } 1357 1358 if ((lpItem->pszText != NULL) && 1359 (lpItem->pszText != LPSTR_TEXTCALLBACKA)) 1360 { 1361 COMCTL32_Free(lpItem->pszText); 1362 } 1363 1364 lpItem->pszText = LPSTR_TEXTCALLBACKA; 1365 } 1366 else 1367 { 1368 if (lpItem->pszText == LPSTR_TEXTCALLBACKA) 1369 { 1370 lpItem->pszText = NULL; 1371 } 1372 1373 bResult = Str_SetPtrA(&lpItem->pszText, lpLVItem->pszText); 1374 } 1375 } 1376 } 1377 1378 return bResult; 1379 } 1380 1381 /*** 1382 * DESCRIPTION: 1383 * Initializes subitem attributes. 1384 * 1385 * NOTE: The documentation specifies that the operation fails if the user 1386 * tries to set the indent of a subitem. 1387 * 1388 * PARAMETER(S): 1389 * [I] HWND : window handle 1390 * [O] LISTVIEW_SUBITEM *: destination subitem 1391 * [I] LPLVITEM : source subitem 1392 * 1393 * RETURN: 1394 * SUCCCESS : TRUE 1395 * FAILURE : FALSE 1396 */ 1397 static BOOL LISTVIEW_InitSubItem(HWND hwnd, LISTVIEW_SUBITEM *lpSubItem, 1398 LPLVITEMA lpLVItem) 1399 { 1400 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 1401 BOOL bResult = FALSE; 1402 1403 if ((lpSubItem != NULL) && (lpLVItem != NULL)) 1404 { 1405 if (!(lpLVItem->mask & LVIF_INDENT)) 1406 { 1407 bResult = TRUE; 1408 ZeroMemory(lpSubItem, sizeof(LISTVIEW_SUBITEM)); 1409 1410 lpSubItem->iSubItem = lpLVItem->iSubItem; 1411 1412 if (lpLVItem->mask & LVIF_IMAGE) 1413 { 1414 lpSubItem->iImage = lpLVItem->iImage; 1415 } 1416 1417 if (lpLVItem->mask & LVIF_TEXT) 1418 { 1419 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1354 if (unicode) 1355 { 1356 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) 1420 1357 { 1421 1358 if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) … … 1424 1361 } 1425 1362 1426 if ((lp SubItem->pszText != NULL) &&1427 (lp SubItem->pszText != LPSTR_TEXTCALLBACKA))1363 if ((lpItem->pszText != NULL) && 1364 (lpItem->pszText != LPSTR_TEXTCALLBACKW)) 1428 1365 { 1429 COMCTL32_Free(lp SubItem->pszText);1366 COMCTL32_Free(lpItem->pszText); 1430 1367 } 1431 1368 1432 lp SubItem->pszText = LPSTR_TEXTCALLBACKA;1369 lpItem->pszText = LPSTR_TEXTCALLBACKW; 1433 1370 } 1434 1371 else 1435 1372 { 1436 if (lp SubItem->pszText == LPSTR_TEXTCALLBACKA)1373 if (lpItem->pszText == LPSTR_TEXTCALLBACKW) 1437 1374 { 1438 lp SubItem->pszText = NULL;1375 lpItem->pszText = NULL; 1439 1376 } 1440 1377 1441 bResult = Str_SetPtrA(&lpSubItem->pszText, lpLVItem->pszText); 1378 bResult = Str_SetPtrW(&lpItem->pszText, lpLVItem->pszText); 1379 } 1380 } else //!unicode 1381 { 1382 if ((LPSTR)lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1383 { 1384 if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) 1385 { 1386 return FALSE; 1387 } 1388 1389 if ((lpItem->pszText != NULL) && 1390 (lpItem->pszText != LPSTR_TEXTCALLBACKW)) 1391 { 1392 COMCTL32_Free(lpItem->pszText); 1393 } 1394 1395 lpItem->pszText = LPSTR_TEXTCALLBACKW; 1396 } 1397 else 1398 { 1399 INT len; 1400 1401 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpItem->pszText); 1402 len = (lpLVItem->pszText != NULL) ? lstrlenA((LPSTR)lpLVItem->pszText):0; 1403 1404 if (len > 0) 1405 { 1406 len++; 1407 lpItem->pszText = (LPWSTR)COMCTL32_Alloc(len*sizeof(WCHAR)); 1408 lstrcpyAtoW(lpItem->pszText,(LPSTR)lpLVItem->pszText); 1409 } else lpItem->pszText = NULL; 1410 1411 bResult = TRUE; 1412 } 1413 } 1414 } 1415 } 1416 1417 return bResult; 1418 } 1419 1420 /*** 1421 * DESCRIPTION: 1422 * Initializes subitem attributes. 1423 * 1424 * NOTE: The documentation specifies that the operation fails if the user 1425 * tries to set the indent of a subitem. 1426 * 1427 * PARAMETER(S): 1428 * [I] HWND : window handle 1429 * [O] LISTVIEW_SUBITEM *: destination subitem 1430 * [I] LPLVITEM : source subitem 1431 * 1432 * RETURN: 1433 * SUCCCESS : TRUE 1434 * FAILURE : FALSE 1435 */ 1436 static BOOL LISTVIEW_InitSubItem(HWND hwnd,LISTVIEW_SUBITEM *lpSubItem,LPLVITEMW lpLVItem,BOOL unicode) 1437 { 1438 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 1439 BOOL bResult = FALSE; 1440 1441 if ((lpSubItem != NULL) && (lpLVItem != NULL)) 1442 { 1443 if (!(lpLVItem->mask & LVIF_INDENT)) 1444 { 1445 bResult = TRUE; 1446 ZeroMemory(lpSubItem, sizeof(LISTVIEW_SUBITEM)); 1447 1448 lpSubItem->iSubItem = lpLVItem->iSubItem; 1449 1450 if (lpLVItem->mask & LVIF_IMAGE) 1451 { 1452 lpSubItem->iImage = lpLVItem->iImage; 1453 } 1454 1455 if (lpLVItem->mask & LVIF_TEXT) 1456 { 1457 if (unicode) 1458 { 1459 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) 1460 { 1461 if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) 1462 { 1463 return FALSE; 1464 } 1465 1466 if ((lpSubItem->pszText != NULL) && 1467 (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) 1468 { 1469 COMCTL32_Free(lpSubItem->pszText); 1470 } 1471 1472 lpSubItem->pszText = LPSTR_TEXTCALLBACKW; 1473 } 1474 else 1475 { 1476 if (lpSubItem->pszText == LPSTR_TEXTCALLBACKW) 1477 { 1478 lpSubItem->pszText = NULL; 1479 } 1480 1481 bResult = Str_SetPtrW(&lpSubItem->pszText, lpLVItem->pszText); 1482 } 1483 } else //!unicode 1484 { 1485 if ((LPSTR)lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1486 { 1487 if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) 1488 { 1489 return FALSE; 1490 } 1491 1492 if ((lpSubItem->pszText != NULL) && 1493 (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) 1494 { 1495 COMCTL32_Free(lpSubItem->pszText); 1496 } 1497 1498 lpSubItem->pszText = LPSTR_TEXTCALLBACKW; 1499 } 1500 else 1501 { 1502 INT len; 1503 1504 if (lpSubItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpSubItem->pszText); 1505 len = (lpLVItem->pszText != NULL) ? lstrlenA((LPSTR)lpLVItem->pszText):0; 1506 1507 if (len > 0) 1508 { 1509 len++; 1510 lpSubItem->pszText = (LPWSTR)COMCTL32_Alloc(len*sizeof(WCHAR)); 1511 lstrcpyAtoW(lpSubItem->pszText,(LPSTR)lpLVItem->pszText); 1512 } else lpSubItem->pszText = NULL; 1513 1514 bResult = TRUE; 1515 } 1442 1516 } 1443 1517 } … … 1460 1534 * FAILURE : FALSE 1461 1535 */ 1462 static BOOL LISTVIEW_AddSubItem(HWND hwnd, LPLVITEM A lpLVItem)1463 { 1464 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);1536 static BOOL LISTVIEW_AddSubItem(HWND hwnd, LPLVITEMW lpLVItem,BOOL unicode) 1537 { 1538 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1465 1539 LISTVIEW_SUBITEM *lpSubItem = NULL; 1466 1540 BOOL bResult = FALSE; … … 1476 1550 if (lpSubItem != NULL) 1477 1551 { 1478 if (LISTVIEW_InitSubItem(hwnd, lpSubItem, lpLVItem ) != FALSE)1552 if (LISTVIEW_InitSubItem(hwnd, lpSubItem, lpLVItem,unicode) != FALSE) 1479 1553 { 1480 1554 nPosition = LISTVIEW_FindInsertPosition(hdpaSubItems, … … 1579 1653 * FAILURE : FALSE 1580 1654 */ 1581 static BOOL LISTVIEW_SetItem(HWND hwnd, LPLVITEM A lpLVItem)1582 { 1583 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);1655 static BOOL LISTVIEW_SetItem(HWND hwnd, LPLVITEMW lpLVItem,BOOL unicode) 1656 { 1657 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1584 1658 BOOL bResult = FALSE; 1585 1659 HDPA hdpaSubItems; … … 1600 1674 { 1601 1675 ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); 1602 nmlv.hdr.hwndFrom = hwnd;1603 nmlv.hdr.idFrom = lCtrlId;1604 nmlv.hdr.code = LVN_ITEMCHANGING;1605 1676 nmlv.lParam = lpItem->lParam; 1606 uChanged = LISTVIEW_GetItemChanges(lpItem, lpLVItem );1677 uChanged = LISTVIEW_GetItemChanges(lpItem, lpLVItem,unicode); 1607 1678 if (uChanged != 0) 1608 1679 { … … 1617 1688 nmlv.lParam = lpItem->lParam; 1618 1689 /* send LVN_ITEMCHANGING notification */ 1619 ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv);1690 sendNotify(hwnd,LVN_ITEMCHANGING,&nmlv.hdr); 1620 1691 1621 1692 /* copy information */ 1622 bResult = LISTVIEW_InitItem(hwnd, lpItem, lpLVItem );1693 bResult = LISTVIEW_InitItem(hwnd, lpItem, lpLVItem,unicode); 1623 1694 1624 1695 /* send LVN_ITEMCHANGED notification */ 1625 nmlv.hdr.code = LVN_ITEMCHANGED; 1626 ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv); 1696 sendNotify(hwnd,LVN_ITEMCHANGED,&nmlv.hdr); 1627 1697 } 1628 1698 else … … 1652 1722 * FAILURE : FALSE 1653 1723 */ 1654 static BOOL LISTVIEW_SetSubItem(HWND hwnd, LPLVITEM A lpLVItem)1655 { 1656 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);1724 static BOOL LISTVIEW_SetSubItem(HWND hwnd, LPLVITEMW lpLVItem,BOOL unicode) 1725 { 1726 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1657 1727 BOOL bResult = FALSE; 1658 1728 HDPA hdpaSubItems; … … 1672 1742 if (lpSubItem != NULL) 1673 1743 { 1674 bResult = LISTVIEW_InitSubItem(hwnd, lpSubItem, lpLVItem );1744 bResult = LISTVIEW_InitSubItem(hwnd, lpSubItem, lpLVItem,unicode); 1675 1745 } 1676 1746 else 1677 1747 { 1678 bResult = LISTVIEW_AddSubItem(hwnd, lpLVItem );1748 bResult = LISTVIEW_AddSubItem(hwnd, lpLVItem,unicode); 1679 1749 } 1680 1750 … … 1750 1820 RECT rcItem) 1751 1821 { 1752 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);1753 CHAR szDispText[DISP_TEXT_SIZE];1754 LVITEM AlvItem;1822 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1823 WCHAR szDispText[DISP_TEXT_SIZE]; 1824 LVITEMW lvItem; 1755 1825 1756 1826 // TRACE("(hwnd=%x, hdc=%x, nItem=%d, nSubItem=%d\n", hwnd, hdc, … … 1758 1828 1759 1829 /* get information needed for drawing the item */ 1760 ZeroMemory(&lvItem, sizeof(LVITEM A));1830 ZeroMemory(&lvItem, sizeof(LVITEMW)); 1761 1831 lvItem.mask = LVIF_TEXT; 1762 1832 lvItem.iItem = nItem; … … 1764 1834 lvItem.cchTextMax = DISP_TEXT_SIZE; 1765 1835 lvItem.pszText = szDispText; 1766 ListView_GetItem A(hwnd,&lvItem);1836 ListView_GetItemW(hwnd,&lvItem); 1767 1837 1768 1838 /* set item colors */ … … 1770 1840 SetTextColor(hdc, infoPtr->clrText); 1771 1841 1772 ExtTextOut A(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED,1773 &rcItem, lvItem.pszText, lstrlen A(lvItem.pszText), NULL);1842 ExtTextOutW(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1843 &rcItem, lvItem.pszText, lstrlenW(lvItem.pszText), NULL); 1774 1844 } 1775 1845 … … 1790 1860 static VOID LISTVIEW_DrawItem(HWND hwnd, HDC hdc, INT nItem, RECT rcItem) 1791 1861 { 1792 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);1793 CHAR szDispText[DISP_TEXT_SIZE];1862 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1863 WCHAR szDispText[DISP_TEXT_SIZE]; 1794 1864 INT nLabelWidth; 1795 LVITEM AlvItem;1865 LVITEMW lvItem; 1796 1866 INT nMixMode; 1797 1867 DWORD dwBkColor; … … 1801 1871 1802 1872 /* get information needed for drawing the item */ 1803 ZeroMemory(&lvItem, sizeof(LVITEM A));1873 ZeroMemory(&lvItem, sizeof(LVITEMW)); 1804 1874 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_INDENT; 1805 1875 lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED | LVIS_STATEIMAGEMASK; … … 1808 1878 lvItem.cchTextMax = DISP_TEXT_SIZE; 1809 1879 lvItem.pszText = szDispText; 1810 ListView_GetItem A(hwnd,&lvItem);1880 ListView_GetItemW(hwnd,&lvItem); 1811 1881 1812 1882 /* state icons */ … … 1871 1941 } 1872 1942 1873 nLabelWidth = ListView_GetStringWidth A(hwnd, lvItem.pszText);1943 nLabelWidth = ListView_GetStringWidthW(hwnd, lvItem.pszText); 1874 1944 if (rcItem.left + nLabelWidth < rcItem.right) 1875 1945 rcItem.right = rcItem.left + nLabelWidth; 1876 1946 1877 1947 /* draw label */ 1878 ExtTextOut A(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED,1879 &rcItem, lvItem.pszText, lstrlen A(lvItem.pszText), NULL);1948 ExtTextOutW(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1949 &rcItem, lvItem.pszText, lstrlenW(lvItem.pszText), NULL); 1880 1950 1881 1951 if ((lvItem.state & LVIS_FOCUSED) && (infoPtr->bFocus == TRUE)) … … 1908 1978 static VOID LISTVIEW_DrawLargeItem(HWND hwnd, HDC hdc, INT nItem, RECT rcItem) 1909 1979 { 1910 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);1911 CHAR szDispText[DISP_TEXT_SIZE];1980 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1981 WCHAR szDispText[DISP_TEXT_SIZE]; 1912 1982 INT nDrawPosX = rcItem.left; 1913 1983 INT nLabelWidth; 1914 1984 TEXTMETRICA tm; 1915 LVITEM AlvItem;1985 LVITEMW lvItem; 1916 1986 1917 1987 // TRACE("(hwnd=%x, hdc=%x, nItem=%d, left=%d, top=%d, right=%d, \ … … 1920 1990 1921 1991 /* get information needed for drawing the item */ 1922 ZeroMemory(&lvItem, sizeof(LVITEM A));1992 ZeroMemory(&lvItem, sizeof(LVITEMW)); 1923 1993 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; 1924 1994 lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED; … … 1927 1997 lvItem.cchTextMax = DISP_TEXT_SIZE; 1928 1998 lvItem.pszText = szDispText; 1929 ListView_GetItem A(hwnd, &lvItem);1999 ListView_GetItemW(hwnd, &lvItem); 1930 2000 1931 2001 if (lvItem.state & LVIS_SELECTED) … … 1963 2033 1964 2034 rcItem.top += infoPtr->iconSize.cy + ICON_BOTTOM_PADDING; 1965 nLabelWidth = ListView_GetStringWidth A(hwnd, lvItem.pszText);2035 nLabelWidth = ListView_GetStringWidthW(hwnd, lvItem.pszText); 1966 2036 nDrawPosX = infoPtr->iconSpacing.cx - nLabelWidth; 1967 2037 if (nDrawPosX > 1) … … 1979 2049 GetTextMetricsA(hdc, &tm); 1980 2050 rcItem.bottom = rcItem.top + tm.tmHeight + HEIGHT_PADDING; 1981 ExtTextOut A(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED,1982 &rcItem, lvItem.pszText, lstrlen A(lvItem.pszText), NULL);2051 ExtTextOutW(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 2052 &rcItem, lvItem.pszText, lstrlenW(lvItem.pszText), NULL); 1983 2053 1984 2054 if (lvItem.state & LVIS_FOCUSED) … … 2001 2071 static VOID LISTVIEW_RefreshReport(HWND hwnd, HDC hdc) 2002 2072 { 2003 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd,0);2073 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2004 2074 SCROLLINFO scrollInfo; 2005 2075 INT nDrawPosY = infoPtr->rcList.top; … … 2020 2090 nLast = min(nLast, GETITEMCOUNT(infoPtr)); 2021 2091 2022 //AH required for Odin?2023 #if 02024 2092 /* send cache hint notification */ 2025 2093 if (GetWindowLongA(hwnd,GWL_STYLE) & LVS_OWNERDATA) … … 2027 2095 NMLVCACHEHINT nmlv; 2028 2096 2029 nmlv.hdr.hwndFrom = hwnd;2030 nmlv.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID);2031 nmlv.hdr.code = LVN_ODCACHEHINT;2032 2097 nmlv.iFrom = nItem; 2033 2098 nmlv.iTo = nLast; 2034 2099 2035 SendMessageA(GetParent(hwnd), WM_NOTIFY, (WPARAM)nmlv.hdr.idFrom, 2036 (LPARAM)&nmlv); 2037 } 2038 #endif 2100 sendNotify(hwnd,LVN_ODCACHEHINT,&nmlv.hdr); 2101 } 2039 2102 2040 2103 for (; nItem < nLast; nItem++) … … 2082 2145 static INT LISTVIEW_GetCountPerRow(HWND hwnd) 2083 2146 { 2084 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd,0);2147 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2085 2148 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2086 2149 INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left; … … 2119 2182 static INT LISTVIEW_GetCountPerColumn(HWND hwnd) 2120 2183 { 2121 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd,0);2184 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2122 2185 INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; 2123 2186 INT nCountPerColumn = 1; … … 2148 2211 static INT LISTVIEW_GetColumnCount(HWND hwnd) 2149 2212 { 2150 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2213 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2151 2214 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 2152 2215 INT nColumnCount = 0; … … 2181 2244 static VOID LISTVIEW_RefreshList(HWND hwnd, HDC hdc) 2182 2245 { 2183 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2246 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2184 2247 RECT rcItem; 2185 2248 INT i, j; … … 2224 2287 static VOID LISTVIEW_RefreshIcon(HWND hwnd, HDC hdc, BOOL bSmall) 2225 2288 { 2226 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2289 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2227 2290 POINT ptPosition; 2228 2291 POINT ptOrigin; … … 2277 2340 static VOID LISTVIEW_Refresh(HWND hwnd, HDC hdc) 2278 2341 { 2279 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2342 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2280 2343 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2281 2344 HFONT hOldFont; … … 2334 2397 WORD wWidth, WORD wHeight) 2335 2398 { 2336 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2399 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2337 2400 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2338 2401 INT nItemCountPerColumn = 1; … … 2455 2518 static LRESULT LISTVIEW_DeleteAllItems(HWND hwnd) 2456 2519 { 2457 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2520 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2458 2521 LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); 2459 2522 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); … … 2476 2539 2477 2540 /* send LVN_DELETEALLITEMS notification */ 2478 nmlv.hdr.hwndFrom = hwnd;2479 nmlv.hdr.idFrom = lCtrlId;2480 nmlv.hdr.code = LVN_DELETEALLITEMS;2481 2541 nmlv.iItem = -1; 2482 2542 2483 2543 /* verify if subsequent LVN_DELETEITEM notifications should be 2484 2544 suppressed */ 2485 bSuppress = ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv);2545 bSuppress = sendNotify(hwnd,LVN_DELETEALLITEMS,&nmlv.hdr); 2486 2546 2487 2547 for (i = 0; i < GETITEMCOUNT(infoPtr); i++) … … 2497 2557 /* free subitem string */ 2498 2558 if ((lpSubItem->pszText != NULL) && 2499 (lpSubItem->pszText != LPSTR_TEXTCALLBACK A))2559 (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) 2500 2560 { 2501 2561 COMCTL32_Free(lpSubItem->pszText); … … 2513 2573 { 2514 2574 /* send LVN_DELETEITEM notification */ 2515 nmlv.hdr.code = LVN_DELETEITEM;2516 2575 nmlv.iItem = i; 2517 2576 nmlv.lParam = lpItem->lParam; 2518 ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv);2577 sendNotify(hwnd,LVN_DELETEITEM,&nmlv.hdr); 2519 2578 } 2520 2579 2521 2580 /* free item string */ 2522 2581 if ((lpItem->pszText != NULL) && 2523 (lpItem->pszText != LPSTR_TEXTCALLBACK A))2582 (lpItem->pszText != LPSTR_TEXTCALLBACKW)) 2524 2583 { 2525 2584 COMCTL32_Free(lpItem->pszText); … … 2573 2632 static LRESULT LISTVIEW_DeleteColumn(HWND hwnd, INT nColumn) 2574 2633 { 2575 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2634 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2576 2635 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2577 2636 BOOL bResult = FALSE; … … 2612 2671 static LRESULT LISTVIEW_DeleteItem(HWND hwnd, INT nItem) 2613 2672 { 2614 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2673 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2615 2674 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 2616 2675 UINT uView = lStyle & LVS_TYPEMASK; 2617 LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID);2618 2676 NMLISTVIEW nmlv; 2619 2677 BOOL bResult = FALSE; … … 2640 2698 /* free item string */ 2641 2699 if ((lpSubItem->pszText != NULL) && 2642 (lpSubItem->pszText != LPSTR_TEXTCALLBACK A))2700 (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) 2643 2701 { 2644 2702 COMCTL32_Free(lpSubItem->pszText); … … 2654 2712 { 2655 2713 /* send LVN_DELETEITEM notification */ 2656 nmlv.hdr.hwndFrom = hwnd;2657 nmlv.hdr.idFrom = lCtrlId;2658 nmlv.hdr.code = LVN_DELETEITEM;2659 2714 nmlv.iItem = nItem; 2660 2715 nmlv.lParam = lpItem->lParam; 2661 SendMessageA(GetParent(hwnd), WM_NOTIFY, (WPARAM)lCtrlId, 2662 (LPARAM)&nmlv); 2716 sendNotify(hwnd,LVN_DELETEITEM,&nmlv.hdr); 2663 2717 2664 2718 /* free item string */ 2665 2719 if ((lpItem->pszText != NULL) && 2666 (lpItem->pszText != LPSTR_TEXTCALLBACK A))2720 (lpItem->pszText != LPSTR_TEXTCALLBACKW)) 2667 2721 { 2668 2722 COMCTL32_Free(lpItem->pszText); … … 2721 2775 static LRESULT LISTVIEW_GetEditControl(HWND hwnd) 2722 2776 { 2723 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2777 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2724 2778 return infoPtr->hwndEdit; 2725 2779 } … … 2742 2796 static BOOL LISTVIEW_EndEditLabel(HWND hwnd, LPSTR pszText, DWORD nItem) 2743 2797 { 2744 NMLVDISPINFO AdispInfo;2798 NMLVDISPINFOW dispInfo; 2745 2799 LISTVIEW_ITEM *lpItem; 2746 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 2747 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 2800 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2748 2801 HDPA hdpaSubItems; 2749 2802 BOOL bUpdateItemText; 2750 2751 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); 2803 WCHAR* textW = NULL; 2804 2805 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOW)); 2752 2806 2753 2807 if (NULL == (hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem))) … … 2757 2811 return FALSE; 2758 2812 2759 dispInfo.hdr.hwndFrom = hwnd;2760 dispInfo.hdr.idFrom = nCtrlId;2761 dispInfo.hdr.code = LVN_ENDLABELEDITA;2762 2813 dispInfo.item.mask = 0; 2763 2814 dispInfo.item.iItem = nItem; 2764 2815 dispInfo.item.state = lpItem->state; 2765 2816 dispInfo.item.stateMask = 0; 2766 dispInfo.item.pszText = pszText; 2767 dispInfo.item.cchTextMax = pszText ? strlen(pszText) : 0; 2817 if (isUnicodeNotify(&infoPtr->header)) 2818 { 2819 textW = HEAP_strdupAtoW(GetProcessHeap(),0,pszText); 2820 2821 dispInfo.item.pszText = textW; 2822 dispInfo.item.cchTextMax = textW ? lstrlenW(textW):0; 2823 } else 2824 { 2825 dispInfo.item.pszText = (LPWSTR)pszText; 2826 dispInfo.item.cchTextMax = pszText ? lstrlenA(pszText):0; 2827 } 2768 2828 dispInfo.item.iImage = lpItem->iImage; 2769 2829 dispInfo.item.lParam = lpItem->lParam; 2770 2830 infoPtr->hwndEdit = 0; 2771 2831 2772 bUpdateItemText = ListView_Notify(GetParent(hwnd), nCtrlId, &dispInfo);2832 bUpdateItemText = sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? LVN_ENDLABELEDITW:LVN_ENDLABELEDITA,&dispInfo.hdr); 2773 2833 2774 2834 /* Do we need to update the Item Text */ 2775 2835 if(bUpdateItemText) 2776 2836 { 2777 if(lpItem->pszText != LPSTR_TEXTCALLBACKA) 2778 { 2779 Str_SetPtrA(&lpItem->pszText, pszText); 2780 } 2781 } 2837 if(lpItem->pszText != LPSTR_TEXTCALLBACKW) 2838 { 2839 if (isUnicodeNotify(&infoPtr->header)) 2840 Str_SetPtrW(&lpItem->pszText,textW); 2841 else 2842 { 2843 COMCTL32_Free(lpItem->pszText); 2844 lpItem->pszText = HEAP_strdupAtoW(GetProcessHeap(),0,pszText); 2845 } 2846 2847 } 2848 } 2849 2850 if (textW) COMCTL32_Free(textW); 2782 2851 2783 2852 return TRUE; … … 2796 2865 * FAILURE : FALSE 2797 2866 */ 2798 2799 static HWND LISTVIEW_EditLabel A(HWND hwnd, INT nItem)2800 { 2801 NMLVDISPINFO AdispInfo;2867 //CB: unicode parameter not used, edit doesn't use unicode chars 2868 static HWND LISTVIEW_EditLabel(HWND hwnd, INT nItem,BOOL unicode) 2869 { 2870 NMLVDISPINFOW dispInfo; 2802 2871 RECT rect; 2803 2872 LISTVIEW_ITEM *lpItem; 2804 2873 HWND hedit; 2805 2874 HINSTANCE hinst = GetWindowLongA(hwnd, GWL_HINSTANCE); 2806 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 2807 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 2875 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2808 2876 HDPA hdpaSubItems; 2809 CHAR szDispText[DISP_TEXT_SIZE]; 2810 LVITEMA lvItem; 2877 LVITEMW lvItem; 2878 CHAR* textA = NULL; 2879 WCHAR* textW = NULL; 2811 2880 2812 2881 … … 2831 2900 2832 2901 /* get information needed for drawing the item */ 2833 ZeroMemory(&lvItem, sizeof(LVITEM A));2902 ZeroMemory(&lvItem, sizeof(LVITEMW)); 2834 2903 lvItem.mask = LVIF_TEXT; 2835 2904 lvItem.iItem = nItem; 2836 2905 lvItem.iSubItem = 0; 2837 2906 lvItem.cchTextMax = DISP_TEXT_SIZE; 2838 lvItem.pszText = szDispText; 2839 ListView_GetItemA(hwnd, &lvItem); 2840 2841 dispInfo.hdr.hwndFrom = hwnd; 2842 dispInfo.hdr.idFrom = nCtrlId; 2843 dispInfo.hdr.code = LVN_BEGINLABELEDITA; 2907 if (isUnicodeNotify(&infoPtr->header)) 2908 { 2909 textW = (WCHAR*)COMCTL32_Alloc(DISP_TEXT_SIZE*sizeof(WCHAR)); 2910 lvItem.pszText = textW; 2911 ListView_GetItemW(hwnd,&lvItem); 2912 dispInfo.item.cchTextMax = lstrlenW(lvItem.pszText); 2913 } else 2914 { 2915 textA = (CHAR*)COMCTL32_Alloc(DISP_TEXT_SIZE*sizeof(CHAR)); 2916 lvItem.pszText = (LPWSTR)textA; 2917 ListView_GetItemA(hwnd, &lvItem); 2918 dispInfo.item.cchTextMax = lstrlenA((LPSTR)lvItem.pszText); 2919 } 2920 2844 2921 dispInfo.item.mask = 0; 2845 2922 dispInfo.item.iItem = nItem; … … 2847 2924 dispInfo.item.stateMask = 0; 2848 2925 dispInfo.item.pszText = lvItem.pszText; 2849 dispInfo.item.cchTextMax = strlen(lvItem.pszText);2850 2926 dispInfo.item.iImage = lpItem->iImage; 2851 2927 dispInfo.item.lParam = lpItem->lParam; 2852 2928 2853 if ( ListView_LVNotify(GetParent(hwnd), nCtrlId, &dispInfo))2929 if (sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? LVN_BEGINLABELEDITW:LVN_BEGINLABELEDITA,&dispInfo.hdr)) 2854 2930 return 0; 2855 2931 … … 2858 2934 return 0; 2859 2935 2860 if (!(hedit = CreateEditLabel(szDispText , WS_VISIBLE, 2936 //Edit uses ANSI by default -> convert 2937 if (isUnicodeNotify(&infoPtr->header)) 2938 { 2939 textA = UnicodeToAsciiString(textW); 2940 } 2941 2942 if (!(hedit = CreateEditLabel(textA , WS_VISIBLE, 2861 2943 rect.left-2, rect.top-1, 0, 2862 2944 rect.bottom - rect.top+2, … … 2868 2950 SendMessageA(hedit, EM_SETSEL, 0, -1); 2869 2951 2952 if (textA) COMCTL32_Free(textA); 2953 if (textW) COMCTL32_Free(textW); 2954 2870 2955 return hedit; 2871 2956 } … … 2886 2971 static BOOL LISTVIEW_EnsureVisible(HWND hwnd, INT nItem, BOOL bPartial) 2887 2972 { 2888 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);2973 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2889 2974 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2890 2975 INT nScrollPosHeight = 0; … … 3044 3129 static INT LISTVIEW_GetNearestItem(HWND hwnd, POINT pt, UINT vkDirection) 3045 3130 { 3046 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);3131 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3047 3132 LVHITTESTINFO lvHitTestInfo; 3048 3133 INT nItem = -1; … … 3104 3189 * FAILURE : -1 3105 3190 */ 3106 static LRESULT LISTVIEW_FindItem(HWND hwnd, INT nStart, 3107 LPLVFINDINFO lpFindInfo) 3108 { 3109 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 3191 static LRESULT LISTVIEW_FindItem(HWND hwnd,INT nStart,LPLVFINDINFOW lpFindInfo,BOOL unicode) 3192 { 3193 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3110 3194 POINT ptItem; 3111 CHAR szDispText[DISP_TEXT_SIZE]; 3112 LVITEMA lvItem; 3113 BOOL bWrap = FALSE; 3195 LVITEMW lvItem; 3196 BOOL bWrap = FALSE,rc; 3114 3197 INT nItem = nStart; 3115 3198 INT nLast = GETITEMCOUNT(infoPtr); 3199 CHAR* textA = NULL; 3200 WCHAR* textW = NULL; 3116 3201 3117 3202 if ((nItem >= -1) && (lpFindInfo != NULL)) 3118 3203 { 3119 ZeroMemory(&lvItem, sizeof(LVITEM A));3204 ZeroMemory(&lvItem, sizeof(LVITEMW)); 3120 3205 3121 3206 if (lpFindInfo->flags & LVFI_PARAM) … … 3127 3212 { 3128 3213 lvItem.mask |= LVIF_TEXT; 3129 lvItem.pszText = szDispText; 3214 if (unicode) 3215 { 3216 textW = (WCHAR*)COMCTL32_Alloc(DISP_TEXT_SIZE*sizeof(WCHAR)); 3217 lvItem.pszText = textW; 3218 } else 3219 { 3220 textA = (CHAR*)COMCTL32_Alloc(DISP_TEXT_SIZE*sizeof(CHAR)); 3221 lvItem.pszText = (LPWSTR)textA; 3222 } 3130 3223 lvItem.cchTextMax = DISP_TEXT_SIZE; 3131 3224 } … … 3134 3227 { 3135 3228 lvItem.mask |= LVIF_TEXT; 3136 lvItem.pszText = szDispText; 3229 if (unicode) 3230 { 3231 if (!textW) 3232 { 3233 textW = (WCHAR*)COMCTL32_Alloc(DISP_TEXT_SIZE*sizeof(WCHAR)); 3234 lvItem.pszText = textW; 3235 } 3236 } else 3237 { 3238 if (!textA) 3239 { 3240 textA = (CHAR*)COMCTL32_Alloc(DISP_TEXT_SIZE*sizeof(CHAR)); 3241 lvItem.pszText = (LPWSTR)textA; 3242 } 3243 } 3137 3244 lvItem.cchTextMax = DISP_TEXT_SIZE; 3138 3245 } … … 3173 3280 lvItem.iItem = nItem; 3174 3281 lvItem.iSubItem = 0; 3175 if (ListView_GetItemA(hwnd, &lvItem) != FALSE) 3282 if (unicode) 3283 ListView_GetItemW(hwnd, &lvItem); 3284 else 3285 ListView_GetItemA(hwnd,(LVITEMA*)&lvItem); 3286 if (rc != FALSE) 3176 3287 { 3177 3288 if (lvItem.mask & LVIF_TEXT) … … 3179 3290 if (lpFindInfo->flags & LVFI_PARTIAL) 3180 3291 { 3181 if (strstr(lvItem.pszText, lpFindInfo->psz) == NULL) 3292 if (unicode) 3293 { 3294 if (wcswcs((const wchar_t*)lvItem.pszText,(wchar_t*)lpFindInfo->psz) == NULL) 3182 3295 continue; 3296 } else 3297 { 3298 if (strstr((LPSTR)lvItem.pszText,(LPSTR)lpFindInfo->psz) == NULL) 3299 continue; 3300 } 3183 3301 } 3184 3302 else 3185 3303 { 3186 if (strcmp(lvItem.pszText, lpFindInfo->psz) != 0) 3187 continue; 3304 if (unicode) 3305 { 3306 if (lstrcmpW(lvItem.pszText,lpFindInfo->psz) != 0) 3307 continue; 3308 3309 } else 3310 { 3311 if (lstrcmpA((LPSTR)lvItem.pszText,(LPSTR)lpFindInfo->psz) != 0) 3312 continue; 3313 } 3188 3314 } 3189 3315 } … … 3227 3353 static LRESULT LISTVIEW_GetBkColor(HWND hwnd) 3228 3354 { 3229 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);3355 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3230 3356 3231 3357 return infoPtr->clrBk; … … 3262 3388 static UINT LISTVIEW_GetCallbackMask(HWND hwnd) 3263 3389 { 3264 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);3390 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3265 3391 3266 3392 return infoPtr->uCallbackMask; … … 3280 3406 * FAILURE : FALSE 3281 3407 */ 3282 static LRESULT LISTVIEW_GetColumn A(HWND hwnd, INT nItem, LPLVCOLUMNA lpColumn)3283 { 3284 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);3285 HDITEM Ahdi;3408 static LRESULT LISTVIEW_GetColumn(HWND hwnd,INT nItem,LPLVCOLUMNW lpColumn,BOOL unicode) 3409 { 3410 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3411 HDITEMW hdi; 3286 3412 BOOL bResult = FALSE; 3287 3413 … … 3289 3415 { 3290 3416 /* initialize memory */ 3291 ZeroMemory(&hdi, sizeof(HDITEM A));3417 ZeroMemory(&hdi, sizeof(HDITEMW)); 3292 3418 3293 3419 if (lpColumn->mask & LVCF_FMT) … … 3318 3444 } 3319 3445 3320 bResult = Header_GetItemA(infoPtr->hwndHeader, nItem, &hdi); 3446 if (unicode) 3447 bResult = Header_GetItemW(infoPtr->hwndHeader,nItem,&hdi); 3448 else 3449 bResult = Header_GetItemA(infoPtr->hwndHeader,nItem,(HDITEMW*)&hdi); 3321 3450 if (bResult != FALSE) 3322 3451 { … … 3364 3493 } 3365 3494 3366 /* LISTVIEW_GetColumnW */3367 3368 3495 static LRESULT LISTVIEW_GetColumnOrderArray(HWND hwnd, INT iCount, LPINT lpiArray) 3369 3496 { 3370 /* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0); */3497 /* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); */ 3371 3498 INT i; 3372 3499 … … 3395 3522 static LRESULT LISTVIEW_GetColumnWidth(HWND hwnd, INT nColumn) 3396 3523 { 3397 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);3524 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3398 3525 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 3399 3526 INT nColumnWidth = 0; … … 3409 3536 ZeroMemory(&hdi, sizeof(HDITEMA)); 3410 3537 hdi.mask = HDI_WIDTH; 3411 if (Header_GetItem A(infoPtr->hwndHeader, nColumn, &hdi) != FALSE)3538 if (Header_GetItemW(infoPtr->hwndHeader, nColumn, &hdi) != FALSE) 3412 3539 { 3413 3540 nColumnWidth = hdi.cxy; … … 3432 3559 static LRESULT LISTVIEW_GetCountPerPage(HWND hwnd) 3433 3560 { 3434 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);3561 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3435 3562 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 3436 3563 INT nItemCount = 0; … … 3473 3600 LISTVIEW_INFO *infoPtr; 3474 3601 /* make sure we can get the listview info */ 3475 if (!(infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0)))3602 if (!(infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd))) 3476 3603 return (0); 3477 3604 return (infoPtr->dwExStyle); … … 3490 3617 static LRESULT LISTVIEW_GetHeader(HWND hwnd) 3491 3618 { 3492 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);3619 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3493 3620 3494 3621 return infoPtr->hwndHeader; … … 3513 3640 static LRESULT LISTVIEW_GetImageList(HWND hwnd, INT nImageList) 3514 3641 { 3515 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);3642 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3516 3643 HIMAGELIST himl = NULL; 3517 3644 … … 3540 3667 * PARAMETER(S): 3541 3668 * [I] HWND : window handle 3542 * [IO] LPLVITEM A: item info3669 * [IO] LPLVITEMW : item info 3543 3670 * [I] internal : if true then we will use tricks that avoid copies 3544 3671 * but are not compatible with the regular interface … … 3548 3675 * FAILURE : FALSE 3549 3676 */ 3550 static LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem) 3551 { 3552 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 3553 LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); 3677 static LRESULT LISTVIEW_GetItem(HWND hwnd, LPLVITEMW lpLVItem,BOOL unicode) 3678 { 3679 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3554 3680 BOOL bResult = FALSE; 3555 NMLVDISPINFO AdispInfo;3681 NMLVDISPINFOW dispInfo; 3556 3682 LISTVIEW_SUBITEM *lpSubItem; 3557 3683 LISTVIEW_ITEM *lpItem; … … 3564 3690 if ((lpLVItem->iItem >= 0) && (lpLVItem->iItem < GETITEMCOUNT(infoPtr))) 3565 3691 { 3566 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFO A));3692 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOW)); 3567 3693 hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); 3568 3694 if (hdpaSubItems != NULL) … … 3574 3700 if (lpLVItem->iSubItem == 0) 3575 3701 { 3702 LPSTR textA = NULL; 3703 LPWSTR textW = NULL; 3704 3576 3705 if ((lpItem->iImage == I_IMAGECALLBACK) && 3577 3706 (lpLVItem->mask & LVIF_IMAGE)) … … 3580 3709 } 3581 3710 3582 if ((lpItem->pszText == LPSTR_TEXTCALLBACK A) &&3711 if ((lpItem->pszText == LPSTR_TEXTCALLBACKW) && 3583 3712 (lpLVItem->mask & LVIF_TEXT)) 3584 3713 { 3585 3714 dispInfo.item.mask |= LVIF_TEXT; 3586 ZeroMemory(lpLVItem->pszText, sizeof(CHAR)*lpLVItem->cchTextMax);3587 dispInfo.item.pszText = lpLVItem->pszText;3588 3715 dispInfo.item.cchTextMax = lpLVItem->cchTextMax; 3716 if (isUnicodeNotify(&infoPtr->header)) 3717 { 3718 textW = (WCHAR*)COMCTL32_Alloc(dispInfo.item.cchTextMax*sizeof(WCHAR)); 3719 if (textW) textW[0] = 0; 3720 dispInfo.item.pszText = textW; 3721 } else 3722 { 3723 textA = (CHAR*)COMCTL32_Alloc(dispInfo.item.cchTextMax*sizeof(CHAR)); 3724 if (textA) textA[0] = 0; 3725 dispInfo.item.pszText = (LPWSTR)textA; 3726 } 3589 3727 } 3590 3728 … … 3597 3735 if (dispInfo.item.mask != 0) 3598 3736 { 3599 dispInfo.hdr.hwndFrom = hwnd;3600 dispInfo.hdr.idFrom = lCtrlId;3601 dispInfo.hdr.code = LVN_GETDISPINFOA;3602 3737 dispInfo.item.iItem = lpLVItem->iItem; 3603 3738 dispInfo.item.iSubItem = 0; 3604 3739 dispInfo.item.lParam = lpItem->lParam; 3605 ListView_Notify(GetParent(hwnd), lCtrlId, &dispInfo);3740 sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? LVN_GETDISPINFOW:LVN_GETDISPINFOA,&dispInfo.hdr); 3606 3741 } 3607 3742 … … 3619 3754 if (dispInfo.item.mask & LVIF_DI_SETITEM) 3620 3755 { 3621 Str_SetPtrA(&lpItem->pszText, dispInfo.item.pszText); 3756 if (isUnicodeNotify(&infoPtr->header)) 3757 { 3758 Str_SetPtrW(&lpItem->pszText,dispInfo.item.pszText); 3759 } else 3760 { 3761 INT len = dispInfo.item.pszText ? lstrlenA((LPSTR)dispInfo.item.pszText):0; 3762 3763 COMCTL32_Free(lpItem->pszText); 3764 if (len > 0) 3765 { 3766 len++; 3767 lpItem->pszText = (WCHAR*)COMCTL32_Alloc(len*sizeof(WCHAR)); 3768 lstrcpyAtoW(lpItem->pszText,(LPSTR)dispInfo.item.pszText); 3769 } else lpItem->pszText = NULL; 3770 } 3622 3771 } 3623 3772 /* Make sure the source string is valid */ 3624 3773 if (dispInfo.item.pszText == NULL) 3625 lpLVItem->pszText[0] = '\0';3626 else3627 3774 { 3628 strncpy(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3629 lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; 3775 if (unicode) 3776 lpLVItem->pszText[0] = L'\0'; 3777 else 3778 ((LPSTR)lpLVItem->pszText)[0] = '\0'; 3779 } else 3780 { 3781 if (unicode) 3782 { 3783 if (isUnicodeNotify(&infoPtr->header)) 3784 lstrcpynW(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3785 else 3786 lstrcpynAtoW(lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3787 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 3788 } else 3789 { 3790 if (isUnicodeNotify(&infoPtr->header)) 3791 lstrcpynWtoA((LPSTR)lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3792 else 3793 lstrcpynA((LPSTR)lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3794 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 3795 } 3630 3796 } 3631 3797 } … … 3634 3800 if (lpItem->pszText != NULL) 3635 3801 { 3636 strncpy(lpLVItem->pszText, lpItem->pszText, 3637 lpLVItem->cchTextMax); 3638 lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; 3802 if (unicode) 3803 { 3804 lstrcpynW(lpLVItem->pszText,lpItem->pszText,lpLVItem->cchTextMax); 3805 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 3806 } else 3807 { 3808 lstrcpynWtoA((LPSTR)lpLVItem->pszText,lpItem->pszText,lpLVItem->cchTextMax); 3809 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 3810 } 3639 3811 } 3640 3812 else 3641 3813 { 3642 ZeroMemory(lpLVItem->pszText, sizeof(char)* 3643 lpLVItem->cchTextMax); 3814 if (unicode) 3815 ZeroMemory(lpLVItem->pszText,sizeof(WCHAR)*lpLVItem->cchTextMax); 3816 else 3817 ZeroMemory(lpLVItem->pszText,sizeof(CHAR)*lpLVItem->cchTextMax); 3644 3818 } 3645 3819 } … … 3666 3840 lpLVItem->iIndent = lpItem->iIndent; 3667 3841 } 3842 if (textA) COMCTL32_Free(textA); 3843 if (textW) COMCTL32_Free(textW); 3668 3844 } 3669 3845 else 3670 3846 { 3847 CHAR* textA = NULL; 3848 WCHAR* textW = NULL; 3671 3849 lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, 3672 3850 lpLVItem->iSubItem); … … 3679 3857 } 3680 3858 3681 if ((lpSubItem->pszText == LPSTR_TEXTCALLBACK A) &&3859 if ((lpSubItem->pszText == LPSTR_TEXTCALLBACKW) && 3682 3860 (lpLVItem->mask & LVIF_TEXT)) 3683 3861 { 3684 3862 dispInfo.item.mask |= LVIF_TEXT; 3685 ZeroMemory(lpLVItem->pszText,3686 sizeof(CHAR)*lpLVItem->cchTextMax);3687 dispInfo.item.pszText = lpLVItem->pszText;3688 3863 dispInfo.item.cchTextMax = lpLVItem->cchTextMax; 3864 if (isUnicodeNotify(&infoPtr->header)) 3865 { 3866 textW = (WCHAR*)COMCTL32_Alloc(dispInfo.item.cchTextMax*sizeof(WCHAR)); 3867 if (textW) textW[0] = 0; 3868 dispInfo.item.pszText = textW; 3869 } else 3870 { 3871 textA = (CHAR*)COMCTL32_Alloc(dispInfo.item.cchTextMax*sizeof(CHAR)); 3872 if (textA) textA[0] = 0; 3873 dispInfo.item.pszText = (LPWSTR)textA; 3874 } 3689 3875 } 3690 3876 } … … 3699 3885 { 3700 3886 dispInfo.item.mask |= LVIF_TEXT; 3701 ZeroMemory(lpLVItem->pszText,3702 sizeof(CHAR)*lpLVItem->cchTextMax);3703 dispInfo.item.pszText = lpLVItem->pszText;3704 3887 dispInfo.item.cchTextMax = lpLVItem->cchTextMax; 3888 if (isUnicodeNotify(&infoPtr->header)) 3889 { 3890 textW = (WCHAR*)COMCTL32_Alloc(dispInfo.item.cchTextMax*sizeof(WCHAR)); 3891 if (textW) textW[0] = 0; 3892 dispInfo.item.pszText = textW; 3893 } else 3894 { 3895 textA = (CHAR*)COMCTL32_Alloc(dispInfo.item.cchTextMax*sizeof(CHAR)); 3896 if (textA) textA[0] = 0; 3897 dispInfo.item.pszText = (LPWSTR)textA; 3898 } 3705 3899 } 3706 3900 } … … 3708 3902 if (dispInfo.item.mask != 0) 3709 3903 { 3710 dispInfo.hdr.hwndFrom = hwnd;3711 dispInfo.hdr.idFrom = lCtrlId;3712 dispInfo.hdr.code = LVN_GETDISPINFOA;3713 3904 dispInfo.item.iItem = lpLVItem->iItem; 3714 3905 dispInfo.item.iSubItem = lpLVItem->iSubItem; 3715 3906 dispInfo.item.lParam = lpItem->lParam; 3716 ListView_Notify(GetParent(hwnd), lCtrlId, &dispInfo);3907 sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? LVN_GETDISPINFOW:LVN_GETDISPINFOW,&dispInfo.hdr); 3717 3908 } 3718 3909 … … 3740 3931 { 3741 3932 if (lpSubItem) 3742 Str_SetPtrA(&lpSubItem->pszText, dispInfo.item.pszText); 3933 { 3934 if (isUnicodeNotify(&infoPtr->header)) 3935 { 3936 Str_SetPtrW(&lpSubItem->pszText,dispInfo.item.pszText); 3937 } else 3938 { 3939 INT len = dispInfo.item.pszText ? lstrlenA((LPSTR)dispInfo.item.pszText):0; 3940 3941 COMCTL32_Free(lpSubItem->pszText); 3942 if (len > 0) 3943 { 3944 len++; 3945 lpSubItem->pszText = (WCHAR*)COMCTL32_Alloc(len*sizeof(WCHAR)); 3946 lstrcpyAtoW(lpSubItem->pszText,(LPSTR)dispInfo.item.pszText); 3947 } else lpSubItem->pszText = NULL; 3948 } 3949 } 3743 3950 } 3744 3951 /* Make sure the source string is valid */ 3952 3745 3953 if (dispInfo.item.pszText == NULL) 3746 lpLVItem->pszText[0] = '\0';3747 else3748 3954 { 3749 strncpy(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3750 lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; 3955 if (unicode) 3956 lpLVItem->pszText[0] = L'\0'; 3957 else 3958 ((LPSTR)lpLVItem->pszText)[0] = '\0'; 3959 } else 3960 { 3961 if (unicode) 3962 { 3963 if (isUnicodeNotify(&infoPtr->header)) 3964 lstrcpynW(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3965 else 3966 lstrcpynAtoW(lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3967 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 3968 } else 3969 { 3970 if (isUnicodeNotify(&infoPtr->header)) 3971 lstrcpynWtoA((LPSTR)lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3972 else 3973 lstrcpynA((LPSTR)lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3974 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 3975 } 3751 3976 } 3752 3977 } 3753 3978 else if (lpLVItem->mask & LVIF_TEXT) 3754 3979 { 3755 if (lp Item->pszText != NULL)3980 if (lpSubItem->pszText != NULL) 3756 3981 { 3757 strncpy(lpLVItem->pszText, lpSubItem->pszText, 3758 lpLVItem->cchTextMax); 3759 lpLVItem->pszText[lpLVItem->cchTextMax-1]='\0'; 3982 if (unicode) 3983 { 3984 lstrcpynW(lpLVItem->pszText,lpSubItem->pszText,lpLVItem->cchTextMax); 3985 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 3986 } else 3987 { 3988 lstrcpynWtoA((LPSTR)lpLVItem->pszText,lpSubItem->pszText,lpLVItem->cchTextMax); 3989 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 3990 } 3760 3991 } 3761 3992 else 3762 3993 { 3763 ZeroMemory(lpLVItem->pszText, sizeof(char)* 3764 lpLVItem->cchTextMax); 3994 if (unicode) 3995 ZeroMemory(lpLVItem->pszText,sizeof(WCHAR)*lpLVItem->cchTextMax); 3996 else 3997 ZeroMemory(lpLVItem->pszText,sizeof(CHAR)*lpLVItem->cchTextMax); 3765 3998 } 3766 3999 } … … 3774 4007 } 3775 4008 3776 /* LISTVIEW_GetItemW */3777 4009 /* LISTVIEW_GetHotCursor */ 3778 4010 … … 3792 4024 LISTVIEW_INFO *infoPtr; 3793 4025 /* make sure we can get the listview info */ 3794 if (!(infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0)))4026 if (!(infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd))) 3795 4027 return (-1); 3796 4028 return (infoPtr->nHotItem); … … 3811 4043 static LRESULT LISTVIEW_GetItemCount(HWND hwnd) 3812 4044 { 3813 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4045 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3814 4046 3815 4047 return GETITEMCOUNT(infoPtr); … … 3832 4064 LPPOINT lpptPosition) 3833 4065 { 3834 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4066 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3835 4067 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 3836 4068 BOOL bResult = FALSE; … … 3912 4144 static LRESULT LISTVIEW_GetItemRect(HWND hwnd, INT nItem, LPRECT lprc) 3913 4145 { 3914 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4146 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3915 4147 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 3916 4148 BOOL bResult = FALSE; … … 4237 4469 INT LISTVIEW_GetLabelWidth(HWND hwnd, INT nItem) 4238 4470 { 4239 CHAR szDispText[DISP_TEXT_SIZE];4471 WCHAR szDispText[DISP_TEXT_SIZE]; 4240 4472 INT nLabelWidth = 0; 4241 LVITEM AlvItem;4473 LVITEMW lvItem; 4242 4474 4243 4475 // TRACE("(hwnd=%x, nItem=%d)\n", hwnd, nItem); 4244 4476 4245 ZeroMemory(&lvItem, sizeof(LVITEM A));4477 ZeroMemory(&lvItem, sizeof(LVITEMW)); 4246 4478 lvItem.mask = LVIF_TEXT; 4247 4479 lvItem.iItem = nItem; 4248 4480 lvItem.cchTextMax = DISP_TEXT_SIZE; 4249 4481 lvItem.pszText = szDispText; 4250 if (LISTVIEW_GetItem A(hwnd, &lvItem) != FALSE)4251 { 4252 nLabelWidth = ListView_GetStringWidth A(hwnd,lvItem.pszText);4482 if (LISTVIEW_GetItem(hwnd,&lvItem,TRUE) != FALSE) 4483 { 4484 nLabelWidth = ListView_GetStringWidthW(hwnd,lvItem.pszText); 4253 4485 } 4254 4486 … … 4269 4501 LRESULT LISTVIEW_GetItemSpacing(HWND hwnd, BOOL bSmall) 4270 4502 { 4271 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4503 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4272 4504 LONG lResult; 4273 4505 … … 4299 4531 LRESULT LISTVIEW_GetItemState(HWND hwnd, INT nItem, UINT uMask) 4300 4532 { 4301 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4302 LVITEM AlvItem;4533 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4534 LVITEMW lvItem; 4303 4535 UINT uState = 0; 4304 4536 4305 4537 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr))) 4306 4538 { 4307 ZeroMemory(&lvItem, sizeof(LVITEM A));4539 ZeroMemory(&lvItem, sizeof(LVITEMW)); 4308 4540 lvItem.iItem = nItem; 4309 4541 lvItem.stateMask = uMask; 4310 4542 lvItem.mask = LVIF_STATE; 4311 if (LISTVIEW_GetItem A(hwnd, &lvItem) != FALSE)4543 if (LISTVIEW_GetItem(hwnd,&lvItem,TRUE) != FALSE) 4312 4544 { 4313 4545 uState = lvItem.state; … … 4325 4557 * [I] HWND : window handle 4326 4558 * [I] INT : item index 4327 * [IO] LPLVITEM A: item information4559 * [IO] LPLVITEMW : item information 4328 4560 * 4329 4561 * RETURN: … … 4331 4563 * FAILURE : 0 4332 4564 */ 4333 LRESULT LISTVIEW_GetItemText A(HWND hwnd, INT nItem, LPLVITEMA lpLVItem)4334 { 4335 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4565 LRESULT LISTVIEW_GetItemText(HWND hwnd,INT nItem,LPLVITEMW lpLVItem,BOOL unicode) 4566 { 4567 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4336 4568 INT nLength = 0; 4337 4569 … … 4342 4574 lpLVItem->mask = LVIF_TEXT; 4343 4575 lpLVItem->iItem = nItem; 4344 if (LISTVIEW_GetItem A(hwnd, lpLVItem) != FALSE)4345 { 4346 nLength = lstrlenA(lpLVItem->pszText);4576 if (LISTVIEW_GetItem(hwnd,lpLVItem,unicode) != FALSE) 4577 { 4578 nLength = unicode ? lstrlenW(lpLVItem->pszText):lstrlenA((LPSTR)lpLVItem->pszText); 4347 4579 } 4348 4580 } … … 4367 4599 static LRESULT LISTVIEW_GetNextItem(HWND hwnd, INT nItem, UINT uFlags) 4368 4600 { 4369 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4601 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4370 4602 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 4371 4603 UINT uMask = 0; 4372 LVFINDINFO lvFindInfo;4604 LVFINDINFOW lvFindInfo; 4373 4605 INT nCountPerColumn; 4374 4606 INT i; … … 4376 4608 if ((nItem >= -1) && (nItem < GETITEMCOUNT(infoPtr))) 4377 4609 { 4378 ZeroMemory(&lvFindInfo, sizeof(LVFINDINFO ));4610 ZeroMemory(&lvFindInfo, sizeof(LVFINDINFOW)); 4379 4611 4380 4612 if (uFlags & LVNI_CUT) … … 4406 4638 lvFindInfo.vkDirection = VK_UP; 4407 4639 ListView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); 4408 while ((nItem = ListView_FindItem (hwnd, nItem, &lvFindInfo)) != -1)4640 while ((nItem = ListView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1) 4409 4641 { 4410 4642 if ((ListView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) … … 4429 4661 lvFindInfo.vkDirection = VK_DOWN; 4430 4662 ListView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); 4431 while ((nItem = ListView_FindItem (hwnd, nItem, &lvFindInfo)) != -1)4663 while ((nItem = ListView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1) 4432 4664 { 4433 4665 if ((ListView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) … … 4453 4685 lvFindInfo.vkDirection = VK_LEFT; 4454 4686 ListView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); 4455 while ((nItem = ListView_FindItem (hwnd, nItem, &lvFindInfo)) != -1)4687 while ((nItem = ListView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1) 4456 4688 { 4457 4689 if ((ListView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) … … 4477 4709 lvFindInfo.vkDirection = VK_RIGHT; 4478 4710 ListView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); 4479 while ((nItem = ListView_FindItem (hwnd, nItem, &lvFindInfo)) != -1)4711 while ((nItem = ListView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1) 4480 4712 { 4481 4713 if ((ListView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) … … 4565 4797 static LRESULT LISTVIEW_GetSelectedCount(HWND hwnd) 4566 4798 { 4567 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4799 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4568 4800 INT nSelectedCount = 0; 4569 4801 INT i; … … 4592 4824 static LRESULT LISTVIEW_GetSelectionMark(HWND hwnd) 4593 4825 { 4594 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4826 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4595 4827 4596 4828 return infoPtr->nSelectionMark; … … 4608 4840 * FAILURE : zero 4609 4841 */ 4610 static LRESULT LISTVIEW_GetStringWidth A(HWND hwnd, LPCSTR lpszText)4611 { 4612 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4842 static LRESULT LISTVIEW_GetStringWidth(HWND hwnd,LPWSTR lpszText,BOOL unicode) 4843 { 4844 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4613 4845 HFONT hFont, hOldFont; 4614 4846 SIZE stringSize; … … 4621 4853 hdc = GetDC(hwnd); 4622 4854 hOldFont = SelectObject(hdc, hFont); 4623 GetTextExtentPointA(hdc, lpszText, lstrlenA(lpszText), &stringSize); 4855 if (unicode) 4856 GetTextExtentPointW(hdc,lpszText,lstrlenW(lpszText),&stringSize); 4857 else 4858 GetTextExtentPointA(hdc,(LPSTR)lpszText,lstrlenA((LPSTR)lpszText),&stringSize); 4624 4859 SelectObject(hdc, hOldFont); 4625 4860 ReleaseDC(hwnd, hdc); … … 4641 4876 static LRESULT LISTVIEW_GetTextBkColor(HWND hwnd) 4642 4877 { 4643 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*) GetWindowLongA(hwnd, 0);4878 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 4644 4879 4645 4880 return infoPtr->clrTextBk; … … 4658 4893 static LRESULT LISTVIEW_GetTextColor(HWND hwnd) 4659 4894 { 4660 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*) GetWindowLongA(hwnd, 0);4895 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 4661 4896 4662 4897 return infoPtr->clrText; … … 4677 4912 static INT LISTVIEW_HitTestItem(HWND hwnd, LPLVHITTESTINFO lpHitTestInfo) 4678 4913 { 4679 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4914 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4680 4915 RECT rcItem; 4681 4916 INT i; … … 4742 4977 static LRESULT LISTVIEW_HitTest(HWND hwnd, LPLVHITTESTINFO lpHitTestInfo) 4743 4978 { 4744 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);4979 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4745 4980 INT nItem = -1; 4746 4981 … … 4785 5020 * FAILURE : -1 4786 5021 */ 4787 static LRESULT LISTVIEW_InsertColumnA(HWND hwnd, INT nColumn, 4788 LPLVCOLUMNA lpColumn) 4789 { 4790 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 4791 HDITEMA hdi; 5022 static LRESULT LISTVIEW_InsertColumn(HWND hwnd,INT nColumn,LPLVCOLUMNW lpColumn,BOOL unicode) 5023 { 5024 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5025 HDITEMW hdi; 4792 5026 INT nNewColumn = -1; 4793 5027 … … 4798 5032 { 4799 5033 /* initialize memory */ 4800 ZeroMemory(&hdi, sizeof(HDITEM A));5034 ZeroMemory(&hdi, sizeof(HDITEMW)); 4801 5035 4802 5036 if (lpColumn->mask & LVCF_FMT) … … 4854 5088 hdi.mask |= HDI_TEXT | HDI_FORMAT; 4855 5089 hdi.pszText = lpColumn->pszText; 4856 hdi.cchTextMax = lstrlenA(lpColumn->pszText);5090 hdi.cchTextMax = unicode ? lstrlenW(lpColumn->pszText):lstrlenA((LPSTR)lpColumn->pszText); 4857 5091 hdi.fmt |= HDF_STRING; 4858 5092 } … … 4871 5105 4872 5106 /* insert item in header control */ 4873 nNewColumn = SendMessageA(infoPtr->hwndHeader, HDM_INSERTITEMA, 4874 (WPARAM)nColumn, (LPARAM)&hdi); 5107 if (unicode) 5108 nNewColumn = SendMessageA(infoPtr->hwndHeader,HDM_INSERTITEMW,(WPARAM)nColumn,(LPARAM)&hdi); 5109 else 5110 nNewColumn = SendMessageA(infoPtr->hwndHeader,HDM_INSERTITEMA,(WPARAM)nColumn,(LPARAM)&hdi); 4875 5111 4876 5112 /* Need to reset the item width when inserting a new column */ … … 4882 5118 4883 5119 return nNewColumn; 4884 }4885 4886 static LRESULT LISTVIEW_InsertColumnW(HWND hwnd, INT nColumn,4887 LPLVCOLUMNW lpColumn)4888 {4889 LVCOLUMNA lvca;4890 LRESULT lres;4891 4892 memcpy(&lvca,lpColumn,sizeof(lvca));4893 if (lpColumn->mask & LVCF_TEXT)4894 lvca.pszText = HEAP_strdupWtoA(GetProcessHeap(),0,lpColumn->pszText);4895 lres = LISTVIEW_InsertColumnA(hwnd,nColumn,&lvca);4896 if (lpColumn->mask & LVCF_TEXT)4897 HeapFree(GetProcessHeap(),0,lvca.pszText);4898 return lres;4899 5120 } 4900 5121 … … 4922 5143 LISTVIEW_ITEM* lv_second = (LISTVIEW_ITEM*) DPA_GetPtr( hdpa_second, 0 ); 4923 5144 LONG lStyle = GetWindowLongA((HWND) lParam, GWL_STYLE); 4924 INT cmpv = lstrcmp A( lv_first->pszText, lv_second->pszText );5145 INT cmpv = lstrcmpW( lv_first->pszText, lv_second->pszText ); 4925 5146 /* if we're sorting descending, negate the return value */ 4926 5147 return (lStyle & LVS_SORTDESCENDING) ? -cmpv : cmpv; … … 4933 5154 * PARAMETER(S): 4934 5155 * [I] HWND : window handle 4935 * [I] LPLVITEM A: item information5156 * [I] LPLVITEMW : item information 4936 5157 * 4937 5158 * RETURN: … … 4939 5160 * FAILURE : -1 4940 5161 */ 4941 static LRESULT LISTVIEW_InsertItem A(HWND hwnd, LPLVITEMA lpLVItem)4942 { 4943 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5162 static LRESULT LISTVIEW_InsertItem(HWND hwnd, LPLVITEMW lpLVItem,BOOL unicode) 5163 { 5164 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4944 5165 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 4945 5166 UINT uView = lStyle & LVS_TYPEMASK; … … 4962 5183 { 4963 5184 ZeroMemory(lpItem, sizeof(LISTVIEW_ITEM)); 4964 if (LISTVIEW_InitItem(hwnd, lpItem, lpLVItem ) != FALSE)5185 if (LISTVIEW_InitItem(hwnd, lpItem, lpLVItem,unicode) != FALSE) 4965 5186 { 4966 5187 /* insert item in listview control data structure */ … … 4973 5194 if ( ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) 4974 5195 && !(lStyle & LVS_OWNERDRAWFIXED) 4975 && (LPSTR_TEXTCALLBACK A!= lpLVItem->pszText) )5196 && (LPSTR_TEXTCALLBACKW != lpLVItem->pszText) ) 4976 5197 { 4977 5198 /* Insert the item in the proper sort order based on the pszText … … 5001 5222 /* send LVN_INSERTITEM notification */ 5002 5223 ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); 5003 nmlv.hdr.hwndFrom = hwnd;5004 nmlv.hdr.idFrom = lCtrlId;5005 nmlv.hdr.code = LVN_INSERTITEM;5006 5224 nmlv.iItem = nItem; 5007 5225 nmlv.lParam = lpItem->lParam;; 5008 ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv);5226 sendNotify(hwnd,LVN_INSERTITEM,&nmlv.hdr); 5009 5227 5010 5228 if ((uView == LVS_SMALLICON) || (uView == LVS_LIST)) … … 5050 5268 } 5051 5269 5052 static LRESULT LISTVIEW_InsertItemW(HWND hwnd, LPLVITEMW lpLVItem) {5053 LVITEMA lvia;5054 LRESULT lres;5055 5056 memcpy(&lvia,lpLVItem,sizeof(LVITEMA));5057 if (lvia.mask & LVIF_TEXT) {5058 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKW)5059 lvia.pszText = LPSTR_TEXTCALLBACKA;5060 else5061 lvia.pszText = HEAP_strdupWtoA(GetProcessHeap(),0,lpLVItem->pszText);5062 }5063 lres = LISTVIEW_InsertItemA(hwnd, &lvia);5064 if (lvia.mask & LVIF_TEXT) {5065 if (lpLVItem->pszText != LPSTR_TEXTCALLBACKW)5066 HeapFree(GetProcessHeap(),0,lvia.pszText);5067 }5068 return lres;5069 }5070 5071 5270 /*** 5072 5271 * DESCRIPTION: … … 5084 5283 static LRESULT LISTVIEW_RedrawItems(HWND hwnd, INT nFirst, INT nLast) 5085 5284 { 5086 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5285 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5087 5286 BOOL bResult = FALSE; 5088 5287 RECT rc; … … 5119 5318 static LRESULT LISTVIEW_SetBkColor(HWND hwnd, COLORREF clrBk) 5120 5319 { 5121 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5320 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5122 5321 5123 5322 infoPtr->clrBk = clrBk; … … 5144 5343 static BOOL LISTVIEW_SetCallbackMask(HWND hwnd, UINT uMask) 5145 5344 { 5146 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5345 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5147 5346 5148 5347 infoPtr->uCallbackMask = uMask; … … 5164 5363 * FAILURE : FALSE 5165 5364 */ 5166 static LRESULT LISTVIEW_SetColumnA(HWND hwnd, INT nColumn, 5167 LPLVCOLUMNA lpColumn) 5168 { 5169 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 5365 static LRESULT LISTVIEW_SetColumn(HWND hwnd,INT nColumn,LPLVCOLUMNW lpColumn,BOOL unicode) 5366 { 5367 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5170 5368 BOOL bResult = FALSE; 5171 HDITEM Ahdi, hdiget;5369 HDITEMW hdi, hdiget; 5172 5370 5173 5371 if ((lpColumn != NULL) && (nColumn >= 0) && … … 5184 5382 /* get current format first */ 5185 5383 hdiget.mask = HDI_FORMAT; 5186 if (Header_GetItem A(infoPtr->hwndHeader, nColumn, &hdiget))5384 if (Header_GetItemW(infoPtr->hwndHeader, nColumn, &hdiget)) 5187 5385 /* preserve HDF_STRING if present */ 5188 5386 hdi.fmt = hdiget.fmt & HDF_STRING; … … 5236 5434 hdi.mask |= HDI_TEXT | HDI_FORMAT; 5237 5435 hdi.pszText = lpColumn->pszText; 5238 hdi.cchTextMax = lstrlenA(lpColumn->pszText);5436 hdi.cchTextMax = unicode ? lstrlenW(lpColumn->pszText):lstrlenA((LPSTR)lpColumn->pszText); 5239 5437 hdi.fmt |= HDF_STRING; 5240 5438 } … … 5253 5451 5254 5452 /* set header item attributes */ 5255 bResult = Header_SetItemA(infoPtr->hwndHeader, nColumn, &hdi); 5453 if (unicode) 5454 bResult = Header_SetItemW(infoPtr->hwndHeader,nColumn,&hdi); 5455 else 5456 bResult = Header_SetItemA(infoPtr->hwndHeader,nColumn,(HDITEMA*)&hdi); 5256 5457 } 5257 5458 … … 5276 5477 static LRESULT LISTVIEW_SetColumnOrderArray(HWND hwnd, INT iCount, LPINT lpiArray) 5277 5478 { 5278 /* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0); */5479 /* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); */ 5279 5480 5280 5481 // FIXME("iCount %d lpiArray %p\n", iCount, lpiArray); … … 5312 5513 5313 5514 // make sure we can get the listview info 5314 if (!(infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0)))5515 if (!(infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd))) 5315 5516 return (FALSE); 5316 5517 if (!infoPtr->hwndHeader) // make sure we have a header … … 5326 5527 5327 5528 // call header to update the column change 5328 lret = Header_SetItem A(infoPtr->hwndHeader, (WPARAM)iCol, (LPARAM)&hdi);5529 lret = Header_SetItemW(infoPtr->hwndHeader, (WPARAM)iCol, (LPARAM)&hdi); 5329 5530 5330 5531 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); … … 5353 5554 DWORD dwOldStyle; 5354 5555 /* make sure we can get the listview info */ 5355 if (!(infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0)))5556 if (!(infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd))) 5356 5557 return (0); 5357 5558 /* store previous style */ … … 5381 5582 INT iOldIndex; 5382 5583 /* make sure we can get the listview info */ 5383 if (!(infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0)))5584 if (!(infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd))) 5384 5585 return (-1); 5385 5586 /* store previous index */ … … 5407 5608 static LRESULT LISTVIEW_SetImageList(HWND hwnd, INT nType, HIMAGELIST himl) 5408 5609 { 5409 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5610 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5410 5611 HIMAGELIST himlTemp = 0; 5411 5612 … … 5445 5646 * FAILURE : FALSE 5446 5647 */ 5447 static LRESULT LISTVIEW_SetItem A(HWND hwnd, LPLVITEMA lpLVItem)5448 { 5449 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5648 static LRESULT LISTVIEW_SetItemHandler(HWND hwnd,LPLVITEMW lpLVItem,BOOL unicode) 5649 { 5650 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5450 5651 BOOL bResult = FALSE; 5451 5652 … … 5456 5657 if (lpLVItem->iSubItem == 0) 5457 5658 { 5458 bResult = LISTVIEW_SetItem(hwnd, lpLVItem);5659 bResult = LISTVIEW_SetItem(hwnd,lpLVItem,unicode); 5459 5660 } 5460 5661 else 5461 5662 { 5462 bResult = LISTVIEW_SetSubItem(hwnd, lpLVItem);5663 bResult = LISTVIEW_SetSubItem(hwnd,lpLVItem,unicode); 5463 5664 } 5464 5665 } … … 5468 5669 return bResult; 5469 5670 } 5470 5471 /* LISTVIEW_SetItemW */5472 5671 5473 5672 /*** … … 5486 5685 static BOOL LISTVIEW_SetItemCount(HWND hwnd, INT nItems, DWORD dwFlags) 5487 5686 { 5488 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*) GetWindowLongA(hwnd, 0);5687 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 5489 5688 5490 5689 // FIXME("(%d %08lx)empty stub!\n", nItems, dwFlags); … … 5533 5732 INT nPosX, INT nPosY) 5534 5733 { 5535 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*) GetWindowLongA(hwnd, 0);5734 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 5536 5735 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 5537 5736 LISTVIEW_ITEM *lpItem; … … 5577 5776 * FAILURE : FALSE 5578 5777 */ 5579 static LRESULT LISTVIEW_SetItemState(HWND hwnd, INT nItem, LPLVITEM AlpLVItem)5580 { 5581 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5778 static LRESULT LISTVIEW_SetItemState(HWND hwnd, INT nItem, LPLVITEMW lpLVItem) 5779 { 5780 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5582 5781 BOOL bResult = FALSE; 5583 LVITEM AlvItem;5782 LVITEMW lvItem; 5584 5783 INT i; 5585 5784 … … 5587 5786 { 5588 5787 bResult = TRUE; 5589 ZeroMemory(&lvItem, sizeof(LVITEM A));5788 ZeroMemory(&lvItem, sizeof(LVITEMW)); 5590 5789 lvItem.mask = LVIF_STATE; 5591 5790 lvItem.state = lpLVItem->state; … … 5596 5795 { 5597 5796 lvItem.iItem = i; 5598 if (ListView_SetItem A(hwnd,&lvItem) == FALSE)5797 if (ListView_SetItemW(hwnd,&lvItem) == FALSE) 5599 5798 { 5600 5799 bResult = FALSE; … … 5604 5803 else 5605 5804 { 5606 ZeroMemory(&lvItem, sizeof(LVITEM A));5805 ZeroMemory(&lvItem, sizeof(LVITEMW)); 5607 5806 lvItem.mask = LVIF_STATE; 5608 5807 lvItem.state = lpLVItem->state; 5609 5808 lvItem.stateMask = lpLVItem->stateMask; 5610 5809 lvItem.iItem = nItem; 5611 bResult = ListView_SetItem A(hwnd, &lvItem);5810 bResult = ListView_SetItemW(hwnd, &lvItem); 5612 5811 } 5613 5812 … … 5622 5821 * [I] HWND : window handle 5623 5822 * [I] INT : item index 5624 * [I] LPLVITEM A: item or subitem info5823 * [I] LPLVITEMW : item or subitem info 5625 5824 * 5626 5825 * RETURN: … … 5628 5827 * FAILURE : FALSE 5629 5828 */ 5630 static BOOL LISTVIEW_SetItemText A(HWND hwnd, INT nItem, LPLVITEMA lpLVItem)5631 { 5632 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5829 static BOOL LISTVIEW_SetItemText(HWND hwnd, INT nItem, LPLVITEMW lpLVItem,BOOL unicode) 5830 { 5831 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5633 5832 BOOL bResult = FALSE; 5634 LVITEM AlvItem;5833 LVITEMW lvItem; 5635 5834 5636 5835 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr))) 5637 5836 { 5638 ZeroMemory(&lvItem, sizeof(LVITEM A));5837 ZeroMemory(&lvItem, sizeof(LVITEMW)); 5639 5838 lvItem.mask = LVIF_TEXT; 5640 5839 lvItem.pszText = lpLVItem->pszText; 5641 5840 lvItem.iItem = nItem; 5642 5841 lvItem.iSubItem = lpLVItem->iSubItem; 5643 bResult = ListView_SetItemA(hwnd, &lvItem); 5842 if (unicode) 5843 bResult = ListView_SetItemW(hwnd,&lvItem); 5844 else 5845 bResult = ListView_SetItemA(hwnd,&lvItem); 5644 5846 } 5645 5847 … … 5647 5849 } 5648 5850 5649 /* LISTVIEW_SetItemTextW */5650 5651 5851 /*** 5652 5852 * DESCRIPTION: … … 5662 5862 static LRESULT LISTVIEW_SetSelectionMark(HWND hwnd, INT nIndex) 5663 5863 { 5664 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5864 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5665 5865 INT nOldIndex = infoPtr->nSelectionMark; 5666 5866 infoPtr->nSelectionMark = nIndex; … … 5682 5882 static LRESULT LISTVIEW_SetTextBkColor(HWND hwnd, COLORREF clrTextBk) 5683 5883 { 5684 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5884 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5685 5885 5686 5886 infoPtr->clrTextBk = clrTextBk; … … 5704 5904 static LRESULT LISTVIEW_SetTextColor (HWND hwnd, COLORREF clrText) 5705 5905 { 5706 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5906 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5707 5907 5708 5908 infoPtr->clrText = clrText; … … 5738 5938 INT rv; 5739 5939 HWND hwnd = (HWND)lParam; 5740 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5940 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5741 5941 5742 5942 rv = (infoPtr->pfnCompare)( ((LISTVIEW_ITEM*) first)->lParam, … … 5761 5961 static LRESULT LISTVIEW_SortItems(HWND hwnd, WPARAM wParam, LPARAM lParam) 5762 5962 { 5763 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);5963 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5764 5964 HDPA hdpaSubItems; 5765 5965 LISTVIEW_ITEM *lpItem; … … 5828 6028 static LRESULT LISTVIEW_Update(HWND hwnd, INT nItem) 5829 6029 { 5830 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);6030 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5831 6031 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 5832 6032 BOOL bResult = FALSE; … … 5846 6046 { 5847 6047 /* get item bounding rectangle */ 5848 rc.left = LVIR_BOUNDS; 5849 ListView_GetItemRect(hwnd, nItem, &rc); 6048 ListView_GetItemRect(hwnd,nItem,&rc,LVIR_BOUNDS); 5850 6049 InvalidateRect(hwnd, &rc, TRUE); 5851 6050 } … … 5867 6066 static LRESULT LISTVIEW_Create(HWND hwnd, WPARAM wParam, LPARAM lParam) 5868 6067 { 5869 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);6068 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5870 6069 LPCREATESTRUCTA lpcs = (LPCREATESTRUCTA)lParam; 5871 6070 UINT uView = lpcs->style & LVS_TYPEMASK; 5872 6071 LOGFONTA logFont; 5873 6072 DWORD headerStyle = WS_CHILD | HDS_HORZ; 5874 5875 /* initialize info pointer */5876 ZeroMemory(infoPtr, sizeof(LISTVIEW_INFO));5877 5878 /* determine the type of structures to use */5879 infoPtr->notifyFormat = SendMessageA(GetParent(hwnd), WM_NOTIFYFORMAT,5880 (WPARAM)hwnd, (LPARAM)NF_QUERY);5881 if (infoPtr->notifyFormat != NFR_ANSI)5882 {5883 //FIXME("ANSI notify format is NOT used\n");5884 }5885 6073 5886 6074 /* initialize color information */ … … 5967 6155 LPARAM lParam) 5968 6156 { 5969 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);6157 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5970 6158 BOOL bResult; 5971 6159 … … 5999 6187 static LRESULT LISTVIEW_GetFont(HWND hwnd) 6000 6188 { 6001 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);6189 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6002 6190 6003 6191 return infoPtr->hFont; … … 6258 6446 static LRESULT LISTVIEW_KeyDown(HWND hwnd, INT nVirtualKey, LONG lKeyData) 6259 6447 { 6260 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 6261 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 6262 HWND hwndParent = GetParent(hwnd); 6448 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6263 6449 NMLVKEYDOWN nmKeyDown; 6264 NMHDR nmh;6265 6450 INT nItem = -1; 6266 6451 BOOL bRedraw = FALSE; … … 6268 6453 /* send LVN_KEYDOWN notification */ 6269 6454 ZeroMemory(&nmKeyDown, sizeof(NMLVKEYDOWN)); 6270 nmKeyDown.hdr.hwndFrom = hwnd;6271 nmKeyDown.hdr.idFrom = nCtrlId;6272 nmKeyDown.hdr.code = LVN_KEYDOWN;6273 6455 nmKeyDown.wVKey = nVirtualKey; 6274 6456 nmKeyDown.flags = 0; 6275 SendMessageA(hwndParent, WM_NOTIFY, (WPARAM)nCtrlId, (LPARAM)&nmKeyDown); 6276 6277 /* initialize */ 6278 nmh.hwndFrom = hwnd; 6279 nmh.idFrom = nCtrlId; 6457 sendNotify(hwnd,LVN_KEYDOWN,&nmKeyDown.hdr); 6280 6458 6281 6459 switch (nVirtualKey) … … 6285 6463 { 6286 6464 /* send NM_RETURN notification */ 6287 nmh.code = NM_RETURN; 6288 ListView_Notify(hwndParent, nCtrlId, &nmh); 6465 sendNotify(hwnd,NM_RETURN); 6289 6466 6290 6467 /* send LVN_ITEMACTIVATE notification */ 6291 nmh.code = LVN_ITEMACTIVATE; 6292 ListView_Notify(hwndParent, nCtrlId, &nmh); 6468 sendNotify(hwnd,LVN_ITEMACTIVATE); 6293 6469 } 6294 6470 break; … … 6359 6535 static LRESULT LISTVIEW_KillFocus(HWND hwnd) 6360 6536 { 6361 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongA(hwnd, 0); 6362 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 6363 NMHDR nmh; 6537 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 6364 6538 6365 6539 /* send NM_KILLFOCUS notification */ 6366 nmh.hwndFrom = hwnd; 6367 nmh.idFrom = nCtrlId; 6368 nmh.code = NM_KILLFOCUS; 6369 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6540 sendNotify(hwnd,NM_KILLFOCUS); 6370 6541 6371 6542 /* set window focus flag */ … … 6394 6565 WORD wPosY) 6395 6566 { 6396 LONG nCtrlId = GetWindowLongA(hwnd, GWL_ID);6397 NMHDR nmh;6398 6567 LVHITTESTINFO htInfo; 6399 6568 … … 6401 6570 6402 6571 /* send NM_DBLCLK notification */ 6403 nmh.hwndFrom = hwnd; 6404 nmh.idFrom = nCtrlId; 6405 nmh.code = NM_DBLCLK; 6406 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6572 sendNotify(hwnd,NM_DBLCLK); 6407 6573 6408 6574 /* To send the LVN_ITEMACTIVATE, it must be on an Item */ … … 6413 6579 { 6414 6580 /* send LVN_ITEMACTIVATE notification */ 6415 nmh.code = LVN_ITEMACTIVATE; 6416 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6581 sendNotify(hwnd,LVN_ITEMACTIVATE); 6417 6582 } 6418 6583 … … 6436 6601 WORD wPosY) 6437 6602 { 6438 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);6603 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6439 6604 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 6440 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);6441 6605 static BOOL bGroupSelect = TRUE; 6442 6606 POINT ptPosition; 6443 NMHDR nmh;6444 6607 INT nItem; 6445 6608 … … 6448 6611 6449 6612 /* send NM_RELEASEDCAPTURE notification */ 6450 nmh.hwndFrom = hwnd; 6451 nmh.idFrom = nCtrlId; 6452 nmh.code = NM_RELEASEDCAPTURE; 6453 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6613 sendNotify(hwnd,NM_RELEASEDCAPTURE); 6454 6614 6455 6615 if (infoPtr->bFocus == FALSE) … … 6540 6700 WORD wPosY) 6541 6701 { 6542 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);6702 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6543 6703 6544 6704 // TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); … … 6546 6706 if (infoPtr->bLButtonDown != FALSE) 6547 6707 { 6548 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);6549 NMHDR nmh;6550 6551 6708 /* send NM_CLICK notification */ 6552 nmh.hwndFrom = hwnd; 6553 nmh.idFrom = nCtrlId; 6554 nmh.code = NM_CLICK; 6555 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6709 sendNotify(hwnd,NM_CLICK); 6556 6710 6557 6711 /* set left button flag */ … … 6568 6722 if(nItem != -1 && htInfo.flags == LVHT_ONITEMLABEL) 6569 6723 { 6570 LISTVIEW_EditLabel A(hwnd, nItem);6724 LISTVIEW_EditLabel(hwnd,nItem,TRUE); 6571 6725 } 6572 6726 infoPtr->bDoEditLabel = FALSE; … … 6596 6750 6597 6751 /* allocate memory for info structure */ 6598 infoPtr = (LISTVIEW_INFO *)COMCTL32_Alloc(sizeof(LISTVIEW_INFO)); 6599 SetWindowLongA(hwnd,0,(DWORD)infoPtr); 6600 if (infoPtr == NULL) 6601 { 6602 //ERR("could not allocate info memory!\n"); 6603 return 0; 6604 } 6605 6606 if ((LISTVIEW_INFO *)GetWindowLongA(hwnd, 0) != infoPtr) 6607 { 6608 //ERR("pointer assignment error!\n"); 6609 return 0; 6610 } 6752 infoPtr = (LISTVIEW_INFO*)initControl(hwnd,sizeof(LISTVIEW_INFO)); 6753 if (!infoPtr) return 0; 6611 6754 6612 6755 return DefWindowProcA(hwnd,WM_NCCREATE,wParam,lParam); … … 6625 6768 static LRESULT LISTVIEW_NCDestroy(HWND hwnd) 6626 6769 { 6627 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);6770 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6628 6771 6629 6772 //TRACE("(hwnd=%x)\n", hwnd); … … 6643 6786 6644 6787 /* free listview info pointer*/ 6645 COMCTL32_Free(infoPtr);6788 doneControl(hwnd); 6646 6789 6647 6790 return 0; … … 6662 6805 static LRESULT LISTVIEW_Notify(HWND hwnd, INT nCtrlId, LPNMHDR lpnmh) 6663 6806 { 6664 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);6807 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6665 6808 6666 6809 if (lpnmh->hwndFrom == infoPtr->hwndHeader) 6667 6810 { 6668 6811 /* handle notification from header control */ 6669 if ( lpnmh->code == HDN_ENDTRACKA)6812 if ((lpnmh->code == HDN_ENDTRACKA) || (lpnmh->code == HDN_ENDTRACKW)) 6670 6813 { 6671 6814 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 6672 6815 InvalidateRect(hwnd, NULL, TRUE); 6673 6816 } 6674 else if( lpnmh->code == HDN_ITEMCLICKA)6817 else if((lpnmh->code == HDN_ITEMCLICKA) || (lpnmh->code == HDN_ITEMCLICKW)) 6675 6818 { 6676 6819 /* Handle sorting by Header Column */ 6677 6820 NMLISTVIEW nmlv; 6678 6821 LPNMHEADERA pnmHeader = (LPNMHEADERA) lpnmh; 6679 LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID);6680 6822 6681 6823 ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); 6682 nmlv.hdr.hwndFrom = hwnd;6683 nmlv.hdr.idFrom = lCtrlId;6684 nmlv.hdr.code = LVN_COLUMNCLICK;6685 6824 nmlv.iItem = -1; 6686 6825 nmlv.iSubItem = pnmHeader->iItem; 6687 6826 6688 ListView_LVNotify(GetParent(hwnd),lCtrlId, &nmlv);6827 sendNotify(hwnd,LVN_COLUMNCLICK,&nmlv.hdr); 6689 6828 6690 6829 } … … 6709 6848 /*** 6710 6849 * DESCRIPTION: 6711 * Determines the type of structure to use.6712 *6713 * PARAMETER(S):6714 * [I] HWND : window handle of the sender6715 * [I] HWND : listview window handle6716 * [I] INT : command specifying the nature of the WM_NOTIFYFORMAT6717 *6718 * RETURN:6719 * Zero6720 */6721 static LRESULT LISTVIEW_NotifyFormat(HWND hwndFrom, HWND hwnd, INT nCommand)6722 {6723 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);6724 6725 if (nCommand == NF_REQUERY)6726 {6727 /* determine the type of structure to use */6728 infoPtr->notifyFormat = SendMessageA(hwndFrom, WM_NOTIFYFORMAT,6729 (WPARAM)hwnd, (LPARAM)NF_QUERY);6730 if (infoPtr->notifyFormat == NFR_UNICODE)6731 {6732 //FIXME("NO support for unicode structures");6733 }6734 }6735 6736 return 0;6737 }6738 6739 /***6740 * DESCRIPTION:6741 6850 * Paints/Repaints the listview control. 6742 6851 * … … 6784 6893 WORD wPosY) 6785 6894 { 6786 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);6787 NMHDR nmh;6788 6789 6895 // TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); 6790 6896 6791 6897 /* send NM_RELEASEDCAPTURE notification */ 6792 nmh.hwndFrom = hwnd; 6793 nmh.idFrom = nCtrlId; 6794 nmh.code = NM_RELEASEDCAPTURE; 6795 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6898 sendNotify(hwnd,NM_RELEASEDCAPTURE); 6796 6899 6797 6900 /* send NM_RDBLCLK notification */ 6798 nmh.code = NM_RDBLCLK; 6799 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6901 sendNotify(hwnd,NM_RDBLCLK); 6800 6902 6801 6903 return 0; … … 6818 6920 WORD wPosY) 6819 6921 { 6820 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 6821 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 6922 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6822 6923 POINT ptPosition; 6823 NMHDR nmh;6824 6924 INT nItem; 6825 6925 … … 6827 6927 6828 6928 /* send NM_RELEASEDCAPTURE notification */ 6829 nmh.hwndFrom = hwnd; 6830 nmh.idFrom = nCtrlId; 6831 nmh.code = NM_RELEASEDCAPTURE; 6832 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6929 sendNotify(hwnd,NM_RELEASEDCAPTURE); 6833 6930 6834 6931 /* make sure the listview control window has the focus */ … … 6876 6973 WORD wPosY) 6877 6974 { 6878 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);6975 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6879 6976 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 6880 NMHDR nmh;6881 6977 6882 6978 // TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); … … 6887 6983 6888 6984 /* send NM_RClICK notification */ 6889 ZeroMemory(&nmh, sizeof(NMHDR)); 6890 nmh.hwndFrom = hwnd; 6891 nmh.idFrom = nCtrlId; 6892 nmh.code = NM_RCLICK; 6893 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6985 sendNotify(hwnd,NM_RCLICK); 6894 6986 6895 6987 /* set button flag */ … … 6918 7010 static LRESULT LISTVIEW_SetFocus(HWND hwnd, HWND hwndLoseFocus) 6919 7011 { 6920 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 6921 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 6922 NMHDR nmh; 7012 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6923 7013 6924 7014 /* send NM_SETFOCUS notification */ 6925 nmh.hwndFrom = hwnd; 6926 nmh.idFrom = nCtrlId; 6927 nmh.code = NM_SETFOCUS; 6928 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 7015 sendNotify(hwnd,NM_SETFOCUS); 6929 7016 6930 7017 /* set window focus flag */ … … 6951 7038 static LRESULT LISTVIEW_SetFont(HWND hwnd, HFONT hFont, WORD fRedraw) 6952 7039 { 6953 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);7040 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 6954 7041 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 6955 7042 … … 7061 7148 static VOID LISTVIEW_UpdateSize(HWND hwnd) 7062 7149 { 7063 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);7150 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 7064 7151 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 7065 7152 UINT uView = lStyle & LVS_TYPEMASK; … … 7114 7201 LPSTYLESTRUCT lpss) 7115 7202 { 7116 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);7203 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 7117 7204 UINT uNewView = lpss->styleNew & LVS_TYPEMASK; 7118 7205 UINT uOldView = lpss->styleOld & LVS_TYPEMASK; … … 7250 7337 return LISTVIEW_DeleteItem(hwnd, (INT)wParam); 7251 7338 7339 case LVM_EDITLABELA: 7340 return LISTVIEW_EditLabel(hwnd,(INT)wParam,FALSE); 7341 7252 7342 case LVM_EDITLABELW: 7253 case LVM_EDITLABELA: 7254 return LISTVIEW_EditLabelA(hwnd, (INT)wParam); 7343 return LISTVIEW_EditLabel(hwnd,(INT)wParam,TRUE); 7255 7344 7256 7345 case LVM_ENSUREVISIBLE: … … 7258 7347 7259 7348 case LVM_FINDITEMA: 7260 return LISTVIEW_FindItem(hwnd, (INT)wParam, (LPLVFINDINFO)lParam); 7349 return LISTVIEW_FindItem(hwnd,(INT)wParam,(LPLVFINDINFOW)lParam,FALSE); 7350 7351 case LVM_FINDITEMW: 7352 return LISTVIEW_FindItem(hwnd,(INT)wParam,(LPLVFINDINFOW)lParam,TRUE); 7261 7353 7262 7354 case LVM_GETBKCOLOR: … … 7269 7361 7270 7362 case LVM_GETCOLUMNA: 7271 return LISTVIEW_GetColumnA(hwnd, (INT)wParam, (LPLVCOLUMNA)lParam); 7272 7273 /* case LVM_GETCOLUMNW: */ 7363 return LISTVIEW_GetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,FALSE); 7364 7365 case LVM_GETCOLUMNW: 7366 return LISTVIEW_GetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE); 7367 7274 7368 7275 7369 case LVM_GETCOLUMNORDERARRAY: … … 7304 7398 7305 7399 case LVM_GETITEMA: 7306 return LISTVIEW_GetItemA(hwnd, (LPLVITEMA)lParam); 7307 7308 /* case LVM_GETITEMW: */ 7400 return LISTVIEW_GetItem(hwnd,(LPLVITEMW)lParam,FALSE); 7401 7402 case LVM_GETITEMW: 7403 return LISTVIEW_GetItem(hwnd,(LPLVITEMW)lParam,TRUE); 7404 7309 7405 7310 7406 case LVM_GETITEMCOUNT: … … 7324 7420 7325 7421 case LVM_GETITEMTEXTA: 7326 LISTVIEW_GetItemText A(hwnd, (INT)wParam, (LPLVITEMA)lParam);7422 LISTVIEW_GetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,FALSE); 7327 7423 break; 7328 7424 7329 /* case LVM_GETITEMTEXTW: */ 7425 case LVM_GETITEMTEXTW: 7426 LISTVIEW_GetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,TRUE); 7427 break; 7428 7330 7429 7331 7430 case LVM_GETNEXTITEM: … … 7344 7443 7345 7444 case LVM_GETSTRINGWIDTHA: 7346 return LISTVIEW_GetStringWidthA (hwnd, (LPCSTR)lParam); 7347 7348 /* case LVM_GETSTRINGWIDTHW: */ 7445 return LISTVIEW_GetStringWidth(hwnd,(LPWSTR)lParam,FALSE); 7446 7447 case LVM_GETSTRINGWIDTHW: 7448 return LISTVIEW_GetStringWidth(hwnd,(LPWSTR)lParam,TRUE); 7449 7349 7450 /* case LVM_GETSUBITEMRECT: */ 7350 7451 … … 7371 7472 7372 7473 case LVM_INSERTCOLUMNA: 7373 return LISTVIEW_InsertColumn A(hwnd, (INT)wParam, (LPLVCOLUMNA)lParam);7474 return LISTVIEW_InsertColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,FALSE); 7374 7475 7375 7476 case LVM_INSERTCOLUMNW: 7376 return LISTVIEW_InsertColumn W(hwnd, (INT)wParam, (LPLVCOLUMNW)lParam);7477 return LISTVIEW_InsertColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE); 7377 7478 7378 7479 case LVM_INSERTITEMA: 7379 return LISTVIEW_InsertItem A(hwnd, (LPLVITEMA)lParam);7480 return LISTVIEW_InsertItem(hwnd,(LPLVITEMW)lParam,FALSE); 7380 7481 7381 7482 case LVM_INSERTITEMW: 7382 return LISTVIEW_InsertItem W(hwnd, (LPLVITEMW)lParam);7483 return LISTVIEW_InsertItem(hwnd,(LPLVITEMW)lParam,TRUE); 7383 7484 7384 7485 case LVM_REDRAWITEMS: … … 7397 7498 7398 7499 case LVM_SETCOLUMNA: 7399 return LISTVIEW_SetColumn A(hwnd, (INT)wParam, (LPLVCOLUMNA)lParam);7500 return LISTVIEW_SetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,FALSE); 7400 7501 7401 7502 case LVM_SETCOLUMNW: 7402 //FIXME("Unimplemented msg LVM_SETCOLUMNW\n"); 7403 return 0; 7503 return LISTVIEW_SetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE); 7404 7504 7405 7505 case LVM_SETCOLUMNORDERARRAY: … … 7424 7524 7425 7525 case LVM_SETITEMA: 7426 return LISTVIEW_SetItemA(hwnd, (LPLVITEMA)lParam); 7427 7428 /* case LVM_SETITEMW: */ 7526 return LISTVIEW_SetItemHandler(hwnd,(LPLVITEMW)lParam,FALSE); 7527 7528 case LVM_SETITEMW: 7529 return LISTVIEW_SetItemHandler(hwnd,(LPLVITEMW)lParam,TRUE); 7429 7530 7430 7531 case LVM_SETITEMCOUNT: … … 7438 7539 7439 7540 case LVM_SETITEMSTATE: 7440 return LISTVIEW_SetItemState(hwnd, (INT)wParam, (LPLVITEM A)lParam);7541 return LISTVIEW_SetItemState(hwnd, (INT)wParam, (LPLVITEMW)lParam); 7441 7542 7442 7543 case LVM_SETITEMTEXTA: 7443 return LISTVIEW_SetItemTextA(hwnd, (INT)wParam, (LPLVITEMA)lParam); 7444 7445 /* case LVM_SETITEMTEXTW: */ 7544 return LISTVIEW_SetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,FALSE); 7545 7546 case LVM_SETITEMTEXTW: 7547 return LISTVIEW_SetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,TRUE); 7446 7548 7447 7549 case LVM_SETSELECTIONMARK: … … 7515 7617 return LISTVIEW_Notify(hwnd, (INT)wParam, (LPNMHDR)lParam); 7516 7618 7517 case WM_NOTIFYFORMAT:7518 return LISTVIEW_NotifyFormat(hwnd, (HWND)wParam, (INT)lParam);7519 7520 7619 case WM_PAINT: 7521 7620 return LISTVIEW_Paint(hwnd, (HDC)wParam); … … 7570 7669 7571 7670 /* call default window procedure */ 7572 return DefWindowProcA(hwnd, uMsg, wParam, lParam);7671 return defComCtl32ProcA(hwnd, uMsg, wParam, lParam); 7573 7672 } 7574 7673 … … 7634 7733 */ 7635 7734 char buffer[1024]; 7636 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(hwnd, 0);7735 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 7637 7736 HDC hdc = GetDC(infoPtr->hwndEdit); 7638 7737 HFONT hFont, hOldFont = 0; … … 7697 7796 { 7698 7797 BOOL cancel = FALSE; 7699 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(GetParent(hwnd), 0);7798 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(GetParent(hwnd)); 7700 7799 EDITLABEL_ITEM *einfo = infoPtr->pedititem; 7701 7800 static BOOL bIgnoreKillFocus = FALSE; … … 7785 7884 HDC hOldFont=0; 7786 7885 TEXTMETRICA textMetric; 7787 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *) GetWindowLongA(parent, 0);7886 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(parent); 7788 7887 7789 7888 if (NULL == (infoPtr->pedititem = (EDITLABEL_ITEM*)COMCTL32_Alloc(sizeof(EDITLABEL_ITEM)))) -
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.