Changeset 1337 for trunk/src/user32


Ignore:
Timestamp:
Oct 17, 1999, 6:42:40 PM (26 years ago)
Author:
sandervl
Message:

Implemented SetWindowPlacement + bugfixes

Location:
trunk/src/user32
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/oslibwin.cpp

    r1333 r1337  
    1 /* $Id: oslibwin.cpp,v 1.30 1999-10-17 12:17:43 cbratschi Exp $ */
     1/* $Id: oslibwin.cpp,v 1.31 1999-10-17 16:42:38 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    962962//******************************************************************************
    963963//******************************************************************************
    964 
     964BOOL OSLibSetWindowRestoreRect(HWND hwnd, PRECT pRect)
     965{
     966 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
     967
     968  WinSetWindowUShort(hwnd, QWS_XRESTORE,  (USHORT)pRect->left );
     969  WinSetWindowUShort(hwnd, QWS_YRESTORE,  (USHORT)(yHeight - pRect->top -
     970                                                   (pRect->bottom - pRect->top)));
     971  WinSetWindowUShort(hwnd, QWS_CXRESTORE, (USHORT)(pRect->right - pRect->left));
     972  WinSetWindowUShort(hwnd, QWS_CYRESTORE, (USHORT)(pRect->bottom - pRect->top));
     973  return TRUE;
     974}
     975//******************************************************************************
     976//******************************************************************************
     977BOOL OSLibSetWindowMinPos(HWND hwnd, ULONG x, ULONG y)
     978{
     979 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
     980
     981  WinSetWindowUShort(hwnd, QWS_XMINIMIZE, (USHORT)x );
     982  WinSetWindowUShort(hwnd, QWS_YMINIMIZE, (USHORT)(yHeight - y -
     983                    ( 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER)) -
     984                      WinQuerySysValue( HWND_DESKTOP, SV_CYICON)));
     985  return TRUE;
     986}
     987//******************************************************************************
     988//******************************************************************************
  • trunk/src/user32/oslibwin.h

    r1333 r1337  
    1 /* $Id: oslibwin.h,v 1.17 1999-10-17 12:17:43 cbratschi Exp $ */
     1/* $Id: oslibwin.h,v 1.18 1999-10-17 16:42:39 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    275275PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc);
    276276
     277BOOL OSLibSetWindowRestoreRect(HWND hwnd, PRECT pRect);
     278BOOL OSLibSetWindowMinPos(HWND hwnd, ULONG x, ULONG y);
     279
    277280#endif //__OSLIBWIN_H__
  • trunk/src/user32/win32wbase.cpp

    r1336 r1337  
    1 /* $Id: win32wbase.cpp,v 1.49 1999-10-17 15:46:09 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.50 1999-10-17 16:42:39 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    726726    if (isSubclassedOS2Wnd) OSLibWinSubclassWindow(OS2Hwnd,pOldWndProc);
    727727
     728    fIsDestroyed = TRUE;
    728729    //According to the SDK, WM_PARENTNOTIFY messages are sent to the parent (this window)
    729730    //before any window destruction has begun
     
    739740    if (hwndVertScroll && OSLibWinQueryWindow(hwndVertScroll,QWOS_PARENT) == OSLIB_HWND_OBJECT) OSLibWinDestroyWindow(hwndVertScroll);
    740741
    741     fIsDestroyed = TRUE;
    742742    if(getFirstChild() == NULL) {
    743743        delete this;
     
    846846 WORD fwSizeType = 0;
    847847
     848    dwStyle &= ~(WS_MINIMIZE|WS_MAXIMIZE);
    848849    if(fMinimize) {
    849850            fwSizeType = SIZE_MINIMIZED;
     851            dwStyle |= WS_MINIMIZE;
    850852    }
    851853    else
    852854    if(fMaximize) {
    853855            fwSizeType = SIZE_MAXIMIZED;
     856            dwStyle |= WS_MAXIMIZE;
    854857    }
    855858    else    fwSizeType = SIZE_RESTORED;
     
    10051008                                                    // bit 24, 1=extended key
    10061009                                                    // bit 25-28, reserved
    1007                                             // bit 29, key is released, always 1 for WM_SYSKEYUP ?? <- conflict according to the MS docs
     1010                                                    // bit 29, key is released, always 1 for WM_SYSKEYUP ?? <- conflict according to the MS docs
    10081011    if (keyWasPressed)
    10091012        lParam |= 1 << 30;                          // bit 30, previous state, 1 means key was pressed
     
    18841887    {
    18851888        /* should happen only in CreateWindowEx() */
    1886         int wParam = SIZE_RESTORED;
    1887 
    1888             flags &= ~WIN_NEED_SIZE;
    1889             if (dwStyle & WS_MAXIMIZE)
    1890                 wParam = SIZE_MAXIMIZED;
    1891             else
    1892             if (dwStyle & WS_MINIMIZE)
    1893                 wParam = SIZE_MINIMIZED;
    1894        
     1889        int wParam = SIZE_RESTORED;
     1890
     1891        flags &= ~WIN_NEED_SIZE;
     1892        if (dwStyle & WS_MAXIMIZE)
     1893            wParam = SIZE_MAXIMIZED;
     1894        else
     1895        if (dwStyle & WS_MINIMIZE)
     1896            wParam = SIZE_MINIMIZED;
     1897
    18951898        SendMessageA(WM_SIZE, wParam,
    18961899                     MAKELONG(rectClient.right-rectClient.left,
     
    20452048}
    20462049//******************************************************************************
     2050//TODO: WPF_RESTOREMAXIMIZED
     2051//******************************************************************************
     2052BOOL Win32BaseWindow::SetWindowPlacement(WINDOWPLACEMENT *winpos)
     2053{
     2054   if(isFrameWindow())
     2055   {
     2056      // Set the minimized position
     2057      if (winpos->flags & WPF_SETMINPOSITION)
     2058      {
     2059         OSLibSetWindowMinPos(OS2HwndFrame, winpos->ptMinPosition.x, winpos->ptMinPosition.y);
     2060      }
     2061
     2062      //TODO: Max position
     2063
     2064      // Set the new restore position.
     2065      OSLibSetWindowRestoreRect(OS2HwndFrame, &winpos->rcNormalPosition);
     2066   }
     2067
     2068   return ShowWindow(winpos->showCmd);
     2069}
     2070//******************************************************************************
    20472071//Also destroys all the child windows (destroy parent, destroy children)
    20482072//******************************************************************************
     
    22472271        }
    22482272        break;
    2249        
     2273
    22502274    case GW_HWNDLAST:
    22512275        if(getParent())
     
    22612285        hwndRelated = window->getWindowHandle();
    22622286        break;
    2263        
     2287
    22642288    case GW_HWNDNEXT:
    22652289        window = (Win32BaseWindow *)getNextChild();
     
    22682292        }
    22692293        break;
    2270        
     2294
    22712295    case GW_HWNDPREV:
    22722296        if(!getParent())
     
    22902314        }
    22912315        break;
    2292                
     2316
    22932317    case GW_OWNER:
    22942318        if(getOwner()) {
     
    24462470                ss.styleOld = dwExStyle;
    24472471                ss.styleNew = value;
    2448         dprintf(("SetWindowLong GWL_EXSTYLE %x new style %x", getWindowHandle(), value));
     2472                dprintf(("SetWindowLong GWL_EXSTYLE %x new style %x", getWindowHandle(), value));
    24492473                SendMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);
    24502474                setExStyle(ss.styleNew);
     
    24582482                ss.styleOld = dwStyle;
    24592483                ss.styleNew = value;
    2460         dprintf(("SetWindowLong GWL_STYLE %x new style %x", getWindowHandle(), value));
     2484                dprintf(("SetWindowLong GWL_STYLE %x new style %x", getWindowHandle(), value));
    24612485                SendMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
    24622486                setStyle(ss.styleNew);
    2463                 OSLibSetWindowStyle(OS2HwndFrame, dwStyle);
     2487                if(!IsWindowDestroyed())
     2488                    OSLibSetWindowStyle(OS2HwndFrame, dwStyle);
    24642489                SendMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
    24652490                return ss.styleOld;
  • trunk/src/user32/win32wbase.h

    r1336 r1337  
    1 /* $Id: win32wbase.h,v 1.27 1999-10-17 15:46:10 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.28 1999-10-17 16:42:40 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    148148         BOOL   ShowWindow(ULONG nCmdShow);
    149149         BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
     150         BOOL   SetWindowPlacement(WINDOWPLACEMENT *winpos);
    150151         BOOL   DestroyWindow();
    151152         HWND   SetActiveWindow();
  • trunk/src/user32/window.cpp

    r1336 r1337  
    1 /* $Id: window.cpp,v 1.17 1999-10-17 15:46:10 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.18 1999-10-17 16:42:40 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    147147        {
    148148          sprintf(tmpClassA,"#%d", (int) className);
    149           AsciiToUnicode(tmpClassA, tmpClassW);
     149          AsciiToUnicode(tmpClassA, tmpClassW);
    150150          classAtom = GlobalFindAtomW(tmpClassW);
    151151          className = (LPCWSTR)tmpClassW;
     
    463463    if(!window) {
    464464        dprintf(("SetWindowPos, window %x not found", hwnd));
    465     SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     465        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    466466        return 0;
    467467    }
     
    471471//******************************************************************************
    472472//******************************************************************************
    473 BOOL WIN32API SetWindowPlacement( HWND arg1, const WINDOWPLACEMENT *  arg2)
    474 {
    475     dprintf(("USER32:  SetWindowPlacement\n"));
    476     return O32_SetWindowPlacement(arg1, arg2);
    477 }
    478 //******************************************************************************
    479 //******************************************************************************
    480 BOOL WIN32API GetWindowPlacement( HWND arg1, LPWINDOWPLACEMENT arg2)
    481 {
    482 #ifdef DEBUG
    483     WriteLog("USER32:  GetWindowPlacement\n");
    484 #endif
    485     return O32_GetWindowPlacement(arg1, arg2);
     473BOOL WIN32API SetWindowPlacement(HWND hwnd, const WINDOWPLACEMENT *winpos)
     474{
     475  Win32BaseWindow *window;
     476
     477    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     478    if(!window) {
     479        dprintf(("SetWindowPlacement, window %x not found", hwnd));
     480        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     481        return 0;
     482    }
     483    return window->SetWindowPlacement((WINDOWPLACEMENT *)winpos);
     484}
     485//******************************************************************************
     486//******************************************************************************
     487BOOL WIN32API GetWindowPlacement(HWND hwnd, LPWINDOWPLACEMENT arg2)
     488{
     489    dprintf(("USER32:  GetWindowPlacement\n"));
     490    return O32_GetWindowPlacement(Win32BaseWindow::Win32ToOS2FrameHandle(hwnd), arg2);
    486491}
    487492//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.