Changeset 6709 for trunk/src/comctl32/comboex.c
- Timestamp:
 - Sep 15, 2001, 11:26:26 AM (24 years ago)
 - File:
 - 
      
- 1 edited
 
- 
          
  trunk/src/comctl32/comboex.c (modified) (74 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
trunk/src/comctl32/comboex.c
r6705 r6709 4 4 * result in a FIXME: 5 5 * CBES_EX_NOEDITIMAGEINDENT 6 * CBES_EX_PATHWORDBREAKPROC7 * CBES_EX_NOSIZELIMIT8 * CBES_EX_CASESENSITIVE6 * CBES_EX_PATHWORDBREAKPROC 7 * CBES_EX_NOSIZELIMIT 8 * CBES_EX_CASESENSITIVE 9 9 * 2. None of the following callback items are implemented. Therefor 10 10 * no CBEN_GETDISPINFO notifies are issued. Use in either CBEM_INSERTITEM … … 37 37 * generate message sequence similar to native DLL. 38 38 * 2. Handle case where CBEM_SETITEM is called to display data in EDIT 39 * Control. 39 * Control. 40 40 * 3. Add override for WNDPROC for the EDIT control (reqed for VK_RETURN). 41 41 * 4. Dump input data for things using COMBOBOXEXITEM{A|W}. … … 55 55 * 3. Lock image selected status to focus state of edit control if 56 56 * edit control exists. Mimics native actions. 57 * 4. Implemented WM_SETFOCUS in EditWndProc to track status of 57 * 4. Implemented WM_SETFOCUS in EditWndProc to track status of 58 58 * focus for 3 above. 59 59 * 5. The LBN_SELCHANGE is just for documentation purposes. … … 70 70 * 71 71 * mod 6 72 * 1. Add support for WM_NOTIFYFORMAT (both incoming and outgoing) and do 72 * 1. Add support for WM_NOTIFYFORMAT (both incoming and outgoing) and do 73 73 * WM_NOTIFY correctly based on results. 74 74 * 2. Fix memory leaks of text strings in COMBOEX_WM_DELETEITEM. 75 75 * 3. Add routines to handle special cases of NMCBEENDEDIT and NMCOMBOXEX 76 * so translation to ANSI is done correctly. 76 * so translation to ANSI is done correctly. 77 77 * 4. Fix some issues with COMBOEX_DrawItem. 78 78 * … … 150 150 /* 151 151 * Special flag set in DRAWITEMSTRUCT itemState field. It is set by 152 * the ComboEx version of the Combo Window Proc so that when the 153 * WM_DRAWITEM message is then passed to ComboEx, we know that this 152 * the ComboEx version of the Combo Window Proc so that when the 153 * WM_DRAWITEM message is then passed to ComboEx, we know that this 154 154 * particular WM_DRAWITEM message is for listbox only items. Any messasges 155 155 * without this flag is then for the Edit control field. 156 156 * 157 * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that 157 * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that 158 158 * only version 4.0 applications will have ODS_COMBOBOXEDIT set. 159 159 */ … … 189 189 if (TRACE_ON(comboex)){ 190 190 TRACE("item %p - mask=%08x, pszText=%p, cchTM=%d, iImage=%d\n", 191 item, item->mask, item->pszText, item->cchTextMax,192 item->iImage);191 item, item->mask, item->pszText, item->cchTextMax, 192 item->iImage); 193 193 TRACE("item %p - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n", 194 item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam);194 item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam); 195 195 if ((item->mask & CBEIF_TEXT) && item->pszText) 196 TRACE("item %p - pszText=%s\n",197 item, debugstr_w((const WCHAR *)item->pszText));196 TRACE("item %p - pszText=%s\n", 197 item, debugstr_w((const WCHAR *)item->pszText)); 198 198 } 199 199 } … … 205 205 if (TRACE_ON(comboex)){ 206 206 TRACE("input - mask=%08x, iItem=%d, pszText=%p, cchTM=%d, iImage=%d\n", 207 input->mask, input->iItem, input->pszText, input->cchTextMax,208 input->iImage);207 input->mask, input->iItem, input->pszText, input->cchTextMax, 208 input->iImage); 209 209 if ((input->mask & CBEIF_TEXT) && input->pszText) { 210 if (true_for_w)211 TRACE("input - pszText=<%s>\n", 212 debugstr_w((const WCHAR *)input->pszText));213 else 214 TRACE("input - pszText=<%s>\n", 215 debugstr_a((const char *)input->pszText));210 if (true_for_w) 211 TRACE("input - pszText=<%s>\n", 212 debugstr_w((const WCHAR *)input->pszText)); 213 else 214 TRACE("input - pszText=<%s>\n", 215 debugstr_a((const char *)input->pszText)); 216 216 } 217 217 TRACE("input - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n", 218 input->iSelectedImage, input->iOverlay, input->iIndent, input->lParam);218 input->iSelectedImage, input->iOverlay, input->iIndent, input->lParam); 219 219 } 220 220 } … … 226 226 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 227 227 228 if (infoPtr->hwndCombo) 229 return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam);228 if (infoPtr->hwndCombo) 229 return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam); 230 230 231 231 return 0; … … 241 241 hdr->code = code; 242 242 if (infoPtr->NtfUnicode) 243 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,244 (LPARAM)hdr);243 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 244 (LPARAM)hdr); 245 245 else 246 return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,247 (LPARAM)hdr);246 return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 247 (LPARAM)hdr); 248 248 } 249 249 … … 259 259 hdr->hdr.code = code; 260 260 if (infoPtr->NtfUnicode) 261 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,262 (LPARAM)hdr);261 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 262 (LPARAM)hdr); 263 263 else { 264 LPWSTR str, ostr = NULL;265 INT ret, len = 0;266 267 if (hdr->ceItem.mask & CBEIF_TEXT) {268 ostr = hdr->ceItem.pszText;269 str = ostr;270 if (!str) str = (LPWSTR)L"";271 len = WideCharToMultiByte (CP_ACP, 0, str, -1, 0, 0, NULL, NULL);272 if (len > 0) {273 hdr->ceItem.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(CHAR));274 WideCharToMultiByte (CP_ACP, 0, str, -1, (LPSTR)hdr->ceItem.pszText,275 len, NULL, NULL);276 }277 }278 279 ret = SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,280 (LPARAM)hdr);281 if (hdr->ceItem.mask & CBEIF_TEXT) {282 if (len > 0)283 COMCTL32_Free (hdr->ceItem.pszText);284 hdr->ceItem.pszText = ostr;285 }286 return ret;264 LPWSTR str, ostr = NULL; 265 INT ret, len = 0; 266 267 if (hdr->ceItem.mask & CBEIF_TEXT) { 268 ostr = hdr->ceItem.pszText; 269 str = ostr; 270 if (!str) str = (LPWSTR)L""; 271 len = WideCharToMultiByte (CP_ACP, 0, str, -1, 0, 0, NULL, NULL); 272 if (len > 0) { 273 hdr->ceItem.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(CHAR)); 274 WideCharToMultiByte (CP_ACP, 0, str, -1, (LPSTR)hdr->ceItem.pszText, 275 len, NULL, NULL); 276 } 277 } 278 279 ret = SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 280 (LPARAM)hdr); 281 if (hdr->ceItem.mask & CBEIF_TEXT) { 282 if (len > 0) 283 COMCTL32_Free (hdr->ceItem.pszText); 284 hdr->ceItem.pszText = ostr; 285 } 286 return ret; 287 287 } 288 288 } … … 299 299 hdr->hdr.code = (infoPtr->NtfUnicode) ? CBEN_ENDEDITW : CBEN_ENDEDITA; 300 300 if (infoPtr->NtfUnicode) 301 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,302 (LPARAM)hdr);301 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 302 (LPARAM)hdr); 303 303 else { 304 NMCBEENDEDITA ansi;305 306 memcpy (&ansi.hdr, &hdr->hdr, sizeof(NMHDR));307 ansi.fChanged = hdr->fChanged;308 ansi.iNewSelection = hdr->iNewSelection;309 WideCharToMultiByte (CP_ACP, 0, itemText, -1,310 (LPSTR)&ansi.szText, CBEMAXSTRLEN, NULL, NULL);311 ansi.iWhy = hdr->iWhy;312 return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,313 (LPARAM)&ansi);304 NMCBEENDEDITA ansi; 305 306 memcpy (&ansi.hdr, &hdr->hdr, sizeof(NMHDR)); 307 ansi.fChanged = hdr->fChanged; 308 ansi.iNewSelection = hdr->iNewSelection; 309 WideCharToMultiByte (CP_ACP, 0, itemText, -1, 310 (LPSTR)&ansi.szText, CBEMAXSTRLEN, NULL, NULL); 311 ansi.iWhy = hdr->iWhy; 312 return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 313 (LPARAM)&ansi); 314 314 } 315 315 } … … 340 340 } 341 341 if (cit->mask & CBEIF_IMAGE) 342 cit->iImage = item->iImage;342 cit->iImage = item->iImage; 343 343 if (cit->mask & CBEIF_SELECTEDIMAGE) 344 cit->iSelectedImage = item->iSelectedImage;344 cit->iSelectedImage = item->iSelectedImage; 345 345 if (cit->mask & CBEIF_OVERLAY) 346 cit->iOverlay = item->iOverlay;346 cit->iOverlay = item->iOverlay; 347 347 if (cit->mask & CBEIF_INDENT) 348 cit->iIndent = item->iIndent;348 cit->iIndent = item->iIndent; 349 349 if (cit->mask & CBEIF_LPARAM) 350 cit->lParam = item->lParam;350 cit->lParam = item->lParam; 351 351 352 352 } … … 364 364 iinfo.rcImage.left = iinfo.rcImage.right = 0; 365 365 if (infoPtr->himl) { 366 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);367 xoff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP;366 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo); 367 xoff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP; 368 368 } 369 369 GetClientRect (infoPtr->hwndCombo, &rect); … … 380 380 381 381 TRACE("Combo client (%d,%d)-(%d,%d), setting Edit to (%d,%d)-(%d,%d)\n", 382 rect.left, rect.top, rect.right, rect.bottom,383 x, y, x + w, y + h);382 rect.left, rect.top, rect.right, rect.bottom, 383 x, y, x + w, y + h); 384 384 SetWindowPos(infoPtr->hwndEdit, HWND_TOP, 385 x, y,386 w, h,387 SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);385 x, y, 386 w, h, 387 SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER); 388 388 } 389 389 … … 399 399 cy = mysize.cy + CBE_EXTRA; 400 400 if (infoPtr->himl) { 401 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);402 cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy);403 TRACE("upgraded height due to image: height=%d\n", cy);401 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo); 402 cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy); 403 TRACE("upgraded height due to image: height=%d\n", cy); 404 404 } 405 405 SendMessageW (hwnd, CB_SETITEMHEIGHT, (WPARAM) -1, (LPARAM) cy); 406 406 if (infoPtr->hwndCombo) 407 407 SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, 408 (WPARAM) 0, (LPARAM) cy);408 (WPARAM) 0, (LPARAM) cy); 409 409 } 410 410 … … 419 419 /* EM_SETSEL32 (0,-1) */ 420 420 if (item->mask & CBEIF_TEXT) { 421 SendMessageW (infoPtr->hwndEdit, WM_SETTEXT, 0, (LPARAM)item->pszText);422 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);423 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);424 } 425 } 426 427 421 SendMessageW (infoPtr->hwndEdit, WM_SETTEXT, 0, (LPARAM)item->pszText); 422 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0); 423 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1); 424 } 425 } 426 427 428 428 static CBE_ITEMDATA * 429 429 COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index) … … 433 433 434 434 if ((index > infoPtr->nb_items) || (index < -1)) 435 return 0;435 return 0; 436 436 if (index == -1) 437 return infoPtr->edit;437 return infoPtr->edit; 438 438 item = infoPtr->items; 439 439 i = infoPtr->nb_items - 1; … … 441 441 /* find the item in the list */ 442 442 while (item && (i > index)) { 443 item = (CBE_ITEMDATA *)item->next;444 i--;443 item = (CBE_ITEMDATA *)item->next; 444 i--; 445 445 } 446 446 if (!item || (i != index)) { 447 FIXME("COMBOBOXEX item structures broken. Please report!\n");448 return 0;447 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 448 return 0; 449 449 } 450 450 return item; … … 456 456 { 457 457 if (item->pszText == LPSTR_TEXTCALLBACKW) 458 FIXME("Callback not implemented yet for pszText\n");458 FIXME("Callback not implemented yet for pszText\n"); 459 459 if (item->iImage == I_IMAGECALLBACK) 460 FIXME("Callback not implemented yet for iImage\n");460 FIXME("Callback not implemented yet for iImage\n"); 461 461 if (item->iSelectedImage == I_IMAGECALLBACK) 462 FIXME("Callback not implemented yet for iSelectedImage\n");462 FIXME("Callback not implemented yet for iSelectedImage\n"); 463 463 if (item->iOverlay == I_IMAGECALLBACK) 464 FIXME("Callback not implemented yet for iOverlay\n");464 FIXME("Callback not implemented yet for iOverlay\n"); 465 465 if (item->iIndent == I_INDENTCALLBACK) 466 FIXME("Callback not implemented yet for iIndent\n");466 FIXME("Callback not implemented yet for iIndent\n"); 467 467 } 468 468 … … 482 482 /* if item number requested does not exist then return failure */ 483 483 if ((index > infoPtr->nb_items) || (index < 0)) { 484 ERR("attempt to delete item that does not exist\n");485 return CB_ERR;484 ERR("attempt to delete item that does not exist\n"); 485 return CB_ERR; 486 486 } 487 487 488 488 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 489 ERR("attempt to delete item that was not found!\n");490 return CB_ERR;489 ERR("attempt to delete item that was not found!\n"); 490 return CB_ERR; 491 491 } 492 492 … … 515 515 516 516 if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN) 517 return 0;517 return 0; 518 518 519 519 TRACE("-- 0x%x\n", infoPtr->hwndEdit); … … 560 560 /* if item number requested does not exist then return failure */ 561 561 if ((index > infoPtr->nb_items) || (index < -1)) { 562 ERR("attempt to get item that does not exist\n");563 return 0;562 ERR("attempt to get item that does not exist\n"); 563 return 0; 564 564 } 565 565 566 566 /* if the item is the edit control and there is no edit control, skip */ 567 if ((index == -1) && 567 if ((index == -1) && 568 568 ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)) 569 return 0;569 return 0; 570 570 571 571 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 572 ERR("attempt to get item that was not found!\n");573 return 0;572 ERR("attempt to get item that was not found!\n"); 573 return 0; 574 574 } 575 575 … … 594 594 595 595 len = WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 0, 0, NULL, NULL); 596 if (len > 0) 597 WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 598 cit->pszText, cit->cchTextMax, NULL, NULL);596 if (len > 0) 597 WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 598 cit->pszText, cit->cchTextMax, NULL, NULL); 599 599 600 600 cit->iImage = tmpcit.iImage; … … 613 613 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 614 614 615 TRACE("%s hwnd=0x%x\n", 616 infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);615 TRACE("%s hwnd=0x%x\n", 616 infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd); 617 617 618 618 return infoPtr->bUnicode; … … 626 626 627 627 if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN) 628 return FALSE;629 if ((infoPtr->flags & (WCBE_ACTEDIT | WCBE_EDITCHG)) == 630 (WCBE_ACTEDIT | WCBE_EDITCHG))631 return TRUE;628 return FALSE; 629 if ((infoPtr->flags & (WCBE_ACTEDIT | WCBE_EDITCHG)) == 630 (WCBE_ACTEDIT | WCBE_EDITCHG)) 631 return TRUE; 632 632 return FALSE; 633 633 } … … 661 661 /* fast path for iItem = -1 */ 662 662 item->next = infoPtr->items; 663 infoPtr->items = item;663 infoPtr->items = item; 664 664 } 665 665 else { 666 666 INT i = infoPtr->nb_items-1; 667 CBE_ITEMDATA *moving = infoPtr->items;668 669 while ((i > index) && moving) {670 moving = (CBE_ITEMDATA *)moving->next;671 i--;672 }673 if (!moving) {674 FIXME("COMBOBOXEX item structures broken. Please report!\n");675 COMCTL32_Free(item);676 return -1;677 }678 item->next = moving->next;679 moving->next = item;667 CBE_ITEMDATA *moving = infoPtr->items; 668 669 while ((i > index) && moving) { 670 moving = (CBE_ITEMDATA *)moving->next; 671 i--; 672 } 673 if (!moving) { 674 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 675 COMCTL32_Free(item); 676 return -1; 677 } 678 item->next = moving->next; 679 moving->next = item; 680 680 } 681 681 … … 684 684 if (item->mask & CBEIF_TEXT) { 685 685 LPWSTR str; 686 INT len;686 INT len; 687 687 688 688 str = cit->pszText; 689 689 if (!str) str = (LPWSTR) L""; 690 len = strlenW (str);691 if (len > 0) {692 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));693 strcpyW (item->pszText, str);694 }695 else696 item->pszText = NULL;690 len = strlenW (str); 691 if (len > 0) { 692 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 693 strcpyW (item->pszText, str); 694 } 695 else 696 item->pszText = NULL; 697 697 item->cchTextMax = cit->cchTextMax; 698 698 } … … 713 713 COMBOEX_DumpItem (item); 714 714 715 SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, 716 (WPARAM)cit->iItem, (LPARAM)item);715 SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, 716 (WPARAM)cit->iItem, (LPARAM)item); 717 717 718 718 COMBOEX_CopyItem (infoPtr, item, &nmcit.ceItem); … … 727 727 COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 728 728 { 729 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;730 COMBOBOXEXITEMW citW;731 LRESULT ret;729 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam; 730 COMBOBOXEXITEMW citW; 731 LRESULT ret; 732 732 733 733 memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA)); 734 734 if (cit->mask & CBEIF_TEXT) { 735 735 LPSTR str; 736 INT len;736 INT len; 737 737 738 738 str = cit->pszText; 739 739 if (!str) str=""; 740 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);741 if (len > 0) {742 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));743 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);744 }740 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 741 if (len > 0) { 742 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 743 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len); 744 } 745 745 } 746 746 ret = COMBOEX_InsertItemW(hwnd,wParam,(LPARAM)&citW);; 747 747 748 748 if (cit->mask & CBEIF_TEXT) 749 COMCTL32_Free(citW.pszText);749 COMCTL32_Free(citW.pszText); 750 750 return ret; 751 751 } … … 763 763 764 764 if (lParam & (CBES_EX_NOEDITIMAGEINDENT | 765 CBES_EX_PATHWORDBREAKPROC |766 CBES_EX_NOSIZELIMIT |767 CBES_EX_CASESENSITIVE))768 FIXME("Extended style not implemented %08lx\n", lParam);765 CBES_EX_PATHWORDBREAKPROC | 766 CBES_EX_NOSIZELIMIT | 767 CBES_EX_CASESENSITIVE)) 768 FIXME("Extended style not implemented %08lx\n", lParam); 769 769 770 770 if ((DWORD)wParam) { 771 infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;771 infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam; 772 772 } 773 773 else 774 infoPtr->dwExtStyle = (DWORD)lParam;774 infoPtr->dwExtStyle = (DWORD)lParam; 775 775 776 776 /* … … 778 778 */ 779 779 if ((infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE) ^ 780 (dwTemp & CBES_EX_NOEDITIMAGE)) {781 /* if state of EX_NOEDITIMAGE changes, invalidate all */782 TRACE("EX_NOEDITIMAGE state changed to %ld\n",783 infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE);784 InvalidateRect (hwnd, NULL, TRUE);785 COMBOEX_AdjustEditPos (infoPtr);786 if (infoPtr->hwndEdit)787 InvalidateRect (infoPtr->hwndEdit, NULL, TRUE);780 (dwTemp & CBES_EX_NOEDITIMAGE)) { 781 /* if state of EX_NOEDITIMAGE changes, invalidate all */ 782 TRACE("EX_NOEDITIMAGE state changed to %ld\n", 783 infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE); 784 InvalidateRect (hwnd, NULL, TRUE); 785 COMBOEX_AdjustEditPos (infoPtr); 786 if (infoPtr->hwndEdit) 787 InvalidateRect (infoPtr->hwndEdit, NULL, TRUE); 788 788 } 789 789 … … 826 826 /* if item number requested does not exist then return failure */ 827 827 if ((index > infoPtr->nb_items) || (index < -1)) { 828 ERR("attempt to set item that does not exist yet!\n");829 return 0;828 ERR("attempt to set item that does not exist yet!\n"); 829 return 0; 830 830 } 831 831 832 832 /* if the item is the edit control and there is no edit control, skip */ 833 if ((index == -1) && 833 if ((index == -1) && 834 834 ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)) 835 return 0;835 return 0; 836 836 837 837 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 838 ERR("attempt to set item that was not found!\n");839 return 0;840 } 841 842 /* add/change stuff to the internal item structure */ 838 ERR("attempt to set item that was not found!\n"); 839 return 0; 840 } 841 842 /* add/change stuff to the internal item structure */ 843 843 item->mask |= cit->mask; 844 844 if (cit->mask & CBEIF_TEXT) { 845 845 LPWSTR str; 846 INT len;847 WCHAR emptystr[1] = {0};846 INT len; 847 WCHAR emptystr[1] = {0}; 848 848 849 849 str = cit->pszText; 850 850 if (!str) str=emptystr; 851 len = strlenW(str);852 if (len > 0) {853 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));854 strcpyW(item->pszText,str);855 }851 len = strlenW(str); 852 if (len > 0) { 853 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 854 strcpyW(item->pszText,str); 855 } 856 856 item->cchTextMax = cit->cchTextMax; 857 857 } … … 873 873 /* if original request was to update edit control, do some fast foot work */ 874 874 if (cit->iItem == -1) { 875 COMBOEX_SetEditText (infoPtr, item);876 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE);875 COMBOEX_SetEditText (infoPtr, item); 876 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE); 877 877 } 878 878 return TRUE; … … 882 882 COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 883 883 { 884 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;885 COMBOBOXEXITEMW citW;886 LRESULT ret;884 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam; 885 COMBOBOXEXITEMW citW; 886 LRESULT ret; 887 887 888 888 memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA)); 889 889 if (cit->mask & CBEIF_TEXT) { 890 890 LPSTR str; 891 INT len;891 INT len; 892 892 893 893 str = cit->pszText; 894 894 if (!str) str=""; 895 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);896 if (len > 0) {897 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));898 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);899 }895 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 896 if (len > 0) { 897 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 898 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len); 899 } 900 900 } 901 901 ret = COMBOEX_SetItemW(hwnd,wParam,(LPARAM)&citW);; 902 902 903 903 if (cit->mask & CBEIF_TEXT) 904 COMCTL32_Free(citW.pszText);904 COMCTL32_Free(citW.pszText); 905 905 return ret; 906 906 } … … 913 913 BOOL bTemp = infoPtr->bUnicode; 914 914 915 TRACE("to %s hwnd=0x%04x, was %s\n", 916 ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd,917 (bTemp) ? "TRUE" : "FALSE");915 TRACE("to %s hwnd=0x%04x, was %s\n", 916 ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd, 917 (bTemp) ? "TRUE" : "FALSE"); 918 918 919 919 infoPtr->bUnicode = (BOOL)wParam; … … 937 937 i = MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, NULL, 0); 938 938 if (i > 0) { 939 desired = (LPWSTR)COMCTL32_Alloc ((i + 1)*sizeof(WCHAR));940 MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, desired, i);939 desired = (LPWSTR)COMCTL32_Alloc ((i + 1)*sizeof(WCHAR)); 940 MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, desired, i); 941 941 } 942 942 … … 945 945 /* now search from after starting loc and wrapping back to start */ 946 946 for(i=start+1; i<count; i++) { 947 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 948 CB_GETITEMDATA, (WPARAM)i, 0);949 TRACE("desired=%s, item=%s\n", 950 debugstr_w(desired), debugstr_w(item->pszText));951 if (lstrcmpiW(item->pszText, desired) == 0) {952 COMCTL32_Free (desired);953 return i;954 }947 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 948 CB_GETITEMDATA, (WPARAM)i, 0); 949 TRACE("desired=%s, item=%s\n", 950 debugstr_w(desired), debugstr_w(item->pszText)); 951 if (lstrcmpiW(item->pszText, desired) == 0) { 952 COMCTL32_Free (desired); 953 return i; 954 } 955 955 } 956 956 for(i=0; i<=start; i++) { 957 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 958 CB_GETITEMDATA, (WPARAM)i, 0);959 TRACE("desired=%s, item=%s\n", 960 debugstr_w(desired), debugstr_w(item->pszText));961 if (lstrcmpiW(item->pszText, desired) == 0) {962 COMCTL32_Free (desired);963 return i;964 }957 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 958 CB_GETITEMDATA, (WPARAM)i, 0); 959 TRACE("desired=%s, item=%s\n", 960 debugstr_w(desired), debugstr_w(item->pszText)); 961 if (lstrcmpiW(item->pszText, desired) == 0) { 962 COMCTL32_Free (desired); 963 return i; 964 } 965 965 } 966 966 COMCTL32_Free(desired); … … 977 977 LRESULT lret = 0; 978 978 979 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 980 wParam, lParam);979 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 980 wParam, lParam); 981 981 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) { 982 item2 = COMBOEX_FindItem (infoPtr, index);983 if (item2 != item1) {984 ERR("data structures damaged!\n");985 return CB_ERR;986 }987 if (item1->mask & CBEIF_LPARAM)988 lret = (LRESULT) item1->lParam;989 TRACE("returning 0x%08lx\n", lret);990 return lret;982 item2 = COMBOEX_FindItem (infoPtr, index); 983 if (item2 != item1) { 984 ERR("data structures damaged!\n"); 985 return CB_ERR; 986 } 987 if (item1->mask & CBEIF_LPARAM) 988 lret = (LRESULT) item1->lParam; 989 TRACE("returning 0x%08lx\n", lret); 990 return lret; 991 991 } 992 992 lret = (LRESULT)item1; … … 1005 1005 1006 1006 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 1007 /* FIXME: need to clear selection */1008 return CB_ERR;1007 /* FIXME: need to clear selection */ 1008 return CB_ERR; 1009 1009 } 1010 1010 1011 1011 TRACE("selecting item %d text=%s\n", index, (item->pszText) ? 1012 debugstr_w(item->pszText) : "<null>");1012 debugstr_w(item->pszText) : "<null>"); 1013 1013 infoPtr->selected = index; 1014 1014 … … 1026 1026 CBE_ITEMDATA *item1, *item2; 1027 1027 1028 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 1029 wParam, lParam);1028 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 1029 wParam, lParam); 1030 1030 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) { 1031 item2 = COMBOEX_FindItem (infoPtr, index);1032 if (item2 != item1) {1033 ERR("data structures damaged!\n");1034 return CB_ERR;1035 }1036 item1->mask |= CBEIF_LPARAM;1037 item1->lParam = lParam;1038 TRACE("setting lparam to 0x%08lx\n", lParam);1039 return 0;1031 item2 = COMBOEX_FindItem (infoPtr, index); 1032 if (item2 != item1) { 1033 ERR("data structures damaged!\n"); 1034 return CB_ERR; 1035 } 1036 item1->mask |= CBEIF_LPARAM; 1037 item1->lParam = lParam; 1038 TRACE("setting lparam to 0x%08lx\n", lParam); 1039 return 0; 1040 1040 } 1041 1041 TRACE("non-valid result from combo 0x%08lx\n", (DWORD)item1); … … 1054 1054 /* First, lets forward the message to the normal combo control 1055 1055 just like Windows. */ 1056 if (infoPtr->hwndCombo) 1056 if (infoPtr->hwndCombo) 1057 1057 SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, wParam, lParam); 1058 1058 … … 1060 1060 GetWindowRect (hwnd, &cbx_wrect); 1061 1061 GetClientRect (hwnd, &cbx_crect); 1062 /* the height of comboex as height of the combo + comboex border */ 1062 /* the height of comboex as height of the combo + comboex border */ 1063 1063 height = cb_wrect.bottom-cb_wrect.top 1064 1064 + cbx_wrect.bottom-cbx_wrect.top 1065 1065 - (cbx_crect.bottom-cbx_crect.top); 1066 1066 TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n", 1067 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,1068 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);1067 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom, 1068 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom); 1069 1069 TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n", 1070 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,1071 cbx_wrect.right-cbx_wrect.left, height);1070 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom, 1071 cbx_wrect.right-cbx_wrect.left, height); 1072 1072 SetWindowPos (hwnd, HWND_TOP, 0, 0, 1073 cbx_wrect.right-cbx_wrect.left,1074 height,1075 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);1073 cbx_wrect.right-cbx_wrect.left, 1074 height, 1075 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 1076 1076 1077 1077 return ret; … … 1101 1101 #endif 1102 1102 if (infoPtr == NULL) { 1103 ERR("could not allocate info memory!\n");1104 return 0;1103 ERR("could not allocate info memory!\n"); 1104 return 0; 1105 1105 } 1106 1106 … … 1115 1115 1116 1116 i = SendMessageA(GetParent (hwnd), 1117 WM_NOTIFYFORMAT, hwnd, NF_QUERY);1117 WM_NOTIFYFORMAT, hwnd, NF_QUERY); 1118 1118 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 1119 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",1120 i);1121 i = NFR_ANSI;1119 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 1120 i); 1121 i = NFR_ANSI; 1122 1122 } 1123 1123 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; … … 1127 1127 /* create combo box */ 1128 1128 dwComboStyle = GetWindowLongA (hwnd, GWL_STYLE) & 1129 (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);1129 (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD); 1130 1130 1131 1131 GetWindowRect(hwnd, &wnrc1); 1132 1132 GetClientRect(hwnd, &clrc1); 1133 1133 TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d)\n", 1134 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,1135 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom);1134 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 1135 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom); 1136 1136 TRACE("combo style=%08lx, adding style=%08lx\n", dwComboStyle, 1137 1137 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 1138 1138 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 1139 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED);1139 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED); 1140 1140 1141 1141 /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */ … … 1147 1147 1148 1148 infoPtr->hwndCombo = CreateWindowA ("ComboBox", "", 1149 /* following line added to match native */1149 /* following line added to match native */ 1150 1150 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 1151 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 1152 /* was base and is necessary */1153 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,1154 cs->y, cs->x, cs->cx, cs->cy, hwnd,1155 (HMENU) GetWindowLongA (hwnd, GWL_ID),1156 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);1157 1158 /* 1151 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 1152 /* was base and is necessary */ 1153 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle, 1154 cs->y, cs->x, cs->cx, cs->cy, hwnd, 1155 (HMENU) GetWindowLongA (hwnd, GWL_ID), 1156 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL); 1157 1158 /* 1159 1159 * native does the following at this point according to trace: 1160 1160 * GetWindowThreadProcessId(hwndCombo,0) … … 1165 1165 1166 1166 /* 1167 * Setup a property to hold the pointer to the COMBOBOXEX 1167 * Setup a property to hold the pointer to the COMBOBOXEX 1168 1168 * data structure. 1169 1169 */ 1170 1170 test = GetPropA(infoPtr->hwndCombo, (LPCSTR)(LONG)ComboExInfo); 1171 1171 if (!test || ((COMBOEX_INFO *)test != infoPtr)) { 1172 SetPropA(infoPtr->hwndCombo, "CC32SubclassInfo", (LONG)infoPtr);1173 } 1174 infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndCombo, 1175 GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc);1172 SetPropA(infoPtr->hwndCombo, "CC32SubclassInfo", (LONG)infoPtr); 1173 } 1174 infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndCombo, 1175 GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc); 1176 1176 infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 1177 1177 … … 1182 1182 */ 1183 1183 if ((cs->style & CBS_DROPDOWNLIST) == CBS_DROPDOWN) { 1184 infoPtr->hwndEdit = CreateWindowExA (0, "EDIT", "",1185 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL,1186 0, 0, 0, 0, /* will set later */1187 infoPtr->hwndCombo, 1188 (HMENU) GetWindowLongA (hwnd, GWL_ID),1189 GetWindowLongA (hwnd, GWL_HINSTANCE),1190 NULL);1191 1192 /* native does the following at this point according to trace:1193 * GetWindowThreadProcessId(hwndEdit,0)1194 * GetCurrentThreadId()1195 * GetWindowThreadProcessId(hwndEdit, &???)1196 * GetCurrentProcessId()1197 */1198 1199 /*1200 * Setup a property to hold the pointer to the COMBOBOXEX 1201 * data structure.1202 */1203 test = GetPropA(infoPtr->hwndEdit, (LPCSTR)(LONG)ComboExInfo);1204 if (!test || ((COMBOEX_INFO *)test != infoPtr)) {1205 SetPropA(infoPtr->hwndEdit, "CC32SubclassInfo", (LONG)infoPtr);1206 }1207 infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndEdit, 1208 GWL_WNDPROC, (LONG)COMBOEX_EditWndProc);1209 infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);1184 infoPtr->hwndEdit = CreateWindowExA (0, "EDIT", "", 1185 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL, 1186 0, 0, 0, 0, /* will set later */ 1187 infoPtr->hwndCombo, 1188 (HMENU) GetWindowLongA (hwnd, GWL_ID), 1189 GetWindowLongA (hwnd, GWL_HINSTANCE), 1190 NULL); 1191 1192 /* native does the following at this point according to trace: 1193 * GetWindowThreadProcessId(hwndEdit,0) 1194 * GetCurrentThreadId() 1195 * GetWindowThreadProcessId(hwndEdit, &???) 1196 * GetCurrentProcessId() 1197 */ 1198 1199 /* 1200 * Setup a property to hold the pointer to the COMBOBOXEX 1201 * data structure. 1202 */ 1203 test = GetPropA(infoPtr->hwndEdit, (LPCSTR)(LONG)ComboExInfo); 1204 if (!test || ((COMBOEX_INFO *)test != infoPtr)) { 1205 SetPropA(infoPtr->hwndEdit, "CC32SubclassInfo", (LONG)infoPtr); 1206 } 1207 infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndEdit, 1208 GWL_WNDPROC, (LONG)COMBOEX_EditWndProc); 1209 infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 1210 1210 } 1211 1211 else { 1212 infoPtr->hwndEdit = 0;1213 infoPtr->font = 0;1212 infoPtr->hwndEdit = 0; 1213 infoPtr->font = 0; 1214 1214 } 1215 1215 … … 1219 1219 */ 1220 1220 if (!infoPtr->font) { 1221 SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), 1222 &mylogfont, 0);1223 infoPtr->font = CreateFontIndirectA (&mylogfont);1221 SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), 1222 &mylogfont, 0); 1223 infoPtr->font = CreateFontIndirectA (&mylogfont); 1224 1224 } 1225 1225 SendMessageW (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0); 1226 1226 if (infoPtr->hwndEdit) { 1227 SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0);1228 SendMessageW (infoPtr->hwndEdit, EM_SETMARGINS, (WPARAM)EC_USEFONTINFO, 0);1227 SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0); 1228 SendMessageW (infoPtr->hwndEdit, EM_SETMARGINS, (WPARAM)EC_USEFONTINFO, 0); 1229 1229 } 1230 1230 … … 1237 1237 GetWindowRect(infoPtr->hwndCombo, &cmbwrc); 1238 1238 TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) CB wnd=(%d,%d)-(%d,%d)\n", 1239 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,1240 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,1241 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);1242 SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 1243 0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top,1244 SWP_NOACTIVATE | SWP_NOREDRAW);1239 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 1240 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 1241 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); 1242 SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 1243 0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top, 1244 SWP_NOACTIVATE | SWP_NOREDRAW); 1245 1245 1246 1246 GetWindowRect(infoPtr->hwndCombo, &cmbwrc); 1247 1247 TRACE("CB window=(%d,%d)-(%d,%d)\n", 1248 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);1249 SetWindowPos(hwnd, HWND_TOP, 1250 0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top,1251 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);1248 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); 1249 SetWindowPos(hwnd, HWND_TOP, 1250 0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top, 1251 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 1252 1252 1253 1253 COMBOEX_AdjustEditPos (infoPtr); 1254 1254 1255 1255 /* 1256 * Create an item structure to represent the data in the 1256 * Create an item structure to represent the data in the 1257 1257 * EDIT control. 1258 1258 */ … … 1284 1284 { 1285 1285 case CBN_DROPDOWN: 1286 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1287 (LPARAM)hwnd);1288 /*1289 * from native trace of first dropdown after typing in URL in IE4 1290 * CB_GETCURSEL(Combo)1291 * GetWindowText(Edit)1292 * CB_GETCURSEL(Combo)1293 * CB_GETCOUNT(Combo)1294 * CB_GETITEMDATA(Combo, n)1295 * WM_NOTIFY(parent, CBEN_ENDEDITA|W)1296 * CB_GETCURSEL(Combo)1297 * CB_SETCURSEL(COMBOEX, n)1298 * SetFocus(Combo)1299 * the rest is supposition 1300 */1301 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);1302 if (cursel == -1) {1303 /* find match from edit against those in Combobox */1304 GetWindowTextW (infoPtr->hwndEdit, wintext, 520);1305 n = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0);1306 for (cursel = 0; cursel < n; cursel++){1307 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1308 CB_GETITEMDATA, 1309 cursel, 0);1310 if ((INT)item == CB_ERR) break;1311 if (lstrcmpiW(item->pszText, wintext) == 0) break;1312 }1313 if ((cursel == n) || ((INT)item == CB_ERR)) {1314 TRACE("failed to find match??? item=%p cursel=%d\n",1315 item, cursel);1316 if (infoPtr->hwndEdit)1317 SetFocus(infoPtr->hwndEdit);1318 return 0;1319 }1320 }1321 else {1322 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1323 CB_GETITEMDATA, 1324 cursel, 0);1325 if ((INT)item == CB_ERR) {1326 TRACE("failed to find match??? item=%p cursel=%d\n",1327 item, cursel);1328 if (infoPtr->hwndEdit)1329 SetFocus(infoPtr->hwndEdit);1330 return 0;1331 }1332 }1333 1334 /* Save flags for testing and reset them */1335 oldflags = infoPtr->flags;1336 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);1337 1338 if (oldflags & WCBE_ACTEDIT) {1339 cbeend.fChanged = (oldflags & WCBE_EDITCHG);1340 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,1341 CB_GETCURSEL, 0, 0);1342 cbeend.iWhy = CBENF_DROPDOWN;1343 1344 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, item->pszText)) {1345 /* abort the change */1346 TRACE("Notify requested abort of change\n");1347 return 0;1348 }1349 }1350 1351 /* if selection has changed the set the new current selection */1352 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);1353 if ((oldflags & WCBE_EDITCHG) || (cursel != infoPtr->selected)) {1354 infoPtr->selected = cursel;1355 SendMessageW (hwnd, CB_SETCURSEL, cursel, 0);1356 SetFocus(infoPtr->hwndCombo);1357 }1358 return 0;1286 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1287 (LPARAM)hwnd); 1288 /* 1289 * from native trace of first dropdown after typing in URL in IE4 1290 * CB_GETCURSEL(Combo) 1291 * GetWindowText(Edit) 1292 * CB_GETCURSEL(Combo) 1293 * CB_GETCOUNT(Combo) 1294 * CB_GETITEMDATA(Combo, n) 1295 * WM_NOTIFY(parent, CBEN_ENDEDITA|W) 1296 * CB_GETCURSEL(Combo) 1297 * CB_SETCURSEL(COMBOEX, n) 1298 * SetFocus(Combo) 1299 * the rest is supposition 1300 */ 1301 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1302 if (cursel == -1) { 1303 /* find match from edit against those in Combobox */ 1304 GetWindowTextW (infoPtr->hwndEdit, wintext, 520); 1305 n = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0); 1306 for (cursel = 0; cursel < n; cursel++){ 1307 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1308 CB_GETITEMDATA, 1309 cursel, 0); 1310 if ((INT)item == CB_ERR) break; 1311 if (lstrcmpiW(item->pszText, wintext) == 0) break; 1312 } 1313 if ((cursel == n) || ((INT)item == CB_ERR)) { 1314 TRACE("failed to find match??? item=%p cursel=%d\n", 1315 item, cursel); 1316 if (infoPtr->hwndEdit) 1317 SetFocus(infoPtr->hwndEdit); 1318 return 0; 1319 } 1320 } 1321 else { 1322 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1323 CB_GETITEMDATA, 1324 cursel, 0); 1325 if ((INT)item == CB_ERR) { 1326 TRACE("failed to find match??? item=%p cursel=%d\n", 1327 item, cursel); 1328 if (infoPtr->hwndEdit) 1329 SetFocus(infoPtr->hwndEdit); 1330 return 0; 1331 } 1332 } 1333 1334 /* Save flags for testing and reset them */ 1335 oldflags = infoPtr->flags; 1336 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1337 1338 if (oldflags & WCBE_ACTEDIT) { 1339 cbeend.fChanged = (oldflags & WCBE_EDITCHG); 1340 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1341 CB_GETCURSEL, 0, 0); 1342 cbeend.iWhy = CBENF_DROPDOWN; 1343 1344 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, item->pszText)) { 1345 /* abort the change */ 1346 TRACE("Notify requested abort of change\n"); 1347 return 0; 1348 } 1349 } 1350 1351 /* if selection has changed the set the new current selection */ 1352 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1353 if ((oldflags & WCBE_EDITCHG) || (cursel != infoPtr->selected)) { 1354 infoPtr->selected = cursel; 1355 SendMessageW (hwnd, CB_SETCURSEL, cursel, 0); 1356 SetFocus(infoPtr->hwndCombo); 1357 } 1358 return 0; 1359 1359 1360 1360 case CBN_SELCHANGE: 1361 /*1362 * CB_GETCURSEL(Combo)1363 * CB_GETITEMDATA(Combo) < simulated by COMBOEX_FindItem1364 * lstrlenA1365 * WM_SETTEXT(Edit)1366 * WM_GETTEXTLENGTH(Edit)1367 * WM_GETTEXT(Edit)1368 * EM_SETSEL(Edit, 0,0)1369 * WM_GETTEXTLENGTH(Edit)1370 * WM_GETTEXT(Edit)1371 * EM_SETSEL(Edit, 0,len)1372 * return WM_COMMAND to parent1373 */1374 oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);1375 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {1376 ERR("item %d not found. Problem!\n", oldItem);1377 break;1378 }1379 infoPtr->selected = oldItem;1380 COMBOEX_SetEditText (infoPtr, item);1381 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1382 (LPARAM)hwnd);1361 /* 1362 * CB_GETCURSEL(Combo) 1363 * CB_GETITEMDATA(Combo) < simulated by COMBOEX_FindItem 1364 * lstrlenA 1365 * WM_SETTEXT(Edit) 1366 * WM_GETTEXTLENGTH(Edit) 1367 * WM_GETTEXT(Edit) 1368 * EM_SETSEL(Edit, 0,0) 1369 * WM_GETTEXTLENGTH(Edit) 1370 * WM_GETTEXT(Edit) 1371 * EM_SETSEL(Edit, 0,len) 1372 * return WM_COMMAND to parent 1373 */ 1374 oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1375 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { 1376 ERR("item %d not found. Problem!\n", oldItem); 1377 break; 1378 } 1379 infoPtr->selected = oldItem; 1380 COMBOEX_SetEditText (infoPtr, item); 1381 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1382 (LPARAM)hwnd); 1383 1383 1384 1384 case CBN_SELENDOK: 1385 /* 1386 * We have to change the handle since we are the control1387 * issuing the message. IE4 depends on this.1388 */1389 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1390 (LPARAM)hwnd);1385 /* 1386 * We have to change the handle since we are the control 1387 * issuing the message. IE4 depends on this. 1388 */ 1389 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1390 (LPARAM)hwnd); 1391 1391 1392 1392 case CBN_KILLFOCUS: 1393 /*1394 * from native trace:1395 *1396 * pass to parent1397 * WM_GETTEXT(Edit, 104)1398 * CB_GETCURSEL(Combo) rets -11399 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS1400 * CB_GETCURSEL(Combo)1401 * InvalidateRect(Combo, 0, 0)1402 * return 01403 */1404 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1405 (LPARAM)hwnd);1406 if (infoPtr->flags & WCBE_ACTEDIT) {1407 GetWindowTextW (infoPtr->hwndEdit, wintext, 260);1408 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);1409 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,1410 CB_GETCURSEL, 0, 0);1411 cbeend.iWhy = CBENF_KILLFOCUS;1412 1413 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);1414 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, wintext)) {1415 /* abort the change */1416 TRACE("Notify requested abort of change\n");1417 return 0;1418 }1419 }1420 /* possible CB_GETCURSEL */1421 InvalidateRect (infoPtr->hwndCombo, 0, 0);1422 return 0;1393 /* 1394 * from native trace: 1395 * 1396 * pass to parent 1397 * WM_GETTEXT(Edit, 104) 1398 * CB_GETCURSEL(Combo) rets -1 1399 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS 1400 * CB_GETCURSEL(Combo) 1401 * InvalidateRect(Combo, 0, 0) 1402 * return 0 1403 */ 1404 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1405 (LPARAM)hwnd); 1406 if (infoPtr->flags & WCBE_ACTEDIT) { 1407 GetWindowTextW (infoPtr->hwndEdit, wintext, 260); 1408 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG); 1409 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1410 CB_GETCURSEL, 0, 0); 1411 cbeend.iWhy = CBENF_KILLFOCUS; 1412 1413 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1414 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, wintext)) { 1415 /* abort the change */ 1416 TRACE("Notify requested abort of change\n"); 1417 return 0; 1418 } 1419 } 1420 /* possible CB_GETCURSEL */ 1421 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1422 return 0; 1423 1423 1424 1424 case CBN_CLOSEUP: 1425 1425 default: 1426 /* 1427 * We have to change the handle since we are the control1428 * issuing the message. IE4 depends on this.1429 * We also need to set the focus back to the Edit control1430 * after passing the command to the parent of the ComboEx.1431 */1432 lret = SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1433 (LPARAM)hwnd);1434 if (infoPtr->hwndEdit)1435 SetFocus(infoPtr->hwndEdit);1436 return lret;1426 /* 1427 * We have to change the handle since we are the control 1428 * issuing the message. IE4 depends on this. 1429 * We also need to set the focus back to the Edit control 1430 * after passing the command to the parent of the ComboEx. 1431 */ 1432 lret = SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1433 (LPARAM)hwnd); 1434 if (infoPtr->hwndEdit) 1435 SetFocus(infoPtr->hwndEdit); 1436 return lret; 1437 1437 } 1438 1438 return 0; … … 1450 1450 1451 1451 TRACE("CtlType=%08x, CtlID=%08x, itemID=%08x, hwnd=%x, data=%08lx\n", 1452 dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData);1452 dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData); 1453 1453 1454 1454 if ((dis->itemID >= infoPtr->nb_items) || (dis->itemID < 0)) return FALSE; … … 1458 1458 1459 1459 if (i == dis->itemID) { 1460 infoPtr->items = infoPtr->items->next;1460 infoPtr->items = infoPtr->items->next; 1461 1461 } 1462 1462 else { 1463 item = olditem;1464 i--;1465 1466 /* find the prior item in the list */1467 while (item->next && (i > dis->itemID)) {1468 item = (CBE_ITEMDATA *)item->next;1469 i--;1470 }1471 if (!item->next || (i != dis->itemID)) {1472 FIXME("COMBOBOXEX item structures broken. Please report!\n");1473 return FALSE;1474 }1475 olditem = item->next;1476 item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next;1463 item = olditem; 1464 i--; 1465 1466 /* find the prior item in the list */ 1467 while (item->next && (i > dis->itemID)) { 1468 item = (CBE_ITEMDATA *)item->next; 1469 i--; 1470 } 1471 if (!item->next || (i != dis->itemID)) { 1472 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 1473 return FALSE; 1474 } 1475 olditem = item->next; 1476 item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next; 1477 1477 } 1478 1478 infoPtr->nb_items--; … … 1482 1482 1483 1483 if (olditem->pszText) 1484 COMCTL32_Free(olditem->pszText);1484 COMCTL32_Free(olditem->pszText); 1485 1485 COMCTL32_Free(olditem); 1486 1486 … … 1510 1510 /* dump the DRAWITEMSTRUCT if tracing "comboex" but not "message" */ 1511 1511 if (!TRACE_ON(message)) { 1512 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", 1513 dis->CtlType, dis->CtlID);1514 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", 1515 dis->itemID, dis->itemAction, dis->itemState);1516 TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n",1517 dis->hwndItem, dis->hDC, dis->rcItem.left, 1518 dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, 1519 dis->itemData);1512 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", 1513 dis->CtlType, dis->CtlID); 1514 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", 1515 dis->itemID, dis->itemAction, dis->itemState); 1516 TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n", 1517 dis->hwndItem, dis->hDC, dis->rcItem.left, 1518 dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, 1519 dis->itemData); 1520 1520 } 1521 1521 … … 1532 1532 /* though the list box or combo box has the focus. */ 1533 1533 if (dis->itemID == 0xffffffff) { 1534 if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) ||1535 ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { 1536 1537 TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n",1538 dis->rcItem.left, dis->rcItem.top,1539 dis->rcItem.right, dis->rcItem.bottom);1540 }1541 else if ((dis->CtlType == ODT_COMBOBOX) && 1542 (dis->itemAction == ODA_DRAWENTIRE)) {1543 /* draw of edit control data */1544 1545 /* testing */1546 {1547 RECT exrc, cbrc, edrc;1548 GetWindowRect (hwnd, &exrc);1549 GetWindowRect (infoPtr->hwndCombo, &cbrc);1550 edrc.left=edrc.top=edrc.right=edrc.bottom=-1;1551 if (infoPtr->hwndEdit)1552 GetWindowRect (infoPtr->hwndEdit, &edrc);1553 TRACE("window rects ex=(%d,%d)-(%d,%d), cb=(%d,%d)-(%d,%d), ed=(%d,%d)-(%d,%d)\n",1554 exrc.left, exrc.top, exrc.right, exrc.bottom,1555 cbrc.left, cbrc.top, cbrc.right, cbrc.bottom,1556 edrc.left, edrc.top, edrc.right, edrc.bottom);1557 }1558 }1559 else {1560 ERR("NOT drawing item -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n",1561 dis->rcItem.left, dis->rcItem.top,1562 dis->rcItem.right, dis->rcItem.bottom,1563 dis->itemAction, dis->itemState);1564 return 0;1565 }1534 if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) || 1535 ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { 1536 1537 TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n", 1538 dis->rcItem.left, dis->rcItem.top, 1539 dis->rcItem.right, dis->rcItem.bottom); 1540 } 1541 else if ((dis->CtlType == ODT_COMBOBOX) && 1542 (dis->itemAction == ODA_DRAWENTIRE)) { 1543 /* draw of edit control data */ 1544 1545 /* testing */ 1546 { 1547 RECT exrc, cbrc, edrc; 1548 GetWindowRect (hwnd, &exrc); 1549 GetWindowRect (infoPtr->hwndCombo, &cbrc); 1550 edrc.left=edrc.top=edrc.right=edrc.bottom=-1; 1551 if (infoPtr->hwndEdit) 1552 GetWindowRect (infoPtr->hwndEdit, &edrc); 1553 TRACE("window rects ex=(%d,%d)-(%d,%d), cb=(%d,%d)-(%d,%d), ed=(%d,%d)-(%d,%d)\n", 1554 exrc.left, exrc.top, exrc.right, exrc.bottom, 1555 cbrc.left, cbrc.top, cbrc.right, cbrc.bottom, 1556 edrc.left, edrc.top, edrc.right, edrc.bottom); 1557 } 1558 } 1559 else { 1560 ERR("NOT drawing item -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n", 1561 dis->rcItem.left, dis->rcItem.top, 1562 dis->rcItem.right, dis->rcItem.bottom, 1563 dis->itemAction, dis->itemState); 1564 return 0; 1565 } 1566 1566 } 1567 1567 1568 1568 /* If draw item is -1 (edit control) setup the item pointer */ 1569 1569 if (dis->itemID == 0xffffffff) { 1570 CHAR str[260];1571 INT wlen, alen;1572 1573 item = infoPtr->edit;1574 1575 if (infoPtr->hwndEdit) {1576 1577 /* free previous text of edit item */1578 if (item->pszText) {1579 COMCTL32_Free(item->pszText);1580 item->pszText = 0;1581 item->mask &= ~CBEIF_TEXT;1582 }1583 alen = SendMessageA (infoPtr->hwndEdit, WM_GETTEXT, 260, (LPARAM)&str);1584 TRACE("edit control hwndEdit=%0x, text len=%d str=<%s>\n",1585 infoPtr->hwndEdit, alen, str);1586 if (alen > 0) {1587 item->mask |= CBEIF_TEXT;1588 wlen = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);1589 if (wlen > 0) {1590 item->pszText = (LPWSTR)COMCTL32_Alloc ((wlen + 1)*sizeof(WCHAR));1591 MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, wlen);1592 }1593 }1594 }1570 CHAR str[260]; 1571 INT wlen, alen; 1572 1573 item = infoPtr->edit; 1574 1575 if (infoPtr->hwndEdit) { 1576 1577 /* free previous text of edit item */ 1578 if (item->pszText) { 1579 COMCTL32_Free(item->pszText); 1580 item->pszText = 0; 1581 item->mask &= ~CBEIF_TEXT; 1582 } 1583 alen = SendMessageA (infoPtr->hwndEdit, WM_GETTEXT, 260, (LPARAM)&str); 1584 TRACE("edit control hwndEdit=%0x, text len=%d str=<%s>\n", 1585 infoPtr->hwndEdit, alen, str); 1586 if (alen > 0) { 1587 item->mask |= CBEIF_TEXT; 1588 wlen = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 1589 if (wlen > 0) { 1590 item->pszText = (LPWSTR)COMCTL32_Alloc ((wlen + 1)*sizeof(WCHAR)); 1591 MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, wlen); 1592 } 1593 } 1594 } 1595 1595 } 1596 1596 1597 1597 /* if the item pointer is not set, then get the data and locate it */ 1598 1598 if (!item) { 1599 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,1600 CB_GETITEMDATA, (WPARAM)dis->itemID, 0);1601 if (item == (CBE_ITEMDATA *)CB_ERR)1602 {1603 FIXME("invalid item for id %d \n",dis->itemID);1604 return 0;1605 }1599 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1600 CB_GETITEMDATA, (WPARAM)dis->itemID, 0); 1601 if (item == (CBE_ITEMDATA *)CB_ERR) 1602 { 1603 FIXME("invalid item for id %d \n",dis->itemID); 1604 return 0; 1605 } 1606 1606 } 1607 1607 … … 1612 1612 xbase += (item->iIndent * CBE_INDENT); 1613 1613 if (item->mask & CBEIF_IMAGE) { 1614 ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo);1615 xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP);1614 ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo); 1615 xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP); 1616 1616 } 1617 1617 … … 1619 1619 case ODA_FOCUS: 1620 1620 if (dis->itemState & ODS_SELECTED /*1*/) { 1621 if ((item->mask & CBEIF_TEXT) && item->pszText) {1622 RECT rect2;1623 1624 len = strlenW (item->pszText);1625 GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize);1626 rect.left = xbase + xioff - 1;1627 rect.right = rect.left + txtsize.cx + 2;1628 rect.top = dis->rcItem.top;1629 rect.bottom = dis->rcItem.bottom;1630 GetClipBox (dis->hDC, &rect2);1631 TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n",1632 dis->itemID, rect.left, rect.top,1633 rect.right, rect.bottom);1634 TRACE(" clip=(%d,%d)-(%d,%d)\n",1635 rect2.left, rect2.top,1636 rect2.right, rect2.bottom);1637 1638 DrawFocusRect(dis->hDC, &rect);1639 }1640 else {1641 FIXME("ODA_FOCUS and ODS_SELECTED but no text\n");1642 }1643 }1644 else {1645 FIXME("ODA_FOCUS but not ODS_SELECTED\n");1646 }1621 if ((item->mask & CBEIF_TEXT) && item->pszText) { 1622 RECT rect2; 1623 1624 len = strlenW (item->pszText); 1625 GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize); 1626 rect.left = xbase + xioff - 1; 1627 rect.right = rect.left + txtsize.cx + 2; 1628 rect.top = dis->rcItem.top; 1629 rect.bottom = dis->rcItem.bottom; 1630 GetClipBox (dis->hDC, &rect2); 1631 TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n", 1632 dis->itemID, rect.left, rect.top, 1633 rect.right, rect.bottom); 1634 TRACE(" clip=(%d,%d)-(%d,%d)\n", 1635 rect2.left, rect2.top, 1636 rect2.right, rect2.bottom); 1637 1638 DrawFocusRect(dis->hDC, &rect); 1639 } 1640 else { 1641 FIXME("ODA_FOCUS and ODS_SELECTED but no text\n"); 1642 } 1643 } 1644 else { 1645 FIXME("ODA_FOCUS but not ODS_SELECTED\n"); 1646 } 1647 1647 break; 1648 1648 case ODA_SELECT: 1649 1649 case ODA_DRAWENTIRE: 1650 1650 drawimage = -1; 1651 drawstate = ILD_NORMAL;1652 if (!(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE)) {1653 if (item->mask & CBEIF_IMAGE) 1654 drawimage = item->iImage;1655 if (dis->itemState & ODS_COMBOEXLBOX) {1656 /* drawing listbox entry */1657 if (dis->itemState & ODS_SELECTED) {1658 if (item->mask & CBEIF_SELECTEDIMAGE)1659 drawimage = item->iSelectedImage;1660 drawstate = ILD_SELECTED;1661 }1662 }1663 else {1664 /* drawing combo/edit entry */1665 if (infoPtr->hwndEdit) {1666 /* if we have an edit control, the slave the 1667 * selection state to the Edit focus state 1668 */1669 if (infoPtr->flags & WCBE_EDITFOCUSED) {1670 if (item->mask & CBEIF_SELECTEDIMAGE)1671 drawimage = item->iSelectedImage;1672 drawstate = ILD_SELECTED;1673 }1674 }1675 else {1676 /* if we don't have an edit control, use 1677 * the requested state.1678 */1679 if (dis->itemState & ODS_SELECTED) {1680 if (item->mask & CBEIF_SELECTEDIMAGE)1681 drawimage = item->iSelectedImage;1682 drawstate = ILD_SELECTED;1683 }1684 }1685 }1686 }1687 if (drawimage != -1) {1688 TRACE("drawing image state=%d\n", dis->itemState & ODS_SELECTED);1689 ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, 1690 xbase, dis->rcItem.top, drawstate);1691 }1692 1693 /* setup pointer to text to be drawn */1694 if ((item->mask & CBEIF_TEXT) && item->pszText)1695 str = item->pszText;1696 else1697 str = (LPWSTR) L"";1698 1699 /* now draw the text */1700 len = lstrlenW (str);1701 GetTextExtentPointW (dis->hDC, str, len, &txtsize);1702 nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ?1703 COLOR_HIGHLIGHT : COLOR_WINDOW);1704 SetBkColor (dis->hDC, nbkc);1705 ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ?1706 COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT);1707 SetTextColor (dis->hDC, ntxc);1708 x = xbase + xioff;1709 y = dis->rcItem.top +1710 (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2;1711 rect.left = x;1712 rect.right = x + txtsize.cx;1713 rect.top = dis->rcItem.top + 1;1714 rect.bottom = dis->rcItem.bottom - 1;1715 TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n",1716 dis->itemID, rect.left, rect.top, rect.right, rect.bottom);1717 ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED,1718 &rect, str, len, 0);1719 if (dis->itemState & ODS_FOCUS) {1720 rect.top -= 1;1721 rect.bottom += 1;1722 rect.left -= 1;1723 rect.right += 1;1724 TRACE("drawing item %d focus after text, rect=(%d,%d)-(%d,%d)\n",1725 dis->itemID, rect.left, rect.top, rect.right, rect.bottom);1726 DrawFocusRect (dis->hDC, &rect);1727 }1728 break;1651 drawstate = ILD_NORMAL; 1652 if (!(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE)) { 1653 if (item->mask & CBEIF_IMAGE) 1654 drawimage = item->iImage; 1655 if (dis->itemState & ODS_COMBOEXLBOX) { 1656 /* drawing listbox entry */ 1657 if (dis->itemState & ODS_SELECTED) { 1658 if (item->mask & CBEIF_SELECTEDIMAGE) 1659 drawimage = item->iSelectedImage; 1660 drawstate = ILD_SELECTED; 1661 } 1662 } 1663 else { 1664 /* drawing combo/edit entry */ 1665 if (infoPtr->hwndEdit) { 1666 /* if we have an edit control, the slave the 1667 * selection state to the Edit focus state 1668 */ 1669 if (infoPtr->flags & WCBE_EDITFOCUSED) { 1670 if (item->mask & CBEIF_SELECTEDIMAGE) 1671 drawimage = item->iSelectedImage; 1672 drawstate = ILD_SELECTED; 1673 } 1674 } 1675 else { 1676 /* if we don't have an edit control, use 1677 * the requested state. 1678 */ 1679 if (dis->itemState & ODS_SELECTED) { 1680 if (item->mask & CBEIF_SELECTEDIMAGE) 1681 drawimage = item->iSelectedImage; 1682 drawstate = ILD_SELECTED; 1683 } 1684 } 1685 } 1686 } 1687 if (drawimage != -1) { 1688 TRACE("drawing image state=%d\n", dis->itemState & ODS_SELECTED); 1689 ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, 1690 xbase, dis->rcItem.top, drawstate); 1691 } 1692 1693 /* setup pointer to text to be drawn */ 1694 if ((item->mask & CBEIF_TEXT) && item->pszText) 1695 str = item->pszText; 1696 else 1697 str = (LPWSTR) L""; 1698 1699 /* now draw the text */ 1700 len = lstrlenW (str); 1701 GetTextExtentPointW (dis->hDC, str, len, &txtsize); 1702 nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ? 1703 COLOR_HIGHLIGHT : COLOR_WINDOW); 1704 SetBkColor (dis->hDC, nbkc); 1705 ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ? 1706 COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT); 1707 SetTextColor (dis->hDC, ntxc); 1708 x = xbase + xioff; 1709 y = dis->rcItem.top + 1710 (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2; 1711 rect.left = x; 1712 rect.right = x + txtsize.cx; 1713 rect.top = dis->rcItem.top + 1; 1714 rect.bottom = dis->rcItem.bottom - 1; 1715 TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n", 1716 dis->itemID, rect.left, rect.top, rect.right, rect.bottom); 1717 ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED, 1718 &rect, str, len, 0); 1719 if (dis->itemState & ODS_FOCUS) { 1720 rect.top -= 1; 1721 rect.bottom += 1; 1722 rect.left -= 1; 1723 rect.right += 1; 1724 TRACE("drawing item %d focus after text, rect=(%d,%d)-(%d,%d)\n", 1725 dis->itemID, rect.left, rect.top, rect.right, rect.bottom); 1726 DrawFocusRect (dis->hDC, &rect); 1727 } 1728 break; 1729 1729 default: 1730 FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n", 1731 hwnd, wParam, lParam, dis->itemAction);1730 FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n", 1731 hwnd, wParam, lParam, dis->itemAction); 1732 1732 } 1733 1733 … … 1742 1742 1743 1743 if (infoPtr->hwndCombo) 1744 DestroyWindow (infoPtr->hwndCombo);1744 DestroyWindow (infoPtr->hwndCombo); 1745 1745 1746 1746 if (infoPtr->edit) { 1747 COMCTL32_Free (infoPtr->edit);1748 infoPtr->edit = 0;1747 COMCTL32_Free (infoPtr->edit); 1748 infoPtr->edit = 0; 1749 1749 } 1750 1750 … … 1752 1752 CBE_ITEMDATA *this, *next; 1753 1753 1754 this = infoPtr->items;1755 while (this) {1756 next = (CBE_ITEMDATA *)this->next;1757 if ((this->mask & CBEIF_TEXT) && this->pszText)1758 COMCTL32_Free (this->pszText);1759 COMCTL32_Free (this);1760 this = next;1761 }1754 this = infoPtr->items; 1755 while (this) { 1756 next = (CBE_ITEMDATA *)this->next; 1757 if ((this->mask & CBEIF_TEXT) && this->pszText) 1758 COMCTL32_Free (this->pszText); 1759 COMCTL32_Free (this); 1760 this = next; 1761 } 1762 1762 } 1763 1763 … … 1785 1785 1786 1786 TRACE("adjusted height hwnd=%08x, height=%d\n", 1787 hwnd, mis->itemHeight);1787 hwnd, mis->itemHeight); 1788 1788 1789 1789 return 0; … … 1800 1800 newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL); 1801 1801 if (newstyle != oldstyle) { 1802 TRACE("req style %08lx, reseting style %08lx\n",1803 oldstyle, newstyle);1804 SetWindowLongA (hwnd, GWL_STYLE, newstyle);1802 TRACE("req style %08lx, reseting style %08lx\n", 1803 oldstyle, newstyle); 1804 SetWindowLongA (hwnd, GWL_STYLE, newstyle); 1805 1805 } 1806 1806 return 1; … … 1815 1815 1816 1816 if (lParam == NF_REQUERY) { 1817 i = SendMessageA(GetParent (hwnd),1818 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);1819 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {1820 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",1821 i);1822 i = NFR_ANSI;1823 }1824 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;1825 return (LRESULT)i;1817 i = SendMessageA(GetParent (hwnd), 1818 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY); 1819 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 1820 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 1821 i); 1822 i = NFR_ANSI; 1823 } 1824 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; 1825 return (LRESULT)i; 1826 1826 } 1827 1827 return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI); … … 1837 1837 GetWindowRect (hwnd, &rect); 1838 1838 TRACE("my rect (%d,%d)-(%d,%d)\n", 1839 rect.left, rect.top, rect.right, rect.bottom);1839 rect.left, rect.top, rect.right, rect.bottom); 1840 1840 1841 1841 MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left, 1842 rect.bottom - rect.top, TRUE);1842 rect.bottom - rect.top, TRUE); 1843 1843 1844 1844 COMBOEX_AdjustEditPos (infoPtr); … … 1862 1862 /* width is winpos value + border width of comboex */ 1863 1863 width = wp->cx 1864 + (cbx_wrect.right-cbx_wrect.left) 1865 - (cbx_crect.right-cbx_crect.left); 1864 + (cbx_wrect.right-cbx_wrect.left) 1865 - (cbx_crect.right-cbx_crect.left); 1866 1866 1867 1867 TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n", 1868 wp->x, wp->y, wp->cx, wp->cy, wp->flags);1868 wp->x, wp->y, wp->cx, wp->cy, wp->flags); 1869 1869 TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n", 1870 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,1871 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);1870 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom, 1871 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom); 1872 1872 TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n", 1873 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,1874 width, cb_wrect.bottom-cb_wrect.top);1873 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom, 1874 width, cb_wrect.bottom-cb_wrect.top); 1875 1875 1876 1876 if (width) SetWindowPos (infoPtr->hwndCombo, HWND_TOP, 0, 0, 1877 width,1878 cb_wrect.bottom-cb_wrect.top,1879 SWP_NOACTIVATE);1877 width, 1878 cb_wrect.bottom-cb_wrect.top, 1879 SWP_NOACTIVATE); 1880 1880 1881 1881 GetWindowRect (infoPtr->hwndCombo, &cb_wrect); … … 1883 1883 /* height is combo window height plus border width of comboex */ 1884 1884 height = (cb_wrect.bottom-cb_wrect.top) 1885 + (cbx_wrect.bottom-cbx_wrect.top)1885 + (cbx_wrect.bottom-cbx_wrect.top) 1886 1886 - (cbx_crect.bottom-cbx_crect.top); 1887 1887 if (wp->cy < height) wp->cy = height; 1888 1888 if (infoPtr->hwndEdit) { 1889 COMBOEX_AdjustEditPos (infoPtr);1890 InvalidateRect (infoPtr->hwndCombo, 0, TRUE);1889 COMBOEX_AdjustEditPos (infoPtr); 1890 InvalidateRect (infoPtr->hwndCombo, 0, TRUE); 1891 1891 } 1892 1892 … … 1906 1906 LRESULT lret; 1907 1907 1908 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 1909 hwnd, uMsg, wParam, lParam, infoPtr);1908 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 1909 hwnd, uMsg, wParam, lParam, infoPtr); 1910 1910 1911 1911 if (!infoPtr) return 0; … … 1915 1915 1916 1916 case WM_CHAR: 1917 /* handle (ignore) the return character */1918 if (wParam == VK_RETURN) return 0;1919 /* all other characters pass into the real Edit */1920 return CallWindowProcA (infoPtr->prevEditWndProc, 1921 hwnd, uMsg, wParam, lParam);1917 /* handle (ignore) the return character */ 1918 if (wParam == VK_RETURN) return 0; 1919 /* all other characters pass into the real Edit */ 1920 return CallWindowProcA (infoPtr->prevEditWndProc, 1921 hwnd, uMsg, wParam, lParam); 1922 1922 1923 1923 case WM_ERASEBKGND: 1924 /*1925 * The following was determined by traces of the native 1926 */1924 /* 1925 * The following was determined by traces of the native 1926 */ 1927 1927 hDC = (HDC) wParam; 1928 nbkc = GetSysColor (COLOR_WINDOW);1929 obkc = SetBkColor (hDC, nbkc);1928 nbkc = GetSysColor (COLOR_WINDOW); 1929 obkc = SetBkColor (hDC, nbkc); 1930 1930 GetClientRect (hwnd, &rect); 1931 TRACE("erasing (%d,%d)-(%d,%d)\n",1932 rect.left, rect.top, rect.right, rect.bottom);1933 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);1931 TRACE("erasing (%d,%d)-(%d,%d)\n", 1932 rect.left, rect.top, rect.right, rect.bottom); 1933 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); 1934 1934 SetBkColor (hDC, obkc); 1935 return CallWindowProcA (infoPtr->prevEditWndProc, 1936 hwnd, uMsg, wParam, lParam);1935 return CallWindowProcA (infoPtr->prevEditWndProc, 1936 hwnd, uMsg, wParam, lParam); 1937 1937 1938 1938 case WM_KEYDOWN: { 1939 INT oldItem, selected; 1940 CBE_ITEMDATA *item; 1941 1942 switch ((INT)wParam) 1943 { 1944 case VK_ESCAPE: 1945 /* native version seems to do following for COMBOEX */ 1946 /* 1947 * GetWindowTextA(Edit,&?, 0x104) x 1948 * CB_GETCURSEL to Combo rets -1 x 1949 * WM_NOTIFY to COMBOEX parent (rebar) x 1950 * (CBEN_ENDEDIT{A|W} 1951 * fChanged = FALSE x 1952 * inewSelection = -1 x 1953 * txt="www.hoho" x 1954 * iWhy = 3 x 1955 * CB_GETCURSEL to Combo rets -1 x 1956 * InvalidateRect(Combo, 0) x 1957 * WM_SETTEXT to Edit x 1958 * EM_SETSEL to Edit (0,0) x 1959 * EM_SETSEL to Edit (0,-1) x 1960 * RedrawWindow(Combo, 0, 0, 5) x 1961 */ 1962 TRACE("special code for VK_ESCAPE\n"); 1963 1964 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 1965 1966 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1967 cbeend.fChanged = FALSE; 1968 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1969 CB_GETCURSEL, 0, 0); 1970 cbeend.iWhy = CBENF_ESCAPE; 1971 1972 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { 1973 /* abort the change */ 1974 TRACE("Notify requested abort of change\n"); 1975 return 0; 1976 } 1977 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); 1978 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1979 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { 1980 ERR("item %d not found. Problem!\n", oldItem); 1981 break; 1982 } 1983 infoPtr->selected = oldItem; 1984 COMBOEX_SetEditText (infoPtr, item); 1985 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1986 RDW_INVALIDATE); 1987 break; 1988 1989 case VK_RETURN: 1990 /* native version seems to do following for COMBOEX */ 1991 /* 1992 * GetWindowTextA(Edit,&?, 0x104) x 1993 * CB_GETCURSEL to Combo rets -1 x 1994 * CB_GETCOUNT to Combo rets 0 1995 * if >0 loop 1996 * CB_GETITEMDATA to match 1997 * *** above 3 lines simulated by FindItem x 1998 * WM_NOTIFY to COMBOEX parent (rebar) x 1999 * (CBEN_ENDEDIT{A|W} x 2000 * fChanged = TRUE (-1) x 2001 * iNewSelection = -1 or selected x 2002 * txt= x 2003 * iWhy = 2 (CBENF_RETURN) x 2004 * CB_GETCURSEL to Combo rets -1 x 2005 * if -1 send CB_SETCURSEL to Combo -1 x 2006 * InvalidateRect(Combo, 0, 0) x 2007 * SetFocus(Edit) x 2008 * CallWindowProc(406615a8, Edit, 0x100, 0xd, 0x1c0001) 2009 */ 2010 2011 TRACE("special code for VK_RETURN\n"); 2012 2013 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2014 2015 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 2016 selected = SendMessageW (infoPtr->hwndCombo, 2017 CB_GETCURSEL, 0, 0); 2018 2019 if (selected != -1) { 2020 item = COMBOEX_FindItem (infoPtr, selected); 2021 TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n", 2022 selected, debugstr_w(item->pszText)); 2023 TRACE("handling VK_RETURN, edittext=%s\n", 2024 debugstr_w(edit_text)); 2025 if (lstrcmpiW (item->pszText, edit_text)) { 2026 /* strings not equal -- indicate edit has changed */ 2027 selected = -1; 1939 INT oldItem, selected; 1940 CBE_ITEMDATA *item; 1941 1942 switch ((INT)wParam) 1943 { 1944 case VK_ESCAPE: 1945 /* native version seems to do following for COMBOEX */ 1946 /* 1947 * GetWindowTextA(Edit,&?, 0x104) x 1948 * CB_GETCURSEL to Combo rets -1 x 1949 * WM_NOTIFY to COMBOEX parent (rebar) x 1950 * (CBEN_ENDEDIT{A|W} 1951 * fChanged = FALSE x 1952 * inewSelection = -1 x 1953 * txt="www.hoho" x 1954 * iWhy = 3 x 1955 * CB_GETCURSEL to Combo rets -1 x 1956 * InvalidateRect(Combo, 0) x 1957 * WM_SETTEXT to Edit x 1958 * EM_SETSEL to Edit (0,0) x 1959 * EM_SETSEL to Edit (0,-1) x 1960 * RedrawWindow(Combo, 0, 0, 5) x 1961 */ 1962 TRACE("special code for VK_ESCAPE\n"); 1963 1964 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 1965 1966 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1967 cbeend.fChanged = FALSE; 1968 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1969 CB_GETCURSEL, 0, 0); 1970 cbeend.iWhy = CBENF_ESCAPE; 1971 1972 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { 1973 /* abort the change */ 1974 TRACE("Notify requested abort of change\n"); 1975 return 0; 1976 } 1977 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); 1978 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1979 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { 1980 ERR("item %d not found. Problem!\n", oldItem); 1981 break; 1982 } 1983 infoPtr->selected = oldItem; 1984 COMBOEX_SetEditText (infoPtr, item); 1985 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1986 RDW_INVALIDATE); 1987 break; 1988 1989 case VK_RETURN: 1990 /* native version seems to do following for COMBOEX */ 1991 /* 1992 * GetWindowTextA(Edit,&?, 0x104) x 1993 * CB_GETCURSEL to Combo rets -1 x 1994 * CB_GETCOUNT to Combo rets 0 1995 * if >0 loop 1996 * CB_GETITEMDATA to match 1997 * *** above 3 lines simulated by FindItem x 1998 * WM_NOTIFY to COMBOEX parent (rebar) x 1999 * (CBEN_ENDEDIT{A|W} x 2000 * fChanged = TRUE (-1) x 2001 * iNewSelection = -1 or selected x 2002 * txt= x 2003 * iWhy = 2 (CBENF_RETURN) x 2004 * CB_GETCURSEL to Combo rets -1 x 2005 * if -1 send CB_SETCURSEL to Combo -1 x 2006 * InvalidateRect(Combo, 0, 0) x 2007 * SetFocus(Edit) x 2008 * CallWindowProc(406615a8, Edit, 0x100, 0xd, 0x1c0001) 2009 */ 2010 2011 TRACE("special code for VK_RETURN\n"); 2012 2013 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2014 2015 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 2016 selected = SendMessageW (infoPtr->hwndCombo, 2017 CB_GETCURSEL, 0, 0); 2018 2019 if (selected != -1) { 2020 item = COMBOEX_FindItem (infoPtr, selected); 2021 TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n", 2022 selected, debugstr_w(item->pszText)); 2023 TRACE("handling VK_RETURN, edittext=%s\n", 2024 debugstr_w(edit_text)); 2025 if (lstrcmpiW (item->pszText, edit_text)) { 2026 /* strings not equal -- indicate edit has changed */ 2027 selected = -1; 2028 } 2029 } 2030 2031 cbeend.iNewSelection = selected; 2032 cbeend.fChanged = TRUE; 2033 cbeend.iWhy = CBENF_RETURN; 2034 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { 2035 /* abort the change, restore previous */ 2036 TRACE("Notify requested abort of change\n"); 2037 COMBOEX_SetEditText (infoPtr, infoPtr->edit); 2038 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 2039 RDW_INVALIDATE); 2040 return 0; 2041 } 2042 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); 2043 if (oldItem != -1) { 2044 /* if something is selected, then deselect it */ 2045 SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, 2046 (WPARAM)-1, 0); 2047 } 2048 InvalidateRect (infoPtr->hwndCombo, 0, 0); 2049 SetFocus(infoPtr->hwndEdit); 2050 break; 2051 2052 default: 2053 return CallWindowProcA (infoPtr->prevEditWndProc, 2054 hwnd, uMsg, wParam, lParam); 2055 } 2056 return 0; 2028 2057 } 2029 }2030 2031 cbeend.iNewSelection = selected;2032 cbeend.fChanged = TRUE;2033 cbeend.iWhy = CBENF_RETURN;2034 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {2035 /* abort the change, restore previous */2036 TRACE("Notify requested abort of change\n");2037 COMBOEX_SetEditText (infoPtr, infoPtr->edit);2038 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |2039 RDW_INVALIDATE);2040 return 0;2041 }2042 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0);2043 if (oldItem != -1) {2044 /* if something is selected, then deselect it */2045 SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL,2046 (WPARAM)-1, 0);2047 }2048 InvalidateRect (infoPtr->hwndCombo, 0, 0);2049 SetFocus(infoPtr->hwndEdit);2050 break;2051 2052 default:2053 return CallWindowProcA (infoPtr->prevEditWndProc,2054 hwnd, uMsg, wParam, lParam);2055 }2056 return 0;2057 }2058 2058 2059 2059 case WM_SETFOCUS: 2060 /* remember the focus to set state of icon */2061 lret = CallWindowProcA (infoPtr->prevEditWndProc, 2062 hwnd, uMsg, wParam, lParam);2063 infoPtr->flags |= WCBE_EDITFOCUSED;2064 return lret;2060 /* remember the focus to set state of icon */ 2061 lret = CallWindowProcA (infoPtr->prevEditWndProc, 2062 hwnd, uMsg, wParam, lParam); 2063 infoPtr->flags |= WCBE_EDITFOCUSED; 2064 return lret; 2065 2065 2066 2066 case WM_KILLFOCUS: 2067 /* 2068 * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS2069 */2070 infoPtr->flags &= ~WCBE_EDITFOCUSED;2071 if (infoPtr->flags & WCBE_ACTEDIT) {2072 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);2073 2074 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);2075 cbeend.fChanged = FALSE;2076 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,2077 CB_GETCURSEL, 0, 0);2078 cbeend.iWhy = CBENF_KILLFOCUS;2079 2080 COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text);2081 }2082 /* fall through */2067 /* 2068 * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS 2069 */ 2070 infoPtr->flags &= ~WCBE_EDITFOCUSED; 2071 if (infoPtr->flags & WCBE_ACTEDIT) { 2072 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 2073 2074 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2075 cbeend.fChanged = FALSE; 2076 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 2077 CB_GETCURSEL, 0, 0); 2078 cbeend.iWhy = CBENF_KILLFOCUS; 2079 2080 COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text); 2081 } 2082 /* fall through */ 2083 2083 2084 2084 default: 2085 return CallWindowProcA (infoPtr->prevEditWndProc, 2086 hwnd, uMsg, wParam, lParam);2085 return CallWindowProcA (infoPtr->prevEditWndProc, 2086 hwnd, uMsg, wParam, lParam); 2087 2087 } 2088 2088 return 0; … … 2102 2102 WCHAR edit_text[260]; 2103 2103 2104 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 2105 hwnd, uMsg, wParam, lParam, infoPtr);2104 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 2105 hwnd, uMsg, wParam, lParam, infoPtr); 2106 2106 2107 2107 if (!infoPtr) return 0; … … 2111 2111 2112 2112 case CB_FINDSTRINGEXACT: 2113 return COMBOEX_FindStringExact (infoPtr, wParam, lParam);2113 return COMBOEX_FindStringExact (infoPtr, wParam, lParam); 2114 2114 2115 2115 case WM_DRAWITEM: 2116 /*2117 * The only way this message should come is from the2118 * child Listbox issuing the message. Flag this so2119 * that ComboEx knows this is listbox.2120 */2121 ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX;2122 return CallWindowProcA (infoPtr->prevComboWndProc, 2123 hwnd, uMsg, wParam, lParam);2116 /* 2117 * The only way this message should come is from the 2118 * child Listbox issuing the message. Flag this so 2119 * that ComboEx knows this is listbox. 2120 */ 2121 ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX; 2122 return CallWindowProcA (infoPtr->prevComboWndProc, 2123 hwnd, uMsg, wParam, lParam); 2124 2124 2125 2125 case WM_ERASEBKGND: 2126 /*2127 * The following was determined by traces of the native 2128 */2126 /* 2127 * The following was determined by traces of the native 2128 */ 2129 2129 hDC = (HDC) wParam; 2130 nbkc = GetSysColor (COLOR_WINDOW);2131 obkc = SetBkColor (hDC, nbkc);2130 nbkc = GetSysColor (COLOR_WINDOW); 2131 obkc = SetBkColor (hDC, nbkc); 2132 2132 GetClientRect (hwnd, &rect); 2133 TRACE("erasing (%d,%d)-(%d,%d)\n",2134 rect.left, rect.top, rect.right, rect.bottom);2135 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);2133 TRACE("erasing (%d,%d)-(%d,%d)\n", 2134 rect.left, rect.top, rect.right, rect.bottom); 2135 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); 2136 2136 SetBkColor (hDC, obkc); 2137 return CallWindowProcA (infoPtr->prevComboWndProc, 2138 hwnd, uMsg, wParam, lParam);2137 return CallWindowProcA (infoPtr->prevComboWndProc, 2138 hwnd, uMsg, wParam, lParam); 2139 2139 2140 2140 case WM_SETCURSOR: 2141 /*2142 * WM_NOTIFY to comboex parent (rebar)2143 * with NM_SETCURSOR with extra words of 0,0,0,0,0x020100012144 * CallWindowProc (previous)2145 */2146 nmmse.dwItemSpec = 0;2147 nmmse.dwItemData = 0;2148 nmmse.pt.x = 0;2149 nmmse.pt.y = 0;2150 nmmse.dwHitInfo = lParam;2151 COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse);2152 return CallWindowProcA (infoPtr->prevComboWndProc, 2153 hwnd, uMsg, wParam, lParam);2141 /* 2142 * WM_NOTIFY to comboex parent (rebar) 2143 * with NM_SETCURSOR with extra words of 0,0,0,0,0x02010001 2144 * CallWindowProc (previous) 2145 */ 2146 nmmse.dwItemSpec = 0; 2147 nmmse.dwItemData = 0; 2148 nmmse.pt.x = 0; 2149 nmmse.pt.y = 0; 2150 nmmse.dwHitInfo = lParam; 2151 COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse); 2152 return CallWindowProcA (infoPtr->prevComboWndProc, 2153 hwnd, uMsg, wParam, lParam); 2154 2154 2155 2155 case WM_COMMAND: 2156 switch (HIWORD(wParam)) {2157 2158 case EN_UPDATE:2159 /* traces show that COMBOEX does not issue CBN_EDITUPDATE2160 * on the EN_UPDATE2161 */2162 return 0;2163 2164 case EN_KILLFOCUS:2165 /*2166 * Native does:2167 *2168 * GetFocus() retns AA2169 * GetWindowTextA(Edit)2170 * CB_GETCURSEL(Combo) (got -1)2171 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS2172 * CB_GETCURSEL(Combo) (got -1)2173 * InvalidateRect(Combo, 0, 0)2174 * WM_KILLFOCUS(Combo, AA)2175 * return 0;2176 */2177 focusedhwnd = GetFocus();2178 if (infoPtr->flags & WCBE_ACTEDIT) {2179 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);2180 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);2181 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,2182 CB_GETCURSEL, 0, 0);2183 cbeend.iWhy = CBENF_KILLFOCUS;2184 2185 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);2186 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {2187 /* abort the change */2188 TRACE("Notify requested abort of change\n");2189 return 0;2190 }2191 }2192 /* possible CB_GETCURSEL */2193 InvalidateRect (infoPtr->hwndCombo, 0, 0);2194 if (focusedhwnd)2195 SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS,2196 (WPARAM)focusedhwnd, 0); 2197 return 0;2198 2199 case EN_SETFOCUS: {2200 /* 2201 * For EN_SETFOCUS this issues the same calls and messages2202 * as the native seems to do.2203 *2204 * for some cases however native does the following:2205 * (noticed after SetFocus during LBUTTONDOWN on2206 * on dropdown arrow)2207 * WM_GETTEXTLENGTH (Edit);2208 * WM_GETTEXT (Edit, len+1, str);2209 * EM_SETSEL (Edit, 0, 0);2210 * WM_GETTEXTLENGTH (Edit);2211 * WM_GETTEXT (Edit, len+1, str);2212 * EM_SETSEL (Edit, 0, len);2213 * WM_NOTIFY (parent, CBEN_BEGINEDIT)2214 */2215 NMHDR hdr;2216 2217 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);2218 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);2219 COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr);2220 infoPtr->flags |= WCBE_ACTEDIT;2221 infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */2222 return 0;2223 }2224 2225 case EN_CHANGE: {2226 /* 2227 * For EN_CHANGE this issues the same calls and messages2228 * as the native seems to do.2229 */2230 WCHAR edit_text[260];2231 WCHAR *lastwrk;2232 INT selected, cnt;2233 CBE_ITEMDATA *item;2234 2235 selected = SendMessageW (infoPtr->hwndCombo,2236 CB_GETCURSEL, 0, 0);2237 2238 /* lstrlenA( lastworkingURL ) */2239 2240 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);2241 if (selected == -1) {2242 lastwrk = infoPtr->edit->pszText;2243 cnt = lstrlenW (lastwrk);2244 if (cnt >= 259) cnt = 259;2245 }2246 else {2247 item = COMBOEX_FindItem (infoPtr, selected);2248 cnt = lstrlenW (item->pszText);2249 lastwrk = item->pszText;2250 if (cnt >= 259) cnt = 259;2251 }2252 2253 TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n",2254 selected, debugstr_w(lastwrk));2255 TRACE("handling EN_CHANGE, edittext=%s\n",2256 debugstr_w(edit_text));2257 2258 /* lstrcmpiW is between lastworkingURL and GetWindowText */2259 2260 if (lstrcmpiW (lastwrk, edit_text)) {2261 /* strings not equal -- indicate edit has changed */2262 infoPtr->flags |= WCBE_EDITCHG;2263 }2264 SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND,2265 MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf),2266 CBN_EDITCHANGE),2267 infoPtr->hwndSelf);2268 return 0;2269 }2270 2271 case LBN_SELCHANGE:2272 /*2273 * Therefore from traces there is no additional code here2274 */2275 2276 /*2277 * Using native COMCTL32 gets the following:2278 * 1 == SHDOCVW.DLL issues call/message2279 * 2 == COMCTL32.DLL issues call/message2280 * 3 == WINE issues call/message2281 *2282 *2283 * for LBN_SELCHANGE:2284 * 1 CB_GETCURSEL(ComboEx)2285 * 1 CB_GETDROPPEDSTATE(ComboEx)2286 * 1 CallWindowProc( *2* for WM_COMMAND(LBN_SELCHANGE)2287 * 2 CallWindowProc( *3* for WM_COMMAND(LBN_SELCHANGE)2288 ** call CBRollUp( xxx, TRUE for LBN_SELCHANGE, TRUE)2289 * 3 WM_COMMAND(ComboEx, CBN_SELENDOK)2290 * WM_USER+49(ComboLB, 1,0) <=============!!!!!!!!!!!2291 * 3 ShowWindow(ComboLB, SW_HIDE)2292 * 3 RedrawWindow(Combo, RDW_UPDATENOW)2293 * 3 WM_COMMAND(ComboEX, CBN_CLOSEUP)2294 ** end of CBRollUp2295 * 3 WM_COMMAND(ComboEx, CBN_SELCHANGE) (echo to parent)2296 * ? LB_GETCURSEL <==|2297 * ? LB_GETTEXTLEN |2298 * ? LB_GETTEXT | Needs to be added to2299 * ? WM_CTLCOLOREDIT(ComboEx) | Combo processing2300 * ? LB_GETITEMDATA |2301 * ? WM_DRAWITEM(ComboEx) <==|2302 */2303 default:2304 break;2305 }/* fall through */2156 switch (HIWORD(wParam)) { 2157 2158 case EN_UPDATE: 2159 /* traces show that COMBOEX does not issue CBN_EDITUPDATE 2160 * on the EN_UPDATE 2161 */ 2162 return 0; 2163 2164 case EN_KILLFOCUS: 2165 /* 2166 * Native does: 2167 * 2168 * GetFocus() retns AA 2169 * GetWindowTextA(Edit) 2170 * CB_GETCURSEL(Combo) (got -1) 2171 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS 2172 * CB_GETCURSEL(Combo) (got -1) 2173 * InvalidateRect(Combo, 0, 0) 2174 * WM_KILLFOCUS(Combo, AA) 2175 * return 0; 2176 */ 2177 focusedhwnd = GetFocus(); 2178 if (infoPtr->flags & WCBE_ACTEDIT) { 2179 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2180 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG); 2181 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 2182 CB_GETCURSEL, 0, 0); 2183 cbeend.iWhy = CBENF_KILLFOCUS; 2184 2185 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 2186 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { 2187 /* abort the change */ 2188 TRACE("Notify requested abort of change\n"); 2189 return 0; 2190 } 2191 } 2192 /* possible CB_GETCURSEL */ 2193 InvalidateRect (infoPtr->hwndCombo, 0, 0); 2194 if (focusedhwnd) 2195 SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS, 2196 (WPARAM)focusedhwnd, 0); 2197 return 0; 2198 2199 case EN_SETFOCUS: { 2200 /* 2201 * For EN_SETFOCUS this issues the same calls and messages 2202 * as the native seems to do. 2203 * 2204 * for some cases however native does the following: 2205 * (noticed after SetFocus during LBUTTONDOWN on 2206 * on dropdown arrow) 2207 * WM_GETTEXTLENGTH (Edit); 2208 * WM_GETTEXT (Edit, len+1, str); 2209 * EM_SETSEL (Edit, 0, 0); 2210 * WM_GETTEXTLENGTH (Edit); 2211 * WM_GETTEXT (Edit, len+1, str); 2212 * EM_SETSEL (Edit, 0, len); 2213 * WM_NOTIFY (parent, CBEN_BEGINEDIT) 2214 */ 2215 NMHDR hdr; 2216 2217 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0); 2218 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1); 2219 COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr); 2220 infoPtr->flags |= WCBE_ACTEDIT; 2221 infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */ 2222 return 0; 2223 } 2224 2225 case EN_CHANGE: { 2226 /* 2227 * For EN_CHANGE this issues the same calls and messages 2228 * as the native seems to do. 2229 */ 2230 WCHAR edit_text[260]; 2231 WCHAR *lastwrk; 2232 INT selected, cnt; 2233 CBE_ITEMDATA *item; 2234 2235 selected = SendMessageW (infoPtr->hwndCombo, 2236 CB_GETCURSEL, 0, 0); 2237 2238 /* lstrlenA( lastworkingURL ) */ 2239 2240 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2241 if (selected == -1) { 2242 lastwrk = infoPtr->edit->pszText; 2243 cnt = lstrlenW (lastwrk); 2244 if (cnt >= 259) cnt = 259; 2245 } 2246 else { 2247 item = COMBOEX_FindItem (infoPtr, selected); 2248 cnt = lstrlenW (item->pszText); 2249 lastwrk = item->pszText; 2250 if (cnt >= 259) cnt = 259; 2251 } 2252 2253 TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n", 2254 selected, debugstr_w(lastwrk)); 2255 TRACE("handling EN_CHANGE, edittext=%s\n", 2256 debugstr_w(edit_text)); 2257 2258 /* lstrcmpiW is between lastworkingURL and GetWindowText */ 2259 2260 if (lstrcmpiW (lastwrk, edit_text)) { 2261 /* strings not equal -- indicate edit has changed */ 2262 infoPtr->flags |= WCBE_EDITCHG; 2263 } 2264 SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND, 2265 MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf), 2266 CBN_EDITCHANGE), 2267 infoPtr->hwndSelf); 2268 return 0; 2269 } 2270 2271 case LBN_SELCHANGE: 2272 /* 2273 * Therefore from traces there is no additional code here 2274 */ 2275 2276 /* 2277 * Using native COMCTL32 gets the following: 2278 * 1 == SHDOCVW.DLL issues call/message 2279 * 2 == COMCTL32.DLL issues call/message 2280 * 3 == WINE issues call/message 2281 * 2282 * 2283 * for LBN_SELCHANGE: 2284 * 1 CB_GETCURSEL(ComboEx) 2285 * 1 CB_GETDROPPEDSTATE(ComboEx) 2286 * 1 CallWindowProc( *2* for WM_COMMAND(LBN_SELCHANGE) 2287 * 2 CallWindowProc( *3* for WM_COMMAND(LBN_SELCHANGE) 2288 ** call CBRollUp( xxx, TRUE for LBN_SELCHANGE, TRUE) 2289 * 3 WM_COMMAND(ComboEx, CBN_SELENDOK) 2290 * WM_USER+49(ComboLB, 1,0) <=============!!!!!!!!!!! 2291 * 3 ShowWindow(ComboLB, SW_HIDE) 2292 * 3 RedrawWindow(Combo, RDW_UPDATENOW) 2293 * 3 WM_COMMAND(ComboEX, CBN_CLOSEUP) 2294 ** end of CBRollUp 2295 * 3 WM_COMMAND(ComboEx, CBN_SELCHANGE) (echo to parent) 2296 * ? LB_GETCURSEL <==| 2297 * ? LB_GETTEXTLEN | 2298 * ? LB_GETTEXT | Needs to be added to 2299 * ? WM_CTLCOLOREDIT(ComboEx) | Combo processing 2300 * ? LB_GETITEMDATA | 2301 * ? WM_DRAWITEM(ComboEx) <==| 2302 */ 2303 default: 2304 break; 2305 }/* fall through */ 2306 2306 default: 2307 return CallWindowProcA (infoPtr->prevComboWndProc, 2308 hwnd, uMsg, wParam, lParam);2307 return CallWindowProcA (infoPtr->prevComboWndProc, 2308 hwnd, uMsg, wParam, lParam); 2309 2309 } 2310 2310 return 0; … … 2320 2320 2321 2321 if (!COMBOEX_GetInfoPtr (hwnd)) { 2322 if (uMsg == WM_CREATE)2323 return COMBOEX_Create (hwnd, wParam, lParam);2324 if (uMsg == WM_NCCREATE)2325 COMBOEX_NCCreate (hwnd, wParam, lParam);2322 if (uMsg == WM_CREATE) 2323 return COMBOEX_Create (hwnd, wParam, lParam); 2324 if (uMsg == WM_NCCREATE) 2325 COMBOEX_NCCreate (hwnd, wParam, lParam); 2326 2326 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 2327 2327 } … … 2330 2330 { 2331 2331 case CBEM_DELETEITEM: /* maps to CB_DELETESTRING */ 2332 return COMBOEX_DeleteItem (hwnd, wParam, lParam);2333 2334 case CBEM_GETCOMBOCONTROL:2335 return COMBOEX_GetComboControl (hwnd, wParam, lParam);2336 2337 case CBEM_GETEDITCONTROL:2338 return COMBOEX_GetEditControl (hwnd, wParam, lParam);2339 2340 case CBEM_GETEXTENDEDSTYLE:2341 return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam);2342 2343 case CBEM_GETIMAGELIST:2344 return COMBOEX_GetImageList (hwnd, wParam, lParam);2345 2346 case CBEM_GETITEMA:2347 return COMBOEX_GetItemA (hwnd, wParam, lParam);2348 2349 case CBEM_GETITEMW:2350 return COMBOEX_GetItemW (hwnd, wParam, lParam);2351 2352 case CBEM_GETUNICODEFORMAT:2353 return COMBOEX_GetUnicodeFormat (hwnd, wParam, lParam);2354 2355 case CBEM_HASEDITCHANGED:2356 return COMBOEX_HasEditChanged (hwnd, wParam, lParam);2357 2358 case CBEM_INSERTITEMA:2359 return COMBOEX_InsertItemA (hwnd, wParam, lParam);2360 2361 case CBEM_INSERTITEMW:2362 return COMBOEX_InsertItemW (hwnd, wParam, lParam);2363 2364 case CBEM_SETEXSTYLE:/* FIXME: obsoleted, should be the same as: */2365 case CBEM_SETEXTENDEDSTYLE:2366 return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam);2367 2368 case CBEM_SETIMAGELIST:2369 return COMBOEX_SetImageList (hwnd, wParam, lParam);2370 2371 case CBEM_SETITEMA:2372 return COMBOEX_SetItemA (hwnd, wParam, lParam);2373 2374 case CBEM_SETITEMW:2375 return COMBOEX_SetItemW (hwnd, wParam, lParam);2376 2377 case CBEM_SETUNICODEFORMAT:2378 return COMBOEX_SetUnicodeFormat (hwnd, wParam, lParam);2332 return COMBOEX_DeleteItem (hwnd, wParam, lParam); 2333 2334 case CBEM_GETCOMBOCONTROL: 2335 return COMBOEX_GetComboControl (hwnd, wParam, lParam); 2336 2337 case CBEM_GETEDITCONTROL: 2338 return COMBOEX_GetEditControl (hwnd, wParam, lParam); 2339 2340 case CBEM_GETEXTENDEDSTYLE: 2341 return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam); 2342 2343 case CBEM_GETIMAGELIST: 2344 return COMBOEX_GetImageList (hwnd, wParam, lParam); 2345 2346 case CBEM_GETITEMA: 2347 return COMBOEX_GetItemA (hwnd, wParam, lParam); 2348 2349 case CBEM_GETITEMW: 2350 return COMBOEX_GetItemW (hwnd, wParam, lParam); 2351 2352 case CBEM_GETUNICODEFORMAT: 2353 return COMBOEX_GetUnicodeFormat (hwnd, wParam, lParam); 2354 2355 case CBEM_HASEDITCHANGED: 2356 return COMBOEX_HasEditChanged (hwnd, wParam, lParam); 2357 2358 case CBEM_INSERTITEMA: 2359 return COMBOEX_InsertItemA (hwnd, wParam, lParam); 2360 2361 case CBEM_INSERTITEMW: 2362 return COMBOEX_InsertItemW (hwnd, wParam, lParam); 2363 2364 case CBEM_SETEXSTYLE: /* FIXME: obsoleted, should be the same as: */ 2365 case CBEM_SETEXTENDEDSTYLE: 2366 return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam); 2367 2368 case CBEM_SETIMAGELIST: 2369 return COMBOEX_SetImageList (hwnd, wParam, lParam); 2370 2371 case CBEM_SETITEMA: 2372 return COMBOEX_SetItemA (hwnd, wParam, lParam); 2373 2374 case CBEM_SETITEMW: 2375 return COMBOEX_SetItemW (hwnd, wParam, lParam); 2376 2377 case CBEM_SETUNICODEFORMAT: 2378 return COMBOEX_SetUnicodeFormat (hwnd, wParam, lParam); 2379 2379 2380 2380 2381 2381 /* Combo messages we are not sure if we need to process or just forward */ 2382 case CB_GETDROPPEDCONTROLRECT:2383 case CB_GETITEMHEIGHT:2384 case CB_GETLBTEXT:2385 case CB_GETLBTEXTLEN:2386 case CB_GETEXTENDEDUI:2387 case CB_LIMITTEXT:2388 case CB_RESETCONTENT:2389 case CB_SELECTSTRING:2390 case WM_SETTEXT:2391 case WM_GETTEXT:2392 FIXME("(0x%x 0x%x 0x%lx): possibly missing function\n",2393 uMsg, wParam, lParam);2394 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);2382 case CB_GETDROPPEDCONTROLRECT: 2383 case CB_GETITEMHEIGHT: 2384 case CB_GETLBTEXT: 2385 case CB_GETLBTEXTLEN: 2386 case CB_GETEXTENDEDUI: 2387 case CB_LIMITTEXT: 2388 case CB_RESETCONTENT: 2389 case CB_SELECTSTRING: 2390 case WM_SETTEXT: 2391 case WM_GETTEXT: 2392 FIXME("(0x%x 0x%x 0x%lx): possibly missing function\n", 2393 uMsg, wParam, lParam); 2394 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam); 2395 2395 2396 2396 /* Combo messages OK to just forward to the regular COMBO */ 2397 case CB_GETCOUNT: 2398 case CB_GETCURSEL:2399 case CB_GETDROPPEDSTATE:2397 case CB_GETCOUNT: 2398 case CB_GETCURSEL: 2399 case CB_GETDROPPEDSTATE: 2400 2400 case CB_SETDROPPEDWIDTH: 2401 2401 case CB_SETEXTENDEDUI: 2402 2402 case CB_SHOWDROPDOWN: 2403 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);2403 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam); 2404 2404 2405 2405 /* Combo messages we need to process specially */ 2406 2406 case CB_FINDSTRINGEXACT: 2407 return COMBOEX_FindStringExact (COMBOEX_GetInfoPtr (hwnd), 2408 wParam, lParam);2409 2410 case CB_GETITEMDATA:2411 return COMBOEX_GetItemData (hwnd, wParam, lParam);2412 2413 case CB_SETCURSEL:2414 return COMBOEX_SetCursel (hwnd, wParam, lParam);2415 2416 case CB_SETITEMDATA:2417 return COMBOEX_SetItemData (hwnd, wParam, lParam);2418 2419 case CB_SETITEMHEIGHT:2420 return COMBOEX_SetItemHeight (hwnd, wParam, lParam);2407 return COMBOEX_FindStringExact (COMBOEX_GetInfoPtr (hwnd), 2408 wParam, lParam); 2409 2410 case CB_GETITEMDATA: 2411 return COMBOEX_GetItemData (hwnd, wParam, lParam); 2412 2413 case CB_SETCURSEL: 2414 return COMBOEX_SetCursel (hwnd, wParam, lParam); 2415 2416 case CB_SETITEMDATA: 2417 return COMBOEX_SetItemData (hwnd, wParam, lParam); 2418 2419 case CB_SETITEMHEIGHT: 2420 return COMBOEX_SetItemHeight (hwnd, wParam, lParam); 2421 2421 2422 2422 2423 2423 2424 2424 /* Window messages passed to parent */ 2425 case WM_COMMAND:2426 return COMBOEX_Command (hwnd, wParam, lParam);2427 2428 case WM_NOTIFY:2429 if (infoPtr->NtfUnicode)2430 return SendMessageW (GetParent (hwnd),2431 uMsg, wParam, lParam);2432 else2433 return SendMessageA (GetParent (hwnd),2434 uMsg, wParam, lParam);2425 case WM_COMMAND: 2426 return COMBOEX_Command (hwnd, wParam, lParam); 2427 2428 case WM_NOTIFY: 2429 if (infoPtr->NtfUnicode) 2430 return SendMessageW (GetParent (hwnd), 2431 uMsg, wParam, lParam); 2432 else 2433 return SendMessageA (GetParent (hwnd), 2434 uMsg, wParam, lParam); 2435 2435 2436 2436 2437 2437 /* Window messages we need to process */ 2438 2438 case WM_DELETEITEM: 2439 return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam);2439 return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam); 2440 2440 2441 2441 case WM_DRAWITEM: 2442 2442 return COMBOEX_DrawItem (hwnd, wParam, lParam); 2443 2443 2444 case WM_DESTROY:2445 return COMBOEX_Destroy (hwnd, wParam, lParam);2444 case WM_DESTROY: 2445 return COMBOEX_Destroy (hwnd, wParam, lParam); 2446 2446 2447 2447 case WM_MEASUREITEM: … … 2449 2449 2450 2450 case WM_NOTIFYFORMAT: 2451 return COMBOEX_NotifyFormat (hwnd, wParam, lParam);2452 2453 case WM_SIZE:2454 return COMBOEX_Size (hwnd, wParam, lParam);2451 return COMBOEX_NotifyFormat (hwnd, wParam, lParam); 2452 2453 case WM_SIZE: 2454 return COMBOEX_Size (hwnd, wParam, lParam); 2455 2455 2456 2456 case WM_WINDOWPOSCHANGING: 2457 return COMBOEX_WindowPosChanging (hwnd, wParam, lParam);2458 2459 default:2460 if (uMsg >= WM_USER)2461 ERR("unknown msg %04x wp=%08x lp=%08lx\n",2462 uMsg, wParam, lParam);2457 return COMBOEX_WindowPosChanging (hwnd, wParam, lParam); 2458 2459 default: 2460 if (uMsg >= WM_USER) 2461 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 2462 uMsg, wParam, lParam); 2463 2463 #ifdef __WIN32OS2__ 2464 2464 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 2465 2465 #else 2466 return DefWindowProcA (hwnd, uMsg, wParam, lParam);2466 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 2467 2467 #endif 2468 2468 } … … 2484 2484 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 2485 2485 wndClass.lpszClassName = WC_COMBOBOXEXA; 2486 2486 2487 2487 RegisterClassA (&wndClass); 2488 2488  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  