Ignore:
Timestamp:
Jul 26, 1999, 11:01:34 AM (26 years ago)
Author:
sandervl
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/win32wnd.cpp

    r392 r397  
    1 /* $Id: win32wnd.cpp,v 1.22 1999-07-25 15:51:56 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.23 1999-07-26 09:01:34 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    4141     !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
    4242
     43#define HAS_BORDER(style, exStyle) \
     44    ((style & WS_BORDER) || HAS_THICKFRAME(style) || HAS_DLGFRAME(style,exStyle))
     45
    4346//******************************************************************************
    4447//******************************************************************************
     
    235238  }
    236239
     240  if (cs->x < 0) cs->x = 0;
     241  if (cs->y < 0) cs->y = 0;
     242
    237243  //Allocate window words
    238244  nrUserWindowLong = windowClass->getExtraWndWords();
     
    345351  DWORD dwOSWinStyle, dwOSFrameStyle;
    346352
    347   OSLibWinConvertStyle(cs->style, &dwOSWinStyle, &dwOSFrameStyle);
    348 
    349   OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : 0,
     353  OSLibWinConvertStyle(cs->style, cs->dwExStyle, &dwOSWinStyle, &dwOSFrameStyle);
     354
     355  //TODO: Test
     356#if 1
     357  if(cs->style & WS_CHILD) {
     358        dwOSFrameStyle = 0;
     359  }
     360#endif
     361
     362  OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP,
    350363                                 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
    351                                  (owner) ? owner->getOS2WindowHandle() : 0,
     364                                 (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP,
    352365                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    353366                                 &OS2HwndFrame);
     
    378391  }
    379392#endif
     393
    380394  /* Set the window menu */
    381395  if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
     
    396410        SetIcon(windowClass->getIcon());
    397411
     412  if(getParent()) {
     413        SetWindowPos(getParent()->getWindowHandle(), rectClient.left, rectClient.top,
     414                     rectClient.right-rectClient.left,
     415                     rectClient.bottom-rectClient.top,
     416                     SWP_NOACTIVATE);
     417  }
     418  else {
     419        SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
     420                     rectClient.right-rectClient.left,
     421                     rectClient.bottom-rectClient.top,
     422                     SWP_NOACTIVATE);
     423  }
     424  //Get the client window rectangle
     425  GetClientRect(Win32Hwnd, &rectClient);
     426
    398427  /* Send the WM_CREATE message
    399428   * Perhaps we shouldn't allow width/height changes as well.
     
    404433  if(SendInternalMessage(WM_NCCREATE, 0, (LPARAM)cs) )
    405434  {
     435  //doesn't work right, messes up client rectangle
     436#if 0
    406437        SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient );
     438#endif
    407439        OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top);
    408440        dprintf(("Sending WM_CREATE"));
     
    415447                SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );
    416448            }
    417             SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
    418                          rectClient.right-rectClient.left,
    419                          rectClient.bottom-rectClient.top,
    420                          SWP_NOACTIVATE);
    421449            if (cs->style & WS_VISIBLE) ShowWindow( sw );
    422450
     
    432460        }
    433461  }
     462  OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0);
     463  OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0);
     464  DestroyWindow();
    434465  return FALSE;
    435466}
     
    469500                 else
    470501             flags &= ~WIN_RESTORE_MAX;
    471          dwStyle |= WS_MINIMIZE;
     502             dwStyle |= WS_MINIMIZE;
    472503
    473504#if 0
     
    680711ULONG Win32Window::MsgEnable(BOOL fEnable)
    681712{
    682   return SendInternalMessageA(WM_ENABLE, fEnable, 0);
     713    return SendInternalMessageA(WM_ENABLE, fEnable, 0);
    683714}
    684715//******************************************************************************
     
    687718ULONG Win32Window::MsgShow(BOOL fShow)
    688719{
    689   return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
     720    return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
    690721}
    691722//******************************************************************************
     
    693724ULONG Win32Window::MsgMove(ULONG x, ULONG y)
    694725{
    695   dprintf(("MsgMove to (%d,%d)", x, y));
    696   return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y));
     726    dprintf(("MsgMove to (%d,%d)", x, y));
     727    if(fCreated == FALSE) {
     728        return 1;
     729    }
     730
     731    return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y));
    697732}
    698733//******************************************************************************
     
    13521387 ULONG        setstate = 0;
    13531388
    1354   switch(hwndInsertAfter) {
     1389    switch(hwndInsertAfter) {
    13551390    case HWND_BOTTOM:
    13561391        hwndInsertAfter = HWNDOS_BOTTOM;
     
    13651400        if(window) {
    13661401            hwndInsertAfter = window->getOS2WindowHandle();
     1402            PRECT clientRect = window->getClientRect();
     1403
     1404#if 0
     1405            if(x+cx > clientRect->right - clientRect->left) {
     1406                cx = (clientRect->right - clientRect->left) - x;
     1407            }
     1408            if(y+cy > clientRect->bottom - clientRect->top) {
     1409                cy = (clientRect->bottom - clientRect->top) - y;
     1410            }
     1411#endif
     1412            //TODO: Not quite right (Solitaire child window placement slightly wrong)
     1413            if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() ))
     1414            {
     1415                x += GetSystemMetrics(SM_CXDLGFRAME);
     1416                y -= GetSystemMetrics(SM_CYDLGFRAME);
     1417            }
     1418            else
     1419            {
     1420                if (HAS_THICKFRAME(window->getStyle()))
     1421                {
     1422                    x += GetSystemMetrics(SM_CXFRAME);
     1423                    y -= GetSystemMetrics(SM_CYFRAME);
     1424                }
     1425                if (window->getStyle() & WS_BORDER)
     1426                {
     1427                    x += GetSystemMetrics(SM_CXBORDER);
     1428                    y -= GetSystemMetrics(SM_CYBORDER);
     1429                }
     1430            }
    13671431        }
    13681432        else {
     
    13701434            hwndInsertAfter = 0;
    13711435        }
     1436
    13721437        break;
    13731438
    1374   }
    1375   setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER;
    1376   if(fuFlags & SWP_DRAWFRAME)
    1377     setstate |= 0; //TODO
    1378   if(fuFlags & SWP_FRAMECHANGED)
    1379     setstate |= 0; //TODO
    1380   if(fuFlags & SWP_HIDEWINDOW)
    1381     setstate &= ~SWPOS_ZORDER;
    1382   if(fuFlags & SWP_NOACTIVATE)
    1383     setstate &= ~SWPOS_ACTIVATE;
    1384   if(fuFlags & SWP_NOCOPYBITS)
    1385     setstate |= 0;      //TODO
    1386   if(fuFlags & SWP_NOMOVE)
    1387     setstate &= ~SWPOS_MOVE;
    1388   if(fuFlags & SWP_NOSIZE)
    1389     setstate &= ~SWPOS_SIZE;
    1390   if(fuFlags & SWP_NOREDRAW)
    1391     setstate |= SWPOS_NOREDRAW;
    1392   if(fuFlags & SWP_NOZORDER)
    1393     setstate &= ~SWPOS_ZORDER;
    1394   if(fuFlags & SWP_SHOWWINDOW)
    1395     setstate |= SWPOS_SHOW;
    1396 
    1397   return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate);
     1439    }
     1440    setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER;
     1441    if(fuFlags & SWP_DRAWFRAME)
     1442        setstate |= 0; //TODO
     1443    if(fuFlags & SWP_FRAMECHANGED)
     1444        setstate |= 0; //TODO
     1445    if(fuFlags & SWP_HIDEWINDOW)
     1446        setstate &= ~SWPOS_ZORDER;
     1447    if(fuFlags & SWP_NOACTIVATE)
     1448        setstate &= ~SWPOS_ACTIVATE;
     1449    if(fuFlags & SWP_NOCOPYBITS)
     1450        setstate |= 0;      //TODO
     1451    if(fuFlags & SWP_NOMOVE)
     1452        setstate &= ~SWPOS_MOVE;
     1453    if(fuFlags & SWP_NOSIZE)
     1454        setstate &= ~SWPOS_SIZE;
     1455    if(fuFlags & SWP_NOREDRAW)
     1456        setstate |= SWPOS_NOREDRAW;
     1457    if(fuFlags & SWP_NOZORDER)
     1458        setstate &= ~SWPOS_ZORDER;
     1459    if(fuFlags & SWP_SHOWWINDOW)
     1460        setstate |= SWPOS_SHOW;
     1461
     1462    //TODO send NCCREATE if size changed or SWP_FRAMECHANGED flag specified.
     1463    return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate);
    13981464}
    13991465//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.