Changeset 2383 for trunk/src/user32/win32wbase.cpp
- Timestamp:
- Jan 9, 2000, 3:38:30 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbase.cpp
r2374 r2383 1 /* $Id: win32wbase.cpp,v 1.13 4 2000-01-08 14:41:27sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.135 2000-01-09 14:37:11 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 151 151 fParentDC = FALSE; 152 152 fDefWndProcCalled = FALSE; 153 fWindowRectChanged = FALSE; //Set when parent window has been moved; cleared when window rect is updated 153 154 154 155 windowNameA = NULL; … … 193 194 isIcon = FALSE; 194 195 lastHitTestVal = HTOS_NORMAL; 195 fIgnoreHitTest = FALSE;196 196 owner = NULL; 197 197 windowClass = 0; … … 645 645 subclassScrollBars(dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL); 646 646 647 // FrameSubclassTitleBar(this); 647 if(!fOS2Look) 648 FrameSubclassTitleBar(this); 648 649 649 650 fakeWinBase.hwndThis = OS2Hwnd; … … 864 865 } 865 866 //****************************************************************************** 866 //****************************************************************************** 867 ULONG Win32BaseWindow::MsgHitTest(MSG *msg) 868 { 869 lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)msg->pt.x, (USHORT)msg->pt.y)); 870 dprintf2(("MsgHitTest returned %x", lastHitTestVal)); 871 872 if (lastHitTestVal == HTERROR) 873 return HTOS_ERROR; 874 875 #if 0 //CB: problems with groupboxes, internal handling is better 876 if (lastHitTestVal == HTTRANSPARENT) 877 return HTOS_TRANSPARENT; 878 #endif 879 880 return HTOS_NORMAL; 867 // NOTE: WM_NCHITTEST messages are sent whenever the mouse cursor moves or a mouse button is clicked/released 868 // (directly when receiving those messages) 869 //****************************************************************************** 870 ULONG Win32BaseWindow::MsgHitTest(ULONG x, ULONG y) 871 { 872 lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)x, (USHORT)y)); 873 dprintf(("MsgHitTest (%d,%d) (%d,%d) (%d,%d) returned %x", x, y, rectWindow.left, rectWindow.right, rectWindow.top, rectWindow.bottom, lastHitTestVal)); 874 return lastHitTestVal; 881 875 } 882 876 //****************************************************************************** … … 1239 1233 } 1240 1234 /*********************************************************************** 1241 * NC_HandleNCLButtonDown1242 *1243 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().1244 */1245 LONG Win32BaseWindow::HandleNCLButtonDown(WPARAM wParam,LPARAM lParam)1246 {1247 switch(wParam) /* Hit test */1248 {1249 case HTCAPTION:1250 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);1251 break;1252 1253 case HTSYSMENU:1254 SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);1255 break;1256 1257 case HTMENU:1258 SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU,lParam);1259 break;1260 1261 case HTHSCROLL:1262 SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);1263 break;1264 1265 case HTVSCROLL:1266 SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);1267 break;1268 1269 case HTLEFT:1270 case HTRIGHT:1271 case HTTOP:1272 case HTTOPLEFT:1273 case HTTOPRIGHT:1274 case HTBOTTOM:1275 case HTBOTTOMLEFT:1276 case HTBOTTOMRIGHT:1277 /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */1278 SendInternalMessageA(WM_SYSCOMMAND,SC_SIZE+wParam-2,lParam);1279 break;1280 case HTBORDER:1281 break;1282 }1283 1284 return 0;1285 }1286 //******************************************************************************1287 //******************************************************************************1288 LONG Win32BaseWindow::HandleNCLButtonUp(WPARAM wParam,LPARAM lParam)1289 {1290 switch(wParam) /* Hit test */1291 {1292 case HTMINBUTTON:1293 SendInternalMessageA(WM_SYSCOMMAND,SC_MINIMIZE,lParam);1294 break;1295 1296 case HTMAXBUTTON:1297 SendInternalMessageA(WM_SYSCOMMAND,SC_MAXIMIZE,lParam);1298 break;1299 1300 case HTCLOSE:1301 SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);1302 break;1303 }1304 1305 return 0;1306 }1307 /***********************************************************************1308 * NC_HandleNCLButtonDblClk1309 *1310 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().1311 */1312 LONG Win32BaseWindow::HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam)1313 {1314 /*1315 * if this is an icon, send a restore since we are handling1316 * a double click1317 */1318 if (dwStyle & WS_MINIMIZE)1319 {1320 SendInternalMessageA(WM_SYSCOMMAND,SC_RESTORE,lParam);1321 return 0;1322 }1323 1324 switch(wParam) /* Hit test */1325 {1326 case HTCAPTION:1327 /* stop processing if WS_MAXIMIZEBOX is missing */1328 if (dwStyle & WS_MAXIMIZEBOX)1329 SendInternalMessageA(WM_SYSCOMMAND,1330 (dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,1331 lParam);1332 break;1333 1334 case HTSYSMENU:1335 if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))1336 SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);1337 break;1338 1339 case HTHSCROLL:1340 SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);1341 break;1342 1343 case HTVSCROLL:1344 SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);1345 break;1346 }1347 1348 return 0;1349 }1350 /***********************************************************************1351 1235 * NC_HandleSysCommand 1352 1236 * … … 1605 1489 setStyle(getStyle() | WS_VISIBLE); 1606 1490 OSLibWinEnableWindowUpdate(OS2HwndFrame,TRUE); 1607 } else 1491 } 1492 else 1608 1493 { 1609 1494 if (getStyle() & WS_VISIBLE) … … 1615 1500 return 0; 1616 1501 } 1617 1618 case WM_NCPAINT:1619 return 0;1620 1621 case WM_NCACTIVATE:1622 return TRUE;1623 1624 case WM_NCCREATE:1625 return(TRUE);1626 1627 case WM_NCDESTROY:1628 return 0;1629 1630 case WM_NCCALCSIZE:1631 return NCHandleCalcSize(wParam, (NCCALCSIZE_PARAMS *)lParam);1632 1502 1633 1503 case WM_CTLCOLORMSGBOX: … … 1778 1648 if( (getStyle() & WS_MINIMIZE) && getWindowClass()->getIcon()) 1779 1649 { 1780 int x = ( rectWindow.right - rectWindow.left - GetSystemMetrics(SM_CXICON))/2;1781 int y = ( rectWindow.bottom - rectWindow.top - GetSystemMetrics(SM_CYICON))/2;1650 int x = (getWindowRect()->right - getWindowRect()->left - GetSystemMetrics(SM_CXICON))/2; 1651 int y = (getWindowRect()->bottom - getWindowRect()->top - GetSystemMetrics(SM_CYICON))/2; 1782 1652 dprintf(("Painting class icon: vis rect=(%i,%i - %i,%i)\n", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom )); 1783 1653 DrawIcon(hdc, x, y, getWindowClass()->getIcon() ); … … 1791 1661 return 0; 1792 1662 1663 case WM_NCPAINT: 1664 if(!fOS2Look) { 1665 HandleNCPaint(wParam, FALSE); 1666 } 1667 return 0; 1668 1669 case WM_NCACTIVATE: 1670 if(!fOS2Look) { 1671 return HandleNCActivate(wParam); 1672 } 1673 return TRUE; 1674 1675 case WM_NCCREATE: 1676 return(TRUE); 1677 1678 case WM_NCDESTROY: 1679 return 0; 1680 1681 case WM_NCCALCSIZE: 1682 return NCHandleCalcSize(wParam, (NCCALCSIZE_PARAMS *)lParam); 1683 1793 1684 case WM_NCLBUTTONDOWN: 1794 return HandleNCLButtonDown(wParam,lParam); 1685 if(!fOS2Look) { 1686 return HandleNCLButtonDown(wParam,lParam); 1687 } 1688 return 0; 1795 1689 1796 1690 case WM_NCLBUTTONUP: 1797 return HandleNCLButtonUp(wParam,lParam); 1691 if(!fOS2Look) { 1692 return HandleNCLButtonUp(wParam,lParam); 1693 } 1694 return 0; 1798 1695 1799 1696 case WM_NCLBUTTONDBLCLK: 1800 return HandleNCLButtonDblClk(wParam,lParam); 1697 if(!fOS2Look) { 1698 return HandleNCLButtonDblClk(wParam,lParam); 1699 } 1700 return 0; 1801 1701 1802 1702 case WM_NCRBUTTONDOWN: … … 1818 1718 point.y = (SHORT)HIWORD(lParam); 1819 1719 1820 return FrameHitTest(this,point.x,point.y); 1720 if(fOS2Look) { 1721 return FrameHitTest(this, point.x, point.y); 1722 } 1723 else return HandleNCHitTest(point); 1821 1724 } 1822 1725 … … 2316 2219 } 2317 2220 //****************************************************************************** 2221 //When our parent window is moved, we aren't notified of the change (rectWindow is in 2222 //screen coordinates, so it needs to be updated) 2223 //Set the fWindowRectChanged flag and do the same for all the children 2224 //Whenever getWindowRect is called and this flag is set, it refreshes the rectWindow structure 2225 //****************************************************************************** 2226 void Win32BaseWindow::setWindowRectChanged() 2227 { 2228 Win32BaseWindow *child; 2229 2230 fWindowRectChanged = TRUE; 2231 2232 child = (Win32BaseWindow *)getFirstChild(); 2233 while(child) 2234 { 2235 child->setWindowRectChanged(); 2236 child = (Win32BaseWindow *)child->getNextChild(); 2237 } 2238 } 2239 //****************************************************************************** 2240 //****************************************************************************** 2241 PRECT Win32BaseWindow::getWindowRect() 2242 { 2243 if(fWindowRectChanged) { 2244 OSLibWinQueryWindowRect(getOS2FrameWindowHandle(), &rectWindow, RELATIVE_TO_SCREEN); 2245 fWindowRectChanged = FALSE; 2246 } 2247 return &rectWindow; 2248 } 2249 //****************************************************************************** 2250 //****************************************************************************** 2251 void Win32BaseWindow::setWindowRect(LONG left, LONG top, LONG right, LONG bottom) 2252 { 2253 fWindowRectChanged = FALSE; 2254 2255 rectWindow.left = left; 2256 rectWindow.top = top; 2257 rectWindow.right = right; 2258 rectWindow.bottom = bottom; 2259 } 2260 //****************************************************************************** 2261 //****************************************************************************** 2262 void Win32BaseWindow::setWindowRect(PRECT rect) 2263 { 2264 fWindowRectChanged = FALSE; 2265 2266 rectWindow = *rect; 2267 } 2268 //****************************************************************************** 2318 2269 //****************************************************************************** 2319 2270 BOOL Win32BaseWindow::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags) … … 2882 2833 return OSLibWinIsWindowVisible(OS2HwndFrame); 2883 2834 #endif 2884 }2885 //******************************************************************************2886 //******************************************************************************2887 BOOL Win32BaseWindow::GetWindowRect(PRECT pRect)2888 {2889 return OSLibWinQueryWindowRect(OS2HwndFrame, pRect, RELATIVE_TO_SCREEN);2890 2835 } 2891 2836 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.