- Timestamp:
- May 22, 2000, 7:21:11 PM (25 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/button.cpp
r3153 r3584 1 /* $Id: button.cpp,v 1.3 4 2000-03-18 16:13:25cbratschi Exp $ */1 /* $Id: button.cpp,v 1.35 2000-05-22 17:21:06 cbratschi Exp $ */ 2 2 /* File: button.cpp -- Button type widgets 3 3 * … … 7 7 * Copyright (c) 1999 Christoph Bratschi 8 8 * 9 * Corel version: 20000 3179 * Corel version: 20000513 10 10 * (WINE version: 20000130) 11 11 * … … 924 924 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 925 925 RECT rbox, rtext, client; 926 HBRUSH hBrush; 926 HBRUSH hBrush, hOldBrush; 927 HPEN hPen, hOldPen; 928 COLORREF colour; 927 929 int textLen, delta; 928 930 char* text = NULL; … … 960 962 961 963 hBrush = GetSysColorBrush(COLOR_BTNFACE); 964 965 /* In order to make things right, draw the rectangle background! */ 966 if ( !(infoPtr->state & BUTTON_HASFOCUS) && (action == ODA_DRAWENTIRE) ) 967 { 968 colour = GetBkColor(hDC); 969 hPen = CreatePen( PS_SOLID, 1, colour ); 970 if ( hPen ) 971 { 972 hOldBrush = SelectObject( hDC, hBrush ); 973 hOldPen = SelectObject( hDC, hPen ); 974 Rectangle( hDC, client.left, client.top, client.right, client.bottom ); 975 SelectObject( hDC, hOldPen ); 976 SelectObject( hDC, hOldBrush ); 977 DeleteObject( hPen ); 978 } 979 } 962 980 963 981 if (dwStyle & BS_LEFTTEXT) -
trunk/src/user32/combo.cpp
r3261 r3584 1 /* $Id: combo.cpp,v 1.3 0 2000-03-28 17:13:46 sandervlExp $ */1 /* $Id: combo.cpp,v 1.31 2000-05-22 17:21:07 cbratschi Exp $ */ 2 2 /* 3 3 * Combo controls … … 8 8 * FIXME: roll up in Netscape 3.01. 9 9 * 10 * Corel version: 20000 31710 * Corel version: 20000513 11 11 * (WINE version: 991212) 12 12 * … … 419 419 if (posChanging->cy != newComboHeight) 420 420 { 421 lphc->droppedRect.bottom = lphc->droppedRect.top + posChanging->cy - newComboHeight;422 421 if (posChanging->cy > newComboHeight) 422 lphc->droppedRect.bottom = lphc->droppedRect.top + posChanging->cy - newComboHeight; 423 423 posChanging->cy = newComboHeight; 424 424 } … … 495 495 /* create listbox popup */ 496 496 497 lbeStyle = (LBS_NOTIFY | WS_BORDER | WS_CLIPSIBLINGS ) |497 lbeStyle = (LBS_NOTIFY | WS_BORDER | WS_CLIPSIBLINGS | WS_CHILD) | 498 498 (lpcs->style & (WS_VSCROLL | CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)); 499 499 … … 509 509 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */ 510 510 { 511 lbeStyle |= WS_ CHILD | WS_VISIBLE;511 lbeStyle |= WS_VISIBLE; 512 512 513 513 /* … … 518 518 lbeExStyle |= WS_EX_CLIENTEDGE; 519 519 } 520 else /* popup listbox */ 521 { 522 lbeStyle |= WS_POPUP; 523 lbeStyle |= WS_EX_TOOLWINDOW; 524 } 525 526 /* Dropdown ComboLBox is not a child window and we cannot pass 527 * ID_CB_LISTBOX directly because it will be treated as a menu handle. 528 */ 520 529 521 lphc->hWndLBox = CreateWindowExA(lbeExStyle, 530 522 clbName, … … 536 528 lphc->droppedRect.bottom - lphc->droppedRect.top, 537 529 lphc->hwndself, 538 ( lphc->dwStyle & CBS_DROPDOWN)? (HMENU)0 : (HMENU)ID_CB_LISTBOX,530 (HMENU)ID_CB_LISTBOX, 539 531 GetWindowLongA(lphc->hwndself,GWL_HINSTANCE), 540 532 (LPVOID)lphc ); 541 542 /*543 * The ComboLBox is a strange little beast (when it's not a CBS_SIMPLE)...544 * It's a popup window but, when you get the window style, you get WS_CHILD.545 * When created, it's parent is the combobox but, when you ask for it's parent546 * after that, you're supposed to get the desktop. (see MFC code function547 * AfxCancelModes)548 * To achieve this in Wine, we have to create it as a popup and change549 * it's style to child after the creation.550 */551 if ( (lphc->hWndLBox!= 0) &&552 (CB_GETTYPE(lphc) != CBS_SIMPLE) )553 {554 /* Not using SetWindowLongA here because it doesn't allow us to555 * change the WS_CHILD style. This code should be equivalent (excluding556 * the change in owner) to:557 * SetWindowLongA(lphc->hWndLBox, GWL_STYLE,558 * (GetWindowLongA(lphc->hWndLBox,GWL_STYLE) | WS_CHILD) & ~WS_POPUP);559 */560 STYLESTRUCT style;561 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(lphc->hWndLBox);562 563 if (!win32wnd)564 {565 /* Is this the right error? */566 SetLastError( ERROR_INVALID_WINDOW_HANDLE );567 return 0;568 }569 570 /* save old style, set new style */571 style.styleOld = win32wnd->getStyle();572 style.styleNew = (style.styleOld | WS_CHILD) & ~WS_POPUP;573 574 SendMessageA(lphc->hWndLBox,WM_STYLECHANGING,GWL_STYLE,(LPARAM)&style);575 #if 0 //CB: our code doesn't work with this style change576 win32wnd->setStyle(style.styleNew);577 #endif578 SendMessageA(lphc->hWndLBox,WM_STYLECHANGED,GWL_STYLE,(LPARAM)&style);579 580 /* Set owner to NULL - it seems to be what Windows does to a ComboLBox581 * after creation.582 */583 win32wnd->setOwner(NULL);584 }585 533 586 534 if( lphc->hWndLBox ) 587 535 { 588 536 BOOL bEdit = TRUE; 589 lbeStyle = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_LEFT ;537 lbeStyle = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_LEFT | ES_COMBO; 590 538 591 539 /* … … 622 570 if( bEdit ) 623 571 { 624 /* 625 * If the combo is a dropdown, we must resize the control to fit only 626 * the text area and button. To do this, we send a dummy resize and the 627 * WM_WINDOWPOSCHANGING message will take care of setting the height for 628 * us. 629 */ 630 if( CB_GETTYPE(lphc) != CBS_SIMPLE ) 631 { 572 if( CB_GETTYPE(lphc) != CBS_SIMPLE ) 573 { 574 /* Now do the trick with parent */ 575 SetParent(lphc->hWndLBox, HWND_DESKTOP); 576 577 /* 578 * If the combo is a dropdown, we must resize the control to fit only 579 * the text area and button. To do this, we send a dummy resize and the 580 * WM_WINDOWPOSCHANGING message will take care of setting the height for 581 * us. 582 */ 583 632 584 CBForceDummyResize(lphc); 633 585 } … … 918 870 static LRESULT COMBO_GetDlgCode(HWND hwnd,WPARAM wParam,LPARAM lParam) 919 871 { 920 return DLGC_WANTARROWS | DLGC_WANTCHARS; 872 LPHEADCOMBO lphc = (LPHEADCOMBO)GetInfoPtr(hwnd); 873 LRESULT result = DLGC_WANTARROWS | DLGC_WANTCHARS; 874 875 if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN)) 876 { 877 int vk = (int)((LPMSG)lParam)->wParam; 878 879 if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED)) 880 result |= DLGC_WANTMESSAGE; 881 } 882 return result; 921 883 } 922 884 … … 985 947 * Select listbox entry according to the contents of the edit control. 986 948 */ 987 static INT CBUpdateLBox( LPHEADCOMBO lphc )949 static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect ) 988 950 { 989 951 INT length, idx; … … 1007 969 } 1008 970 1009 if( idx >= 0 ) 1010 { 1011 /* the LB_SETCARETINDEX message should scroll the list box if required 1012 and sending LB_SETTOPINDEX can generate annoying behaviors */ 1013 /* probably superfluous but Windows sends this too */ 1014 SendMessageA( lphc->hWndLBox, LB_SETCARETINDEX, (WPARAM)idx, 0 ); 1015 } 971 SendMessageA( lphc->hWndLBox, LB_SETCURSEL, (WPARAM)(bSelect ? idx : -1), 0 ); 972 973 /* the LB_SETCARETINDEX message should scroll the list box if required 974 and sending LB_SETTOPINDEX can generate annoying behaviors */ 975 /* probably superfluous but Windows sends this too */ 976 SendMessageA( lphc->hWndLBox, LB_SETCARETINDEX, (WPARAM)(idx < 0 ? 0 : idx), 0 ); 977 SendMessageA( lphc->hWndLBox, LB_SETTOPINDEX, (WPARAM)(idx < 0 ? 0 : idx), 0 ); 978 1016 979 return idx; 1017 980 } … … 1045 1008 1046 1009 SendMessageA( lphc->hWndEdit, WM_SETTEXT, 0, pText ? (LPARAM)pText : (LPARAM)"" ); 1010 1011 lphc->wState &= ~CBF_NOEDITNOTIFY; 1012 1047 1013 if( lphc->wState & CBF_FOCUSED ) 1048 1014 SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1) ); … … 1062 1028 RECT rect; 1063 1029 int nItems = 0; 1064 int i;1065 int nHeight; 1066 int nDroppedHeight,nTempDroppedHeight;1067 int screenH1030 int nDroppedHeight; 1031 1032 HWND hWnd = 0; 1033 RECT DesktopRect; 1068 1034 1069 1035 //TRACE("[%04x]: drop down\n", CB_HWND(lphc)); … … 1076 1042 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) 1077 1043 { 1078 lphc->droppedIndex = CBUpdateLBox( lphc );1044 lphc->droppedIndex = CBUpdateLBox( lphc,TRUE ); 1079 1045 1080 1046 if( !(lphc->wState & CBF_CAPTURE) ) … … 1088 1054 lphc->droppedIndex = 0; 1089 1055 1090 SendMessageA( lphc->hWndLBox, LB_SETTOPINDEX, (WPARAM)lphc->droppedIndex, 0 ); 1056 SendMessageA( lphc->hWndLBox, LB_SETTOPINDEX, 1057 (WPARAM)(lphc->droppedIndex == LB_ERR ? 0 : lphc->droppedIndex), 0 ); 1091 1058 SendMessageA( lphc->hWndLBox, LB_CARETON, 0, 0 ); 1092 1059 } … … 1108 1075 nDroppedHeight = lphc->droppedRect.bottom - lphc->droppedRect.top; 1109 1076 nItems = (int)SendMessageA (lphc->hWndLBox, LB_GETCOUNT, 0, 0); 1110 nHeight = COMBO_YBORDERSIZE(); 1111 nTempDroppedHeight = 0;1112 for (i = 0; i < nItems; i++)1113 {1114 nHeight += (int)SendMessageA (lphc->hWndLBox, LB_GETITEMHEIGHT, i, 0); 1115 1116 /* Did we pass the limit of what can be displayed */1117 if (nHeight > nDroppedHeight) 1118 {1119 break;1077 1078 if (nItems > 0) 1079 { 1080 int nHeight; 1081 1082 nHeight = (int)SendMessageA (lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0); 1083 nHeight *= nItems; 1084 1085 if (nHeight < nDroppedHeight - COMBO_YBORDERSIZE()) 1086 nDroppedHeight = nHeight + COMBO_YBORDERSIZE(); 1120 1087 } 1121 nTempDroppedHeight = nHeight; 1088 1089 /*Now we should know screen size. */ 1090 hWnd = GetDesktopWindow(); 1091 1092 if( hWnd ) 1093 { 1094 GetClientRect( hWnd, &DesktopRect ); 1122 1095 } 1123 1096 1124 nDroppedHeight = nTempDroppedHeight;1125 1097 1126 1098 /*If height of dropped rectangle gets beyond a screen size it should go up, otherwise down.*/ 1127 screenH = GetSystemMetrics(SM_CYSCREEN); 1128 if((rect.bottom + nDroppedHeight) >= screenH) 1129 { 1130 SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.top - nDroppedHeight, 1131 lphc->droppedRect.right - lphc->droppedRect.left, 1132 nDroppedHeight, 1133 SWP_NOACTIVATE | SWP_NOREDRAW); 1134 } 1135 else 1136 { 1137 SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom, 1138 lphc->droppedRect.right - lphc->droppedRect.left, 1139 nDroppedHeight, 1140 SWP_NOACTIVATE | SWP_NOREDRAW); 1141 } 1099 if((rect.bottom + nDroppedHeight) >= DesktopRect.bottom) 1100 rect.bottom = rect.top - nDroppedHeight; 1101 1102 SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom, 1103 lphc->droppedRect.right - lphc->droppedRect.left, 1104 nDroppedHeight, 1105 SWP_NOACTIVATE | SWP_SHOWWINDOW); 1106 1142 1107 1143 1108 if( !(lphc->wState & CBF_NOREDRAW) ) 1144 1109 RedrawWindow( lphc->hwndself, NULL, 0, RDW_INVALIDATE | 1145 1110 RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN ); 1146 1111 1147 1112 EnableWindow( lphc->hWndLBox, TRUE ); 1148 //SvL: Don't activate combo listbox window or else focus will change 1149 // (this window's parent is the desktop) 1150 ShowWindow( lphc->hWndLBox, SW_SHOWNOACTIVATE); 1151 1113 if (GetCapture() != lphc->hwndself) 1114 SetCapture(lphc->hWndLBox); 1152 1115 } 1153 1116 … … 1173 1136 1174 1137 lphc->wState &= ~CBF_DROPPED; 1138 /* By hiding the window, the capture by lphc->hWndLBox will be released too */ 1139 1175 1140 ShowWindow( lphc->hWndLBox, SW_HIDE ); 1176 if(GetCapture() == lphc->hWndLBox)1177 {1178 ReleaseCapture();1179 }1180 1141 1181 1142 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) 1182 1143 { 1183 INT index = SendMessageA( lphc->hWndLBox, LB_GETCURSEL, 0, 0 ); 1184 CBUpdateEdit( lphc, index ); 1185 rect = lphc->buttonRect; 1144 rect = lphc->buttonRect; 1186 1145 } 1187 1146 else … … 1212 1171 * Used by the ComboLBox to show/hide itself in response to VK_F4, etc... 1213 1172 */ 1214 BOOL COMBO_FlipListbox( LPHEADCOMBO lphc, BOOL bRedrawButton )1173 BOOL COMBO_FlipListbox( LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton ) 1215 1174 { 1216 1175 if( lphc->wState & CBF_DROPPED ) 1217 1176 { 1218 CBRollUp( lphc, TRUE, bRedrawButton );1177 CBRollUp( lphc, ok, bRedrawButton ); 1219 1178 return FALSE; 1220 1179 } … … 1223 1182 return TRUE; 1224 1183 } 1225 1226 /***********************************************************************1227 * COMBO_GetLBWindow1228 *1229 * Edit control helper.1230 */1231 HWND COMBO_GetLBWindow( HWND hwnd )1232 {1233 LPHEADCOMBO lphc = (LPHEADCOMBO)GetInfoPtr(hwnd);1234 1235 return lphc ? lphc->hWndLBox:0;1236 }1237 1238 1184 1239 1185 /*********************************************************************** … … 1379 1325 else 1380 1326 { 1381 CBUpdateLBox( lphc );1327 CBUpdateLBox( lphc, lphc->wState & CBF_DROPPED ); 1382 1328 } 1383 1329 break; … … 1428 1374 * by arrowkeys in the dropdown listbox */ 1429 1375 1430 if( ( lphc->dwStyle &CBS_SIMPLE) ||1376 if( (CB_GETTYPE(lphc) == CBS_SIMPLE) || 1431 1377 ((lphc->wState & CBF_DROPPED) && !(lphc->wState & CBF_NOROLLUP)) ) 1432 1378 { … … 1435 1381 else lphc->wState &= ~CBF_NOROLLUP; 1436 1382 1437 if( lphc->wState & CBF_EDIT ) 1438 { 1439 INT index = SendMessageA(lphc->hWndLBox, LB_GETCURSEL, 0, 0); 1440 1441 lphc->wState |= CBF_NOLBSELECT; 1442 CBUpdateEdit( lphc, index ); 1443 /* select text in edit, as Windows does */ 1444 SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1) ); 1383 CB_NOTIFY( lphc, CBN_SELCHANGE ); 1384 1385 if( HIWORD(wParam) == LBN_SELCHANGE) 1386 { 1387 if( lphc->wState & CBF_EDIT ) 1388 { 1389 INT index = SendMessageA(lphc->hWndLBox, LB_GETCURSEL, 0, 0); 1390 1391 lphc->wState |= CBF_NOLBSELECT; 1392 CBUpdateEdit( lphc, index ); 1393 /* select text in edit, as Windows does */ 1394 SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1) ); 1395 } 1396 else 1397 InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE); 1445 1398 } 1446 else 1447 InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE); 1448 1449 CB_NOTIFY( lphc, CBN_SELCHANGE ); 1399 1450 1400 /* fall through */ 1451 1401 … … 1548 1498 } 1549 1499 1500 static LRESULT COMBO_GetTextLength(HWND hwnd,WPARAM wParam,LPARAM lParam) 1501 { 1502 LPHEADCOMBO lphc = (LPHEADCOMBO)GetInfoPtr(hwnd); 1503 1504 if (!(lphc->wState & CBF_EDIT)) 1505 { 1506 int idx = SendMessageA( lphc->hWndLBox, LB_GETCURSEL, 0, 0 ); 1507 1508 if (idx == -1) return 0; 1509 return SendMessageA( lphc->hWndLBox, LB_GETTEXTLEN, idx, 0 ); 1510 } else if (lphc->wState & CBF_EDIT) 1511 { 1512 /* Don't bother turning on CBF_NOEDITNOTIFY. */ 1513 return SendMessageA( lphc->hWndEdit, WM_GETTEXTLENGTH, wParam, lParam ); 1514 } else return CB_ERR; 1515 } 1516 1550 1517 static LRESULT COMBO_HandleText(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) 1551 1518 { … … 1558 1525 } 1559 1526 1560 if ((message == WM_GETTEXTLENGTH) && !(lphc->wState & CBF_EDIT)) 1561 { 1562 int j = SendMessageA( lphc->hWndLBox, LB_GETCURSEL, 0, 0 ); 1563 1564 if (j == -1) return 0; 1565 return SendMessageA( lphc->hWndLBox, LB_GETTEXTLEN, j, 0); 1566 } else if( lphc->wState & CBF_EDIT ) 1567 { 1527 if (lphc->wState & CBF_EDIT) 1528 { 1529 LRESULT res; 1530 1568 1531 lphc->wState |= CBF_NOEDITNOTIFY; 1569 1570 return SendMessageA( lphc->hWndEdit, message, wParam, lParam ); 1571 } else return CB_ERR; 1532 res = SendMessageA( lphc->hWndEdit, message, wParam, lParam ); 1533 lphc->wState &= ~CBF_NOEDITNOTIFY; 1534 return res; 1535 } else return CB_ERR; 1572 1536 } 1573 1537 … … 1728 1692 1729 1693 lphc->wState |= CBF_CAPTURE; 1694 SetCapture( hwnd ); 1730 1695 CBDropDown( lphc ); 1731 SetCapture( hwnd );1732 1696 } 1733 1697 if( bButton ) CBRepaintButton( lphc ); … … 1751 1715 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) 1752 1716 { 1753 INT index = CBUpdateLBox( lphc ); 1754 CBUpdateEdit( lphc, index ); 1717 INT index = CBUpdateLBox( lphc, TRUE ); 1718 1719 lphc->wState |= CBF_NOLBSELECT; 1720 CBUpdateEdit( lphc, index ); 1721 lphc->wState &= ~CBF_NOLBSELECT; 1755 1722 } 1756 ReleaseCapture(); 1757 //SvL: Don't set the capture here. Otherwise other controls don't respond the first time! 1758 // SetCapture(lphc->hWndLBox); 1723 SetCapture(lphc->hWndLBox); 1759 1724 } 1760 1725 … … 1804 1769 lphc->wState &= ~CBF_CAPTURE; 1805 1770 ReleaseCapture(); 1806 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) CBUpdateLBox( lphc );1771 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) CBUpdateLBox( lphc,TRUE ); 1807 1772 1808 1773 /* hand over pointer tracking */ … … 1860 1825 if( KEYDATA_ALT & HIWORD(lParam) ) 1861 1826 if( wParam == VK_UP || wParam == VK_DOWN ) 1862 COMBO_FlipListbox( lphc, TRUE );1863 1864 return DefWindowProcA(hwnd,WM_SYSKEYDOWN,wParam,lParam);1827 COMBO_FlipListbox( lphc,FALSE,FALSE ); 1828 1829 return 0; 1865 1830 } 1866 1831 … … 1868 1833 { 1869 1834 LPHEADCOMBO lphc = (LPHEADCOMBO)GetInfoPtr(hwnd); 1835 1836 if (((CHAR)wParam == VK_RETURN || (CHAR)wParam == VK_ESCAPE) && (lphc->wState & CBF_DROPPED)) 1837 { 1838 CBRollUp( lphc, (CHAR)wParam == VK_RETURN, FALSE ); 1839 return TRUE; 1840 } 1870 1841 1871 1842 if( lphc->wState & CBF_EDIT ) … … 2272 2243 return COMBO_GetText(hwnd,wParam,lParam); 2273 2244 2245 case WM_GETTEXTLENGTH: 2246 return COMBO_GetTextLength(hwnd,wParam,lParam); 2247 2274 2248 case WM_SETTEXT: 2275 case WM_GETTEXTLENGTH:2276 2249 case WM_CLEAR: 2277 2250 case WM_CUT: -
trunk/src/user32/edit.cpp
r3153 r3584 1 /* $Id: edit.cpp,v 1.3 8 2000-03-18 16:13:26cbratschi Exp $ */1 /* $Id: edit.cpp,v 1.39 2000-05-22 17:21:07 cbratschi Exp $ */ 2 2 /* 3 3 * Edit control … … 9 9 * Copyright 1999 Christoph Bratschi 10 10 * 11 * Corel version: 20000 31711 * Corel version: 20000513 12 12 * (WINE version: 991212) 13 13 * … … 109 109 BOOL bCaptureState; /* flag indicating whether mouse was captured */ 110 110 BOOL bEnableState; /* flag keeping the enable state */ 111 HWND hwndListBox; /* handle of ComboBox's listbox or NULL */ 111 112 /* 112 113 * only for multi line controls … … 590 591 case WM_GETDLGCODE: 591 592 //DPRINTF_EDIT_MSG32("WM_GETDLGCODE"); 592 result = DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS; 593 if (es->style & ES_WANTRETURN) 593 result = DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS; 594 595 if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN)) 594 596 { 595 LPMSG msg = (LPMSG)lParam; 596 if (msg && (msg->message == WM_KEYDOWN) && (msg->wParam == VK_RETURN)) 597 int vk = (int)((LPMSG)lParam)->wParam; 598 599 if ((GetWindowLongA(hwnd,GWL_STYLE) & ES_WANTRETURN) && vk == VK_RETURN) 600 { 597 601 result |= DLGC_WANTMESSAGE; 602 } 603 else if (es->hwndListBox && (vk == VK_RETURN || vk == VK_ESCAPE)) 604 { 605 if (SendMessageA(GetParent(hwnd), CB_GETDROPPEDSTATE, 0, 0)) 606 result |= DLGC_WANTMESSAGE; 607 } 598 608 } 599 609 break; … … 601 611 case WM_CHAR: 602 612 //DPRINTF_EDIT_MSG32("WM_CHAR"); 613 if (((CHAR)wParam == VK_RETURN || (CHAR)wParam == VK_ESCAPE) && es->hwndListBox) 614 { 615 HWND hwndParent = GetParent(hwnd); 616 617 if (SendMessageA(hwndParent, CB_GETDROPPEDSTATE, 0, 0)) 618 SendMessageA(hwndParent, WM_KEYDOWN, wParam, 0); 619 break; 620 } 603 621 EDIT_WM_Char(hwnd, es, (CHAR)wParam, (DWORD)lParam); 604 622 break; … … 3369 3387 * 3370 3388 */ 3371 static BOOL EDIT_CheckCombo(HWND hwnd, UINT msg, INT key, DWORD key_data) 3372 { 3373 HWND hLBox; 3374 3375 /******************************************************************** 3376 * This if statement used to check to see if the parent of the 3377 * edit control was a 'combobox' by comparing the ATOM of the parent 3378 * to a table of internal window control ATOMs. However, this check 3379 * would fail if the parent was a superclassed combobox (Although 3380 * having the same basic functionality of a combobox, it has a 3381 * different name and ATOM, thus defeating this check.) 3382 * 3383 * The safe way to determine if the parent is a combobox is to send it 3384 * a message only a combo box would understand. I send it a message 3385 * CB_GETCOUNT, if I get 0 then the parent is not a combobox - 3386 * return FALSE. If I get > 0, then the parent IS a combobox 3387 * (or sub/super classed derrivative thereof) 3388 ********************************************************************/ 3389 #if 0 //CB: our code 3390 if (GetClassWord(GetParent(hwnd),GCW_ATOM) == GlobalFindAtomA(COMBOBOXCLASSNAME) && 3391 (hLBox = COMBO_GetLBWindow(GetParent(hwnd)))) 3392 #else 3393 if ( 3394 ((SendMessageA(GetParent(hwnd), CB_GETCOUNT, 0, 0)) > 0) && 3395 (hLBox = COMBO_GetLBWindow(GetParent(hwnd))) 3396 ) 3397 #endif 3398 { 3399 HWND hCombo = GetParent(hwnd); 3400 BOOL bUIFlip = TRUE; 3401 3402 //TRACE_(combo)("[%04x]: handling msg %04x (%04x)\n", 3403 // wnd->hwndSelf, (UINT16)msg, (UINT16)key); 3404 3405 switch (msg) { 3406 case WM_KEYDOWN: /* Handle F4 and arrow keys */ 3407 if (key != VK_F4) { 3408 bUIFlip = (BOOL)SendMessageA(hCombo, CB_GETEXTENDEDUI, 0, 0); 3409 if (SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0)) 3410 bUIFlip = FALSE; 3411 } 3412 if (!bUIFlip) 3413 SendMessageA(hLBox, WM_KEYDOWN, (WPARAM)key, 0); 3414 else { 3415 /* make sure ComboLBox pops up */ 3416 SendMessageA(hCombo, CB_SETEXTENDEDUI, 0, 0); 3417 SendMessageA(hLBox, WM_KEYDOWN, VK_F4, 0); 3418 SendMessageA(hCombo, CB_SETEXTENDEDUI, 1, 0); 3419 } 3420 break; 3421 case WM_SYSKEYDOWN: /* Handle Alt+up/down arrows */ 3422 bUIFlip = (BOOL)SendMessageA(hCombo, CB_GETEXTENDEDUI, 0, 0); 3423 if (bUIFlip) { 3424 bUIFlip = (BOOL)SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0); 3425 SendMessageA(hCombo, CB_SHOWDROPDOWN, (bUIFlip) ? FALSE : TRUE, 0); 3426 } else 3427 SendMessageA(hLBox, WM_KEYDOWN, VK_F4, 0); 3428 break; 3429 } 3430 return TRUE; 3431 } 3432 return FALSE; 3433 } 3434 3389 static BOOL EDIT_CheckCombo(HWND hwnd, EDITSTATE *es, UINT msg, INT key, DWORD key_data) 3390 { 3391 HWND hLBox = es->hwndListBox; 3392 HWND hCombo; 3393 BOOL bDropped; 3394 int nEUI; 3395 3396 if (!hLBox) 3397 return FALSE; 3398 3399 hCombo = GetParent(hwnd); 3400 bDropped = TRUE; 3401 nEUI = 0; 3402 3403 //TRACE_(combo)("[%04x]: handling msg %04x (%04x)\n", 3404 // wnd->hwndSelf, (UINT16)msg, (UINT16)key); 3405 3406 if (key == VK_UP || key == VK_DOWN) 3407 { 3408 if (SendMessageA(hCombo, CB_GETEXTENDEDUI, 0, 0)) 3409 nEUI = 1; 3410 3411 if (msg == WM_KEYDOWN || nEUI) 3412 bDropped = (BOOL)SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0); 3413 } 3414 3415 switch (msg) 3416 { 3417 case WM_KEYDOWN: 3418 if (!bDropped && nEUI && (key == VK_UP || key == VK_DOWN)) 3419 { 3420 /* make sure ComboLBox pops up */ 3421 SendMessageA(hCombo, CB_SETEXTENDEDUI, FALSE, 0); 3422 key = VK_F4; 3423 nEUI = 2; 3424 } 3425 3426 SendMessageA(hLBox, WM_KEYDOWN, (WPARAM)key, 0); 3427 break; 3428 3429 case WM_SYSKEYDOWN: /* Handle Alt+up/down arrows */ 3430 if (nEUI) 3431 SendMessageA(hCombo, CB_SHOWDROPDOWN, bDropped ? FALSE : TRUE, 0); 3432 else 3433 SendMessageA(hLBox, WM_KEYDOWN, (WPARAM)VK_F4, 0); 3434 break; 3435 } 3436 3437 if(nEUI == 2) 3438 SendMessageA(hCombo, CB_SETEXTENDEDUI, TRUE, 0); 3439 3440 return TRUE; 3441 } 3435 3442 3436 3443 /********************************************************************* … … 3456 3463 case VK_F4: 3457 3464 case VK_UP: 3458 if (EDIT_CheckCombo(hwnd, WM_KEYDOWN, key, key_data)) 3459 break; 3460 if (key == VK_F4) 3465 if (EDIT_CheckCombo(hwnd,es, WM_KEYDOWN, key, key_data) || key == VK_F4) 3461 3466 break; 3462 3467 /* fall through */ … … 3471 3476 break; 3472 3477 case VK_DOWN: 3473 if (EDIT_CheckCombo(hwnd, WM_KEYDOWN, key, key_data))3478 if (EDIT_CheckCombo(hwnd,es, WM_KEYDOWN, key, key_data)) 3474 3479 break; 3475 3480 /* fall through */ … … 3491 3496 if (es->style & ES_MULTILINE) 3492 3497 EDIT_MovePageUp_ML(hwnd, es, shift); 3498 else 3499 EDIT_CheckCombo(hwnd, es, WM_KEYDOWN, key, key_data); 3493 3500 break; 3494 3501 case VK_NEXT: 3495 3502 if (es->style & ES_MULTILINE) 3496 3503 EDIT_MovePageDown_ML(hwnd, es, shift); 3504 else 3505 EDIT_CheckCombo(hwnd, es, WM_KEYDOWN, key, key_data); 3497 3506 break; 3498 3507 case VK_DELETE: … … 3709 3718 } 3710 3719 3720 if (es->style & ES_COMBO) 3721 es->hwndListBox = GetDlgItem(cs->hwndParent, ID_CB_LISTBOX); 3722 3711 3723 if (es->style & ES_MULTILINE) { 3712 3724 es->buffer_size = BUFSTART_MULTI; … … 4076 4088 return 0; 4077 4089 } else if ((key == VK_UP) || (key == VK_DOWN)) 4078 if (EDIT_CheckCombo(hwnd, WM_SYSKEYDOWN, key, key_data)) 4090 { 4091 if (EDIT_CheckCombo(hwnd,es, WM_SYSKEYDOWN, key, key_data)) 4079 4092 return 0; 4093 } 4080 4094 return DefWindowProcA(hwnd, WM_SYSKEYDOWN, (WPARAM)key, (LPARAM)key_data); 4081 4095 } -
trunk/src/user32/listbox.cpp
r3153 r3584 1 /* $Id: listbox.cpp,v 1.2 4 2000-03-18 16:13:30cbratschi Exp $ */1 /* $Id: listbox.cpp,v 1.25 2000-05-22 17:21:08 cbratschi Exp $ */ 2 2 /* 3 3 * Listbox controls … … 6 6 * Copyright 1999 Christoph Bratschi (ported from WINE) 7 7 * 8 * Corel version: 20000 3178 * Corel version: 20000513 9 9 * (WINE version: 991212) 10 10 * … … 34 34 - VK_LINEDOWN -> bottom most item not always visible 35 35 - performance not optimized 36 - ownerdraw is broken -> toolbar customize dialog37 36 - first item selection mark not redrawn on new selection 37 - LISTBOX_HandleLButtonDownCombo fails, bug in GetWindowRect or ClientToScreen! 38 I clicked on the vertical scrollbar, this happens: 39 t1: SendInternalMessageA WM_LBUTTONDOWN for 68000009 1 1d00c6 40 t1: GetClientRect of 68000009 returned (0,0) (191,110) 41 t1: USER32: GetCapture returned 68000009 42 t1: GetWindowRect 68000009 (450,130) (657,242) 43 t1: ClientToScreen 68000009 (198,29) -> (424,108) 44 mouse position is ok, but screen point is outside window rect!!! 45 the new point is left-top and not on the right!!! 38 46 */ 39 47 … … 112 120 #define SEND_NOTIFICATION(hwnd,descr,code) \ 113 121 (SendMessageA( (descr)->owner, WM_COMMAND, \ 114 MAKEWPARAM( (((descr)->lphc)?ID_CB_LISTBOX:GetWindowLongA(hwnd,GWL_ID)), (code)), hwnd ))122 MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID), (code)), hwnd )) 115 123 116 124 /* Current timer status */ … … 482 490 { 483 491 DRAWITEMSTRUCT dis; 484 UINT id = (descr->lphc) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);492 UINT id = GetWindowLongA(hwnd,GWL_ID); 485 493 486 494 if (!item) … … 714 722 { 715 723 COMPAREITEMSTRUCT cis; 716 UINT id = (descr->lphc) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);724 UINT id = GetWindowLongA(hwnd,GWL_ID); 717 725 718 726 cis.CtlType = ODT_LISTBOX; … … 887 895 INT focusItem; 888 896 897 if (descr->style & LBS_NOREDRAW) return 0; 898 889 899 SetRect( &rect, 0, 0, descr->width, descr->height ); 890 if (descr->style & LBS_NOREDRAW) return 0;891 900 if (descr->style & LBS_MULTICOLUMN) 892 901 rect.right = rect.left + descr->column_width; … … 966 975 /* Paint the focus item now */ 967 976 descr->focus_item = focusItem; 968 if (focusRect.top != focusRect.bottom )977 if (focusRect.top != focusRect.bottom && descr->caret_on) 969 978 LISTBOX_DrawItem( hwnd, descr, hdc, &focusRect, descr->focus_item, ODA_FOCUS ); 970 979 … … 1281 1290 { 1282 1291 INT oldsel = descr->selected_item; 1283 //SvL: Why was this commented out??? (enabled in latest wine code) 1284 if (index == oldsel) return LB_OKAY; 1285 1286 if (oldsel != -1) descr->items[oldsel].selected = FALSE; 1287 if (index != -1) descr->items[index].selected = TRUE; 1288 descr->selected_item = index; 1289 if (oldsel != -1) LISTBOX_RepaintItem( hwnd, descr, oldsel, ODA_SELECT); 1290 if (index != -1) LISTBOX_RepaintItem( hwnd, descr, index, ODA_SELECT ); 1291 if (send_notify && descr->nb_items) SEND_NOTIFICATION( hwnd, descr, 1292 (index != -1) ? LBN_SELCHANGE : LBN_SELCANCEL ); 1293 else 1294 if( descr->lphc ) /* set selection change flag for parent combo */ 1295 descr->lphc->wState |= CBF_SELCHANGE; 1296 } 1297 return LB_OKAY; 1292 1293 if (index != oldsel) 1294 { 1295 if (oldsel != -1) descr->items[oldsel].selected = FALSE; 1296 if (index != -1) descr->items[index].selected = TRUE; 1297 1298 descr->selected_item = index; 1299 1300 if (oldsel != -1) 1301 LISTBOX_RepaintItem( hwnd, descr, oldsel, ODA_SELECT); 1302 if (index != -1) 1303 LISTBOX_RepaintItem( hwnd, descr, index, ODA_SELECT ); 1304 1305 if (send_notify && descr->nb_items) 1306 SEND_NOTIFICATION( hwnd, descr, (index != -1) 1307 ? LBN_SELCHANGE : LBN_SELCANCEL ); 1308 else 1309 if( descr->lphc ) 1310 /* set selection change flag for parent combo */ 1311 descr->lphc->wState |= CBF_SELCHANGE; 1312 } 1313 } 1314 1315 /* "If the index parameter is -1, the return value is LB_ERR even though 1316 * no error occurred." (At least for single selection boxes.) */ 1317 return (index == -1) ? LB_ERR : LB_OKAY; 1298 1318 } 1299 1319 … … 1396 1416 { 1397 1417 MEASUREITEMSTRUCT mis; 1398 UINT id = (descr->lphc) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);1418 UINT id = GetWindowLongA(hwnd,GWL_ID); 1399 1419 1400 1420 mis.CtlType = ODT_LISTBOX; … … 1490 1510 { 1491 1511 DELETEITEMSTRUCT dis; 1492 UINT id = (descr->lphc) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);1512 UINT id = GetWindowLongA(hwnd,GWL_ID); 1493 1513 1494 1514 dis.CtlType = ODT_LISTBOX; … … 1977 1997 1978 1998 static LRESULT LISTBOX_HandleLButtonDownCombo( HWND hwnd, LB_DESCR *pDescr, 1979 WPARAM wParam, INT x, INT y)1999 UINT msg,WPARAM wParam, INT x, INT y) 1980 2000 { 1981 2001 RECT clientRect, screenRect; … … 1989 2009 if(PtInRect(&clientRect, mousePos)) 1990 2010 { 1991 /* MousePos is in client, resume normal processing */ 1992 return LISTBOX_HandleLButtonDown( hwnd, pDescr, wParam, x, y); 2011 /* MousePos is in client, resume normal processing */ 2012 if (msg == WM_LBUTTONDOWN) 2013 { 2014 pDescr->lphc->droppedIndex = pDescr->nb_items ? pDescr->selected_item : -1; 2015 return LISTBOX_HandleLButtonDown( hwnd, pDescr, wParam, x, y); 2016 } 2017 else if (pDescr->style & LBS_NOTIFY) 2018 SEND_NOTIFICATION( hwnd, pDescr, LBN_DBLCLK ); 2019 return 0; 1993 2020 } 1994 2021 else 1995 2022 { 1996 POINT screenMousePos; 1997 HWND hWndOldCapture; 1998 1999 /* Check the Non-Client Area */ 2000 screenMousePos = mousePos; 2001 hWndOldCapture = GetCapture(); 2023 POINT screenMousePos; 2024 RECT screenRect; 2025 HWND hWndOldCapture; 2026 //CB: read buglist 2027 /* Check the Non-Client Area */ 2028 screenMousePos = mousePos; 2029 hWndOldCapture = GetCapture(); 2030 GetWindowRect(hwnd,&screenRect); 2031 ClientToScreen(hwnd,&screenMousePos); 2032 2033 if (!PtInRect(&screenRect,screenMousePos)) 2034 { 2002 2035 ReleaseCapture(); 2003 GetWindowRect(hwnd, &screenRect); 2004 ClientToScreen(hwnd, &screenMousePos); 2005 2006 if(!PtInRect(&screenRect, screenMousePos)) 2007 { 2008 /* Close The Drop Down */ 2009 SEND_NOTIFICATION( hwnd, pDescr, LBN_SELCANCEL ); 2010 return 0; 2011 } 2012 else 2013 { 2014 /* Check to see the NC is a scrollbar */ 2015 INT nHitTestType=0; 2016 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 2017 /* Check Vertical scroll bar */ 2018 if (dwStyle & WS_VSCROLL) 2019 { 2020 clientRect.right += GetSystemMetrics(SM_CXVSCROLL); 2021 if (PtInRect( &clientRect, mousePos )) 2022 { 2023 nHitTestType = HTVSCROLL; 2024 } 2025 } 2026 /* Check horizontal scroll bar */ 2027 if (dwStyle & WS_HSCROLL) 2028 { 2029 clientRect.bottom += GetSystemMetrics(SM_CYHSCROLL); 2030 if (PtInRect( &clientRect, mousePos )) 2031 { 2032 nHitTestType = HTHSCROLL; 2033 } 2034 } 2035 /* Windows sends this message when a scrollbar is clicked 2036 */ 2037 2038 if(nHitTestType != 0) 2039 { 2040 SendMessageA(hwnd, WM_NCLBUTTONDOWN, nHitTestType, 2041 MAKELONG(screenMousePos.x, screenMousePos.y)); 2042 } 2043 /* Resume the Capture after scrolling is complete 2044 */ 2045 if(hWndOldCapture != 0) 2046 { 2047 SetCapture(hWndOldCapture); 2048 } 2049 } 2036 LISTBOX_SetSelection( hwnd, pDescr, pDescr->lphc->droppedIndex, FALSE, FALSE ); 2037 COMBO_FlipListbox( pDescr->lphc, FALSE, FALSE ); 2038 2039 return 0; 2040 } else 2041 { 2042 /* Check to see the NC is a scrollbar */ 2043 INT nHitTestType = SendMessageA(hwnd,WM_NCHITTEST,0,MAKELONG(screenMousePos.x,screenMousePos.y)); 2044 2045 /* Windows sends this message when a scrollbar is clicked 2046 */ 2047 if (nHitTestType != HTCLIENT) 2048 { 2049 SendMessageA(hwnd,(msg == WM_LBUTTONDOWN) ? WM_NCLBUTTONDOWN:WM_NCLBUTTONDBLCLK,nHitTestType,MAKELONG(screenMousePos.x,screenMousePos.y)); 2050 } 2051 2052 /* Resume the Capture after scrolling is complete 2053 */ 2054 if (hWndOldCapture) 2055 { 2056 SetCapture(hWndOldCapture); 2057 } 2058 } 2050 2059 } 2051 2060 return 0; … … 2135 2144 { 2136 2145 INT index; 2137 TIMER_DIRECTION dir ;2146 TIMER_DIRECTION dir = LB_TIMER_NONE; 2138 2147 2139 2148 if (GetCapture() != hwnd) return 0; … … 2156 2165 x = descr->width - 1; 2157 2166 } 2158 else dir = LB_TIMER_NONE; /* inside */2159 2167 } 2160 2168 else … … 2162 2170 if (y < 0) dir = LB_TIMER_UP; /* above */ 2163 2171 else if (y >= descr->height) dir = LB_TIMER_DOWN; /* below */ 2164 else dir = LB_TIMER_NONE; /* inside */2165 2172 } 2166 2173 … … 2356 2363 descr->nb_tabs = 0; 2357 2364 descr->tabs = NULL; 2358 descr->caret_on = TRUE;2365 descr->caret_on = lphc ? FALSE:TRUE; 2359 2366 descr->in_focus = FALSE; 2360 2367 descr->captured = FALSE; … … 2388 2395 else 2389 2396 { 2390 UINT id = (descr->lphc ) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);2397 UINT id = GetWindowLongA(hwnd,GWL_ID); 2391 2398 2392 2399 mis.CtlType = ODT_LISTBOX; … … 3062 3069 } 3063 3070 case WM_LBUTTONDOWN: 3064 return LISTBOX_HandleLButtonDownCombo( hwnd, descr, wParam, 3071 case WM_LBUTTONDBLCLK: 3072 return LISTBOX_HandleLButtonDownCombo( hwnd, descr,msg, wParam, 3065 3073 (INT16)LOWORD(lParam), (INT16)HIWORD(lParam)); 3066 3074 case WM_MOUSEACTIVATE: … … 3077 3085 && (wParam == VK_DOWN || wParam == VK_UP)) ) 3078 3086 { 3079 COMBO_FlipListbox( lphc, FALSE );3087 COMBO_FlipListbox( lphc, FALSE, FALSE ); 3080 3088 return 0; 3081 3089 } -
trunk/src/user32/menu.cpp
r3501 r3584 1 /* $Id: menu.cpp,v 1.2 1 2000-05-09 18:56:56 sandervlExp $*/1 /* $Id: menu.cpp,v 1.22 2000-05-22 17:21:09 cbratschi Exp $*/ 2 2 /* 3 3 * Menu functions … … 9 9 * Copyright 1999 Christoph Bratschi 10 10 * 11 * Corel version: 20000 31711 * Corel version: 200005313 12 12 * (WINE version: 20000130) 13 13 * … … 837 837 lpitem->rect.right += mis.itemWidth; 838 838 839 839 //SvL: Add size of space between two menu items (fixes RealPlayer 7 menu) 840 840 if(menuBar) 841 841 { … … 1599 1599 if (!pTopPopupWnd) 1600 1600 { 1601 1601 DebugInt3(); 1602 1602 return FALSE; 1603 1603 } … … 1616 1616 if( !menu->hWnd ) 1617 1617 { 1618 1618 DebugInt3(); 1619 1619 return FALSE; 1620 1620 } … … 2187 2187 if(win32wnd==NULL) { 2188 2188 //SvL: This happens in Moraff's YourJongg 2.0, return here 2189 2189 //TODO: Check if this is supposed to happen at all... 2190 2190 return (HMENU)0; 2191 2191 } 2192 2192 2193 2193 ht = win32wnd->HandleNCHitTest(pt); … … 2433 2433 functionality. 2434 2434 */ 2435 2435 pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,hPtMenu,FALSE,wFlags,&pmt->pt); 2436 2436 return TRUE; 2437 2437 } … … 2784 2784 goto buttondown; 2785 2785 case WM_LBUTTONDBLCLK: 2786 2787 2788 2789 2790 2791 2786 if (bSysMenu && (hmenu == mt.hTopMenu)) 2787 { 2788 fEndMenu = TRUE; 2789 break; 2790 } 2791 /* fall through */ 2792 2792 case WM_LBUTTONDOWN: 2793 2793 /* If the message belongs to the menu, removes it from the queue */ 2794 2794 /* Else, end menu tracking */ 2795 2795 2796 2796 buttondown: 2797 2797 /* Forcing mouse popup NOW - Ensure timer doesn't popup menu also */ 2798 2798 mouseOverMenuID = -1; 2799 2799 fRemove = MENU_ButtonDown( &mt, hmenu, wFlags ); 2800 2800 fEndMenu = !fRemove; … … 2809 2809 { 2810 2810 /* Forcing mouse popup NOW - Ensure timer doesn't popup menu also */ 2811 2811 mouseOverMenuID = -1; 2812 2812 executedMenuId = MENU_ButtonUp( &mt, hmenu, wFlags); 2813 2813 … … 2852 2852 MENU_FindItemByCoords( ptmenu, mt.pt, &id ); 2853 2853 2854 2855 2856 2857 2854 /* If it is over the same item that set up the timer originally .... */ 2855 if (mouseOverMenuID != -1 && mouseOverMenuID == id) 2856 { 2857 /* .... Pop up the menu */ 2858 2858 mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, hmenu, FALSE, wFlags,&mt.pt); 2859 2859 } 2860 2860 } 2861 2861 … … 2968 2968 } /* switch(msg.message) - kbd */ 2969 2969 } 2970 2971 2972 2970 else if (msg.message == WM_SYSCOMMAND) 2971 { 2972 /* The user clicked on the system menu/button */ 2973 2973 fEndMenu = TRUE; 2974 2974 break; 2975 2975 } 2976 2976 else 2977 2977 { … … 3482 3482 //TRACE("menu=%04x item=%04x ptr=%p len=%d flags=%04x\n", 3483 3483 // hMenu, wItemID, str, nMaxSiz, wFlags ); 3484 if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return 0; 3485 if (!IS_STRING_ITEM(item->fType)) return 0; 3486 if (!str || !nMaxSiz) return strlen(item->text); 3484 3485 item = MENU_FindItem( &hMenu, &wItemID, wFlags ); 3486 3487 if (!str || !nMaxSiz) 3488 { 3489 if (item && IS_STRING_ITEM(item->fType)) 3490 return strlen(item->text); 3491 else 3492 return 0; 3493 } 3494 3487 3495 str[0] = '\0'; 3488 lstrcpynA( str, item->text, nMaxSiz ); 3489 //TRACE("returning '%s'\n", str ); 3496 3497 if (item) 3498 { 3499 if (!IS_STRING_ITEM(item->fType)) return 0; 3500 lstrcpynA( str, item->text, nMaxSiz ); 3501 } 3502 3490 3503 return strlen(str); 3491 3504 } … … 3504 3517 //TRACE("menu=%04x item=%04x ptr=%p len=%d flags=%04x\n", 3505 3518 // hMenu, wItemID, str, nMaxSiz, wFlags ); 3506 if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return 0; 3507 if (!IS_STRING_ITEM(item->fType)) return 0; 3508 if (!str || !nMaxSiz) return strlen(item->text); 3519 3520 item = MENU_FindItem( &hMenu, &wItemID, wFlags ); 3521 3522 if (!str || !nMaxSiz) 3523 { 3524 if (item && IS_STRING_ITEM(item->fType)) 3525 return strlen(item->text); 3526 else 3527 return 0; 3528 } 3529 3509 3530 str[0] = '\0'; 3510 lstrcpynAtoW( str, item->text, nMaxSiz ); 3531 3532 if (item) 3533 { 3534 if (!IS_STRING_ITEM(item->fType)) return 0; 3535 lstrcpynAtoW( str, item->text, nMaxSiz ); 3536 } 3537 3511 3538 return lstrlenW(str); 3512 3539 } … … 4727 4754 * IsMenuActive (Internal) 4728 4755 */ 4729 BOOL IsMenuActive( )4756 BOOL IsMenuActive(void) 4730 4757 { 4731 4758 return pTopPopupWnd && (GetWindowLongA(pTopPopupWnd,GWL_STYLE) & WS_VISIBLE); -
trunk/src/user32/pmframe.cpp
r3525 r3584 1 /* $Id: pmframe.cpp,v 1.5 3 2000-05-12 18:09:41 sandervlExp $ */1 /* $Id: pmframe.cpp,v 1.54 2000-05-22 17:21:10 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Frame Managment Code for OS/2 … … 168 168 case WM_HITTEST: 169 169 { 170 171 172 170 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 171 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 172 } 173 173 if(win32wnd && win32wnd->IsWindowCreated()) 174 174 { … … 192 192 case WM_BUTTON3DBLCLK: 193 193 { 194 195 196 194 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 195 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 196 } 197 197 if(win32wnd && win32wnd->IsWindowCreated()) 198 198 { … … 217 217 case WM_MOUSEMOVE: 218 218 { 219 220 221 219 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 220 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 221 } 222 222 if(win32wnd && win32wnd->IsWindowCreated()) 223 223 win32wnd->MsgMouseMove(pWinMsg); 224 224 RestoreOS2TIB(); 225 225 return (MRESULT)TRUE; … … 230 230 dprintf(("PMFRAME: WM_PAINT")); 231 231 if(win32wnd->getStyle() & WS_MINIMIZE_W) 232 232 goto RunDefFrameProc; 233 233 if(win32wnd->IsWindowCreated()) 234 234 win32wnd->MsgNCPaint(); 235 235 236 236 goto RunDefWndProc; … … 441 441 442 442 case WM_SHOW: 443 443 dprintf(("PMFRAME: WM_SHOW")); 444 444 break; 445 445 … … 497 497 498 498 case WM_VRNENABLED: 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 499 if(!win32wnd->isComingToTop() && ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == WS_EX_TOPMOST_W)) 500 { 501 HWND hwndrelated; 502 Win32BaseWindow *topwindow; 503 504 win32wnd->setComingToTop(TRUE); 505 506 hwndrelated = WinQueryWindow(hwnd, QW_PREV); 507 dprintf(("WM_VRNENABLED hwndrelated = %x (hwnd=%x)", hwndrelated, hwnd)); 508 topwindow = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndrelated); 509 if(topwindow == NULL || ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == 0)) { 510 //put window at the top of z order 511 WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); 512 } 513 514 win32wnd->setComingToTop(FALSE); 515 break; 516 } 517 goto RunDefFrameProc; 518 518 519 519 default: -
trunk/src/user32/win32wbase.cpp
r3581 r3584 1 /* $Id: win32wbase.cpp,v 1.19 1 2000-05-20 14:57:24 sandervlExp $ */1 /* $Id: win32wbase.cpp,v 1.192 2000-05-22 17:21:11 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 208 208 } 209 209 if(propertyList) { 210 210 removeWindowProps(); 211 211 } 212 212 } … … 503 503 #if 0 504 504 if(((dwStyle & (WS_CAPTION|WS_POPUP)) == WS_CAPTION) && (getParent() == NULL || getParent() == windowDesktop)) { 505 505 fTaskList = TRUE; 506 506 } 507 507 #else … … 867 867 //SvL: Don't send WM_(NC)ACTIVATE messages when the window is being destroyed 868 868 if(fDestroyWindowCalled) { 869 869 return 0; 870 870 } 871 871 … … 916 916 //SvL: Don't send WM_(NC)ACTIVATE messages when the window is being destroyed 917 917 if(fDestroyWindowCalled) { 918 918 return 0; 919 919 } 920 920 … … 927 927 //SvL: Don't send WM_(NC)ACTIVATE messages when the window is being destroyed 928 928 if(fDestroyWindowCalled) { 929 929 return 0; 930 930 } 931 931 return SendInternalMessageA(WM_KILLFOCUS, hwnd, 0); … … 1056 1056 RECT client = rectClient; 1057 1057 1058 1058 if ((rect.left >= client.left) && (rect.left < client.right) && 1059 1059 (rect.right >= client.left) && (rect.right < client.right) && 1060 1060 (rect.top >= client.top) && (rect.top < client.bottom) && 1061 1061 (rect.bottom >= client.top) && (rect.bottom < client.bottom)) 1062 1062 { 1063 1064 } 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 } 1076 else 1063 return 0; 1064 } 1065 1066 dprintf(("MsgNCPaint (%d,%d)(%d,%d)", rect.left, rect.top, rect.right, rect.bottom)); 1067 hrgn = CreateRectRgnIndirect(&rect); 1068 if (!hrgn) return 0; 1069 1070 rc = SendInternalMessageA(WM_NCPAINT,hrgn,0); 1071 1072 DeleteObject(hrgn); 1073 1074 return rc; 1075 } 1076 else return 0; 1077 1077 } 1078 1078 //****************************************************************************** … … 1329 1329 if ((dwStyle & WS_CAPTION) == WS_CAPTION) 1330 1330 { 1331 //HandleNCPaint((HRGN)1);1331 HandleNCPaint((HRGN)1); 1332 1332 OSLibWinSetWindowText(OS2HwndFrame,(LPSTR)windowNameA); 1333 1333 } … … 1638 1638 if((HIWORD(lParam) & KEYDATA_ALT) && wParam) 1639 1639 { 1640 if (wParam == VK_TAB || wParam == VK_ESCAPE) 1641 1640 if (wParam == VK_TAB || wParam == VK_ESCAPE) 1641 break; 1642 1642 if (wParam == VK_SPACE && (getStyle() & WS_CHILD)) { 1643 1644 1643 getParent()->SendMessageA(Msg, wParam, lParam ); 1644 } 1645 1645 else SendMessageA(WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam ); 1646 1646 } 1647 1647 else /* check for Ctrl-Esc */ 1648 1649 1648 if (wParam != VK_ESCAPE) MessageBeep(0); 1649 break; 1650 1650 } 1651 1651 … … 2037 2037 ULONG showstate = 0; 2038 2038 HWND hWinAfter; 2039 BOOL rc ;2039 BOOL rc,wasVisible,showFlag; 2040 2040 2041 2041 dprintf(("ShowWindow %x %x", getWindowHandle(), nCmdShow)); … … 2048 2048 break; 2049 2049 case SW_HIDE: 2050 if (!wasVisible) return wasVisible; 2051 if(GetCapture() == getWindowHandle() || IsChild(GetCapture())) 2052 ReleaseCapture(); 2053 2050 2054 showstate = SWPOS_HIDE; 2051 2055 break; … … 2077 2081 2078 2082 /* We can't activate a child window (WINE) */ 2079 if( getStyle() & WS_CHILD)2083 if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_MDICHILD)) 2080 2084 showstate &= ~SWPOS_ACTIVATE; 2081 2085 … … 2085 2089 else setStyle(getStyle() & ~WS_VISIBLE); 2086 2090 2091 showFlag = (nCmdShow != SW_HIDE); 2092 2087 2093 rc = OSLibWinShowWindow(OS2HwndFrame, showstate); 2088 2094 OSLibWinShowWindow(OS2Hwnd, showstate); 2089 2095 2090 SendInternalMessageA(WM_SHOWWINDOW, (showstate & SWPOS_SHOW) ? 1 : 0, 0); 2096 //CB: PMFrame: WM_MINMAXFRAME SWP_* handling isn't always successful! 2097 if ((showstate & SWPOS_MAXIMIZE) == SWPOS_MAXIMIZE) 2098 setStyle((getStyle() & ~WS_MINIMIZE) | WS_MAXIMIZE); 2099 else if ((showstate & SWPOS_MINIMIZE) == SWPOS_MINIMIZE) 2100 setStyle((getStyle() & ~WS_MAXIMIZE) | WS_MINIMIZE); 2101 else if ((showstate & SWPOS_RESTORE) == SWPOS_RESTORE) 2102 setStyle(getStyle() & ~(WS_MINIMIZE | WS_MAXIMIZE)); 2091 2103 2092 2104 if (flags & WIN_NEED_SIZE) … … 2140 2152 else 2141 2153 { 2142 if (!(fuFlags & SWP_SHOWWINDOW)) 2143 2144 2145 } 2146 2147 if(cx < 0) cx = 0; 2154 if (!(fuFlags & SWP_SHOWWINDOW)) 2155 fuFlags |= SWP_NOREDRAW; 2156 fuFlags &= ~SWP_HIDEWINDOW; 2157 } 2158 2159 if(cx < 0) cx = 0; 2148 2160 if(cy < 0) cy = 0; 2149 2161 … … 2159 2171 fuFlags |= SWP_NOACTIVATE; /* Already active */ 2160 2172 } 2161 else 2173 else 2162 2174 if((getStyle() & (WS_POPUP | WS_CHILD)) != WS_CHILD ) 2163 2175 { … … 2165 2177 { 2166 2178 fuFlags &= ~SWP_NOZORDER; 2167 hwndInsertAfter = HWND_TOP;2179 hwndInsertAfter = HWND_TOP; 2168 2180 } 2169 2181 } … … 2219 2231 2220 2232 if(fuFlags & SWP_SHOWWINDOW && !IsWindowVisible()) { 2221 2222 2223 2233 setStyle(getStyle() | WS_VISIBLE); 2234 //SvL: TODO: Send WM_SHOWWINDOW?? 2235 OSLibWinShowWindow(OS2Hwnd, SWPOS_SHOW); 2224 2236 } 2225 2237 else 2226 2238 if(fuFlags & SWP_HIDEWINDOW && IsWindowVisible()) { 2227 2228 2229 2239 setStyle(getStyle() & ~WS_VISIBLE); 2240 //SvL: TODO: Send WM_SHOWWINDOW?? 2241 OSLibWinShowWindow(OS2Hwnd, SWPOS_HIDE); 2230 2242 } 2231 2243 rc = OSLibWinSetMultWindowPos(&swp, 1); … … 2233 2245 #ifdef DEBUG 2234 2246 if(fShow) { 2235 2247 dprintf(("Frame style 0x%08x, client style 0x%08x", OSLibQueryWindowStyle(OS2HwndFrame), OSLibQueryWindowStyle(OS2Hwnd))); 2236 2248 } 2237 2249 #endif … … 2306 2318 { 2307 2319 SetWindowPos(0, 0, 0, 0, 0, SWP_HIDEWINDOW | 2308 2320 SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE); 2309 2321 if(!::IsWindow(hwnd)) 2310 2322 { 2311 2323 return TRUE; 2312 2324 } 2313 2325 } … … 2674 2686 rc = (getStyle() & WS_DISABLED) != 0; 2675 2687 if(rc && !fEnable) { 2676 2688 SendMessageA(WM_CANCELMODE, 0, 0); 2677 2689 } 2678 2690 OSLibWinEnableWindow(OS2HwndFrame, fEnable); 2679 2691 if(fEnable == FALSE) { 2680 2681 2682 2683 2684 2692 //SvL: No need to clear focus as PM already does this 2693 if(getWindowHandle() == GetCapture()) { 2694 ReleaseCapture(); /* A disabled window can't capture the mouse */ 2695 dprintf(("Released capture for window %x that is being disabled", getWindowHandle())); 2696 } 2685 2697 } 2686 2698 return rc; … … 2984 2996 } 2985 2997 //****************************************************************************** 2986 //Note: Should return NULL if window is frame window! (IsOS2FrameWindowHandle depends on this 2998 //Note: Should return NULL if window is frame window! (IsOS2FrameWindowHandle depends on this 2987 2999 // behaviour) 2988 3000 //****************************************************************************** … … 3060 3072 3061 3073 if(window->getOS2FrameWindowHandle() == hwndOS2) { 3062 3074 return TRUE; 3063 3075 } 3064 3076 return FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.