- Timestamp:
- Aug 8, 2003, 3:30:22 PM (22 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 8 edited
-
combo.c (modified) (52 diffs)
-
edit.c (modified) (4 diffs)
-
listbox.c (modified) (2 diffs)
-
oslibmsg.cpp (modified) (9 diffs)
-
oslibmsg.h (modified) (3 diffs)
-
oslibmsgtranslate.cpp (modified) (4 diffs)
-
win32wbase.cpp (modified) (3 diffs)
-
windowmsg.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/combo.c
r9524 r10216 49 49 * Drawing globals 50 50 */ 51 static HBITMAP hComboBmp = 0;52 static UINT CBitHeight, CBitWidth;51 static HBITMAP hComboBmp = 0; 52 static UINT CBitHeight, CBitWidth; 53 53 54 54 /* … … 87 87 static BOOL COMBO_Init() 88 88 { 89 HDC hDC;89 HDC hDC; 90 90 91 91 if( hComboBmp ) return TRUE; 92 92 if( (hDC = CreateCompatibleDC(0)) ) 93 93 { 94 BOOL bRet = FALSE;94 BOOL bRet = FALSE; 95 95 if( (hComboBmp = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_COMBO))) ) 96 96 { … … 131 131 /* some braindead apps do try to use scrollbar/border flags */ 132 132 133 lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);133 lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL); 134 134 SetWindowLongA( hwnd, GWL_STYLE, style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL) ); 135 135 136 /*137 * We also have to remove the client edge style to make sure138 * we don't end-up with a non client area.139 */136 /* 137 * We also have to remove the client edge style to make sure 138 * we don't end-up with a non client area. 139 */ 140 140 SetWindowLongA( hwnd, GWL_EXSTYLE, 141 141 GetWindowLongA( hwnd, GWL_EXSTYLE ) & ~WS_EX_CLIENTEDGE ); 142 142 143 if( !(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )143 if( !(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) ) 144 144 lphc->dwStyle |= CBS_HASSTRINGS; 145 if( !(GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )146 lphc->wState |= CBF_NOTIFY;145 if( !(GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) ) 146 lphc->wState |= CBF_NOTIFY; 147 147 148 148 TRACE("[%p], style = %08x\n", lphc, lphc->dwStyle ); … … 163 163 164 164 if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox ) 165 DestroyWindow( lphc->hWndLBox );165 DestroyWindow( lphc->hWndLBox ); 166 166 167 167 SetWindowLongA( lphc->self, 0, 0 ); … … 303 303 */ 304 304 SetWindowPos( lphc->self, 305 (HWND)NULL,306 0, 0,307 windowRect.right - windowRect.left,308 newComboHeight,309 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );305 (HWND)NULL, 306 0, 0, 307 windowRect.right - windowRect.left, 308 newComboHeight, 309 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE ); 310 310 } 311 311 … … 405 405 */ 406 406 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) 407 lprLB->right -= COMBO_EDITBUTTONSPACE();407 lprLB->right -= COMBO_EDITBUTTONSPACE(); 408 408 } 409 409 else … … 412 412 413 413 TRACE("\ttext\t= (%i,%i-%i,%i)\n", 414 lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom);414 lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom); 415 415 416 416 TRACE("\tbutton\t= (%i,%i-%i,%i)\n", 417 lprButton->left, lprButton->top, lprButton->right, lprButton->bottom);417 lprButton->left, lprButton->top, lprButton->right, lprButton->bottom); 418 418 419 419 TRACE("\tlbox\t= (%i,%i-%i,%i)\n", 420 lprLB->left, lprLB->top, lprLB->right, lprLB->bottom );420 lprLB->left, lprLB->top, lprLB->right, lprLB->bottom ); 421 421 } 422 422 … … 468 468 if (posChanging->cy != newComboHeight) 469 469 { 470 TRACE("posChanging->cy=%d, newComboHeight=%d, oldbot=%d, oldtop=%d\n",471 posChanging->cy, newComboHeight, lphc->droppedRect.bottom,472 lphc->droppedRect.top);470 TRACE("posChanging->cy=%d, newComboHeight=%d, oldbot=%d, oldtop=%d\n", 471 posChanging->cy, newComboHeight, lphc->droppedRect.bottom, 472 lphc->droppedRect.top); 473 473 lphc->droppedRect.bottom = lphc->droppedRect.top + posChanging->cy - newComboHeight; 474 474 … … 524 524 if ( CB_GETTYPE(lphc) != CBS_SIMPLE ) 525 525 { 526 lphc->droppedRect.top = lphc->textRect.bottom + COMBO_YBORDERSIZE();527 528 /*529 * If it's a dropdown, the listbox is offset530 */531 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )532 lphc->droppedRect.left += COMBO_EDITBUTTONSPACE();533 534 ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect);535 ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect.right);526 lphc->droppedRect.top = lphc->textRect.bottom + COMBO_YBORDERSIZE(); 527 528 /* 529 * If it's a dropdown, the listbox is offset 530 */ 531 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) 532 lphc->droppedRect.left += COMBO_EDITBUTTONSPACE(); 533 534 ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect); 535 ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect.right); 536 536 } 537 537 … … 542 542 543 543 if( lphc->dwStyle & CBS_SORT ) 544 lbeStyle |= LBS_SORT;544 lbeStyle |= LBS_SORT; 545 545 if( lphc->dwStyle & CBS_HASSTRINGS ) 546 lbeStyle |= LBS_HASSTRINGS;546 lbeStyle |= LBS_HASSTRINGS; 547 547 if( lphc->dwStyle & CBS_NOINTEGRALHEIGHT ) 548 lbeStyle |= LBS_NOINTEGRALHEIGHT;548 lbeStyle |= LBS_NOINTEGRALHEIGHT; 549 549 if( lphc->dwStyle & CBS_DISABLENOSCROLL ) 550 lbeStyle |= LBS_DISABLENOSCROLL;551 552 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */550 lbeStyle |= LBS_DISABLENOSCROLL; 551 552 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */ 553 553 { 554 lbeStyle |= WS_VISIBLE;555 556 /*557 * In win 95 look n feel, the listbox in the simple combobox has558 * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.559 */560 if (TWEAK_WineLook > WIN31_LOOK)561 {562 lbeStyle &= ~WS_BORDER;563 lbeExStyle |= WS_EX_CLIENTEDGE;564 }554 lbeStyle |= WS_VISIBLE; 555 556 /* 557 * In win 95 look n feel, the listbox in the simple combobox has 558 * the WS_EXCLIENTEDGE style instead of the WS_BORDER style. 559 */ 560 if (TWEAK_WineLook > WIN31_LOOK) 561 { 562 lbeStyle &= ~WS_BORDER; 563 lbeExStyle |= WS_EX_CLIENTEDGE; 564 } 565 565 } 566 566 567 567 lphc->hWndLBox = CreateWindowExW(lbeExStyle, 568 clbName,569 NULL,570 lbeStyle,571 lphc->droppedRect.left,572 lphc->droppedRect.top,573 lphc->droppedRect.right - lphc->droppedRect.left,574 lphc->droppedRect.bottom - lphc->droppedRect.top,568 clbName, 569 NULL, 570 lbeStyle, 571 lphc->droppedRect.left, 572 lphc->droppedRect.top, 573 lphc->droppedRect.right - lphc->droppedRect.left, 574 lphc->droppedRect.bottom - lphc->droppedRect.top, 575 575 hwnd, (HMENU)ID_CB_LISTBOX, 576 576 GetWindowLongA( hwnd, GWL_HINSTANCE ), lphc ); … … 578 578 if( lphc->hWndLBox ) 579 579 { 580 BOOLbEdit = TRUE;581 lbeStyle = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_LEFT | ES_COMBO;582 583 /*584 * In Win95 look, the border fo the edit control is585 * provided by the combobox586 */587 if (TWEAK_WineLook == WIN31_LOOK)588 lbeStyle |= WS_BORDER;589 590 if( lphc->wState & CBF_EDIT )591 {592 if( lphc->dwStyle & CBS_OEMCONVERT )593 lbeStyle |= ES_OEMCONVERT;594 if( lphc->dwStyle & CBS_AUTOHSCROLL )595 lbeStyle |= ES_AUTOHSCROLL;596 if( lphc->dwStyle & CBS_LOWERCASE )597 lbeStyle |= ES_LOWERCASE;598 else if( lphc->dwStyle & CBS_UPPERCASE )599 lbeStyle |= ES_UPPERCASE;580 BOOL bEdit = TRUE; 581 lbeStyle = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_LEFT | ES_COMBO; 582 583 /* 584 * In Win95 look, the border fo the edit control is 585 * provided by the combobox 586 */ 587 if (TWEAK_WineLook == WIN31_LOOK) 588 lbeStyle |= WS_BORDER; 589 590 if( lphc->wState & CBF_EDIT ) 591 { 592 if( lphc->dwStyle & CBS_OEMCONVERT ) 593 lbeStyle |= ES_OEMCONVERT; 594 if( lphc->dwStyle & CBS_AUTOHSCROLL ) 595 lbeStyle |= ES_AUTOHSCROLL; 596 if( lphc->dwStyle & CBS_LOWERCASE ) 597 lbeStyle |= ES_LOWERCASE; 598 else if( lphc->dwStyle & CBS_UPPERCASE ) 599 lbeStyle |= ES_UPPERCASE; 600 600 601 601 if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED; 602 602 603 lphc->hWndEdit = CreateWindowExW(0,604 editName,605 NULL,606 lbeStyle,607 lphc->textRect.left, lphc->textRect.top,608 lphc->textRect.right - lphc->textRect.left,609 lphc->textRect.bottom - lphc->textRect.top,603 lphc->hWndEdit = CreateWindowExW(0, 604 editName, 605 NULL, 606 lbeStyle, 607 lphc->textRect.left, lphc->textRect.top, 608 lphc->textRect.right - lphc->textRect.left, 609 lphc->textRect.bottom - lphc->textRect.top, 610 610 hwnd, (HMENU)ID_CB_EDIT, 611 611 GetWindowLongA( hwnd, GWL_HINSTANCE ), NULL ); 612 612 613 if( !lphc->hWndEdit )614 bEdit = FALSE;615 }613 if( !lphc->hWndEdit ) 614 bEdit = FALSE; 615 } 616 616 617 617 if( bEdit ) 618 {619 if( CB_GETTYPE(lphc) != CBS_SIMPLE )620 {618 { 619 if( CB_GETTYPE(lphc) != CBS_SIMPLE ) 620 { 621 621 /* Now do the trick with parent */ 622 SetParent(lphc->hWndLBox, HWND_DESKTOP);622 SetParent(lphc->hWndLBox, HWND_DESKTOP); 623 623 /* 624 624 * If the combo is a dropdown, we must resize the control 625 * to fit only the text area and button. To do this,626 * we send a dummy resize and the WM_WINDOWPOSCHANGING message627 * will take care of setting the height for us.625 * to fit only the text area and button. To do this, 626 * we send a dummy resize and the WM_WINDOWPOSCHANGING message 627 * will take care of setting the height for us. 628 628 */ 629 CBForceDummyResize(lphc);630 }631 632 TRACE("init done\n");633 return 0;634 }635 ERR("edit control failure.\n");629 CBForceDummyResize(lphc); 630 } 631 632 TRACE("init done\n"); 633 return 0; 634 } 635 ERR("edit control failure.\n"); 636 636 } else ERR("listbox failure.\n"); 637 637 } else ERR("no owner for visible combo.\n"); … … 657 657 if (TWEAK_WineLook == WIN31_LOOK) 658 658 { 659 UINT x, y;660 BOOLbBool;661 HDC hMemDC;662 HBRUSH hPrevBrush;663 COLORREF oldTextColor, oldBkColor;664 665 666 hPrevBrush = SelectObject(hdc, GetSysColorBrush(COLOR_BTNFACE));667 668 /*669 * Draw the button background670 */671 PatBlt( hdc,672 rectButton.left,673 rectButton.top,674 rectButton.right-rectButton.left,675 rectButton.bottom-rectButton.top,676 PATCOPY );677 678 if( (bBool = lphc->wState & CBF_BUTTONDOWN) )679 {680 DrawEdge( hdc, &rectButton, EDGE_SUNKEN, BF_RECT );681 }682 else683 {684 DrawEdge( hdc, &rectButton, EDGE_RAISED, BF_RECT );685 }686 687 /*688 * Remove the edge of the button from the rectangle689 * and calculate the position of the bitmap.690 */691 InflateRect( &rectButton, -2, -2);692 693 x = (rectButton.left + rectButton.right - CBitWidth) >> 1;694 y = (rectButton.top + rectButton.bottom - CBitHeight) >> 1;695 696 697 hMemDC = CreateCompatibleDC( hdc );698 SelectObject( hMemDC, hComboBmp );699 oldTextColor = SetTextColor( hdc, GetSysColor(COLOR_BTNFACE) );700 oldBkColor = SetBkColor( hdc, CB_DISABLED(lphc) ? RGB(128,128,128) :701 RGB(0,0,0) );702 BitBlt( hdc, x, y, CBitWidth, CBitHeight, hMemDC, 0, 0, SRCCOPY );703 SetBkColor( hdc, oldBkColor );704 SetTextColor( hdc, oldTextColor );705 DeleteDC( hMemDC );706 SelectObject( hdc, hPrevBrush );659 UINT x, y; 660 BOOL bBool; 661 HDC hMemDC; 662 HBRUSH hPrevBrush; 663 COLORREF oldTextColor, oldBkColor; 664 665 666 hPrevBrush = SelectObject(hdc, GetSysColorBrush(COLOR_BTNFACE)); 667 668 /* 669 * Draw the button background 670 */ 671 PatBlt( hdc, 672 rectButton.left, 673 rectButton.top, 674 rectButton.right-rectButton.left, 675 rectButton.bottom-rectButton.top, 676 PATCOPY ); 677 678 if( (bBool = lphc->wState & CBF_BUTTONDOWN) ) 679 { 680 DrawEdge( hdc, &rectButton, EDGE_SUNKEN, BF_RECT ); 681 } 682 else 683 { 684 DrawEdge( hdc, &rectButton, EDGE_RAISED, BF_RECT ); 685 } 686 687 /* 688 * Remove the edge of the button from the rectangle 689 * and calculate the position of the bitmap. 690 */ 691 InflateRect( &rectButton, -2, -2); 692 693 x = (rectButton.left + rectButton.right - CBitWidth) >> 1; 694 y = (rectButton.top + rectButton.bottom - CBitHeight) >> 1; 695 696 697 hMemDC = CreateCompatibleDC( hdc ); 698 SelectObject( hMemDC, hComboBmp ); 699 oldTextColor = SetTextColor( hdc, GetSysColor(COLOR_BTNFACE) ); 700 oldBkColor = SetBkColor( hdc, CB_DISABLED(lphc) ? RGB(128,128,128) : 701 RGB(0,0,0) ); 702 BitBlt( hdc, x, y, CBitWidth, CBitHeight, hMemDC, 0, 0, SRCCOPY ); 703 SetBkColor( hdc, oldBkColor ); 704 SetTextColor( hdc, oldTextColor ); 705 DeleteDC( hMemDC ); 706 SelectObject( hdc, hPrevBrush ); 707 707 } 708 708 else … … 710 710 UINT buttonState = DFCS_SCROLLCOMBOBOX; 711 711 712 if (lphc->wState & CBF_BUTTONDOWN)713 {714 buttonState |= DFCS_PUSHED;715 }716 717 if (CB_DISABLED(lphc))718 {719 buttonState |= DFCS_INACTIVE;720 }721 722 DrawFrameControl(hdc,723 &rectButton,724 DFC_SCROLL,725 buttonState);712 if (lphc->wState & CBF_BUTTONDOWN) 713 { 714 buttonState |= DFCS_PUSHED; 715 } 716 717 if (CB_DISABLED(lphc)) 718 { 719 buttonState |= DFCS_INACTIVE; 720 } 721 722 DrawFrameControl(hdc, 723 &rectButton, 724 DFC_SCROLL, 725 buttonState); 726 726 } 727 727 } … … 737 737 RECT rectEdit) 738 738 { 739 INT id, size = 0;739 INT id, size = 0; 740 740 LPWSTR pText = NULL; 741 741 … … 751 751 size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0); 752 752 if( (pText = HeapAlloc( GetProcessHeap(), 0, (size + 1) * sizeof(WCHAR))) ) 753 {753 { 754 754 /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */ 755 size=SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText);756 pText[size] = '\0';/* just in case */757 } else return;755 size=SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText); 756 pText[size] = '\0'; /* just in case */ 757 } else return; 758 758 } 759 759 else 760 760 if( !CB_OWNERDRAWN(lphc) ) 761 return;761 return; 762 762 763 763 if( lphc->wState & CBF_EDIT ) 764 764 { 765 765 static const WCHAR empty_stringW[] = { 0 }; 766 if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : empty_stringW );767 if( lphc->wState & CBF_FOCUSED )768 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));766 if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : empty_stringW ); 767 if( lphc->wState & CBF_FOCUSED ) 768 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1)); 769 769 } 770 770 else /* paint text field ourselves */ 771 771 { 772 UINT itemState = ODS_COMBOBOXEDIT;773 HFONT hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;772 UINT itemState = ODS_COMBOBOXEDIT; 773 HFONT hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0; 774 774 775 775 /* … … 786 786 /* setup state for DRAWITEM message. Owner will highlight */ 787 787 if ( (lphc->wState & CBF_FOCUSED) && 788 !(lphc->wState & CBF_DROPPED) )789 itemState |= ODS_SELECTED | ODS_FOCUS;788 !(lphc->wState & CBF_DROPPED) ) 789 itemState |= ODS_SELECTED | ODS_FOCUS; 790 790 791 791 /* 792 * Save the current clip region.793 * To retrieve the clip region, we need to create one "dummy"794 * clip region.795 */792 * Save the current clip region. 793 * To retrieve the clip region, we need to create one "dummy" 794 * clip region. 795 */ 796 796 clipRegion = CreateRectRgnIndirect(&rectEdit); 797 797 798 798 if (GetClipRgn(hdc, clipRegion)!=1) 799 799 { 800 DeleteObject(clipRegion);801 clipRegion=(HRGN)NULL;800 DeleteObject(clipRegion); 801 clipRegion=(HRGN)NULL; 802 802 } 803 803 804 804 if (!IsWindowEnabled(lphc->self) & WS_DISABLED) itemState |= ODS_DISABLED; 805 805 806 dis.CtlType = ODT_COMBOBOX;807 dis.CtlID = ctlid;808 dis.hwndItem = lphc->self;809 dis.itemAction = ODA_DRAWENTIRE;810 dis.itemID = id;811 dis.itemState = itemState;812 dis.hDC = hdc;813 dis.rcItem = rectEdit;814 dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA,815 (WPARAM)id, 0 );806 dis.CtlType = ODT_COMBOBOX; 807 dis.CtlID = ctlid; 808 dis.hwndItem = lphc->self; 809 dis.itemAction = ODA_DRAWENTIRE; 810 dis.itemID = id; 811 dis.itemState = itemState; 812 dis.hDC = hdc; 813 dis.rcItem = rectEdit; 814 dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, 815 (WPARAM)id, 0 ); 816 816 817 817 /* 818 * Clip the DC and have the parent draw the item.819 */818 * Clip the DC and have the parent draw the item. 819 */ 820 820 IntersectClipRect(hdc, 821 rectEdit.left, rectEdit.top,822 rectEdit.right, rectEdit.bottom);821 rectEdit.left, rectEdit.top, 822 rectEdit.right, rectEdit.bottom); 823 823 824 824 SendMessageW(lphc->owner, WM_DRAWITEM, ctlid, (LPARAM)&dis ); 825 825 826 826 /* 827 * Reset the clipping region.828 */827 * Reset the clipping region. 828 */ 829 829 SelectClipRgn(hdc, clipRegion); 830 830 } … … 834 834 835 835 if ( (lphc->wState & CBF_FOCUSED) && 836 !(lphc->wState & CBF_DROPPED) ) {837 838 /* highlight */839 FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );840 SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );841 SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );836 !(lphc->wState & CBF_DROPPED) ) { 837 838 /* highlight */ 839 FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) ); 840 SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) ); 841 SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) ); 842 842 } 843 843 844 844 ExtTextOutW( hdc, 845 rectEdit.left + 1,846 rectEdit.top + 1,847 ETO_OPAQUE | ETO_CLIPPED,848 &rectEdit,849 pText ? pText : empty_stringW , size, NULL );845 rectEdit.left + 1, 846 rectEdit.top + 1, 847 ETO_OPAQUE | ETO_CLIPPED, 848 &rectEdit, 849 pText ? pText : empty_stringW , size, NULL ); 850 850 851 851 if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED)) 852 DrawFocusRect( hdc, &rectEdit );852 DrawFocusRect( hdc, &rectEdit ); 853 853 } 854 854 … … 857 857 } 858 858 if (pText) 859 HeapFree( GetProcessHeap(), 0, pText );859 HeapFree( GetProcessHeap(), 0, pText ); 860 860 } 861 861 … … 943 943 { 944 944 HBRUSH hBkgBrush; 945 HDC hDC;945 HDC hDC; 946 946 947 947 if(lphc->wState & CBF_EDIT) … … 949 949 950 950 hDC = (hParamDC) ? hParamDC 951 : GetDC(hwnd);951 : GetDC(hwnd); 952 952 /* 953 953 * Retrieve the background brush … … 969 969 { 970 970 PAINTSTRUCT ps; 971 HDC hDC;971 HDC hDC; 972 972 973 973 hDC = (hParamDC) ? hParamDC 974 : BeginPaint( lphc->self, &ps);974 : BeginPaint( lphc->self, &ps); 975 975 976 976 TRACE("hdc=%04x\n", hDC); … … 978 978 if( hDC && !(lphc->wState & CBF_NOREDRAW) ) 979 979 { 980 HBRUSH hPrevBrush, hBkgBrush;980 HBRUSH hPrevBrush, hBkgBrush; 981 981 982 982 /* … … 993 993 if (TWEAK_WineLook != WIN31_LOOK) 994 994 { 995 CBPaintBorder(lphc->self, lphc, hDC);995 CBPaintBorder(lphc->self, lphc, hDC); 996 996 } 997 997 998 998 if( !IsRectEmpty(&lphc->buttonRect) ) 999 999 { 1000 CBPaintButton(lphc, hDC, lphc->buttonRect);1000 CBPaintButton(lphc, hDC, lphc->buttonRect); 1001 1001 } 1002 1002 … … 1013 1013 if( !(lphc->wState & CBF_EDIT) ) 1014 1014 { 1015 /*1016 * The text area has a border only in Win 3.1 look.1017 */1018 if (TWEAK_WineLook == WIN31_LOOK)1019 {1020 HPEN hPrevPen = SelectObject( hDC, GetSysColorPen(COLOR_WINDOWFRAME) );1021 1022 Rectangle( hDC,1023 lphc->textRect.left, lphc->textRect.top,1024 lphc->textRect.right - 1, lphc->textRect.bottom - 1);1025 1026 SelectObject( hDC, hPrevPen );1027 }1028 1029 CBPaintText( lphc, hDC, lphc->textRect);1015 /* 1016 * The text area has a border only in Win 3.1 look. 1017 */ 1018 if (TWEAK_WineLook == WIN31_LOOK) 1019 { 1020 HPEN hPrevPen = SelectObject( hDC, GetSysColorPen(COLOR_WINDOWFRAME) ); 1021 1022 Rectangle( hDC, 1023 lphc->textRect.left, lphc->textRect.top, 1024 lphc->textRect.right - 1, lphc->textRect.bottom - 1); 1025 1026 SelectObject( hDC, hPrevPen ); 1027 } 1028 1029 CBPaintText( lphc, hDC, lphc->textRect); 1030 1030 } 1031 1031 1032 1032 if( hPrevBrush ) 1033 SelectObject( hDC, hPrevBrush );1033 SelectObject( hDC, hPrevBrush ); 1034 1034 } 1035 1035 … … 1047 1047 static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect ) 1048 1048 { 1049 INT length, idx;1049 INT length, idx; 1050 1050 LPWSTR pText = NULL; 1051 1051 … … 1063 1063 else pText[0] = '\0'; 1064 1064 idx = SendMessageW(lphc->hWndLBox, LB_FINDSTRING, 1065 (WPARAM)(-1), (LPARAM)pText );1065 (WPARAM)(-1), (LPARAM)pText ); 1066 1066 HeapFree( GetProcessHeap(), 0, pText ); 1067 1067 } … … 1083 1083 static void CBUpdateEdit( LPHEADCOMBO lphc , INT index ) 1084 1084 { 1085 INT length;1085 INT length; 1086 1086 LPWSTR pText = NULL; 1087 1087 static const WCHAR empty_stringW[] = { 0 }; … … 1094 1094 if( length ) 1095 1095 { 1096 if( (pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR))) )1097 {1098 SendMessageW(lphc->hWndLBox, LB_GETTEXT,1099 (WPARAM)index, (LPARAM)pText );1100 }1096 if( (pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR))) ) 1097 { 1098 SendMessageW(lphc->hWndLBox, LB_GETTEXT, 1099 (WPARAM)index, (LPARAM)pText ); 1100 } 1101 1101 } 1102 1102 } … … 1137 1137 /* Update edit only if item is in the list */ 1138 1138 if( !(lphc->wState & CBF_CAPTURE) && lphc->droppedIndex >= 0) 1139 CBUpdateEdit( lphc, lphc->droppedIndex );1139 CBUpdateEdit( lphc, lphc->droppedIndex ); 1140 1140 } 1141 1141 else … … 1185 1185 1186 1186 SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom, 1187 lphc->droppedRect.right - lphc->droppedRect.left,1188 nDroppedHeight,1189 SWP_NOACTIVATE | SWP_SHOWWINDOW);1187 lphc->droppedRect.right - lphc->droppedRect.left, 1188 nDroppedHeight, 1189 SWP_NOACTIVATE | SWP_SHOWWINDOW); 1190 1190 1191 1191 1192 1192 if( !(lphc->wState & CBF_NOREDRAW) ) 1193 1193 RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE | 1194 RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );1194 RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN ); 1195 1195 1196 1196 EnableWindow( lphc->hWndLBox, TRUE ); … … 1206 1206 static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton ) 1207 1207 { 1208 HWND hWnd = lphc->self;1208 HWND hWnd = lphc->self; 1209 1209 1210 1210 TRACE("[%04x]: sel ok? [%i] dropped? [%i]\n", 1211 lphc->self, (INT)ok, (INT)(lphc->wState & CBF_DROPPED));1211 lphc->self, (INT)ok, (INT)(lphc->wState & CBF_DROPPED)); 1212 1212 1213 1213 CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL ); … … 1218 1218 if( lphc->wState & CBF_DROPPED ) 1219 1219 { 1220 RECTrect;1221 1222 lphc->wState &= ~CBF_DROPPED;1223 ShowWindow( lphc->hWndLBox, SW_HIDE );1220 RECT rect; 1221 1222 lphc->wState &= ~CBF_DROPPED; 1223 ShowWindow( lphc->hWndLBox, SW_HIDE ); 1224 1224 1225 1225 if(GetCapture() == lphc->hWndLBox) … … 1228 1228 } 1229 1229 1230 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )1231 {1232 rect = lphc->buttonRect;1233 }1234 else1230 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) 1231 { 1232 rect = lphc->buttonRect; 1233 } 1234 else 1235 1235 { 1236 if( bButton )1237 {1238 UnionRect( &rect,1239 &lphc->buttonRect,1240 &lphc->textRect);1241 }1242 else1243 rect = lphc->textRect;1244 1245 bButton = TRUE;1246 }1247 1248 if( bButton && !(lphc->wState & CBF_NOREDRAW) )1249 RedrawWindow( hWnd, &rect, 0, RDW_INVALIDATE |1250 RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );1251 CB_NOTIFY( lphc, CBN_CLOSEUP );1236 if( bButton ) 1237 { 1238 UnionRect( &rect, 1239 &lphc->buttonRect, 1240 &lphc->textRect); 1241 } 1242 else 1243 rect = lphc->textRect; 1244 1245 bButton = TRUE; 1246 } 1247 1248 if( bButton && !(lphc->wState & CBF_NOREDRAW) ) 1249 RedrawWindow( hWnd, &rect, 0, RDW_INVALIDATE | 1250 RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN ); 1251 CB_NOTIFY( lphc, CBN_CLOSEUP ); 1252 1252 } 1253 1253 } … … 1290 1290 * COMBO_RollupListbox 1291 1291 * 1292 * @@PF Odin specific function. 1292 * @@PF Odin specific function. 1293 1293 */ 1294 1294 BOOL COMBO_RollupListbox( LPHEADCOMBO lphc) … … 1327 1327 1328 1328 if( !(lphc->wState & CBF_EDIT) ) 1329 InvalidateRect(lphc->self, &lphc->textRect, TRUE);1329 InvalidateRect(lphc->self, &lphc->textRect, TRUE); 1330 1330 1331 1331 CB_NOTIFY( lphc, CBN_SETFOCUS ); … … 1339 1339 static void COMBO_KillFocus( LPHEADCOMBO lphc ) 1340 1340 { 1341 HWND hWnd = lphc->self;1341 HWND hWnd = lphc->self; 1342 1342 1343 1343 if( lphc->wState & CBF_FOCUSED ) … … 1349 1349 SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0); 1350 1350 1351 lphc->wState &= ~CBF_FOCUSED;1351 lphc->wState &= ~CBF_FOCUSED; 1352 1352 1353 1353 /* redraw text */ 1354 if( !(lphc->wState & CBF_EDIT) )1355 InvalidateRect(lphc->self, &lphc->textRect, TRUE);1354 if( !(lphc->wState & CBF_EDIT) ) 1355 InvalidateRect(lphc->self, &lphc->textRect, TRUE); 1356 1356 1357 1357 CB_NOTIFY( lphc, CBN_KILLFOCUS ); … … 1371 1371 switch( HIWORD(wParam) >> 8 ) 1372 1372 { 1373 case (EN_SETFOCUS >> 8):1374 1375 TRACE("[%04x]: edit [%04x] got focus\n",1376 lphc->self, lphc->hWndEdit );1377 1378 COMBO_SetFocus( lphc );1379 break;1380 1381 case (EN_KILLFOCUS >> 8):1382 1383 TRACE("[%04x]: edit [%04x] lost focus\n",1384 lphc->self, lphc->hWndEdit );1385 1386 /* NOTE: it seems that Windows' edit control sends an1387 * undocumented message WM_USER + 0x1B instead of this1388 * notification (only when it happens to be a part of1389 * the combo). ?? - AK.1390 */1391 1392 COMBO_KillFocus( lphc );1393 break;1394 1395 1396 case (EN_CHANGE >> 8):1397 /*1398 * In some circumstances (when the selection of the combobox1399 * is changed for example) we don't wans the EN_CHANGE notification1400 * to be forwarded to the parent of the combobox. This code1401 * checks a flag that is set in these occasions and ignores the1402 * notification.1403 */1404 if (lphc->wState & CBF_NOLBSELECT)1405 {1406 lphc->wState &= ~CBF_NOLBSELECT;1407 }1408 else1409 {1410 CBUpdateLBox( lphc, lphc->wState & CBF_DROPPED );1411 }1412 1413 if (!(lphc->wState & CBF_NOEDITNOTIFY))1414 CB_NOTIFY( lphc, CBN_EDITCHANGE );1415 break;1416 1417 case (EN_UPDATE >> 8):1418 if (!(lphc->wState & CBF_NOEDITNOTIFY))1419 CB_NOTIFY( lphc, CBN_EDITUPDATE );1420 break;1421 1422 case (EN_ERRSPACE >> 8):1423 CB_NOTIFY( lphc, CBN_ERRSPACE );1373 case (EN_SETFOCUS >> 8): 1374 1375 TRACE("[%04x]: edit [%04x] got focus\n", 1376 lphc->self, lphc->hWndEdit ); 1377 1378 COMBO_SetFocus( lphc ); 1379 break; 1380 1381 case (EN_KILLFOCUS >> 8): 1382 1383 TRACE("[%04x]: edit [%04x] lost focus\n", 1384 lphc->self, lphc->hWndEdit ); 1385 1386 /* NOTE: it seems that Windows' edit control sends an 1387 * undocumented message WM_USER + 0x1B instead of this 1388 * notification (only when it happens to be a part of 1389 * the combo). ?? - AK. 1390 */ 1391 1392 COMBO_KillFocus( lphc ); 1393 break; 1394 1395 1396 case (EN_CHANGE >> 8): 1397 /* 1398 * In some circumstances (when the selection of the combobox 1399 * is changed for example) we don't wans the EN_CHANGE notification 1400 * to be forwarded to the parent of the combobox. This code 1401 * checks a flag that is set in these occasions and ignores the 1402 * notification. 1403 */ 1404 if (lphc->wState & CBF_NOLBSELECT) 1405 { 1406 lphc->wState &= ~CBF_NOLBSELECT; 1407 } 1408 else 1409 { 1410 CBUpdateLBox( lphc, lphc->wState & CBF_DROPPED ); 1411 } 1412 1413 if (!(lphc->wState & CBF_NOEDITNOTIFY)) 1414 CB_NOTIFY( lphc, CBN_EDITCHANGE ); 1415 break; 1416 1417 case (EN_UPDATE >> 8): 1418 if (!(lphc->wState & CBF_NOEDITNOTIFY)) 1419 CB_NOTIFY( lphc, CBN_EDITUPDATE ); 1420 break; 1421 1422 case (EN_ERRSPACE >> 8): 1423 CB_NOTIFY( lphc, CBN_ERRSPACE ); 1424 1424 } 1425 1425 } … … 1428 1428 switch( HIWORD(wParam) ) 1429 1429 { 1430 case LBN_ERRSPACE:1431 CB_NOTIFY( lphc, CBN_ERRSPACE );1432 break;1433 1434 case LBN_DBLCLK:1435 CB_NOTIFY( lphc, CBN_DBLCLK );1436 break;1437 1438 case LBN_SELCHANGE:1439 case LBN_SELCANCEL:1440 1441 TRACE("[%04x]: lbox selection change [%04x]\n",1442 lphc->self, lphc->wState );1443 1444 if( HIWORD(wParam) == LBN_SELCHANGE)1445 {1446 if( lphc->wState & CBF_EDIT )1447 {1448 INT index = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);1449 lphc->wState |= CBF_NOLBSELECT;1450 CBUpdateEdit( lphc, index );1451 /* select text in edit, as Windows does */1452 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));1453 }1454 else1455 InvalidateRect(lphc->self, &lphc->textRect, TRUE);1456 }1457 1458 /* do not roll up if selection is being tracked1459 * by arrowkeys in the dropdown listbox */1430 case LBN_ERRSPACE: 1431 CB_NOTIFY( lphc, CBN_ERRSPACE ); 1432 break; 1433 1434 case LBN_DBLCLK: 1435 CB_NOTIFY( lphc, CBN_DBLCLK ); 1436 break; 1437 1438 case LBN_SELCHANGE: 1439 case LBN_SELCANCEL: 1440 1441 TRACE("[%04x]: lbox selection change [%04x]\n", 1442 lphc->self, lphc->wState ); 1443 1444 if( HIWORD(wParam) == LBN_SELCHANGE) 1445 { 1446 if( lphc->wState & CBF_EDIT ) 1447 { 1448 INT index = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0); 1449 lphc->wState |= CBF_NOLBSELECT; 1450 CBUpdateEdit( lphc, index ); 1451 /* select text in edit, as Windows does */ 1452 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1)); 1453 } 1454 else 1455 InvalidateRect(lphc->self, &lphc->textRect, TRUE); 1456 } 1457 1458 /* do not roll up if selection is being tracked 1459 * by arrowkeys in the dropdown listbox */ 1460 1460 if( ((lphc->wState & CBF_DROPPED) && !(lphc->wState & CBF_NOROLLUP)) ) 1461 1461 { 1462 1462 CBRollUp( lphc, (HIWORD(wParam) == LBN_SELCHANGE), TRUE ); 1463 1463 } 1464 else lphc->wState &= ~CBF_NOROLLUP;1465 1466 CB_NOTIFY( lphc, CBN_SELCHANGE );1467 1468 /* fall through */1469 1470 case LBN_SETFOCUS:1471 case LBN_KILLFOCUS:1472 /* nothing to do here since ComboLBox always resets the focus to its1473 * combo/edit counterpart */1474 break;1464 else lphc->wState &= ~CBF_NOROLLUP; 1465 1466 CB_NOTIFY( lphc, CBN_SELCHANGE ); 1467 1468 /* fall through */ 1469 1470 case LBN_SETFOCUS: 1471 case LBN_KILLFOCUS: 1472 /* nothing to do here since ComboLBox always resets the focus to its 1473 * combo/edit counterpart */ 1474 break; 1475 1475 } 1476 1476 } … … 1546 1546 if( idx != LB_ERR ) 1547 1547 { 1548 INT n = 0;1548 INT n = 0; 1549 1549 INT length = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, 1550 (WPARAM)idx, 0 );1551 1552 if(unicode)1553 {1554 LPWSTR lpBuffer, lpText = (LPWSTR)lParam;1555 1556 /* 'length' is without the terminating character */1557 if(length >= N)1558 lpBuffer = HeapAlloc(GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));1559 else1560 lpBuffer = lpText;1561 1562 if(lpBuffer)1563 {1564 n = SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)idx, (LPARAM)lpBuffer);1565 1566 /* truncate if buffer is too short */1567 if(length >= N)1568 {1569 if(N && lpText)1570 {1571 if(n != LB_ERR)1572 strncpyW(lpText, lpBuffer, (N > n) ? n+1 : N-1);1573 lpText[N - 1] = '\0';1574 }1575 HeapFree( GetProcessHeap(), 0, lpBuffer );1550 (WPARAM)idx, 0 ); 1551 1552 if(unicode) 1553 { 1554 LPWSTR lpBuffer, lpText = (LPWSTR)lParam; 1555 1556 /* 'length' is without the terminating character */ 1557 if(length >= N) 1558 lpBuffer = HeapAlloc(GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR)); 1559 else 1560 lpBuffer = lpText; 1561 1562 if(lpBuffer) 1563 { 1564 n = SendMessageW(lphc->hWndLBox, LB_GETTEXT, (WPARAM)idx, (LPARAM)lpBuffer); 1565 1566 /* truncate if buffer is too short */ 1567 if(length >= N) 1568 { 1569 if(N && lpText) 1570 { 1571 if(n != LB_ERR) 1572 strncpyW(lpText, lpBuffer, (N > n) ? n+1 : N-1); 1573 lpText[N - 1] = '\0'; 1574 } 1575 HeapFree( GetProcessHeap(), 0, lpBuffer ); 1576 1576 } 1577 }1578 }1579 else1580 {1581 LPSTR lpBuffer, lpText = (LPSTR)lParam;1582 1583 /* 'length' is without the terminating character */1584 if(length >= N)1585 lpBuffer = HeapAlloc(GetProcessHeap(), 0, length + 1);1586 else1587 lpBuffer = lpText;1588 1589 if(lpBuffer)1590 {1591 n = SendMessageA(lphc->hWndLBox, LB_GETTEXT, (WPARAM)idx, (LPARAM)lpBuffer);1592 1593 /* truncate if buffer is too short */1594 if(length >= N)1595 {1596 if(N && lpText)1597 {1598 if(n != LB_ERR)1599 strncpy(lpText, lpBuffer, (N > n) ? n+1 : N-1);1600 lpText[N - 1] = '\0';1601 }1602 HeapFree( GetProcessHeap(), 0, lpBuffer );1577 } 1578 } 1579 else 1580 { 1581 LPSTR lpBuffer, lpText = (LPSTR)lParam; 1582 1583 /* 'length' is without the terminating character */ 1584 if(length >= N) 1585 lpBuffer = HeapAlloc(GetProcessHeap(), 0, length + 1); 1586 else 1587 lpBuffer = lpText; 1588 1589 if(lpBuffer) 1590 { 1591 n = SendMessageA(lphc->hWndLBox, LB_GETTEXT, (WPARAM)idx, (LPARAM)lpBuffer); 1592 1593 /* truncate if buffer is too short */ 1594 if(length >= N) 1595 { 1596 if(N && lpText) 1597 { 1598 if(n != LB_ERR) 1599 strncpy(lpText, lpBuffer, (N > n) ? n+1 : N-1); 1600 lpText[N - 1] = '\0'; 1601 } 1602 HeapFree( GetProcessHeap(), 0, lpBuffer ); 1603 1603 } 1604 }1605 }1606 if (n<0)1607 n=0;1608 else1609 n++;1610 return (LRESULT)n;1604 } 1605 } 1606 if (n<0) 1607 n=0; 1608 else 1609 n++; 1610 return (LRESULT)n; 1611 1611 } 1612 1612 } … … 1627 1627 BOOL bRedraw) 1628 1628 { 1629 BOOL bDrop = (CB_GETTYPE(lphc) != CBS_SIMPLE);1629 BOOL bDrop = (CB_GETTYPE(lphc) != CBS_SIMPLE); 1630 1630 1631 1631 /* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of … … 1634 1634 if( lphc->wState & CBF_EDIT ) 1635 1635 SetWindowPos( lphc->hWndEdit, 0, 1636 rectEdit->left, rectEdit->top,1637 rectEdit->right - rectEdit->left,1638 rectEdit->bottom - rectEdit->top,1636 rectEdit->left, rectEdit->top, 1637 rectEdit->right - rectEdit->left, 1638 rectEdit->bottom - rectEdit->top, 1639 1639 SWP_NOZORDER | SWP_NOACTIVATE | ((bDrop) ? SWP_NOREDRAW : 0) ); 1640 1640 1641 1641 SetWindowPos( lphc->hWndLBox, 0, 1642 rectLB->left, rectLB->top,1642 rectLB->left, rectLB->top, 1643 1643 rectLB->right - rectLB->left, 1644 rectLB->bottom - rectLB->top,1645 SWP_NOACTIVATE | SWP_NOZORDER | ((bDrop) ? SWP_NOREDRAW : 0) );1644 rectLB->bottom - rectLB->top, 1645 SWP_NOACTIVATE | SWP_NOZORDER | ((bDrop) ? SWP_NOREDRAW : 0) ); 1646 1646 1647 1647 if( bDrop ) … … 1666 1666 { 1667 1667 CBCalcPlacement(lphc->self, 1668 lphc,1669 &lphc->textRect,1670 &lphc->buttonRect,1671 &lphc->droppedRect);1668 lphc, 1669 &lphc->textRect, 1670 &lphc->buttonRect, 1671 &lphc->droppedRect); 1672 1672 1673 1673 CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE ); … … 1698 1698 { 1699 1699 CBCalcPlacement(lphc->self, 1700 lphc,1701 &lphc->textRect,1702 &lphc->buttonRect,1703 &lphc->droppedRect);1700 lphc, 1701 &lphc->textRect, 1702 &lphc->buttonRect, 1703 &lphc->droppedRect); 1704 1704 1705 1705 CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE ); … … 1717 1717 static LRESULT COMBO_SetItemHeight( LPHEADCOMBO lphc, INT index, INT height ) 1718 1718 { 1719 LRESULT lRet = CB_ERR;1719 LRESULT lRet = CB_ERR; 1720 1720 1721 1721 if( index == -1 ) /* set text field height */ … … 1725 1725 lphc->editHeight = height; 1726 1726 1727 /*1728 * Redo the layout of the control.1729 */1730 if ( CB_GETTYPE(lphc) == CBS_SIMPLE)1731 {1732 CBCalcPlacement(lphc->self,1733 lphc,1734 &lphc->textRect,1735 &lphc->buttonRect,1736 &lphc->droppedRect);1737 1738 CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );1739 }1740 else1741 {1742 CBForceDummyResize(lphc);1743 }1744 1745 lRet = height;1727 /* 1728 * Redo the layout of the control. 1729 */ 1730 if ( CB_GETTYPE(lphc) == CBS_SIMPLE) 1731 { 1732 CBCalcPlacement(lphc->self, 1733 lphc, 1734 &lphc->textRect, 1735 &lphc->buttonRect, 1736 &lphc->droppedRect); 1737 1738 CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE ); 1739 } 1740 else 1741 { 1742 CBForceDummyResize(lphc); 1743 } 1744 1745 lRet = height; 1746 1746 } 1747 1747 } 1748 else if ( CB_OWNERDRAWN(lphc) ) /* set listbox item height */1749 lRet = SendMessageW(lphc->hWndLBox, LB_SETITEMHEIGHT,1750 (WPARAM)index, (LPARAM)height );1748 else if ( CB_OWNERDRAWN(lphc) ) /* set listbox item height */ 1749 lRet = SendMessageW(lphc->hWndLBox, LB_SETITEMHEIGHT, 1750 (WPARAM)index, (LPARAM)height ); 1751 1751 return lRet; 1752 1752 } … … 1790 1790 if( lphc->wState & CBF_DROPPED ) 1791 1791 { 1792 /* got a click to cancel selection */1792 /* got a click to cancel selection */ 1793 1793 1794 1794 lphc->wState &= ~CBF_BUTTONDOWN; 1795 1795 CBRollUp( lphc, TRUE, FALSE ); 1796 if( !IsWindow( hWnd ) ) return;1796 if( !IsWindow( hWnd ) ) return; 1797 1797 1798 1798 if( lphc->wState & CBF_CAPTURE ) … … 1804 1804 else 1805 1805 { 1806 /* drop down the listbox and start tracking */1806 /* drop down the listbox and start tracking */ 1807 1807 1808 1808 lphc->wState |= CBF_CAPTURE; … … 1826 1826 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) 1827 1827 { 1828 INT index = CBUpdateLBox( lphc, TRUE );1829 /* Update edit only if item is in the list */1830 if(index >= 0)1831 {1832 lphc->wState |= CBF_NOLBSELECT;1833 CBUpdateEdit( lphc, index );1834 lphc->wState &= ~CBF_NOLBSELECT;1835 }1828 INT index = CBUpdateLBox( lphc, TRUE ); 1829 /* Update edit only if item is in the list */ 1830 if(index >= 0) 1831 { 1832 lphc->wState |= CBF_NOLBSELECT; 1833 CBUpdateEdit( lphc, index ); 1834 lphc->wState &= ~CBF_NOLBSELECT; 1835 } 1836 1836 } 1837 1837 ReleaseCapture(); … … 1904 1904 { 1905 1905 1906 /* System messages */1907 1908 case WM_NCCREATE:1909 {1910 LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style :1911 ((LPCREATESTRUCTA)lParam)->style;1906 /* System messages */ 1907 1908 case WM_NCCREATE: 1909 { 1910 LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style : 1911 ((LPCREATESTRUCTA)lParam)->style; 1912 1912 return COMBO_NCCreate(hwnd, style); 1913 }1914 case WM_NCDESTROY:1915 COMBO_NCDestroy(lphc);1916 break;/* -> DefWindowProc */1917 1918 case WM_CREATE:1919 {1920 HWND hwndParent;1921 LONG style;1922 if(unicode)1923 {1924 hwndParent = ((LPCREATESTRUCTW)lParam)->hwndParent;1925 style = ((LPCREATESTRUCTW)lParam)->style;1926 }1927 else1928 {1929 hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;1930 style = ((LPCREATESTRUCTA)lParam)->style;1931 }1913 } 1914 case WM_NCDESTROY: 1915 COMBO_NCDestroy(lphc); 1916 break;/* -> DefWindowProc */ 1917 1918 case WM_CREATE: 1919 { 1920 HWND hwndParent; 1921 LONG style; 1922 if(unicode) 1923 { 1924 hwndParent = ((LPCREATESTRUCTW)lParam)->hwndParent; 1925 style = ((LPCREATESTRUCTW)lParam)->style; 1926 } 1927 else 1928 { 1929 hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent; 1930 style = ((LPCREATESTRUCTA)lParam)->style; 1931 } 1932 1932 return COMBO_Create(hwnd, lphc, hwndParent, style); 1933 }1933 } 1934 1934 1935 1935 case WM_PRINTCLIENT: 1936 if (lParam & PRF_ERASEBKGND)1937 COMBO_EraseBackground(hwnd, lphc, wParam);1938 1939 /* Fallthrough */1940 case WM_PAINT:1941 /* wParam may contain a valid HDC! */1942 return COMBO_Paint(lphc, wParam);1943 case WM_ERASEBKGND:1944 return COMBO_EraseBackground(hwnd, lphc, wParam);1945 case WM_GETDLGCODE:1946 {1947 LRESULT result = DLGC_WANTARROWS | DLGC_WANTCHARS;1948 if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))1949 {1950 int vk = (int)((LPMSG)lParam)->wParam;1951 1952 if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED))1953 result |= DLGC_WANTMESSAGE;1954 }1955 return result;1956 }1957 case WM_WINDOWPOSCHANGING:1958 return COMBO_WindowPosChanging(hwnd, lphc, (LPWINDOWPOS)lParam);1936 if (lParam & PRF_ERASEBKGND) 1937 COMBO_EraseBackground(hwnd, lphc, wParam); 1938 1939 /* Fallthrough */ 1940 case WM_PAINT: 1941 /* wParam may contain a valid HDC! */ 1942 return COMBO_Paint(lphc, wParam); 1943 case WM_ERASEBKGND: 1944 return COMBO_EraseBackground(hwnd, lphc, wParam); 1945 case WM_GETDLGCODE: 1946 { 1947 LRESULT result = DLGC_WANTARROWS | DLGC_WANTCHARS; 1948 if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN)) 1949 { 1950 int vk = (int)((LPMSG)lParam)->wParam; 1951 1952 if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED)) 1953 result |= DLGC_WANTMESSAGE; 1954 } 1955 return result; 1956 } 1957 case WM_WINDOWPOSCHANGING: 1958 return COMBO_WindowPosChanging(hwnd, lphc, (LPWINDOWPOS)lParam); 1959 1959 case WM_WINDOWPOSCHANGED: 1960 1960 /* SetWindowPos can be called on a Combobox to resize its Listbox. … … 1964 1964 */ 1965 1965 /* fall through */ 1966 case WM_SIZE:1967 if( lphc->hWndLBox &&1968 !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc );1969 return TRUE;1970 case WM_SETFONT:1971 COMBO_Font( lphc, (HFONT16)wParam, (BOOL)lParam );1972 return TRUE;1973 case WM_GETFONT:1974 return (LRESULT)lphc->hFont;1975 case WM_SETFOCUS:1976 if( lphc->wState & CBF_EDIT )1977 SetFocus( lphc->hWndEdit );1978 else1979 COMBO_SetFocus( lphc );1980 return TRUE;1981 case WM_KILLFOCUS:1966 case WM_SIZE: 1967 if( lphc->hWndLBox && 1968 !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc ); 1969 return TRUE; 1970 case WM_SETFONT: 1971 COMBO_Font( lphc, (HFONT16)wParam, (BOOL)lParam ); 1972 return TRUE; 1973 case WM_GETFONT: 1974 return (LRESULT)lphc->hFont; 1975 case WM_SETFOCUS: 1976 if( lphc->wState & CBF_EDIT ) 1977 SetFocus( lphc->hWndEdit ); 1978 else 1979 COMBO_SetFocus( lphc ); 1980 return TRUE; 1981 case WM_KILLFOCUS: 1982 1982 { 1983 1983 HWND hwndFocus = WIN_GetFullHandle( (HWND)wParam ); 1984 if( !hwndFocus ||1985 (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox ))1986 COMBO_KillFocus( lphc );1987 return TRUE;1984 if( !hwndFocus || 1985 (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox )) 1986 COMBO_KillFocus( lphc ); 1987 return TRUE; 1988 1988 } 1989 case WM_COMMAND:1990 return COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) );1991 case WM_GETTEXT:1992 return COMBO_GetText( lphc, (INT)wParam, lParam, unicode );1993 case WM_SETTEXT:1994 case WM_GETTEXTLENGTH:1995 case WM_CLEAR:1989 case WM_COMMAND: 1990 return COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) ); 1991 case WM_GETTEXT: 1992 return COMBO_GetText( lphc, (INT)wParam, lParam, unicode ); 1993 case WM_SETTEXT: 1994 case WM_GETTEXTLENGTH: 1995 case WM_CLEAR: 1996 1996 if ((message == WM_GETTEXTLENGTH) && !ISWIN31 && !(lphc->wState & CBF_EDIT)) 1997 1997 { … … 2000 2000 return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0); 2001 2001 } 2002 else if( lphc->wState & CBF_EDIT )2003 {2004 LRESULT ret;2005 lphc->wState |= CBF_NOEDITNOTIFY;2006 ret = unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :2007 SendMessageA(lphc->hWndEdit, message, wParam, lParam);2008 lphc->wState &= ~CBF_NOEDITNOTIFY;2009 return ret;2010 }2011 else return CB_ERR;2012 case WM_CUT:2002 else if( lphc->wState & CBF_EDIT ) 2003 { 2004 LRESULT ret; 2005 lphc->wState |= CBF_NOEDITNOTIFY; 2006 ret = unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) : 2007 SendMessageA(lphc->hWndEdit, message, wParam, lParam); 2008 lphc->wState &= ~CBF_NOEDITNOTIFY; 2009 return ret; 2010 } 2011 else return CB_ERR; 2012 case WM_CUT: 2013 2013 case WM_PASTE: 2014 case WM_COPY:2015 if( lphc->wState & CBF_EDIT )2016 {2017 return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :2018 SendMessageA(lphc->hWndEdit, message, wParam, lParam);2019 }2020 else return CB_ERR;2021 2022 case WM_DRAWITEM:2023 case WM_DELETEITEM:2024 case WM_COMPAREITEM:2025 case WM_MEASUREITEM:2026 return COMBO_ItemOp(lphc, message, lParam);2027 case WM_ENABLE:2028 if( lphc->wState & CBF_EDIT )2029 EnableWindow( lphc->hWndEdit, (BOOL)wParam );2030 EnableWindow( lphc->hWndLBox, (BOOL)wParam );2031 2032 /* Force the control to repaint when the enabled state changes. */2033 InvalidateRect(lphc->self, NULL, TRUE);2034 return TRUE;2035 case WM_SETREDRAW:2036 if( wParam )2037 lphc->wState &= ~CBF_NOREDRAW;2038 else2039 lphc->wState |= CBF_NOREDRAW;2040 2041 if( lphc->wState & CBF_EDIT )2042 SendMessageW(lphc->hWndEdit, message, wParam, lParam);2043 SendMessageW(lphc->hWndLBox, message, wParam, lParam);2044 return 0;2045 case WM_SYSKEYDOWN:2046 if( KEYDATA_ALT & HIWORD(lParam) )2047 if( wParam == VK_UP || wParam == VK_DOWN )2048 COMBO_FlipListbox( lphc, FALSE, FALSE );2014 case WM_COPY: 2015 if( lphc->wState & CBF_EDIT ) 2016 { 2017 return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) : 2018 SendMessageA(lphc->hWndEdit, message, wParam, lParam); 2019 } 2020 else return CB_ERR; 2021 2022 case WM_DRAWITEM: 2023 case WM_DELETEITEM: 2024 case WM_COMPAREITEM: 2025 case WM_MEASUREITEM: 2026 return COMBO_ItemOp(lphc, message, lParam); 2027 case WM_ENABLE: 2028 if( lphc->wState & CBF_EDIT ) 2029 EnableWindow( lphc->hWndEdit, (BOOL)wParam ); 2030 EnableWindow( lphc->hWndLBox, (BOOL)wParam ); 2031 2032 /* Force the control to repaint when the enabled state changes. */ 2033 InvalidateRect(lphc->self, NULL, TRUE); 2034 return TRUE; 2035 case WM_SETREDRAW: 2036 if( wParam ) 2037 lphc->wState &= ~CBF_NOREDRAW; 2038 else 2039 lphc->wState |= CBF_NOREDRAW; 2040 2041 if( lphc->wState & CBF_EDIT ) 2042 SendMessageW(lphc->hWndEdit, message, wParam, lParam); 2043 SendMessageW(lphc->hWndLBox, message, wParam, lParam); 2044 return 0; 2045 case WM_SYSKEYDOWN: 2046 if( KEYDATA_ALT & HIWORD(lParam) ) 2047 if( wParam == VK_UP || wParam == VK_DOWN ) 2048 COMBO_FlipListbox( lphc, FALSE, FALSE ); 2049 2049 return 0; 2050 2050 2051 case WM_CHAR: 2052 case WM_KEYDOWN: 2053 { 2054 HWND hwndTarget; 2055 2056 if ((wParam == VK_RETURN || wParam == VK_ESCAPE) && 2057 (lphc->wState & CBF_DROPPED)) 2058 { 2059 CBRollUp( lphc, wParam == VK_RETURN, FALSE ); 2060 return TRUE; 2061 } 2062 2063 if( lphc->wState & CBF_EDIT ) 2064 hwndTarget = lphc->hWndEdit; 2065 else 2066 hwndTarget = lphc->hWndLBox; 2067 2068 return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) : 2069 SendMessageA(hwndTarget, message, wParam, lParam); 2070 } 2071 case WM_LBUTTONDOWN: 2072 if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self ); 2073 if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam ); 2074 return TRUE; 2075 case WM_LBUTTONUP: 2076 COMBO_LButtonUp( lphc ); 2077 return TRUE; 2078 case WM_MOUSEMOVE: 2079 if( lphc->wState & CBF_CAPTURE ) 2080 COMBO_MouseMove( lphc, wParam, lParam ); 2081 return TRUE; 2051 #ifdef __WIN32OS2__ 2052 case WM_IME_CHAR: 2053 #endif 2054 case WM_CHAR: 2055 case WM_KEYDOWN: 2056 { 2057 HWND hwndTarget; 2058 2059 if ((wParam == VK_RETURN || wParam == VK_ESCAPE) && 2060 (lphc->wState & CBF_DROPPED)) 2061 { 2062 CBRollUp( lphc, wParam == VK_RETURN, FALSE ); 2063 return TRUE; 2064 } 2065 2066 if( lphc->wState & CBF_EDIT ) 2067 hwndTarget = lphc->hWndEdit; 2068 else 2069 hwndTarget = lphc->hWndLBox; 2070 2071 return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) : 2072 SendMessageA(hwndTarget, message, wParam, lParam); 2073 } 2074 case WM_LBUTTONDOWN: 2075 if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self ); 2076 if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam ); 2077 return TRUE; 2078 case WM_LBUTTONUP: 2079 COMBO_LButtonUp( lphc ); 2080 return TRUE; 2081 case WM_MOUSEMOVE: 2082 if( lphc->wState & CBF_CAPTURE ) 2083 COMBO_MouseMove( lphc, wParam, lParam ); 2084 return TRUE; 2082 2085 2083 2086 case WM_MOUSEWHEEL: 2084 2087 if (wParam & (MK_SHIFT | MK_CONTROL)) 2085 2088 return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) : 2086 DefWindowProcA(hwnd, message, wParam, lParam);2089 DefWindowProcA(hwnd, message, wParam, lParam); 2087 2090 if (SHIWORD(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0); 2088 2091 if (SHIWORD(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0); 2089 2092 return TRUE; 2090 2093 2091 /* Combo messages */2092 2093 case CB_ADDSTRING16:2094 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);2095 /* fall through */2096 case CB_ADDSTRING:2097 return unicode ? SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam) :2098 SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);2099 case CB_INSERTSTRING16:2100 wParam = (INT)(INT16)wParam;2101 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);2102 /* fall through */2103 case CB_INSERTSTRING:2104 return unicode ? SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam) :2105 SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam);2106 case CB_DELETESTRING16:2107 case CB_DELETESTRING:2108 return unicode ? SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0) :2109 SendMessageA(lphc->hWndLBox, LB_DELETESTRING, wParam, 0);2110 case CB_SELECTSTRING16:2111 wParam = (INT)(INT16)wParam;2112 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);2113 /* fall through */2114 case CB_SELECTSTRING:2115 return COMBO_SelectString(lphc, (INT)wParam, lParam, unicode);2116 case CB_FINDSTRING16:2117 wParam = (INT)(INT16)wParam;2118 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);2119 /* fall through */2120 case CB_FINDSTRING:2121 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam) :2122 SendMessageA(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam);2123 case CB_FINDSTRINGEXACT16:2124 wParam = (INT)(INT16)wParam;2125 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam);2126 /* fall through */2127 case CB_FINDSTRINGEXACT:2128 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam) :2129 SendMessageA(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam);2130 case CB_SETITEMHEIGHT16:2131 wParam = (INT)(INT16)wParam;/* signed integer */2132 /* fall through */2133 case CB_SETITEMHEIGHT:2134 return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);2135 case CB_GETITEMHEIGHT16:2136 wParam = (INT)(INT16)wParam;2137 /* fall through */2138 case CB_GETITEMHEIGHT:2139 if( (INT)wParam >= 0 )/* listbox item */2094 /* Combo messages */ 2095 2096 case CB_ADDSTRING16: 2097 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam); 2098 /* fall through */ 2099 case CB_ADDSTRING: 2100 return unicode ? SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam) : 2101 SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, lParam); 2102 case CB_INSERTSTRING16: 2103 wParam = (INT)(INT16)wParam; 2104 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam); 2105 /* fall through */ 2106 case CB_INSERTSTRING: 2107 return unicode ? SendMessageW(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam) : 2108 SendMessageA(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam); 2109 case CB_DELETESTRING16: 2110 case CB_DELETESTRING: 2111 return unicode ? SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0) : 2112 SendMessageA(lphc->hWndLBox, LB_DELETESTRING, wParam, 0); 2113 case CB_SELECTSTRING16: 2114 wParam = (INT)(INT16)wParam; 2115 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam); 2116 /* fall through */ 2117 case CB_SELECTSTRING: 2118 return COMBO_SelectString(lphc, (INT)wParam, lParam, unicode); 2119 case CB_FINDSTRING16: 2120 wParam = (INT)(INT16)wParam; 2121 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam); 2122 /* fall through */ 2123 case CB_FINDSTRING: 2124 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam) : 2125 SendMessageA(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam); 2126 case CB_FINDSTRINGEXACT16: 2127 wParam = (INT)(INT16)wParam; 2128 if( CB_HASSTRINGS(lphc) ) lParam = (LPARAM)MapSL(lParam); 2129 /* fall through */ 2130 case CB_FINDSTRINGEXACT: 2131 return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam) : 2132 SendMessageA(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam); 2133 case CB_SETITEMHEIGHT16: 2134 wParam = (INT)(INT16)wParam; /* signed integer */ 2135 /* fall through */ 2136 case CB_SETITEMHEIGHT: 2137 return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam); 2138 case CB_GETITEMHEIGHT16: 2139 wParam = (INT)(INT16)wParam; 2140 /* fall through */ 2141 case CB_GETITEMHEIGHT: 2142 if( (INT)wParam >= 0 ) /* listbox item */ 2140 2143 return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0); 2141 2144 return CBGetTextAreaHeight(hwnd, lphc); 2142 case CB_RESETCONTENT16:2143 case CB_RESETCONTENT:2144 SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0);2145 case CB_RESETCONTENT16: 2146 case CB_RESETCONTENT: 2147 SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0); 2145 2148 if( (lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc) ) 2146 {2147 static const WCHAR empty_stringW[] = { 0 };2149 { 2150 static const WCHAR empty_stringW[] = { 0 }; 2148 2151 SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW); 2149 }2152 } 2150 2153 else 2151 2154 InvalidateRect(lphc->self, NULL, TRUE); 2152 return TRUE;2153 case CB_INITSTORAGE:2154 return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam);2155 case CB_GETHORIZONTALEXTENT:2156 return SendMessageW(lphc->hWndLBox, LB_GETHORIZONTALEXTENT, 0, 0);2157 case CB_SETHORIZONTALEXTENT:2158 return SendMessageW(lphc->hWndLBox, LB_SETHORIZONTALEXTENT, wParam, 0);2159 case CB_GETTOPINDEX:2160 return SendMessageW(lphc->hWndLBox, LB_GETTOPINDEX, 0, 0);2161 case CB_GETLOCALE:2162 return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0);2163 case CB_SETLOCALE:2164 return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);2165 case CB_GETDROPPEDWIDTH:2166 if( lphc->droppedWidth )2155 return TRUE; 2156 case CB_INITSTORAGE: 2157 return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam); 2158 case CB_GETHORIZONTALEXTENT: 2159 return SendMessageW(lphc->hWndLBox, LB_GETHORIZONTALEXTENT, 0, 0); 2160 case CB_SETHORIZONTALEXTENT: 2161 return SendMessageW(lphc->hWndLBox, LB_SETHORIZONTALEXTENT, wParam, 0); 2162 case CB_GETTOPINDEX: 2163 return SendMessageW(lphc->hWndLBox, LB_GETTOPINDEX, 0, 0); 2164 case CB_GETLOCALE: 2165 return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0); 2166 case CB_SETLOCALE: 2167 return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0); 2168 case CB_GETDROPPEDWIDTH: 2169 if( lphc->droppedWidth ) 2167 2170 return lphc->droppedWidth; 2168 return lphc->droppedRect.right - lphc->droppedRect.left;2169 case CB_SETDROPPEDWIDTH:2170 if( (CB_GETTYPE(lphc) != CBS_SIMPLE) &&2171 (INT)wParam < 32768 ) lphc->droppedWidth = (INT)wParam;2172 return CB_ERR;2173 case CB_GETDROPPEDCONTROLRECT16:2174 lParam = (LPARAM)MapSL(lParam);2175 if( lParam )2176 {2177 RECTr;2178 CBGetDroppedControlRect( lphc, &r );2179 CONV_RECT32TO16( &r, (LPRECT16)lParam );2180 }2181 return CB_OKAY;2182 case CB_GETDROPPEDCONTROLRECT:2183 if( lParam ) CBGetDroppedControlRect(lphc, (LPRECT)lParam );2184 return CB_OKAY;2185 case CB_GETDROPPEDSTATE16:2186 case CB_GETDROPPEDSTATE:2187 return (lphc->wState & CBF_DROPPED) ? TRUE : FALSE;2188 case CB_DIR16:2171 return lphc->droppedRect.right - lphc->droppedRect.left; 2172 case CB_SETDROPPEDWIDTH: 2173 if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && 2174 (INT)wParam < 32768 ) lphc->droppedWidth = (INT)wParam; 2175 return CB_ERR; 2176 case CB_GETDROPPEDCONTROLRECT16: 2177 lParam = (LPARAM)MapSL(lParam); 2178 if( lParam ) 2179 { 2180 RECT r; 2181 CBGetDroppedControlRect( lphc, &r ); 2182 CONV_RECT32TO16( &r, (LPRECT16)lParam ); 2183 } 2184 return CB_OKAY; 2185 case CB_GETDROPPEDCONTROLRECT: 2186 if( lParam ) CBGetDroppedControlRect(lphc, (LPRECT)lParam ); 2187 return CB_OKAY; 2188 case CB_GETDROPPEDSTATE16: 2189 case CB_GETDROPPEDSTATE: 2190 return (lphc->wState & CBF_DROPPED) ? TRUE : FALSE; 2191 case CB_DIR16: 2189 2192 lParam = (LPARAM)MapSL(lParam); 2190 message = LB_DIR16;2193 message = LB_DIR16; 2191 2194 /* fall through */ 2192 case CB_DIR:2193 if(message == CB_DIR) message = LB_DIR;2194 return unicode ? SendMessageW(lphc->hWndLBox, message, wParam, lParam) :2195 SendMessageA(lphc->hWndLBox, message, wParam, lParam);2196 2197 case CB_SHOWDROPDOWN16:2198 case CB_SHOWDROPDOWN:2199 if( CB_GETTYPE(lphc) != CBS_SIMPLE )2200 {2201 if( wParam )2202 {2203 if( !(lphc->wState & CBF_DROPPED) )2204 CBDropDown( lphc );2205 }2206 else2207 if( lphc->wState & CBF_DROPPED )2208 CBRollUp( lphc, FALSE, TRUE );2209 }2210 return TRUE;2211 case CB_GETCOUNT16:2212 case CB_GETCOUNT:2213 return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);2214 case CB_GETCURSEL16:2215 case CB_GETCURSEL:2216 return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);2217 case CB_SETCURSEL16:2218 wParam = (INT)(INT16)wParam;2219 /* fall through */2220 case CB_SETCURSEL:2221 lParam = SendMessageW(lphc->hWndLBox, LB_SETCURSEL, wParam, 0);2222 if( lParam >= 0 )2223 SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, wParam, 0);2224 2225 /* no LBN_SELCHANGE in this case, update manually */2226 if( lphc->wState & CBF_EDIT )2227 CBUpdateEdit( lphc, (INT)wParam );2228 else2229 InvalidateRect(lphc->self, &lphc->textRect, TRUE);2230 lphc->wState &= ~CBF_SELCHANGE;2231 return lParam;2232 case CB_GETLBTEXT16:2233 wParam = (INT)(INT16)wParam;2234 lParam = (LPARAM)MapSL(lParam);2235 /* fall through */2236 case CB_GETLBTEXT:2237 return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) :2238 SendMessageA(lphc->hWndLBox, LB_GETTEXT, wParam, lParam);2239 case CB_GETLBTEXTLEN16:2240 wParam = (INT)(INT16)wParam;2241 /* fall through */2242 case CB_GETLBTEXTLEN:2243 return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0);2244 case CB_GETITEMDATA16:2245 wParam = (INT)(INT16)wParam;2246 /* fall through */2247 case CB_GETITEMDATA:2248 return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0);2249 case CB_SETITEMDATA16:2250 wParam = (INT)(INT16)wParam;2251 /* fall through */2252 case CB_SETITEMDATA:2253 return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam);2254 case CB_GETEDITSEL16:2255 wParam = lParam = 0; /* just in case */2256 /* fall through */2257 case CB_GETEDITSEL:2258 /* Edit checks passed parameters itself */2259 if( lphc->wState & CBF_EDIT )2260 return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);2261 return CB_ERR;2262 case CB_SETEDITSEL16:2263 case CB_SETEDITSEL:2264 if( lphc->wState & CBF_EDIT )2195 case CB_DIR: 2196 if(message == CB_DIR) message = LB_DIR; 2197 return unicode ? SendMessageW(lphc->hWndLBox, message, wParam, lParam) : 2198 SendMessageA(lphc->hWndLBox, message, wParam, lParam); 2199 2200 case CB_SHOWDROPDOWN16: 2201 case CB_SHOWDROPDOWN: 2202 if( CB_GETTYPE(lphc) != CBS_SIMPLE ) 2203 { 2204 if( wParam ) 2205 { 2206 if( !(lphc->wState & CBF_DROPPED) ) 2207 CBDropDown( lphc ); 2208 } 2209 else 2210 if( lphc->wState & CBF_DROPPED ) 2211 CBRollUp( lphc, FALSE, TRUE ); 2212 } 2213 return TRUE; 2214 case CB_GETCOUNT16: 2215 case CB_GETCOUNT: 2216 return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0); 2217 case CB_GETCURSEL16: 2218 case CB_GETCURSEL: 2219 return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0); 2220 case CB_SETCURSEL16: 2221 wParam = (INT)(INT16)wParam; 2222 /* fall through */ 2223 case CB_SETCURSEL: 2224 lParam = SendMessageW(lphc->hWndLBox, LB_SETCURSEL, wParam, 0); 2225 if( lParam >= 0 ) 2226 SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, wParam, 0); 2227 2228 /* no LBN_SELCHANGE in this case, update manually */ 2229 if( lphc->wState & CBF_EDIT ) 2230 CBUpdateEdit( lphc, (INT)wParam ); 2231 else 2232 InvalidateRect(lphc->self, &lphc->textRect, TRUE); 2233 lphc->wState &= ~CBF_SELCHANGE; 2234 return lParam; 2235 case CB_GETLBTEXT16: 2236 wParam = (INT)(INT16)wParam; 2237 lParam = (LPARAM)MapSL(lParam); 2238 /* fall through */ 2239 case CB_GETLBTEXT: 2240 return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) : 2241 SendMessageA(lphc->hWndLBox, LB_GETTEXT, wParam, lParam); 2242 case CB_GETLBTEXTLEN16: 2243 wParam = (INT)(INT16)wParam; 2244 /* fall through */ 2245 case CB_GETLBTEXTLEN: 2246 return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0); 2247 case CB_GETITEMDATA16: 2248 wParam = (INT)(INT16)wParam; 2249 /* fall through */ 2250 case CB_GETITEMDATA: 2251 return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0); 2252 case CB_SETITEMDATA16: 2253 wParam = (INT)(INT16)wParam; 2254 /* fall through */ 2255 case CB_SETITEMDATA: 2256 return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam); 2257 case CB_GETEDITSEL16: 2258 wParam = lParam = 0; /* just in case */ 2259 /* fall through */ 2260 case CB_GETEDITSEL: 2261 /* Edit checks passed parameters itself */ 2262 if( lphc->wState & CBF_EDIT ) 2263 return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam); 2264 return CB_ERR; 2265 case CB_SETEDITSEL16: 2266 case CB_SETEDITSEL: 2267 if( lphc->wState & CBF_EDIT ) 2265 2268 return SendMessageW(lphc->hWndEdit, EM_SETSEL, 2266 (INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) );2267 return CB_ERR;2268 case CB_SETEXTENDEDUI16:2269 case CB_SETEXTENDEDUI:2269 (INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) ); 2270 return CB_ERR; 2271 case CB_SETEXTENDEDUI16: 2272 case CB_SETEXTENDEDUI: 2270 2273 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) 2271 2274 return CB_ERR; 2272 if( wParam )2273 lphc->wState |= CBF_EUI;2274 else lphc->wState &= ~CBF_EUI;2275 return CB_OKAY;2276 case CB_GETEXTENDEDUI16:2277 case CB_GETEXTENDEDUI:2278 return (lphc->wState & CBF_EUI) ? TRUE : FALSE;2279 2280 default:2281 if (message >= WM_USER)2282 WARN("unknown msg WM_USER+%04x wp=%04x lp=%08lx\n",2283 message - WM_USER, wParam, lParam );2284 break;2275 if( wParam ) 2276 lphc->wState |= CBF_EUI; 2277 else lphc->wState &= ~CBF_EUI; 2278 return CB_OKAY; 2279 case CB_GETEXTENDEDUI16: 2280 case CB_GETEXTENDEDUI: 2281 return (lphc->wState & CBF_EUI) ? TRUE : FALSE; 2282 2283 default: 2284 if (message >= WM_USER) 2285 WARN("unknown msg WM_USER+%04x wp=%04x lp=%08lx\n", 2286 message - WM_USER, wParam, lParam ); 2287 break; 2285 2288 } 2286 2289 return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) : -
trunk/src/user32/edit.c
r10195 r10216 888 888 case WM_CHAR: 889 889 { 890 #ifdef __WIN32OS2__891 static BOOL bDbcsLead = FALSE;892 static CHAR cDbcsLead = 0;893 894 890 WCHAR charW; 895 891 DPRINTF_EDIT_MSG32("WM_CHAR"); … … 899 895 else 900 896 { 901 WCHAR charA = bDbcsLead ? (( wParam << 8 ) | cDbcsLead ) : wParam; 902 int size = bDbcsLead ? 2 : 1; 903 904 bDbcsLead = !bDbcsLead && IsDBCSLeadByte( wParam ); 905 906 if( bDbcsLead ) 907 cDbcsLead = wParam; 908 else 909 MultiByteToWideChar(CP_ACP, 0, (LPSTR)&charA, size, &charW, 1); 897 CHAR charA = wParam; 898 MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1); 910 899 } 911 900 … … 916 905 break; 917 906 } 918 if( !bDbcsLead ) 919 EDIT_WM_Char(hwnd, es, charW); 920 #else 921 WCHAR charW; 922 DPRINTF_EDIT_MSG32("WM_CHAR"); 923 924 if(unicode) 925 charW = wParam; 926 else 927 { 928 CHAR charA = wParam; 929 MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1); 930 } 931 932 if ((charW == VK_RETURN || charW == VK_ESCAPE) && es->hwndListBox) 933 { 934 if (SendMessageW(GetParent(hwnd), CB_GETDROPPEDSTATE, 0, 0)) 935 SendMessageW(GetParent(hwnd), WM_KEYDOWN, charW, 0); 936 break; 937 } 938 EDIT_WM_Char(hwnd, es, charW); 939 #endif 907 EDIT_WM_Char(hwnd, es, charW); 940 908 break; 941 909 } … … 1016 984 result = EDIT_WM_HScroll(hwnd, es, LOWORD(wParam), SHIWORD(wParam)); 1017 985 break; 986 987 #ifdef __WIN32OS2__ 988 case WM_IME_CHAR: 989 { 990 WCHAR charW; 991 DPRINTF_EDIT_MSG32("WM_IME_CHAR"); 992 993 if(unicode) 994 charW = wParam; 995 else 996 { 997 // always DBCS char 998 CHAR charA[ 2 ]; 999 1000 charA[ 0 ] = ( CHAR )( wParam >> 8 ); 1001 charA[ 1 ] = ( CHAR )wParam; 1002 1003 MultiByteToWideChar( CP_ACP, 0, ( LPSTR )charA, 2, ( LPWSTR )&charW, 1); 1004 } 1005 1006 EDIT_WM_Char(hwnd, es, charW); 1007 break; 1008 } 1009 #endif 1018 1010 1019 1011 case WM_KEYDOWN: -
trunk/src/user32/listbox.c
r10195 r10216 2992 2992 case WM_CHAR: 2993 2993 { 2994 #ifdef __WIN32OS2__2995 static BOOL bDbcsLead = FALSE;2996 static CHAR cDbcsLead = 0;2997 2998 2994 WCHAR charW; 2999 2995 if(unicode) … … 3001 2997 else 3002 2998 { 3003 WCHAR charA = bDbcsLead ? (( wParam << 8 ) | cDbcsLead ) : wParam; 3004 int size = bDbcsLead ? 2 : 1; 3005 3006 bDbcsLead = !bDbcsLead && IsDBCSLeadByte( wParam ); 3007 3008 if( bDbcsLead ) 3009 cDbcsLead = wParam; 3010 else 3011 MultiByteToWideChar(CP_ACP, 0, (LPSTR)&charA, size, &charW, 1); 3012 } 3013 return bDbcsLead ? 0 : LISTBOX_HandleChar( hwnd, descr, charW ); 3014 #else 2999 CHAR charA = (CHAR)wParam; 3000 MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1); 3001 } 3002 return LISTBOX_HandleChar( hwnd, descr, charW ); 3003 } 3004 3005 #ifdef __WIN32OS2__ 3006 case WM_IME_CHAR: 3007 { 3015 3008 WCHAR charW; 3009 3016 3010 if(unicode) 3017 3011 charW = (WCHAR)wParam; 3018 3012 else 3019 3013 { 3020 CHAR charA = (CHAR)wParam; 3021 MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1); 3014 // always DBCS char 3015 CHAR charA[ 2 ]; 3016 3017 charA[ 0 ] = ( CHAR )( wParam >> 8 ); 3018 charA[ 1 ] = ( CHAR )wParam; 3019 3020 MultiByteToWideChar( CP_ACP, 0, ( LPSTR )charA, 2, ( LPWSTR )&charW, 1); 3022 3021 } 3023 3022 return LISTBOX_HandleChar( hwnd, descr, charW ); 3023 } 3024 3024 #endif 3025 }3026 3025 3027 3026 case WM_SYSTIMER: -
trunk/src/user32/oslibmsg.cpp
r10212 r10216 1 /* $Id: oslibmsg.cpp,v 1.7 4 2003-08-06 11:00:44sandervl Exp $ */1 /* $Id: oslibmsg.cpp,v 1.75 2003-08-08 13:30:19 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 236 236 // Check for a queued WM_CHAR message (e.g. inserted by TranslateMessage) 237 237 //****************************************************************************** 238 BOOL ReturnQueuedWMCHAR(LPMSG pMsg, TEB *teb, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 238 BOOL ReturnQueuedWMCHAR(LPMSG pMsg, TEB *teb, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 239 239 BOOL isUnicode, BOOL fRemove) 240 240 { … … 251 251 return FALSE; 252 252 } 253 253 254 254 if(fRemove & PM_REMOVE_W) { 255 255 teb->o.odin.fTranslated = FALSE; … … 276 276 // call the keyboard hook here 277 277 // send keyboard messages to the registered hooks 278 if(fRemove & PM_REMOVE_W) 278 if(fRemove & PM_REMOVE_W) 279 279 { 280 280 switch (pMsg->message) … … 291 291 } 292 292 } 293 293 294 294 //GetMessageW and PeekMessageW expect the character code in UTF-16 295 295 //(we save it in ascii format) … … 298 298 CHAR charA; 299 299 WCHAR charW; 300 300 301 301 charA = pMsg->wParam; 302 302 MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1); … … 400 400 goto continuegetmsg; 401 401 break; 402 case WINWM_CHAR: 403 case WINWM_SYSCHAR: 402 case WINWM_IME_CHAR: 404 403 // prevent from calling wrong DispatchMsg() (DBCS generated WM_CHAR) 405 404 memset( &teb->o.odin.winmsg, 0, sizeof( MSG )); … … 464 463 ULONG ulPMFilter; 465 464 466 for(int i=0;i<uMsgFilterMax-uMsgFilterMin+1;i++) 465 for(int i=0;i<uMsgFilterMax-uMsgFilterMin+1;i++) 467 466 { 468 467 rc = 0; … … 523 522 goto continuepeekmsg; 524 523 break; 525 case WINWM_CHAR: 526 case WINWM_SYSCHAR: 524 case WINWM_IME_CHAR: 527 525 // prevent from calling wrong DispatchMsg() (DBCS generated WM_CHAR) 528 526 memset( &teb->o.odin.winmsg, 0, sizeof( MSG )); -
trunk/src/user32/oslibmsg.h
r10185 r10216 1 /* $Id: oslibmsg.h,v 1.2 1 2003-07-28 11:27:45sandervl Exp $ */1 /* $Id: oslibmsg.h,v 1.22 2003-08-08 13:30:19 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 147 147 #define WINWM_SYSDEADCHAR 0x0107 148 148 #define WINWM_KEYLAST 0x0108 149 #define WINWM_IME_STARTCOMPOSITION 0x010D 150 #define WINWM_IME_ENDCOMPOSITION 0x010E 151 #define WINWM_IME_COMPOSITION 0x010F 152 #define WINWM_IME_KEYLAST 0x010F 149 153 #define WINWM_INITDIALOG 0x0110 150 154 #define WINWM_COMMAND 0x0111 … … 195 199 #define WINWM_DROPFILES 0x0233 196 200 #define WINWM_MDIREFRESHMENU 0x0234 201 #define WINWM_IME_SETCONTEXT 0x0281 202 #define WINWM_IME_NOTIFY 0x0282 203 #define WINWM_IME_CONTROL 0x0283 204 #define WINWM_IME_COMPOSITIONFULL 0x0284 205 #define WINWM_IME_SELECT 0x0285 206 #define WINWM_IME_CHAR 0x0286 207 #define WINWM_IME_REQUEST 0x0288 208 #define WINWM_IME_KEYDOWN 0x0290 209 #define WINWM_IME_KEYUP 0x0291 197 210 #define WINWM_CUT 0x0300 198 211 #define WINWM_COPY 0x0301 -
trunk/src/user32/oslibmsgtranslate.cpp
r10212 r10216 1 /* $Id: oslibmsgtranslate.cpp,v 1.11 4 2003-08-06 11:00:45sandervl Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.115 2003-08-08 13:30:19 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 720 720 WORD wWinScan; 721 721 722 if ( (!IsDBCSEnv() && scanCode == 0) || 723 (scanCode==0 ) && !( flags & KC_CHAR ) ) 722 if ( (!IsDBCSEnv() && scanCode == 0) || 723 (scanCode==0 ) && !( flags & KC_CHAR ) ) 724 724 { 725 725 goto dummymessage; … … 746 746 if( CHAR2FROMMP( os2Msg->mp2 )) // DBCS character 747 747 { 748 CHAR dbcsCh[ 2 ] = { CHAR1FROMMP( os2Msg->mp2 ), CHAR2FROMMP( os2Msg->mp2 )}; 749 748 750 if( isUnicode ) 749 751 { 750 char dbcsCh[] = { CHAR1FROMMP( os2Msg->mp2 ), CHAR2FROMMP( os2Msg->mp2 ), 0 }; 751 WCHAR uniChar[ 2 ]; 752 753 lstrcpynAtoW(( LPWSTR )&uniChar, ( LPCSTR )&dbcsCh, 2 ); 754 winMsg->wParam = ( WPARAM )uniChar[ 0 ]; 752 WCHAR uniChar; 753 754 MultiByteToWideChar( CP_ACP, 0, dbcsCh, 2, &uniChar, 1 ); 755 winMsg->wParam = ( WPARAM )uniChar; 755 756 } 756 // insert DBCS trail byte for Non-Unicode window 757 else if(fMsgRemoved && !(teb->o.odin.fTranslated)) 758 { 759 MSG extramsg; 760 memcpy(&extramsg, winMsg, sizeof(MSG)); 761 762 //After SetFocus(0), all keystrokes are converted in WM_SYS* 763 extramsg.message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR : WINWM_CHAR; 764 765 extramsg.wParam = CHAR2FROMMP( os2Msg->mp2 ); 766 extramsg.lParam = 0; 767 768 setThreadQueueExtraCharMessage(teb, &extramsg); 769 } 757 else 758 winMsg->wParam = ( dbcsCh[ 0 ] << 8 ) | dbcsCh[ 1 ]; 770 759 } 771 760 } … … 830 819 else if( scanCode == 0 ) 831 820 { 832 //After SetFocus(0), all keystrokes are converted in WM_SYS* 833 winMsg->message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR : WINWM_CHAR; 821 if( CHAR2FROMMP( os2Msg->mp2 )) 822 winMsg->message = WINWM_IME_CHAR; 823 else 824 { 825 //After SetFocus(0), all keystrokes are converted in WM_SYS* 826 winMsg->message = (fIgnoreKeystrokes) ? WINWM_SYSCHAR : WINWM_CHAR; 827 } 834 828 } 835 829 else -
trunk/src/user32/win32wbase.cpp
r10190 r10216 1 /* $Id: win32wbase.cpp,v 1.37 6 2003-07-31 15:56:45sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.377 2003-08-08 13:30:20 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 2123 2123 return 0; //comctl32 controls expect this 2124 2124 2125 case WM_IME_CHAR: 2126 if( wParam & 0xFF00 ) // DBCS ? 2127 SendMessageA( getWindowHandle(), WM_CHAR, ( WPARAM )( BYTE )( wParam >> 8 ), lParam ); 2128 SendMessageA( getWindowHandle(), WM_CHAR, ( WPARAM )( BYTE )( wParam & 0xFF ), lParam ); 2129 break; 2130 2125 2131 default: 2126 2132 return 0; … … 2205 2211 return TRUE; 2206 2212 } 2213 2214 case WM_IME_CHAR: 2215 SendMessageW( getWindowHandle(), WM_CHAR, wParam, lParam ); 2216 return 0; 2207 2217 2208 2218 default: -
trunk/src/user32/windowmsg.cpp
r10204 r10216 1 /* $Id: windowmsg.cpp,v 1.4 6 2003-08-04 17:01:58sandervl Exp $ */1 /* $Id: windowmsg.cpp,v 1.47 2003-08-08 13:30:22 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 35 35 #include "timer.h" 36 36 37 #define DBG_LOCALLOG DBG_windowmsg37 #define DBG_LOCALLOG DBG_windowmsg 38 38 #include "dbglocal.h" 39 39 … … 50 50 if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) 51 51 { 52 if (msg->lParam)52 if (msg->lParam) 53 53 { 54 54 /* HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ … … 56 56 /* before calling window proc, verify whether timer is still valid; 57 57 there's a slim chance that the application kills the timer 58 between GetMessage and DispatchMessage API calls */58 between GetMessage and DispatchMessage API calls */ 59 59 if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, msg->lParam)) 60 60 return 0; /* invalid winproc */ 61 61 62 return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd,62 return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd, 63 63 msg->message, msg->wParam, GetTickCount() ); 64 64 } … … 76 76 if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) 77 77 { 78 if (msg->lParam)78 if (msg->lParam) 79 79 { 80 80 /* HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ … … 82 82 /* before calling window proc, verify whether timer is still valid; 83 83 there's a slim chance that the application kills the timer 84 between GetMessage and DispatchMessage API calls */84 between GetMessage and DispatchMessage API calls */ 85 85 if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, msg->lParam)) 86 86 return 0; /* invalid winproc */ 87 87 88 return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd,88 return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd, 89 89 msg->message, msg->wParam, GetTickCount() ); 90 90 } … … 100 100 (msg->message > WM_SYSKEYUP)|| 101 101 (msg->message == WM_CHAR) || 102 #ifdef __WIN32OS2__ 103 (msg->message == WM_DEADCHAR)|| 104 (msg->message == WM_IME_CHAR) ) 105 #else 102 106 (msg->message == WM_DEADCHAR) ) 107 #endif 103 108 { 104 109 SetLastError(ERROR_INVALID_PARAMETER); … … 448 453 return 0; 449 454 455 #ifdef __WIN32OS2__ 456 case WM_IME_CHAR: 457 { 458 // always DBCS char 459 CHAR charA[ 2 ]; 460 461 charA[ 0 ] = ( CHAR )( *pwparam >> 8 ); 462 charA[ 1 ] = ( CHAR )*pwparam; 463 464 MultiByteToWideChar( CP_ACP, 0, ( LPSTR )charA, 2, ( LPWSTR )pwparam, 1); 465 466 return 0; 467 } 468 #endif 469 450 470 case WM_PAINTCLIPBOARD: 451 471 case WM_SIZECLIPBOARD: … … 725 745 return 0; 726 746 747 #ifdef __WIN32OS2__ 748 case WM_IME_CHAR: 749 { // always DBCS char 750 CHAR charA[ 2 ]; 751 752 WideCharToMultiByte( CP_ACP, 0, ( LPWSTR )pwparam, 1, ( LPSTR )charA, 2, 0, 0 ); 753 *pwparam = ( charA[ 0 ] << 8 ) | charA[ 1 ]; 754 755 return 0; 756 } 757 #endif 758 727 759 case WM_PAINTCLIPBOARD: 728 760 case WM_SIZECLIPBOARD: … … 862 894 LRESULT result; 863 895 864 #ifdef __WIN32OS2__865 if( IsDBCSEnv() && msg == WM_CHAR )866 {867 static BYTE dbcsLead = 0;868 WCHAR charA = wParam;869 int size = dbcsLead ? 2 : 1;870 871 if( dbcsLead )872 charA = ( charA << 8 ) | dbcsLead;873 else if( IsDBCSLeadByte( wParam ))874 {875 dbcsLead = wParam;876 return 0;877 }878 MultiByteToWideChar( CP_ACP, 0, ( LPSTR )&charA, size, ( LPWSTR )&wParam, 1 );879 880 dbcsLead = 0;881 }882 else883 #endif884 896 if (WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam ) == -1) return 0; 885 897 … … 888 900 889 901 #ifdef __WIN32OS2__ 890 if(IsDBCSEnv()) 902 if(IsDBCSEnv()) 891 903 { 892 904 switch( msg ) … … 940 952 LRESULT result; 941 953 942 #ifdef __WIN32OS2__943 if( IsDBCSEnv() && msg == WM_CHAR )944 {945 char charA[ 2 ];946 947 if( WideCharToMultiByte( CP_ACP, 0, ( LPWSTR )&wParam, 1, ( LPSTR )charA, 2, 0, 0 ) > 1 )948 {949 func( hwnd, msg, ( WPARAM )charA[ 0 ], lParam );950 wParam = charA[ 1 ];951 }952 else953 wParam = charA[ 0 ];954 }955 else956 #endif957 954 if (WINPROC_MapMsg32WTo32A( hwnd, msg, &wParam, &lParam ) == -1) return 0; 958 955
Note:
See TracChangeset
for help on using the changeset viewer.
