- Timestamp:
- Feb 14, 2000, 6:30:11 PM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/combo.cpp
r2469 r2781 1 /* $Id: combo.cpp,v 1.2 4 2000-01-18 20:10:31 sandervlExp $ */1 /* $Id: combo.cpp,v 1.25 2000-02-14 17:30:10 cbratschi Exp $ */ 2 2 /* 3 3 * Combo controls … … 8 8 * FIXME: roll up in Netscape 3.01. 9 9 * 10 * WINE version: 991212 10 * Corel version: 20000212 11 * (WINE version: 991212) 11 12 * 12 13 * Status: in progress … … 442 443 443 444 if( !CB_GETTYPE(lphc) ) lphc->dwStyle |= CBS_SIMPLE; 444 elseif( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT;445 if( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT; 445 446 446 447 lphc->hwndself = hwnd; … … 521 522 } 522 523 else /* popup listbox */ 524 { 523 525 lbeStyle |= WS_POPUP; 526 lbeStyle |= WS_EX_TOOLWINDOW; 527 } 524 528 525 529 /* Dropdown ComboLBox is not a child window and we cannot pass … … 535 539 lphc->droppedRect.bottom - lphc->droppedRect.top, 536 540 lphc->hwndself, 537 (lphc->dwStyle & CBS_DROPDOWN)? (HMENU)0 : (HMENU)ID_CB_LISTBOX,541 (lphc->dwStyle & CBS_DROPDOWN)? (HMENU)0 : (HMENU)ID_CB_LISTBOX, 538 542 GetWindowLongA(lphc->hwndself,GWL_HINSTANCE), 539 543 (LPVOID)lphc ); … … 551 555 (CB_GETTYPE(lphc) != CBS_SIMPLE) ) 552 556 { 553 SetWindowLongA(lphc->hWndLBox, 554 GWL_STYLE, 555 (GetWindowLongA(lphc->hWndLBox, GWL_STYLE) | WS_CHILD) & ~WS_POPUP); 557 /* Not using SetWindowLongA here because it doesn't allow us to 558 * change the WS_CHILD style. This code should be equivalent (excluding 559 * the change in owner) to: 560 * SetWindowLongA(lphc->hWndLBox, GWL_STYLE, 561 * (GetWindowLongA(lphc->hWndLBox,GWL_STYLE) | WS_CHILD) & ~WS_POPUP); 562 */ 563 STYLESTRUCT style; 564 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(lphc->hWndLBox); 565 566 if (!win32wnd) 567 { 568 /* Is this the right error? */ 569 SetLastError( ERROR_INVALID_WINDOW_HANDLE ); 570 return 0; 571 } 572 573 /* save old style, set new style */ 574 style.styleOld = win32wnd->getStyle(); 575 style.styleNew = (style.styleOld | WS_CHILD) & ~WS_POPUP; 576 577 SendMessageA(lphc->hWndLBox,WM_STYLECHANGING,GWL_STYLE,(LPARAM)&style); 578 #if 0 //CB: our code doesn't work with this style change 579 win32wnd->setStyle(style.styleNew); 580 #endif 581 SendMessageA(lphc->hWndLBox,WM_STYLECHANGED,GWL_STYLE,(LPARAM)&style); 582 583 /* Set owner to NULL - it seems to be what Windows does to a ComboLBox 584 * after creation. 585 */ 586 win32wnd->setOwner(NULL); 556 587 } 557 588 … … 1016 1047 1017 1048 SendMessageA( lphc->hWndEdit, WM_SETTEXT, 0, pText ? (LPARAM)pText : (LPARAM)"" ); 1049 if( lphc->wState & CBF_FOCUSED ) 1050 SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1) ); 1051 1018 1052 1019 1053 if( pText ) … … 1033 1067 int nHeight; 1034 1068 int nDroppedHeight,nTempDroppedHeight; 1069 int screenH 1035 1070 1036 1071 //TRACE("[%04x]: drop down\n", CB_HWND(lphc)); … … 1091 1126 nDroppedHeight = nTempDroppedHeight; 1092 1127 1093 SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom, 1128 /*If height of dropped rectangle gets beyond a screen size it should go up, otherwise down.*/ 1129 screenH = GetSystemMetrics(SM_CYSCREEN); 1130 if((rect.bottom + nDroppedHeight) >= screenH) 1131 { 1132 SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.top - nDroppedHeight, 1094 1133 lphc->droppedRect.right - lphc->droppedRect.left, 1095 1134 nDroppedHeight, 1096 1135 SWP_NOACTIVATE | SWP_NOREDRAW); 1097 1136 } 1137 else 1138 { 1139 SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom, 1140 lphc->droppedRect.right - lphc->droppedRect.left, 1141 nDroppedHeight, 1142 SWP_NOACTIVATE | SWP_NOREDRAW); 1143 } 1098 1144 1099 1145 if( !(lphc->wState & CBF_NOREDRAW) ) … … 1325 1371 } 1326 1372 1327 CBUpdateLBox( lphc ); 1373 if (lphc->wState & CBF_NOLBSELECT) 1374 { 1375 lphc->wState &= ~CBF_NOLBSELECT; 1376 } 1377 else 1378 { 1379 CBUpdateLBox( lphc ); 1380 } 1328 1381 break; 1329 1382 … … 1357 1410 * by arrowkeys in the dropdown listbox */ 1358 1411 1359 if( (lphc->wState & CBF_DROPPED) && !(lphc->wState & CBF_NOROLLUP) ) 1360 CBRollUp( lphc, (HIWORD(wParam) == LBN_SELCHANGE), TRUE ); 1412 if( (lphc->dwStyle & CBS_SIMPLE) || 1413 ((lphc->wState & CBF_DROPPED) && !(lphc->wState & CBF_NOROLLUP)) ) 1414 { 1415 CBRollUp( lphc, (HIWORD(wParam) == LBN_SELCHANGE), TRUE ); 1416 } 1361 1417 else lphc->wState &= ~CBF_NOROLLUP; 1362 1418 … … 1364 1420 { 1365 1421 INT index = SendMessageA(lphc->hWndLBox, LB_GETCURSEL, 0, 0); 1422 1423 lphc->wState |= CBF_NOLBSELECT; 1366 1424 CBUpdateEdit( lphc, index ); 1367 1425 /* select text in edit, as Windows does */ … … 1737 1795 } 1738 1796 1797 static LRESULT COMBO_MouseWheel(HWND hwnd,WPARAM wParam,LPARAM lParam) 1798 { 1799 if (wParam & (MK_SHIFT | MK_CONTROL)) 1800 return DefWindowProcA(hwnd,WM_MOUSEWHEEL,wParam,lParam); 1801 1802 if ((short) HIWORD(wParam) > 0) return SendMessageA(hwnd,WM_KEYDOWN,VK_UP,0); 1803 if ((short) HIWORD(wParam) < 0) return SendMessageA(hwnd,WM_KEYDOWN,VK_DOWN,0); 1804 1805 return TRUE; 1806 } 1807 1739 1808 static LRESULT COMBO_Enable(HWND hwnd,WPARAM wParam,LPARAM lParam) 1740 1809 { … … 2029 2098 2030 2099 lParam = SendMessageA( lphc->hWndLBox, LB_SETCURSEL, wParam, 0); 2100 if( lParam >= 0 ) 2101 SendMessageA( lphc->hWndLBox, LB_SETTOPINDEX, wParam, 0); 2031 2102 if( lphc->wState & CBF_SELCHANGE ) 2032 2103 { … … 2213 2284 case WM_MOUSEMOVE: 2214 2285 return COMBO_MouseMove(hwnd,wParam,lParam); 2286 2287 case WM_MOUSEWHEEL: 2288 return COMBO_MouseWheel(hwnd,wParam,lParam); 2215 2289 2216 2290 /* Combo messages */ -
trunk/src/user32/dc.cpp
r2705 r2781 1 /* $Id: dc.cpp,v 1.4 6 2000-02-09 15:56:16 sandervlExp $ */1 /* $Id: dc.cpp,v 1.47 2000-02-14 17:30:11 cbratschi Exp $ */ 2 2 3 3 /* … … 549 549 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 550 550 if(!lpps || !wnd) { 551 552 553 551 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 552 O32_SetLastError (ERROR_INVALID_PARAMETER); 553 return (HDC)0; 554 554 } 555 555 HWND hwndClient = wnd->getOS2WindowHandle(); … … 563 563 if (!pHps) 564 564 { 565 565 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 566 566 O32_SetLastError (ERROR_INVALID_PARAMETER); 567 567 return (HDC)NULLHANDLE; 568 568 } 569 569 hpsPaint = hPS_ownDC; 570 570 } 571 571 } 572 572 if(!hpsPaint) { 573 573 hpsPaint = GetDCEx(hwnd, 0, DCX_CACHE_W); 574 574 pHps = (pDCData)GpiQueryDCData(hpsPaint); 575 575 if (!pHps) 576 576 { 577 577 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 578 578 O32_SetLastError (ERROR_INVALID_PARAMETER); 579 579 return (HDC)NULLHANDLE; 580 580 } 581 } 581 } 582 582 583 583 #if 0 … … 601 601 lComplexity = WinQueryUpdateRegion(hwndClient, hrgnUpdate); 602 602 if(lComplexity == RGN_ERROR) { 603 603 dprintf (("USER32: BeginPaint update region error!!")); 604 604 O32_SetLastError (ERROR_INVALID_PARAMETER); 605 605 return 0; 606 606 } 607 607 WinQueryUpdateRect(hwndClient, &rectl); 608 608 609 if(lComplexity != RGN_NULL) { 610 611 612 613 614 609 if(lComplexity != RGN_NULL) { 610 WinValidateRegion(hwndClient, hrgnUpdate, FALSE); 611 612 GpiSetClipRegion(pHps->hps, hrgnUpdate, &hrgnOld); 613 //save old clip region (restored for CS_OWNDC windows in EndPaint) 614 wnd->SetClipRegion(hrgnOld); 615 615 } 616 616 … … 621 621 lpps->fErase = wnd->isPSErase(); //correct ?? 622 622 lpps->hdc = (HDC)pHps->hps; 623 623 624 624 if(lComplexity != RGN_NULL) { 625 626 627 628 629 625 long height = wnd->getClientHeight(); 626 lpps->rcPaint.top = height - rectl.yTop; 627 lpps->rcPaint.left = rectl.xLeft; 628 lpps->rcPaint.bottom = height - rectl.yBottom; 629 lpps->rcPaint.right = rectl.xRight; 630 630 } 631 631 else { 632 633 634 } 635 632 lpps->rcPaint.bottom = lpps->rcPaint.top = 0; 633 lpps->rcPaint.right = lpps->rcPaint.left = 0; 634 } 635 636 636 HideCaret(hwnd); 637 637 … … 660 660 if (pHps && (pHps->hdcType == TYPE_3)) 661 661 { 662 663 664 665 666 667 668 669 else 670 671 672 673 674 675 676 677 //// 662 GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnOld); 663 if(hrgnOld) { 664 GpiDestroyRegion(pHps->hps, hrgnOld); 665 } 666 if(hwnd == HWND_DESKTOP || !wnd->isOwnDC()) { 667 ReleaseDC(hwnd, pPaint->hdc); 668 } 669 else 670 if(wnd->GetClipRegion()) { 671 //TODO: What else do we need to restore here??? 672 GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld); 673 wnd->SetClipRegion(0); 674 pHps->hdcType = TYPE_1; 675 } 676 677 //// WinEndPaint (pHps->hps); 678 678 } 679 679 else { 680 680 dprintf(("EndPaint: wrong hdc %x!!", pPaint->hdc)); 681 681 } 682 682 wnd->setSuppressErase(FALSE); … … 714 714 if (updateRegionExists) 715 715 { 716 717 718 719 720 721 722 716 //CB: for PM empty rect is valid 717 if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) { 718 if(pRect) { 719 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 720 } 721 return FALSE; 722 } 723 723 #if 0 724 724 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise) 725 725 // if (wnd->isOwnDC() && wnd->getOwnDC()) 726 727 728 729 730 731 732 733 734 735 736 737 738 726 if (wnd->isOwnDC()) 727 { 728 pDCData pHps = NULL; 729 pHps = (pDCData)GpiQueryDCData(wnd->getOwnDC()); 730 if (!pHps) 731 { 732 O32_SetLastError (ERROR_INVALID_HANDLE); 733 return FALSE; 734 } 735 GpiConvert (pHps->hps, CVTC_DEVICE, CVTC_WORLD, 2, (PPOINTL)&rectl); 736 } 737 else 738 { 739 739 #endif 740 741 742 743 ////////// 744 745 746 747 748 749 740 long height = wnd->getClientHeight(); 741 rectl.yTop = height - rectl.yTop; 742 rectl.yBottom = height - rectl.yBottom; 743 ////////// } 744 745 if (pRect) 746 WINRECT_FROM_PMRECT (*pRect, rectl); 747 748 if (erase) 749 sendEraseBkgnd (wnd); 750 750 } 751 751 else 752 752 { 753 754 755 753 if(pRect) { 754 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 755 } 756 756 } 757 757 … … 780 780 if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE; 781 781 mapOS2ToWin32Rect(hwnd,(PRECTLOS2)&rectl,pRect); 782 } 782 } 783 783 else 784 784 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; … … 827 827 828 828 if(hwnd == 0) { 829 830 831 829 dprintf(("error: GetDCEx window %x not found", hwnd)); 830 O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE); 831 return 0; 832 832 } 833 833 … … 867 867 868 868 pHps->hdcType = TYPE_1; 869 869 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps)); 870 870 return (HDC)hps; 871 871 } … … 913 913 { 914 914 #if 0 //CB: todo 915 916 917 918 919 920 921 922 923 924 915 long height; 916 917 BytesNeeded = GetRegionData (hrgn, 0, NULL); 918 RgnData = (PRGNDATA_W)_alloca (BytesNeeded); 919 if (RgnData == NULL) 920 goto error; 921 GetRegionData (hrgn, BytesNeeded, RgnData); 922 923 i = RgnData->rdh.nCount; 924 pr = (PRECT)(RgnData->Buffer); 925 925 926 926 if (flags & DCX_WINDOW_W) 927 928 927 height = wnd->getWindowHeight(); 928 else height = wnd->getClientHeight(); 929 929 930 930 for (; (i > 0) && success; i--, pr++) { … … 936 936 } 937 937 #endif 938 } 938 } 939 939 else //DCX_INTERSECTRGN_W 940 940 { 941 941 if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) { 942 943 942 dprintf(("ExtSelectClipRgn failed!!")); 943 } 944 944 } 945 945 if (!success) … … 1036 1036 1037 1037 if(pRect) { 1038 1038 dprintf(("RedrawWindow %x (%d,%d)(%d,%d) %x %x", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, hrgn, redraw)); 1039 1039 } 1040 1040 else dprintf(("RedrawWindow %x %x %x %x", hwnd, pRect, hrgn, redraw)); … … 1090 1090 // deciding to skip erase? 1091 1091 if(redraw & RDW_NOERASE_W || ((redraw & (RDW_INVALIDATE_W|RDW_ERASE_W|RDW_ERASENOW_W)) == RDW_INVALIDATE_W)) { 1092 1093 } 1094 else 1092 wnd->setSuppressErase(TRUE); 1093 } 1094 else wnd->setSuppressErase(FALSE); 1095 1095 1096 1096 if (hrgn) … … 1160 1160 if(WinQueryUpdateRect(hwnd, NULL)) 1161 1161 { 1162 1163 1164 1165 else1166 1167 1162 if(redraw & RDW_UPDATENOW_W) { 1163 wnd->MsgPaint (0, FALSE); 1164 } 1165 else 1166 if((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W)) 1167 wnd->setEraseBkgnd (FALSE, !sendEraseBkgnd (wnd)); 1168 1168 } 1169 1169 else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W)) 1170 1170 { 1171 1172 1173 elsePostMessageA(hwnd, WINWM_PAINT, 0, 0);1171 if(redraw & RDW_UPDATENOW_W) 1172 wnd->MsgPaint (0, FALSE); 1173 else PostMessageA(hwnd, WINWM_PAINT, 0, 0); 1174 1174 } 1175 1175 … … 1200 1200 1201 1201 if(!wnd) { 1202 1203 1202 O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE); 1203 return FALSE; 1204 1204 } 1205 1205 -
trunk/src/user32/win32wbase.cpp
r2697 r2781 1 /* $Id: win32wbase.cpp,v 1.16 0 2000-02-09 13:42:38 sandervlExp $ */1 /* $Id: win32wbase.cpp,v 1.161 2000-02-14 17:30:11 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 334 334 fCXDefault = TRUE; 335 335 } 336 if (cs->style & (WS_POPUP | WS_CHILD)) 337 { 338 fXDefault = FALSE; 339 if (fCXDefault) 340 { 341 fCXDefault = FALSE; 342 cs->cx = cs->cy = 0; 343 } 344 } 336 345 if (fXDefault && !fCXDefault) fXDefault = FALSE; //CB: only x positioning doesn't work (calc.exe,cdrlabel.exe) 337 346 … … 1352 1361 { 1353 1362 dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam)))); 1354 if( getStyle() & WS_CHILD && !(getExStyle() & WS_EX_NOPARENTNOTIFY))1363 if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_NOPARENTNOTIFY)) 1355 1364 { 1356 1365 if(getParent()) {
Note:
See TracChangeset
for help on using the changeset viewer.