Ignore:
Timestamp:
Jul 18, 1999, 12:39:52 PM (26 years ago)
Author:
sandervl
Message:

Lots of changes

File:
1 edited

Legend:

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

    r324 r325  
    1 /* $Id: win32wnd.cpp,v 1.8 1999-07-17 18:30:51 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.9 1999-07-18 10:39:51 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    2828#include <oslibwin.h>
    2929#include <oslibutil.h>
     30#include <oslibgdi.h>
    3031
    3132#define HAS_DLGFRAME(style,exStyle) \
     
    383384  maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
    384385
    385   if(sendMessage(WM_NCCREATE, 0, (LPARAM)cs) )
     386  if(SendInternalMessage(WM_NCCREATE, 0, (LPARAM)cs) )
    386387  {
    387388        SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient );
     
    389390                                          maxPos.y - rectWindow.top);
    390391        dprintf(("Sending WM_CREATE"));
    391         if( (sendMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
     392        if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
    392393        {
    393394            SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
     
    430431        if( dwStyle & WS_MINIMIZE )
    431432        {
    432             if( !SendMessageA(WM_QUERYOPEN, 0, 0L ) )
     433            if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )
    433434                return (SWP_NOSIZE | SWP_NOMOVE);
    434435            swpFlags |= SWP_NOCOPYBITS;
     
    570571//    }
    571572
    572     SendMessageA(WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
     573    SendInternalMessageA(WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
    573574
    574575      /* Some sanity checks */
     
    614615        params.lppos = &winposCopy;
    615616   }
    616    result = SendMessageA(WM_NCCALCSIZE, calcValidRect,
    617                           (LPARAM)&params );
     617   result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect,
     618                                 (LPARAM)&params );
    618619   *newClientRect = params.rgrc[0];
    619620   return result;
     
    624625{
    625626  OS2Hwnd = hwndOS2;
    626   return SendMessageA(WM_CREATE, 0, initParam);
     627  return SendInternalMessageA(WM_CREATE, 0, initParam);
    627628}
    628629//******************************************************************************
     
    630631ULONG Win32Window::MsgQuit()
    631632{
    632   return SendMessageA(WM_QUIT, 0, 0);
     633  return SendInternalMessageA(WM_QUIT, 0, 0);
    633634}
    634635//******************************************************************************
     
    636637ULONG Win32Window::MsgClose()
    637638{
    638   return SendMessageA(WM_CLOSE, 0, 0);
     639  return SendInternalMessageA(WM_CLOSE, 0, 0);
    639640}
    640641//******************************************************************************
     
    644645 ULONG rc;
    645646
    646   rc = SendMessageA(WM_DESTROY, 0, 0);
     647  rc = SendInternalMessageA(WM_DESTROY, 0, 0);
    647648  delete this;
    648649  return rc;
     
    652653ULONG Win32Window::MsgEnable(BOOL fEnable)
    653654{
    654   return SendMessageA(WM_ENABLE, fEnable, 0);
     655  return SendInternalMessageA(WM_ENABLE, fEnable, 0);
    655656}
    656657//******************************************************************************
     
    659660ULONG Win32Window::MsgShow(BOOL fShow)
    660661{
    661   return SendMessageA(WM_SHOWWINDOW, fShow, 0);
     662  return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
    662663}
    663664//******************************************************************************
     
    683684  else  fwSizeType = SIZE_RESTORED;
    684685
    685   return SendMessageA(WM_SIZE, fwSizeType, MAKELONG((USHORT)width, (USHORT)height));
     686  return SendInternalMessageA(WM_SIZE, fwSizeType, MAKELONG((USHORT)width, (USHORT)height));
    686687}
    687688//******************************************************************************
     
    689690ULONG Win32Window::MsgActivate(BOOL fActivate, HWND hwnd)
    690691{
    691   return SendMessageA(WM_ACTIVATE, (fActivate) ? WA_ACTIVE : WA_INACTIVE, hwnd);
     692  return SendInternalMessageA(WM_ACTIVATE, (fActivate) ? WA_ACTIVE : WA_INACTIVE, hwnd);
    692693}
    693694//******************************************************************************
     
    695696ULONG Win32Window::MsgSetFocus(HWND hwnd)
    696697{
    697   return SendMessageA(WM_SETFOCUS, hwnd, 0);
     698  return SendInternalMessageA(WM_SETFOCUS, hwnd, 0);
    698699}
    699700//******************************************************************************
     
    701702ULONG Win32Window::MsgKillFocus(HWND hwnd)
    702703{
    703   return SendMessageA(WM_KILLFOCUS, hwnd, 0);
     704  return SendInternalMessageA(WM_KILLFOCUS, hwnd, 0);
    704705}
    705706//******************************************************************************
     
    732733                return 1;
    733734  }
    734   return SendMessageA(win32msg, 0, MAKELONG(x, MapOS2ToWin32Y(OS2Hwnd, y)));
     735  return SendInternalMessageA(win32msg, 0, MAKELONG(x, MapOS2ToWin32Y(OS2Hwnd, y)));
    735736}
    736737//******************************************************************************
     
    738739ULONG Win32Window::MsgPaint(ULONG tmp1, ULONG tmp2)
    739740{
    740   return SendMessageA(WM_PAINT, 0, 0);
     741  return SendInternalMessageA(WM_PAINT, 0, 0);
    741742}
    742743//******************************************************************************
     
    744745ULONG Win32Window::MsgEraseBackGround(ULONG hps)
    745746{
    746   return SendMessageA(WM_ERASEBKGND, hps, 0);
     747  return SendInternalMessageA(WM_ERASEBKGND, hps, 0);
     748}
     749//******************************************************************************
     750//******************************************************************************
     751ULONG Win32Window::MsgSetText(LPSTR lpsz, LONG cch)
     752{
     753  if(isUnicode) {
     754        return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);
     755  }
     756  else  return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
    747757}
    748758//******************************************************************************
     
    787797}
    788798//******************************************************************************
    789 //todo, unicode msgs
    790799//******************************************************************************
    791800LRESULT Win32Window::SendMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
     
    823832                NotifyParent(Msg, wParam, lParam);
    824833                return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
     834
     835        default:
     836                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
     837  }
     838}
     839//******************************************************************************
     840//Called as a result of an OS/2 message
     841//******************************************************************************
     842LRESULT Win32Window::SendInternalMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)
     843{
     844  if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
     845        dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
     846
     847  if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg
     848        return(0);
     849  }
     850  switch(Msg)
     851  {
     852        case WM_CREATE:
     853        {
     854                if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
     855                        dprintf(("WM_NCCREATE returned FALSE\n"));
     856                        return(0); //don't create window
     857                }
     858                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
     859                        dprintf(("WM_CREATE returned FALSE\n"));
     860                        return(0); //don't create window
     861                }
     862                NotifyParent(Msg, wParam, lParam);
     863
     864                return(1);
     865        }
     866        case WM_LBUTTONDOWN:
     867        case WM_MBUTTONDOWN:
     868        case WM_RBUTTONDOWN:
     869                NotifyParent(Msg, wParam, lParam);
     870                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
     871
     872        case WM_DESTROY:
     873                win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
     874                NotifyParent(Msg, wParam, lParam);
     875                return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
     876        default:
     877                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
     878  }
     879}
     880//******************************************************************************
     881//Called as a result of an OS/2 message
     882//todo, unicode msgs (WM_SETTEXT etc)
     883//******************************************************************************
     884LRESULT Win32Window::SendInternalMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
     885{
     886  if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
     887        dprintf(("SendInternalMessageW %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
     888
     889  if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg
     890        return(0);
     891  }
     892  switch(Msg)
     893  {
     894        case WM_CREATE:
     895        {
     896                if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
     897                        dprintf(("WM_NCCREATE returned FALSE\n"));
     898                        return(0); //don't create window
     899                }
     900                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
     901                        dprintf(("WM_CREATE returned FALSE\n"));
     902                        return(0); //don't create window
     903                }
     904                NotifyParent(Msg, wParam, lParam);
     905
     906                return(1);
     907        }
     908        case WM_LBUTTONDOWN:
     909        case WM_MBUTTONDOWN:
     910        case WM_RBUTTONDOWN:
     911                NotifyParent(Msg, wParam, lParam);
     912                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
     913
     914        case WM_DESTROY:
     915                win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);
     916                NotifyParent(Msg, wParam, lParam);
     917                return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
    825918        default:
    826919                return win32wndproc(getWindowHandle(), Msg, wParam, lParam);
     
    875968                if(parentwindow) {
    876969                        if(Msg == WM_CREATE || Msg == WM_DESTROY) {
    877                                 parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle());
     970                                parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle());
    878971                        }
    879                         else    parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );
     972                        else    parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );
    880973                }
    881974        }
     
    9081001 ULONG showstate = 0;
    9091002
     1003  dprintf(("ShowWindow %x", nCmdShow));
    9101004  switch(nCmdShow)
    9111005  {
     
    9421036                break;
    9431037  }
    944   return OSLibWinShowWindow(OS2Hwnd, showstate);
     1038  return OSLibWinShowWindow(OS2HwndFrame, showstate);
    9451039}
    9461040//******************************************************************************
     
    9941088        setstate |= SWPOS_SHOW;
    9951089
    996   return OSLibWinSetWindowPos(OS2Hwnd, hwndInsertAfter, x, y, cx, cy, setstate);
     1090  return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate);
    9971091}
    9981092//******************************************************************************
     
    10611155BOOL Win32Window::UpdateWindow()
    10621156
    1063  RECTL rect;
    1064 
    1065   if(OSLibWinQueryUpdateRect(OS2Hwnd, (PVOID)&rect))
     1157 RECT rect;
     1158
     1159  if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect))
    10661160  {//update region not empty
    1067         SendMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
     1161        SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
    10681162  }
    10691163  return TRUE;
     
    11811275{
    11821276  return OSLibWinIsWindowVisible(OS2Hwnd);
     1277}
     1278//******************************************************************************
     1279//******************************************************************************
     1280BOOL Win32Window::GetWindowRect(PRECT pRect)
     1281{
     1282//  return OSLibWinIsWindowVisible(OS2Hwnd);
     1283}
     1284//******************************************************************************
     1285//******************************************************************************
     1286int Win32Window::GetWindowTextLengthA()
     1287{
     1288  return OSLibWinQueryWindowTextLength(OS2Hwnd);
     1289}
     1290//******************************************************************************
     1291//******************************************************************************
     1292int Win32Window::GetWindowTextA(LPSTR lpsz, int cch)
     1293{
     1294  return OSLibWinQueryWindowText(OS2Hwnd, cch, lpsz);
     1295}
     1296//******************************************************************************
     1297//******************************************************************************
     1298BOOL Win32Window::SetWindowTextA(LPCSTR lpsz)
     1299{
     1300  return OSLibWinSetWindowText(OS2Hwnd, (LPSTR)lpsz);
    11831301}
    11841302//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.