Ignore:
Timestamp:
Jul 17, 1999, 1:56:51 PM (26 years ago)
Author:
sandervl
Message:

* empty log message *

File:
1 edited

Legend:

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

    r319 r321  
    1 /* $Id: win32wnd.cpp,v 1.5 1999-07-17 09:17:58 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.6 1999-07-17 11:52:23 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    123123  if (cs->hwndParent)
    124124  {
     125        Win32Window *window = GetWindowFromHandle(cs->hwndParent);
     126        if(!window) {
     127                dprintf(("Bad parent %04x\n", cs->hwndParent ));
     128                SetLastError(ERROR_INVALID_PARAMETER);
     129                return FALSE;
     130        }
    125131        /* Make sure parent is valid */
    126         if (!IsWindow( cs->hwndParent ))
     132        if (!window->IsWindow() )
    127133        {
    128134                dprintf(("Bad parent %04x\n", cs->hwndParent ));
     
    345351        return FALSE;
    346352  }
    347 
     353  if(OS2Hwnd != OS2HwndFrame) {
     354        if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
     355                dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));
     356                return FALSE;
     357        }
     358        if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
     359                dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));
     360                return FALSE;
     361        }
     362  }
    348363  /* Set the window menu */
    349364  if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
     
    415430
    416431                NotifyParent(WM_CREATE, 0, 0);
    417                 if( !IsWindow(Win32Hwnd) )
     432                if( !IsWindow() )
    418433                {
    419434                    return FALSE;
     
    975990  switch(hwndInsertAfter) {
    976991        case HWND_BOTTOM:
     992                hwndInsertAfter = HWNDOS_BOTTOM;
     993                break;
     994        case HWND_TOPMOST: //TODO:
     995        case HWND_NOTOPMOST: //TODO:
    977996        case HWND_TOP:
    978         case HWND_TOPMOST:
    979         case HWND_NOTOPMOST:
     997                hwndInsertAfter = HWNDOS_TOP;
    980998                break;
    981999        default:
     
    10231041}
    10241042//******************************************************************************
    1025 //TODO:
    1026 //******************************************************************************
    1027 HWND Win32Window::SetActiveWindow()
    1028 {
    1029   return O32_SetActiveWindow(OS2Hwnd);
    1030 }
    1031 //******************************************************************************
    10321043//******************************************************************************
    10331044HWND Win32Window::GetParent()
     
    10781089HWND Win32Window::GetTopWindow()
    10791090{
    1080  HWND topchild;
    1081 
    1082   topchild = OSLibWinQueryTopMostChildWindow(OS2HwndFrame);
    1083   if(topchild)
    1084   {
    1085         return topchild;
    1086   }
    1087   else  return 0;
     1091  return GetWindow(GW_CHILD);
    10881092}
    10891093//******************************************************************************
     
    11071111{
    11081112  return OSLibWinIsIconic(OS2HwndFrame);
     1113}
     1114//******************************************************************************
     1115//TODO: not complete nor correct (distinction between top-level, top-most & child windows)
     1116//******************************************************************************
     1117HWND Win32Window::GetWindow(UINT uCmd)
     1118{
     1119 Win32Window  *win32wnd;
     1120 ULONG         magic;
     1121 ULONG         getcmd = 0;
     1122 HWND          hwndRelated;
     1123
     1124  dprintf(("GetWindow %x %d NOT COMPLETE", getWindowHandle(), uCmd));
     1125  switch(uCmd)
     1126  {
     1127        case GW_CHILD:
     1128                getcmd = QWOS_TOP;
     1129                break;
     1130        case GW_HWNDFIRST:
     1131                if(getParent()) {
     1132                        getcmd = QWOS_TOP; //top of child windows
     1133                }
     1134                else    getcmd = QWOS_TOP; //TODO
     1135                break;
     1136        case GW_HWNDLAST:
     1137                if(getParent()) {
     1138                        getcmd = QWOS_BOTTOM; //bottom of child windows
     1139                }
     1140                else    getcmd = QWOS_BOTTOM; //TODO
     1141                break;
     1142        case GW_HWNDNEXT:
     1143                getcmd = QWOS_NEXT;
     1144                break;
     1145        case GW_HWNDPREV:
     1146                getcmd = QWOS_PREV;
     1147                break;
     1148        case GW_OWNER:
     1149                if(owner) {
     1150                        return owner->getWindowHandle();
     1151                }
     1152                else    return 0;
     1153  }
     1154  hwndRelated = OSLibWinQueryWindow(OS2HwndFrame, getcmd);
     1155  if(hwndRelated)
     1156  {
     1157        win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
     1158        magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
     1159        if(CheckMagicDword(magic) && win32wnd)
     1160        {
     1161                return win32wnd->getWindowHandle();
     1162        }
     1163  }
     1164  return 0;
     1165}
     1166//******************************************************************************
     1167//******************************************************************************
     1168HWND Win32Window::SetActiveWindow()
     1169{
     1170  return OSLibWinSetActiveWindow(OS2HwndFrame);
     1171}
     1172//******************************************************************************
     1173//WM_ENABLE is sent to hwnd, but not to it's children (as it should be)
     1174//******************************************************************************
     1175BOOL Win32Window::EnableWindow(BOOL fEnable)
     1176{
     1177  return OSLibWinEnableWindow(OS2HwndFrame, fEnable);
     1178}
     1179//******************************************************************************
     1180//******************************************************************************
     1181BOOL Win32Window::BringWindowToTop()
     1182{
     1183  return SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
     1184}
     1185//******************************************************************************
     1186//******************************************************************************
     1187HWND Win32Window::GetActiveWindow()
     1188{
     1189 HWND          hwndActive;
     1190 Win32Window  *win32wnd;
     1191 ULONG         magic;
     1192
     1193  hwndActive = OSLibWinQueryActiveWindow();
     1194
     1195  win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32WNDPTR);
     1196  magic    = OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32PM_MAGIC);
     1197  if(CheckMagicDword(magic) && win32wnd)
     1198  {
     1199        return win32wnd->getWindowHandle();
     1200  }
     1201  return hwndActive;
     1202}
     1203//******************************************************************************
     1204//******************************************************************************
     1205BOOL Win32Window::IsWindow()
     1206{
     1207  return TRUE;
     1208}
     1209//******************************************************************************
     1210//******************************************************************************
     1211BOOL Win32Window::IsWindowEnabled()
     1212{
     1213  return OSLibWinIsWindowEnabled(OS2Hwnd);
     1214}
     1215//******************************************************************************
     1216//******************************************************************************
     1217BOOL Win32Window::IsWindowVisible()
     1218{
     1219  return OSLibWinIsWindowVisible(OS2Hwnd);
    11091220}
    11101221//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.