Ignore:
Timestamp:
Aug 22, 1999, 8:29:38 PM (26 years ago)
Author:
dengert
Message:

create windows with correct parent and z-order.

File:
1 edited

Legend:

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

    r601 r628  
    1 /* $Id: oslibwin.cpp,v 1.22 1999-08-20 20:09:51 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.23 1999-08-22 18:29:37 dengert Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    3131  if(hwndParent == OSLIB_HWND_DESKTOP)
    3232  {
    33         hwndParent = HWND_DESKTOP;
     33        hwndParent = HWND_DESKTOP;
    3434  }
    3535
     
    3939//******************************************************************************
    4040HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
    41                           char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame)
     41                          char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame)
    4242{
    4343 HWND  hwndClient;
     
    4646
    4747  if(pszName && *pszName == 0) {
    48         pszName = NULL;
     48        pszName = NULL;
    4949  }
    5050  if(hwndParent == OSLIB_HWND_DESKTOP) {
    51         hwndParent = HWND_DESKTOP;
     51        hwndParent = HWND_DESKTOP;
    5252  }
    5353  if(Owner == OSLIB_HWND_DESKTOP) {
    54         Owner = HWND_DESKTOP;
     54        Owner = HWND_DESKTOP;
    5555  }
    5656
    5757  if(dwFrameStyle) {
    58         dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs
    59         if(pszName)
    60                 dwFrameStyle |= FCF_TITLEBAR;
    61 
    62         dwFrameStyle |= FCF_TASKLIST;
    63         *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
    64                                        &dwFrameStyle, WIN32_STDCLASS,
    65                                        "", 0, 0, 0, &hwndClient);
    66         if(*hwndFrame) {
    67                 if(pszName) {
    68                         WinSetWindowText(*hwndFrame, pszName);
    69                 }
    70                 return hwndClient;
    71         }
    72         dprintf(("OSLibWinCreateWindow: WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
    73         return 0;
     58        ULONG dwClientStyle;
     59
     60        dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP);
     61        if(pszName)
     62                dwFrameStyle |= FCF_TITLEBAR;
     63
     64        dwFrameStyle |= FCF_TASKLIST;
     65        *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
     66                                       &dwFrameStyle, WIN32_STDCLASS,
     67                                       "", dwClientStyle, 0, 0, &hwndClient);
     68        if(*hwndFrame) {
     69                if(pszName) {
     70                        WinSetWindowText(*hwndFrame, pszName);
     71                }
     72                return hwndClient;
     73        }
     74        dprintf(("OSLibWinCreateWindow: WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
     75        return 0;
    7476  }
    7577  hwndClient = WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, 0, 0, 0, 0,
    76                                Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL,
    77                                NULL);
     78                               Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL,
     79                               NULL);
    7880  *hwndFrame = hwndClient;
    7981  return hwndClient;
     
    8385BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle)
    8486{
    85   *OSWinStyle   = 0;
     87  *OSWinStyle   = 0;
    8688  *OSFrameStyle = 0;
    8789
    8890  /* Window styles */
    8991  if(dwStyle & WS_MINIMIZE_W)
    90         *OSWinStyle |= WS_MINIMIZED;
     92        *OSWinStyle |= WS_MINIMIZED;
    9193//Done explicitely in CreateWindowExA
    9294#if 0
    9395  if(dwStyle & WS_VISIBLE_W)
    94         *OSWinStyle |= WS_VISIBLE;
     96        *OSWinStyle |= WS_VISIBLE;
    9597#endif
    9698  if(dwStyle & WS_DISABLED_W)
    97         *OSWinStyle |= WS_DISABLED;
     99        *OSWinStyle |= WS_DISABLED;
    98100  if(dwStyle & WS_CLIPSIBLINGS_W)
    99         *OSWinStyle |= WS_CLIPSIBLINGS;
     101        *OSWinStyle |= WS_CLIPSIBLINGS;
    100102  if(dwStyle & WS_CLIPCHILDREN_W)
    101         *OSWinStyle |= WS_CLIPCHILDREN;
     103        *OSWinStyle |= WS_CLIPCHILDREN;
    102104  if(dwStyle & WS_MAXIMIZE_W)
    103         *OSWinStyle |= WS_MAXIMIZED;
     105        *OSWinStyle |= WS_MAXIMIZED;
    104106  if(dwStyle & WS_GROUP_W)
    105         *OSWinStyle |= WS_GROUP;
     107        *OSWinStyle |= WS_GROUP;
    106108  if(dwStyle & WS_TABSTOP_W)
    107         *OSWinStyle |= WS_TABSTOP;
     109        *OSWinStyle |= WS_TABSTOP;
    108110
    109111  if(dwStyle & WS_CAPTION_W)
    110         *OSFrameStyle |= FCF_TITLEBAR;
     112        *OSFrameStyle |= FCF_TITLEBAR;
    111113  if(dwStyle & WS_DLGFRAME_W)
    112         *OSFrameStyle |= FCF_DLGBORDER;
     114        *OSFrameStyle |= FCF_DLGBORDER;
    113115  else
    114116  if(dwStyle & WS_BORDER_W)
    115         *OSFrameStyle |= FCF_BORDER;
     117        *OSFrameStyle |= FCF_BORDER;
    116118
    117119  if(dwStyle & WS_VSCROLL_W)
    118         *OSFrameStyle |= FCF_VERTSCROLL;
     120        *OSFrameStyle |= FCF_VERTSCROLL;
    119121  if(dwStyle & WS_HSCROLL_W)
    120         *OSFrameStyle |= FCF_HORZSCROLL;
     122        *OSFrameStyle |= FCF_HORZSCROLL;
    121123  if(dwStyle & WS_SYSMENU_W)
    122         *OSFrameStyle |= FCF_SYSMENU;
     124        *OSFrameStyle |= FCF_SYSMENU;
    123125  if(dwStyle & WS_THICKFRAME_W)
    124         *OSFrameStyle |= FCF_SIZEBORDER;        //??
     126        *OSFrameStyle |= FCF_SIZEBORDER;        //??
    125127  if(dwStyle & WS_MINIMIZEBOX_W)
    126         *OSFrameStyle |= FCF_MINBUTTON;
     128        *OSFrameStyle |= FCF_MINBUTTON;
    127129  if(dwStyle & WS_MAXIMIZEBOX_W)
    128         *OSFrameStyle |= FCF_MAXBUTTON;
     130        *OSFrameStyle |= FCF_MAXBUTTON;
    129131
    130132  if(dwExStyle & WS_EX_DLGMODALFRAME_W)
    131         *OSFrameStyle |= FCF_DLGBORDER;
     133        *OSFrameStyle |= FCF_DLGBORDER;
    132134
    133135  return TRUE;
     
    224226//******************************************************************************
    225227BOOL OSLibWinSetWindowPos(HWND hwnd, HWND hwndInsertBehind, LONG x, LONG y, LONG cx,
    226                           LONG cy, ULONG fl)
     228                          LONG cy, ULONG fl)
    227229{
    228230 HWND hwndParent = hwndInsertBehind;
     
    230232
    231233    if(fl & SWP_MOVE) {
    232         switch(hwndParent)
    233         {
    234             case HWNDOS_TOP:
    235             case HWNDOS_BOTTOM:
    236                 hwndParent = HWND_DESKTOP;
    237                 break;
    238         }
    239         y = MapOS2ToWin32Y(hwndParent, cy, y);
     234        switch(hwndParent)
     235        {
     236            case HWNDOS_TOP:
     237            case HWNDOS_BOTTOM:
     238                hwndParent = HWND_DESKTOP;
     239                break;
     240        }
     241        y = MapOS2ToWin32Y(hwndParent, cy, y);
    240242    }
    241243    rc = WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
     
    250252
    251253  if(fl & SWP_SHOW) {
    252         rc = WinShowWindow(hwnd, TRUE);
     254        rc = WinShowWindow(hwnd, TRUE);
    253255  }
    254256  if(rc == 0)
    255         dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
     257        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
    256258  rc = WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, fl);
    257259  if(rc == 0)
    258         dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
     260        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
    259261  return rc;
    260262}
     
    269271BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo)
    270272{
    271  BOOL     rc;
     273 BOOL     rc;
    272274 RECTLOS2 rectl;
    273275
    274276  rc = WinQueryWindowRect(hwnd, (PRECTL)&rectl);
    275277  if(rc) {
    276         if(RelativeTo == RELATIVE_TO_SCREEN) {
    277                 MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl, pRect);
    278         }
    279         else    MapOS2ToWin32Rectl(&rectl, pRect);
    280   }
    281   else  memset(pRect, 0, sizeof(RECT));
     278        if(RelativeTo == RELATIVE_TO_SCREEN) {
     279                MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl, pRect);
     280        }
     281        else    MapOS2ToWin32Rectl(&rectl, pRect);
     282  }
     283  else  memset(pRect, 0, sizeof(RECT));
    282284  return rc;
    283285}
     
    291293  rc = WinQueryWindowPos(hwnd, &swp);
    292294  if(rc == FALSE) {
    293         dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
    294         return FALSE;
     295        dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
     296        return FALSE;
    295297  }
    296298
    297299  if(swp.fl & SWP_MINIMIZE)
    298         return TRUE;
    299   else  return FALSE;
     300        return TRUE;
     301  else  return FALSE;
    300302}
    301303//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.