- Timestamp:
- Jul 16, 1999, 1:32:10 PM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/makefile
r309 r314 1 # $Id: makefile,v 1. 2 1999-07-15 18:03:01sandervl Exp $1 # $Id: makefile,v 1.3 1999-07-16 11:32:08 sandervl Exp $ 2 2 3 3 # … … 28 28 pmwindow.obj win32class.obj win32wnd.obj win32dlg.obj \ 29 29 msgbox.obj window.obj windowmsg.obj windowclass.obj windlgmsg.obj \ 30 windowword.obj gen_object.obj oslibwin.obj 30 windowword.obj gen_object.obj oslibwin.obj win32wndchild.obj 31 31 32 32 … … 67 67 68 68 msgbox.obj: msgbox.cpp 69 window.obj: window.cpp win32class.h win32wnd.h 70 windowmsg.obj: windowmsg.cpp win32class.h win32wnd.h 71 windlgmsg.obj: windlgmsg.cpp win32class.h win32wnd.h win32dlg.h 72 windowclass.obj: windowclass.cpp win32class.h win32wnd.h 73 windowword.obj: windowword.cpp win32class.h win32wnd.h win32dlg.h 69 window.obj: window.cpp win32class.h win32wnd.h win32wndchild.h 70 windowmsg.obj: windowmsg.cpp win32class.h win32wnd.h win32wndchild.h 71 windlgmsg.obj: windlgmsg.cpp win32class.h win32wnd.h win32dlg.h win32wndchild.h 72 windowclass.obj: windowclass.cpp win32class.h win32wnd.h win32wndchild.h 73 windowword.obj: windowword.cpp win32class.h win32wnd.h win32dlg.h win32wndchild.h 74 74 75 pmwindow.obj: pmwindow.cpp win32class.h win32wnd.h win32dlg.h pmwindow.h 76 win32class.obj: win32class.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h 77 win32wnd.obj: win32wnd.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h 78 win32dlg.obj: win32dlg.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h 75 pmwindow.obj: pmwindow.cpp win32class.h win32wnd.h win32dlg.h pmwindow.h win32wndchild.h 76 win32class.obj: win32class.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h 77 win32wnd.obj: win32wnd.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h 78 win32dlg.obj: win32dlg.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h 79 win32wndchild.obj: win32wndchild.cpp win32wndchild.h 79 80 gen_object.obj: gen_object.cpp gen_object.h 80 81 oslibwin.obj: oslibwin.cpp oslibwin.h -
trunk/src/user32/new/oslibwin.cpp
r309 r314 1 /* $Id: oslibwin.cpp,v 1. 3 1999-07-15 18:03:02sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.4 1999-07-16 11:32:08 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 131 131 //****************************************************************************** 132 132 //****************************************************************************** 133 133 HWND OSLibWinCreateMenu(HWND hwndParent, PVOID menutemplate) 134 { 135 return WinCreateMenu(hwndParent, menutemplate); 136 } 137 //****************************************************************************** 138 //****************************************************************************** 139 HWND OSLibWinQueryTopMostChildWindow(HWND hwndParent) 140 { 141 return WinQueryWindow(hwndParent, QW_TOP); 142 } 143 //****************************************************************************** 144 //****************************************************************************** -
trunk/src/user32/new/oslibwin.h
r309 r314 1 /* $Id: oslibwin.h,v 1. 2 1999-07-15 18:03:02sandervl Exp $ */1 /* $Id: oslibwin.h,v 1.3 1999-07-16 11:32:08 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 30 30 BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam); 31 31 32 HWND OSLibWinCreateMenu(HWND hwndParent, PVOID menutemplate); 33 34 HWND OSLibWinQueryTopMostChildWindow(HWND hwndParent); 35 32 36 #endif //__OSLIBWIN_H__ -
trunk/src/user32/new/win32wnd.cpp
r309 r314 1 /* $Id: win32wnd.cpp,v 1. 3 1999-07-15 18:03:02sandervl Exp $ */1 /* $Id: win32wnd.cpp,v 1.4 1999-07-16 11:32:09 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 45 45 //****************************************************************************** 46 46 Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode) 47 : GenericObject(&windows, OBJTYPE_WINDOW) 47 : GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow() 48 48 { 49 49 Init(); … … 68 68 magic = WIN32PM_MAGIC; 69 69 OS2Hwnd = 0; 70 OS2HwndMenu = 0; 70 71 Win32Hwnd = 0; 71 72 … … 76 77 DebugInt3(); 77 78 } 79 Win32Hwnd &= 0xFFFF; 80 Win32Hwnd |= 0x68000000; 81 78 82 posx = posy = 0; 79 83 width = height = 0; … … 83 87 win32wndproc = 0; 84 88 hInstance = 0; 85 parent = 0;86 89 windowId = 0xFFFFFFFF; //default = -1 87 90 userData = 0; … … 110 113 { 111 114 char buffer[256]; 112 DWORD tmp;113 115 INT sw = SW_SHOW; 114 116 POINT maxSize, maxPos, minTrack, maxTrack; … … 220 222 if ((cs->style & WS_CHILD) && cs->hwndParent) 221 223 { 222 if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR) 223 { 224 dprintf(("HMHandleTranslateToOS2 couldn't find parent window %x!!!", cs->hwndParent)); 225 return FALSE; 226 } 227 parent = (Win32Window *)tmp; 224 SetParent(cs->hwndParent); 228 225 } 229 226 else 230 227 { 231 parent = NULL; //desktop232 228 if (!cs->hwndParent) { 233 229 owner = NULL; … … 235 231 else 236 232 { 237 if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR) 233 owner = GetWindowFromHandle(cs->hwndParent); 234 if(owner == NULL) 238 235 { 239 236 dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent)); 240 237 return FALSE; 241 238 } 242 owner = (Win32Window *)tmp;243 239 } 244 240 } … … 251 247 hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) 252 248 ? HWND_BOTTOM : HWND_TOP; 249 250 #if 0 251 //TODO 252 /* Call the WH_CBT hook */ 253 254 if (HOOK_IsHooked( WH_CBT )) 255 { 256 CBT_CREATEWNDA cbtc; 257 LRESULT ret; 258 259 cbtc.lpcs = cs; 260 cbtc.hwndInsertAfter = hwndLinkAfter; 261 ret = unicode ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc) 262 : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc); 263 if (ret) 264 { 265 TRACE_(win)("CBT-hook returned 0\n"); 266 wndPtr->pDriver->pFinalize(wndPtr); 267 retvalue = 0; 268 goto end; 269 } 270 } 271 #endif 253 272 254 273 /* Increment class window counter */ … … 296 315 } 297 316 298 /* Set the window menu */ 299 if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION ) 300 { 301 if (cs->hMenu) SetMenu(getWindowHandle(), cs->hMenu); 302 else 303 { 304 if (windowClass->getMenuNameA()) { 305 cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA()); 306 if (cs->hMenu) SetMenu( getWindowHandle(), cs->hMenu ); 307 } 308 } 309 } 310 else windowId = (UINT)cs->hMenu; 317 rectWindow.left = cs->x; 318 rectWindow.top = cs->y; 319 rectWindow.right = cs->x + cs->cx; 320 rectWindow.bottom = cs->y + cs->cy; 321 rectClient = rectWindow; 311 322 312 323 DWORD dwOSWinStyle, dwOSFrameStyle; … … 314 325 OSLibWinConvertStyle(cs->style, &dwOSWinStyle, &dwOSFrameStyle); 315 326 316 OS2Hwnd = OSLibWinCreateWindow(( parent) ? parent->getOS2WindowHandle() : 0,327 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : 0, 317 328 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName, 318 329 cs->x, cs->y, cs->cx, cs->cy, … … 333 344 } 334 345 335 return TRUE; 336 } 346 /* Set the window menu */ 347 if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION ) 348 { 349 if (cs->hMenu) SetMenu(cs->hMenu); 350 else 351 { 352 if (windowClass->getMenuNameA()) { 353 cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA()); 354 if (cs->hMenu) SetMenu(cs->hMenu ); 355 } 356 } 357 } 358 else windowId = (UINT)cs->hMenu; 359 360 /* Send the WM_CREATE message 361 * Perhaps we shouldn't allow width/height changes as well. 362 * See p327 in "Internals". 363 */ 364 maxPos.x = rectWindow.left; maxPos.y = rectWindow.top; 365 366 if(sendMessage(WM_NCCREATE, 0, (LPARAM)cs) ) 367 { 368 SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient ); 369 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, 370 maxPos.y - rectWindow.top); 371 dprintf(("Sending WM_CREATE")); 372 if( (sendMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 ) 373 { 374 /* Send the size messages */ 375 dprintf(("Sent WM_CREATE")); 376 377 if (!(flags & WIN_NEED_SIZE)) 378 { 379 /* send it anyway */ 380 if (((rectClient.right-rectClient.left) <0) 381 ||((rectClient.bottom-rectClient.top)<0)) 382 dprintf(("sending bogus WM_SIZE message 0x%08lx\n", 383 MAKELONG(rectClient.right-rectClient.left, 384 rectClient.bottom-rectClient.top))); 385 SendMessageA(WM_SIZE, SIZE_RESTORED, 386 MAKELONG(rectClient.right-rectClient.left, 387 rectClient.bottom-rectClient.top)); 388 SendMessageA(WM_MOVE, 0, 389 MAKELONG( rectClient.left, 390 rectClient.top ) ); 391 } 392 393 #if 0 394 /* Show the window, maximizing or minimizing if needed */ 395 396 if (dwStyle & (WS_MINIMIZE | WS_MAXIMIZE)) 397 { 398 RECT16 newPos; 399 UINT16 swFlag = (dwStyle & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE; 400 dwStyle &= ~(WS_MAXIMIZE | WS_MINIMIZE); 401 WINPOS_MinMaximize(swFlag, &newPos ); 402 swFlag = ((dwStyle & WS_CHILD) || GetActiveWindow()) 403 ? SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED 404 : SWP_NOZORDER | SWP_FRAMECHANGED; 405 SetWindowPos(0, newPos.left, newPos.top, 406 newPos.right, newPos.bottom, swFlag ); 407 } 408 #endif 409 410 if( dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) ) 411 { 412 /* Notify the parent window only */ 413 414 NotifyParent(WM_CREATE, 0, 0); 415 if( !IsWindow(Win32Hwnd) ) 416 { 417 return FALSE; 418 } 419 } 420 421 if (cs->style & WS_VISIBLE) ShowWindow( sw ); 422 423 #if 0 424 /* Call WH_SHELL hook */ 425 426 if (!(dwStyle & WS_CHILD) && !owner) 427 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 ); 428 #endif 429 return TRUE; 430 } 431 } 432 return FALSE; 433 } 434 #if 0 435 /*********************************************************************** 436 * WINPOS_MinMaximize 437 * 438 * Fill in lpRect and return additional flags to be used with SetWindowPos(). 439 * This function assumes that 'cmd' is different from the current window 440 * state. 441 */ 442 UINT Win32Window::MinMaximize(UINT16 cmd, LPRECT16 lpRect ) 443 { 444 UINT swpFlags = 0; 445 POINT pt, size; 446 LPINTERNALPOS lpPos; 447 448 size.x = rectWindow.left; size.y = rectWindow.top; 449 lpPos = WINPOS_InitInternalPos( wndPtr, size, &rectWindow ); 450 451 if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd)) 452 { 453 if( dwStyle & WS_MINIMIZE ) 454 { 455 if( !SendMessageA(WM_QUERYOPEN, 0, 0L ) ) 456 return (SWP_NOSIZE | SWP_NOMOVE); 457 swpFlags |= SWP_NOCOPYBITS; 458 } 459 switch( cmd ) 460 { 461 case SW_MINIMIZE: 462 if( dwStyle & WS_MAXIMIZE) 463 { 464 flags |= WIN_RESTORE_MAX; 465 dwStyle &= ~WS_MAXIMIZE; 466 } 467 else 468 flags &= ~WIN_RESTORE_MAX; 469 dwStyle |= WS_MINIMIZE; 470 471 #if 0 472 if( flags & WIN_NATIVE ) 473 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) ) 474 swpFlags |= MINMAX_NOSWP; 475 #endif 476 477 lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos ); 478 479 SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y, 480 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 481 swpFlags |= SWP_NOCOPYBITS; 482 break; 483 484 case SW_MAXIMIZE: 485 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt ); 486 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL ); 487 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); 488 489 if( dwStyle & WS_MINIMIZE ) 490 { 491 if( flags & WIN_NATIVE ) 492 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) ) 493 swpFlags |= MINMAX_NOSWP; 494 495 WINPOS_ShowIconTitle( wndPtr, FALSE ); 496 dwStyle &= ~WS_MINIMIZE; 497 } 498 dwStyle |= WS_MAXIMIZE; 499 500 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, 501 size.x, size.y ); 502 break; 503 504 case SW_RESTORE: 505 if( dwStyle & WS_MINIMIZE ) 506 { 507 if( flags & WIN_NATIVE ) 508 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) ) 509 swpFlags |= MINMAX_NOSWP; 510 511 dwStyle &= ~WS_MINIMIZE; 512 WINPOS_ShowIconTitle( wndPtr, FALSE ); 513 514 if( flags & WIN_RESTORE_MAX) 515 { 516 /* Restore to maximized position */ 517 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt ); 518 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL); 519 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); 520 dwStyle |= WS_MAXIMIZE; 521 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y ); 522 break; 523 } 524 } 525 else 526 if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1); 527 else dwStyle &= ~WS_MAXIMIZE; 528 529 /* Restore to normal position */ 530 531 *lpRect = lpPos->rectNormal; 532 lpRect->right -= lpRect->left; 533 lpRect->bottom -= lpRect->top; 534 535 break; 536 } 537 } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE; 538 return swpFlags; 539 } 540 #endif 337 541 /******************************************************************* 338 542 * GetMinMaxInfo … … 379 583 380 584 #if 0 381 lpPos = (LPINTERNALPOS)GetPropA( wndPtr->hwndSelf, atomInternalPos );585 lpPos = (LPINTERNALPOS)GetPropA( hwndSelf, atomInternalPos ); 382 586 if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) ) 383 587 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition ); … … 407 611 if (minTrack) *minTrack = MinMax.ptMinTrackSize; 408 612 if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize; 613 } 614 /*********************************************************************** 615 * WINPOS_SendNCCalcSize 616 * 617 * Send a WM_NCCALCSIZE message to a window. 618 * All parameters are read-only except newClientRect. 619 * oldWindowRect, oldClientRect and winpos must be non-NULL only 620 * when calcValidRect is TRUE. 621 */ 622 LONG Win32Window::SendNCCalcSize(BOOL calcValidRect, 623 RECT *newWindowRect, RECT *oldWindowRect, 624 RECT *oldClientRect, WINDOWPOS *winpos, 625 RECT *newClientRect ) 626 { 627 NCCALCSIZE_PARAMS params; 628 WINDOWPOS winposCopy; 629 LONG result; 630 631 params.rgrc[0] = *newWindowRect; 632 if (calcValidRect) 633 { 634 winposCopy = *winpos; 635 params.rgrc[1] = *oldWindowRect; 636 params.rgrc[2] = *oldClientRect; 637 params.lppos = &winposCopy; 638 } 639 result = SendMessageA(WM_NCCALCSIZE, calcValidRect, 640 (LPARAM)¶ms ); 641 *newClientRect = params.rgrc[0]; 642 return result; 409 643 } 410 644 //****************************************************************************** … … 613 847 //****************************************************************************** 614 848 //****************************************************************************** 615 LRESULTWin32Window::PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam)849 BOOL Win32Window::PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam) 616 850 { 617 851 POSTMSG_PACKET *postmsg; … … 620 854 if(postmsg == NULL) { 621 855 dprintf(("Win32Window::PostMessageA: malloc returned NULL!!")); 856 return 0; 622 857 } 623 858 postmsg->Msg = msg; … … 628 863 //****************************************************************************** 629 864 //****************************************************************************** 630 LRESULTWin32Window::PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam)865 BOOL Win32Window::PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam) 631 866 { 632 867 POSTMSG_PACKET *postmsg; … … 635 870 if(postmsg == NULL) { 636 871 dprintf(("Win32Window::PostMessageW: malloc returned NULL!!")); 872 return 0; 637 873 } 638 874 postmsg->Msg = msg; … … 642 878 } 643 879 //****************************************************************************** 880 //TODO: do we need to inform the parent of the parent (etc) of the child window? 644 881 //****************************************************************************** 645 882 void Win32Window::NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam) … … 665 902 window = parentwindow; 666 903 } 904 } 905 //****************************************************************************** 906 //****************************************************************************** 907 BOOL Win32Window::SetMenu(ULONG hMenu) 908 { 909 PVOID menutemplate; 910 911 if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR) 912 { 913 OS2HwndMenu = OSLibWinCreateMenu(OS2Hwnd, menutemplate); 914 if(OS2HwndMenu == 0) { 915 dprintf(("Win32Window::SetMenu OS2HwndMenu == 0")); 916 return FALSE; 917 } 918 } 919 dprintf(("Win32Window::SetMenu unknown hMenu (%x)", hMenu)); 920 return FALSE; 921 } 922 //****************************************************************************** 923 //****************************************************************************** 924 BOOL Win32Window::ShowWindow(ULONG nCmdShow) 925 { 926 return O32_ShowWindow(OS2Hwnd, nCmdShow); 927 } 928 //****************************************************************************** 929 //****************************************************************************** 930 BOOL Win32Window::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags) 931 { 932 Win32Window *window; 933 934 switch(hwndInsertAfter) { 935 case HWND_BOTTOM: 936 case HWND_TOP: 937 case HWND_TOPMOST: 938 case HWND_NOTOPMOST: 939 break; 940 default: 941 window = GetWindowFromHandle(hwndInsertAfter); 942 if(window) { 943 hwndInsertAfter = window->getOS2WindowHandle(); 944 } 945 else { 946 dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter)); 947 hwndInsertAfter = 0; 948 } 949 break; 950 951 } 952 return O32_SetWindowPos(OS2Hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags); 953 } 954 //****************************************************************************** 955 BOOL Win32Window::DestroyWindow() 956 { 957 return TRUE; 958 } 959 //****************************************************************************** 960 //TODO: 961 //****************************************************************************** 962 HWND Win32Window::SetActiveWindow() 963 { 964 return O32_SetActiveWindow(OS2Hwnd); 965 } 966 //****************************************************************************** 967 //****************************************************************************** 968 HWND Win32Window::GetParent() 969 { 970 if(getParent()) { 971 return getParent()->getWindowHandle(); 972 } 973 else return 0; 974 } 975 //****************************************************************************** 976 //****************************************************************************** 977 HWND Win32Window::SetParent(HWND hwndNewParent) 978 { 979 HWND oldhwnd; 980 Win32Window *newparent; 981 982 if(getParent()) { 983 oldhwnd = getParent()->getWindowHandle(); 984 } 985 else oldhwnd = 0; 986 987 if(hwndNewParent == 0) {//desktop window = parent 988 setParent(NULL); 989 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP); 990 return oldhwnd; 991 } 992 newparent = GetWindowFromHandle(hwndNewParent); 993 if(newparent) 994 { 995 setParent(newparent); 996 OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle()); 997 return oldhwnd; 998 } 999 SetLastError(ERROR_INVALID_PARAMETER); 1000 return 0; 1001 } 1002 //****************************************************************************** 1003 //****************************************************************************** 1004 BOOL Win32Window::IsChild(HWND hwndParent) 1005 { 1006 if(getParent()) { 1007 return getParent()->getWindowHandle() == hwndParent; 1008 } 1009 else return 0; 1010 } 1011 //****************************************************************************** 1012 //****************************************************************************** 1013 HWND Win32Window::GetTopWindow() 1014 { 1015 HWND topchild; 1016 1017 topchild = OSLibWinQueryTopMostChildWindow(OS2Hwnd); 1018 if(topchild) 1019 {//TODO 1020 return topchild; 1021 } 1022 else return 0; 1023 } 1024 //****************************************************************************** 1025 //TODO 1026 //****************************************************************************** 1027 BOOL Win32Window::UpdateWindow() 1028 { 1029 return TRUE; 1030 } 1031 //****************************************************************************** 1032 //TODO 1033 //****************************************************************************** 1034 BOOL Win32Window::IsIconic() 1035 { 1036 return FALSE; 667 1037 } 668 1038 //****************************************************************************** … … 690 1060 return oldval; 691 1061 case GWL_HWNDPARENT: 692 { 693 ULONG tmp; 694 695 if(getParent()) { 696 oldval = getParent()->getWindowHandle(); 697 } 698 else oldval = 0; 699 700 if(value == 0) {//desktop window = parent 701 setParent(NULL); 702 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP); 703 return oldval; 704 } 705 if(HMHandleTranslateToOS2(value, &tmp) == NO_ERROR) 706 { 707 setParent((Win32Window *)tmp); 708 OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle()); 709 return oldval; 710 } 711 SetLastError(ERROR_INVALID_PARAMETER); 712 return 0; 713 } 1062 return SetParent((HWND)value); 1063 714 1064 case GWL_ID: 715 1065 oldval = getWindowId(); … … 790 1140 //****************************************************************************** 791 1141 //****************************************************************************** 1142 Win32Window *Win32Window::GetWindowFromHandle(HWND hwnd) 1143 { 1144 Win32Window *window; 1145 1146 if(HIWORD(hwnd) != 0x6800) 1147 return NULL; 1148 1149 if(HMHandleTranslateToOS2(LOWORD(hwnd), (PULONG)&window) == NO_ERROR) { 1150 return window; 1151 } 1152 else return NULL; 1153 } 1154 //****************************************************************************** 1155 //****************************************************************************** 792 1156 GenericObject *Win32Window::windows = NULL; -
trunk/src/user32/new/win32wnd.h
r309 r314 1 /* $Id: win32wnd.h,v 1. 3 1999-07-15 18:03:03sandervl Exp $ */1 /* $Id: win32wnd.h,v 1.4 1999-07-16 11:32:09 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 17 17 #include <win32class.h> 18 18 #include <gen_object.h> 19 #include <win32wndchild.h> 19 20 20 21 class Win32Window; 21 22 #define WIN2OS2HWND(a) (Win32Window*)(a^a)23 #define OS22WINHWND(a) (a^a)24 22 25 23 #define OFFSET_WIN32WNDPTR 0 … … 44 42 #define WM_WIN32_POSTMESSAGEW 0x4001 45 43 46 class Win32Window : p ublic GenericObject44 class Win32Window : private GenericObject, private ChildWindow 47 45 { 48 46 public: … … 77 75 HWND getWindowHandle() { return Win32Hwnd; }; 78 76 HWND getOS2WindowHandle() { return OS2Hwnd; }; 79 Win32Window *getParent() { return parent; };80 void setParent(Win32Window *pwindow) { parent = pwindow; };77 Win32Window *getParent() { return (Win32Window *)ChildWindow::GetParent(); }; 78 void setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); }; 81 79 WNDPROC getWindowProc() { return win32wndproc; }; 82 80 void setWindowProc(WNDPROC newproc) { win32wndproc = newproc; }; … … 87 85 void setFlags(DWORD newflags) { flags = newflags; }; 88 86 87 BOOL SetMenu(ULONG hMenu); 88 BOOL ShowWindow(ULONG nCmdShow); 89 BOOL SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags); 90 BOOL DestroyWindow(); 91 HWND SetActiveWindow(); 92 HWND GetParent(); 93 HWND SetParent(HWND hwndNewParent); 94 BOOL IsChild(HWND hwndParent); 95 HWND GetTopWindow(); 96 BOOL UpdateWindow(); 97 BOOL IsIconic(); 98 89 99 LRESULT SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam); 90 100 LRESULT SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam); 91 LRESULTPostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);92 LRESULTPostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);101 BOOL PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam); 102 BOOL PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam); 93 103 LRESULT DefWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 94 104 LRESULT DefWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); … … 98 108 Win32WndClass *getClass() { return windowClass; }; 99 109 110 static Win32Window *GetWindowFromHandle(HWND hwnd); 111 100 112 protected: 101 113 void Init(); 102 114 103 104 115 HWND OS2Hwnd; 116 HWND OS2HwndMenu; 105 117 HWND Win32Hwnd; 106 118 BOOL isUnicode; … … 113 125 WNDPROC win32wndproc; //GWL_WNDPROC 114 126 ULONG hInstance; //GWL_HINSTANCE 115 Win32Window *parent; //GWL_HWNDPARENT 127 //Moved in ChildWindow class 128 ///// Win32Window *parent; //GWL_HWNDPARENT 116 129 ULONG windowId; //GWL_ID 117 130 ULONG userData; //GWL_USERDATA … … 131 144 ULONG nrUserWindowLong; 132 145 146 RECT rectWindow; 147 RECT rectClient; 148 133 149 Win32WndClass *windowClass; 134 150 … … 136 152 137 153 private: 154 #ifndef OS2_INCLUDED 138 155 BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom); 139 156 140 157 void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack ); 158 159 LONG SendNCCalcSize(BOOL calcValidRect, 160 RECT *newWindowRect, RECT *oldWindowRect, 161 RECT *oldClientRect, WINDOWPOS *winpos, 162 RECT *newClientRect ); 163 164 LRESULT sendMessage(ULONG msg, WPARAM wParam, LPARAM lParam) 165 { 166 if(isUnicode) 167 return SendMessageW(msg, wParam, lParam); 168 else return SendMessageA(msg, wParam, lParam); 169 } 170 #endif 141 171 }; 142 172 -
trunk/src/user32/new/window.cpp
r304 r314 1 /* $Id: window.cpp,v 1. 2 1999-07-14 21:05:59 cbratschiExp $ */1 /* $Id: window.cpp,v 1.3 1999-07-16 11:32:09 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 178 178 //****************************************************************************** 179 179 //****************************************************************************** 180 BOOL WIN32API DestroyWindow(HWND arg1) 181 { 182 #ifdef DEBUG 183 WriteLog("USER32: DestroyWindow\n"); 184 #endif 185 return O32_DestroyWindow(arg1); 186 } 187 //****************************************************************************** 188 //****************************************************************************** 189 HWND WIN32API SetActiveWindow( HWND arg1) 190 { 191 #ifdef DEBUG 192 WriteLog("USER32: SetActiveWindow\n"); 193 #endif 194 return O32_SetActiveWindow(arg1); 195 } 196 //****************************************************************************** 197 //****************************************************************************** 198 HWND WIN32API GetParent( HWND arg1) 199 { 200 #ifdef DEBUG 201 //// WriteLog("USER32: GetParent\n"); 202 #endif 203 return O32_GetParent(arg1); 204 } 205 //****************************************************************************** 206 //****************************************************************************** 207 HWND WIN32API SetParent( HWND arg1, HWND arg2) 208 { 209 #ifdef DEBUG 210 WriteLog("USER32: SetParent\n"); 211 #endif 212 return O32_SetParent(arg1, arg2); 213 } 214 //****************************************************************************** 215 //****************************************************************************** 216 BOOL WIN32API IsChild( HWND arg1, HWND arg2) 217 { 218 #ifdef DEBUG 219 WriteLog("USER32: IsChild\n"); 220 #endif 221 return O32_IsChild(arg1, arg2); 222 } 223 //****************************************************************************** 224 //****************************************************************************** 225 HWND WIN32API GetTopWindow( HWND arg1) 226 { 227 #ifdef DEBUG 228 //// WriteLog("USER32: GetTopWindow\n"); 229 #endif 230 return O32_GetTopWindow(arg1); 180 BOOL WIN32API DestroyWindow(HWND hwnd) 181 { 182 Win32Window *window; 183 184 window = Win32Window::GetWindowFromHandle(hwnd); 185 if(!window) { 186 dprintf(("SendMessageA, window %x not found", hwnd)); 187 return 0; 188 } 189 return window->DestroyWindow(); 190 } 191 //****************************************************************************** 192 //****************************************************************************** 193 HWND WIN32API SetActiveWindow( HWND hwnd) 194 { 195 Win32Window *window; 196 197 window = Win32Window::GetWindowFromHandle(hwnd); 198 if(!window) { 199 dprintf(("SendMessageA, window %x not found", hwnd)); 200 return 0; 201 } 202 return window->SetActiveWindow(); 203 } 204 //****************************************************************************** 205 //****************************************************************************** 206 HWND WIN32API GetParent( HWND hwnd) 207 { 208 Win32Window *window; 209 210 window = Win32Window::GetWindowFromHandle(hwnd); 211 if(!window) { 212 dprintf(("SendMessageA, window %x not found", hwnd)); 213 return 0; 214 } 215 return window->GetParent(); 216 } 217 //****************************************************************************** 218 //****************************************************************************** 219 HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent) 220 { 221 Win32Window *window; 222 223 window = Win32Window::GetWindowFromHandle(hwndChild); 224 if(!window) { 225 dprintf(("SendMessageA, window %x not found", hwndChild)); 226 return 0; 227 } 228 return window->SetParent(hwndNewParent); 229 } 230 //****************************************************************************** 231 //****************************************************************************** 232 BOOL WIN32API IsChild( HWND hwndParent, HWND hwnd) 233 { 234 Win32Window *window; 235 236 window = Win32Window::GetWindowFromHandle(hwnd); 237 if(!window) { 238 dprintf(("SendMessageA, window %x not found", hwnd)); 239 return 0; 240 } 241 return window->IsChild(hwndParent); 242 } 243 //****************************************************************************** 244 //****************************************************************************** 245 HWND WIN32API GetTopWindow( HWND hwnd) 246 { 247 Win32Window *window; 248 249 window = Win32Window::GetWindowFromHandle(hwnd); 250 if(!window) { 251 dprintf(("SendMessageA, window %x not found", hwnd)); 252 return 0; 253 } 254 return window->GetTopWindow(); 231 255 } 232 256 //****************************************************************************** … … 234 258 BOOL WIN32API UpdateWindow(HWND hwnd) 235 259 { 236 dprintf(("USER32: UpdateWindow\n")); 237 238 return O32_UpdateWindow(hwnd); 239 } 240 //****************************************************************************** 241 //****************************************************************************** 242 BOOL WIN32API IsIconic( HWND arg1) 243 { 244 #ifdef DEBUG 245 WriteLog("USER32: IsIconic\n"); 246 #endif 247 return O32_IsIconic(arg1); 260 Win32Window *window; 261 262 window = Win32Window::GetWindowFromHandle(hwnd); 263 if(!window) { 264 dprintf(("SendMessageA, window %x not found", hwnd)); 265 return 0; 266 } 267 return window->UpdateWindow(); 268 } 269 //****************************************************************************** 270 //****************************************************************************** 271 BOOL WIN32API IsIconic( HWND hwnd) 272 { 273 Win32Window *window; 274 275 window = Win32Window::GetWindowFromHandle(hwnd); 276 if(!window) { 277 dprintf(("SendMessageA, window %x not found", hwnd)); 278 return 0; 279 } 280 return window->IsIconic(); 248 281 } 249 282 //****************************************************************************** -
trunk/src/user32/new/windowclass.cpp
r311 r314 1 /* $Id: windowclass.cpp,v 1. 4 1999-07-15 18:54:55sandervl Exp $ */1 /* $Id: windowclass.cpp,v 1.5 1999-07-16 11:32:09 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Code for OS/2 … … 19 19 #include <win32class.h> 20 20 #include <win32wnd.h> 21 #include <handlemanager.h>22 21 23 22 //****************************************************************************** … … 261 260 262 261 dprintf(("USER32: GetClassNameA\n")); 263 if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) { 262 wnd = Win32Window::GetWindowFromHandle(hwnd); 263 if(!wnd) { 264 264 dprintf(("GetClassNameA wnd == NULL")); 265 265 return(0); … … 274 274 275 275 dprintf(("USER32: GetClassNameW\n")); 276 if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) { 276 wnd = Win32Window::GetWindowFromHandle(hwnd); 277 if(!wnd) { 277 278 dprintf(("GetClassNameA wnd == NULL")); 278 279 return(0); … … 287 288 288 289 dprintf(("USER32: SetClassLongA\n")); 289 if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) { 290 wnd = Win32Window::GetWindowFromHandle(hwnd); 291 if(!wnd) { 290 292 dprintf(("SetClassLongA wnd == NULL")); 291 293 return(0); … … 300 302 301 303 dprintf(("USER32: SetClassLongW\n")); 302 if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) { 304 wnd = Win32Window::GetWindowFromHandle(hwnd); 305 if(!wnd) { 303 306 dprintf(("SetClassLongW wnd == NULL")); 304 307 return(0); … … 313 316 314 317 dprintf(("USER32: SetClassWordA\n")); 315 if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) { 318 wnd = Win32Window::GetWindowFromHandle(hwnd); 319 if(!wnd) { 316 320 dprintf(("SetClassWordA wnd == NULL")); 317 321 return(0); … … 326 330 327 331 dprintf(("USER32: GetClassWordA\n")); 328 if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) { 332 wnd = Win32Window::GetWindowFromHandle(hwnd); 333 if(!wnd) { 329 334 dprintf(("GetClassWordA wnd == NULL")); 330 335 return(0); … … 339 344 340 345 dprintf(("USER32: GetClassLongA\n")); 341 if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) { 346 wnd = Win32Window::GetWindowFromHandle(hwnd); 347 if(!wnd) { 342 348 dprintf(("GetClassLongA wnd == NULL")); 343 349 return(0); … … 352 358 353 359 dprintf(("USER32: GetClassLongW\n")); 354 if(HMHandleTranslateToOS2(hwnd, (PULONG)&wnd) != NO_ERROR) { 360 wnd = Win32Window::GetWindowFromHandle(hwnd); 361 if(!wnd) { 355 362 dprintf(("GetClassLongW wnd == NULL")); 356 363 return(0); -
trunk/src/user32/new/windowmsg.cpp
r310 r314 1 /* $Id: windowmsg.cpp,v 1. 4 1999-07-15 18:41:46sandervl Exp $ */1 /* $Id: windowmsg.cpp,v 1.5 1999-07-16 11:32:10 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 16 16 #include <misc.h> 17 17 #include <win32wnd.h> 18 #include <handlemanager.h>19 18 #include <win.h> 20 19 #include <hooks.h> … … 47 46 if (!msg->hwnd) return 0; 48 47 49 if(HMHandleTranslateToOS2(msg->hwnd, (PULONG)&window) != NO_ERROR) { 48 window = Win32Window::GetWindowFromHandle(msg->hwnd); 49 if(!window) { 50 50 dprintf(("DispatchMessageA, window %x not found", msg->hwnd)); 51 51 return 0; … … 58 58 59 59 #if 0 60 if(HMHandleTranslateToOS2(msg->hwnd, (PULONG)&window) != NO_ERROR) { 60 window = Win32Window::GetWindowFromHandle(msg->hwnd); 61 if(!window) { 61 62 dprintf(("DispatchMessageA, window %x not found", msg->hwnd)); 62 63 return 0; … … 93 94 if (!msg->hwnd) return 0; 94 95 95 if(HMHandleTranslateToOS2(msg->hwnd, (PULONG)&window) != NO_ERROR) { 96 window = Win32Window::GetWindowFromHandle(msg->hwnd); 97 if(!window) { 96 98 dprintf(("DispatchMessageW, window %x not found", msg->hwnd)); 97 99 return 0; … … 104 106 105 107 #if 0 106 if(HMHandleTranslateToOS2(msg->hwnd, (PULONG)&window) != NO_ERROR) { 108 window = Win32Window::GetWindowFromHandle(msg->hwnd); 109 if(!window) { 107 110 dprintf(("DispatchMessageW, window %x not found", msg->hwnd)); 108 111 return 0; … … 136 139 Win32Window *window; 137 140 138 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) != NO_ERROR) { 141 window = Win32Window::GetWindowFromHandle(hwnd); 142 if(!window) { 139 143 dprintf(("SendMessageA, window %x not found", hwnd)); 140 144 return 0; … … 149 153 Win32Window *window; 150 154 151 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) != NO_ERROR) { 155 window = Win32Window::GetWindowFromHandle(hwnd); 156 if(!window) { 152 157 dprintf(("SendMessageW, window %x not found", hwnd)); 153 158 return 0; … … 165 170 return PostThreadMessageA(GetCurrentThreadId(), msg, wParam, lParam); 166 171 167 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) != NO_ERROR) { 172 window = Win32Window::GetWindowFromHandle(hwnd); 173 if(!window) { 168 174 dprintf(("PostMessageA, window %x not found", hwnd)); 169 175 return 0; … … 181 187 return PostThreadMessageW(GetCurrentThreadId(), msg, wParam, lParam); 182 188 183 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) != NO_ERROR) { 189 window = Win32Window::GetWindowFromHandle(hwnd); 190 if(!window) { 184 191 dprintf(("PostMessageW, window %x not found", hwnd)); 185 192 return 0; -
trunk/src/user32/new/windowword.cpp
r300 r314 1 /* $Id: windowword.cpp,v 1. 1 1999-07-14 08:35:37sandervl Exp $ */1 /* $Id: windowword.cpp,v 1.2 1999-07-16 11:32:10 sandervl Exp $ */ 2 2 3 3 /* … … 14 14 15 15 #include <win32wnd.h> 16 #include <handlemanager.h>17 16 18 17 //****************************************************************************** … … 22 21 Win32Window *window; 23 22 24 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) == NO_ERROR) 23 window = Win32Window::GetWindowFromHandle(hwnd); 24 if(window) 25 25 { 26 26 return window->SetWindowLongA(nIndex, arg3); … … 38 38 Win32Window *window; 39 39 40 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) == NO_ERROR) 40 window = Win32Window::GetWindowFromHandle(hwnd); 41 if(window) 41 42 { 42 43 return window->SetWindowLongA(nIndex, arg3); … … 54 55 Win32Window *window; 55 56 56 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) == NO_ERROR) 57 window = Win32Window::GetWindowFromHandle(hwnd); 58 if(window) 57 59 { 58 60 return window->GetWindowWord(nIndex); … … 70 72 Win32Window *window; 71 73 72 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) == NO_ERROR) 74 window = Win32Window::GetWindowFromHandle(hwnd); 75 if(window) 73 76 { 74 77 return window->SetWindowWord(nIndex, arg3); … … 86 89 Win32Window *window; 87 90 88 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) == NO_ERROR) 91 window = Win32Window::GetWindowFromHandle(hwnd); 92 if(window) 89 93 { 90 94 return window->GetWindowLongA(nIndex); … … 102 106 Win32Window *window; 103 107 104 if(HMHandleTranslateToOS2(hwnd, (PULONG)&window) == NO_ERROR) 108 window = Win32Window::GetWindowFromHandle(hwnd); 109 if(window) 105 110 { 106 111 return window->GetWindowLongA(nIndex);
Note:
See TracChangeset
for help on using the changeset viewer.