Changeset 385 for trunk/src


Ignore:
Timestamp:
Jul 24, 1999, 4:01:45 PM (26 years ago)
Author:
sandervl
Message:

* empty log message *

Location:
trunk/src/user32/new
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/makefile

    r384 r385  
    1 # $Id: makefile,v 1.17 1999-07-24 12:40:20 cbratschi Exp $
     1# $Id: makefile,v 1.18 1999-07-24 14:01:44 sandervl Exp $
    22
    33#
     
    8383
    8484msgbox.obj:    msgbox.cpp
    85 window.obj:    window.cpp win32class.h win32wnd.h win32wndchild.h
     85window.obj:    window.cpp win32class.h win32wnd.h win32wndchild.h oslibwin.h
    8686windowmsg.obj: windowmsg.cpp win32class.h win32wnd.h win32wndchild.h
    8787windlg.obj:    windlg.cpp win32wnd.h win32dlg.h
  • trunk/src/user32/new/oslibgdi.cpp

    r342 r385  
    1 /* $Id: oslibgdi.cpp,v 1.4 1999-07-20 07:42:35 sandervl Exp $ */
     1/* $Id: oslibgdi.cpp,v 1.5 1999-07-24 14:01:44 sandervl Exp $ */
    22/*
    33 * Window GDI wrapper functions for OS/2
     
    4949        hwndParent = HWND_DESKTOP;
    5050    }
    51     if(WinMapWindowPoints(hwndChild, hwndParent, (POINTL *)point, 1) != 0) {
     51    if(WinMapWindowPoints(hwndChild, hwndParent, (POINTL *)point, 1) != TRUE) {
    5252        dprintf(("MapOS2ToWin32Point:WinMapWindowPoint %x %x returned false", hwndParent, hwndChild));
    5353        return FALSE;
     
    5555    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
    5656    point->y = rectParent.yTop - point->y - 1;
     57    return TRUE;
     58}
     59//******************************************************************************
     60// MapOS2ToWin32Rect
     61//   Map os/2 rectangle to screen coordinates and convert to win32 rect
     62//
     63// Parameters:
     64//   hwndParent: Parent window handle
     65//   hwndChild:  Child window handle
     66//   rectOS2:    OS/2 child window RECTL
     67//   rectWin32:  Win32 Child window RECT   (IN)
     68//
     69// Returns:
     70//   TRUE:      Success
     71//   FALSE:     Failures
     72//******************************************************************************
     73BOOL MapOS2ToWin32Rectl(HWND hwndParent, HWND hwndChild, PRECTLOS2 rectOS2, PRECT rectWin32)
     74{
     75 RECTLOS2 rectParent = {0};
     76
     77    if(hwndParent == OSLIB_HWND_DESKTOP) {
     78        hwndParent = HWND_DESKTOP;
     79    }
     80    if(WinMapWindowPoints(hwndChild, hwndParent, (PPOINTL)rectOS2, 2) != TRUE) {
     81        dprintf(("MapOS2ToWin32Rect:WinMapWindowPoint %x %x returned false", hwndParent, hwndChild));
     82        return FALSE;
     83    }
     84
     85    ULONG length = rectOS2->yTop - rectOS2->yBottom;
     86
     87    rectWin32->bottom = length - rectOS2->yBottom;
     88    rectWin32->top    = length - rectOS2->yTop;
     89    rectWin32->left   = rectOS2->xLeft;
     90    rectWin32->right  = rectOS2->xRight;
     91
    5792    return TRUE;
    5893}
     
    134169//******************************************************************************
    135170//******************************************************************************
     171BOOL OSLibWinInvalidateRect(HWND hwnd, PRECT pRect, BOOL fIncludeChildren)
     172{
     173 RECTLOS2 rectl;
     174
     175  MapWin32ToOS2Rectl(pRect, &rectl);
     176  return WinInvalidateRect(hwnd, (PRECTL)&rectl, fIncludeChildren);
     177}
     178//******************************************************************************
     179//Returns rectangle in Win32 window coordinates
     180//******************************************************************************
     181BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect)
     182{
     183 BOOL rc;
     184 RECTLOS2 rectl;
     185
     186  rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl);
     187  if(rc) {
     188        MapOS2ToWin32Rectl(&rectl, pRect);
     189  }
     190  else  memset(pRect, 0, sizeof(RECT));
     191  return rc;
     192}
     193//******************************************************************************
     194//******************************************************************************
     195
  • trunk/src/user32/new/oslibgdi.h

    r342 r385  
    1 /* $Id: oslibgdi.h,v 1.3 1999-07-20 07:42:35 sandervl Exp $ */
     1/* $Id: oslibgdi.h,v 1.4 1999-07-24 14:01:44 sandervl Exp $ */
    22/*
    33 * Window GDI wrapper functions for OS/2
     
    3838BOOL  OSLibWinReleasePS(HDC hdc);
    3939
     40BOOL  OSLibWinInvalidateRect(HWND hwnd, PRECT pRect, BOOL fIncludeChildren); //must be RECTL pointer!
     41BOOL  OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect);
     42
    4043//******************************************************************************
    4144//Map win32 y coordinate (in window coordinates) to OS/2 y coord. (in window coordinates)
     
    4952BOOL  MapOS2ToWin32Point(HWND hwndParent, HWND hwndChild, OSLIBPOINT *point);
    5053
     54//map os/2 rectangle to screen coordinates and convert to win32 rect
     55BOOL  MapOS2ToWin32Rectl(HWND hwndParent, HWND hwndChild, PRECTLOS2 rectOS2, PRECT rectWin32);
     56
    5157BOOL  MapOS2ToWin32Rectl(PRECTLOS2 rectOS2, PRECT rectWin32);
    5258BOOL  MapWin32ToOS2Rectl(PRECT rectWin32, PRECTLOS2 rectOS2);
  • trunk/src/user32/new/oslibwin.cpp

    r345 r385  
    1 /* $Id: oslibwin.cpp,v 1.18 1999-07-20 15:46:53 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.19 1999-07-24 14:01:44 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    183183//******************************************************************************
    184184//******************************************************************************
    185 BOOL OSLibWinInvalidateRect(HWND hwnd,POSRECTL pwrc,BOOL fIncludeChildren)
    186 {
    187   return WinInvalidateRect(hwnd,(PRECTL)pwrc,fIncludeChildren);
    188 }
    189 //******************************************************************************
    190 //******************************************************************************
    191185LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue)
    192186{
     
    260254}
    261255//******************************************************************************
    262 //Returns rectangle in Win32 window coordinates
    263 //******************************************************************************
    264 BOOL OSLibWinQueryUpdateRect(HWND hwnd, PVOID pRect)
    265 {
    266  BOOL rc;
     256//******************************************************************************
     257BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo)
     258{
     259 BOOL     rc;
    267260 RECTLOS2 rectl;
    268261
    269   rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl);
     262  rc = WinQueryWindowRect(hwnd, (PRECTL)&rectl);
    270263  if(rc) {
    271         MapOS2ToWin32Rectl(&rectl, (PRECT)pRect);
     264        if(RelativeTo == RELATIVE_TO_SCREEN) {
     265                MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl, pRect);
     266        }
     267        else    MapOS2ToWin32Rectl(&rectl, pRect);
    272268  }
    273269  else  memset(pRect, 0, sizeof(RECT));
  • trunk/src/user32/new/oslibwin.h

    r345 r385  
    1 /* $Id: oslibwin.h,v 1.16 1999-07-20 15:46:53 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.17 1999-07-24 14:01:44 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    3838BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus);
    3939ULONG OSLibGetWindowHeight(HWND hwnd); //for point transformation
    40 
    41 typedef struct _OSRECTL
    42 {
    43   LONG xLeft;
    44   LONG yBottom;
    45   LONG xRight;
    46   LONG yTop;
    47 } OSRECTL;
    48 
    49 typedef OSRECTL *POSRECTL;
    50 
    51 BOOL OSLibWinInvalidateRect(HWND hwnd,POSRECTL pwrc,BOOL fIncludeChildren); //must be RECTL pointer!
    5240
    5341//reserved deleted
     
    182170
    183171BOOL  OSLibWinDestroyWindow(HWND hwnd);
    184 BOOL  OSLibWinQueryUpdateRect(HWND hwnd, PVOID pRect);
     172
    185173BOOL  OSLibWinIsIconic(HWND hwnd);
    186174BOOL  OSLibWinSetActiveWindow(HWND hwnd);
     
    190178BOOL  OSLibWinIsWindowVisible(HWND hwnd);
    191179BOOL  OSLibWinQueryActiveWindow();
     180
     181
     182#define RELATIVE_TO_WINDOW 0
     183#define RELATIVE_TO_SCREEN 1
     184BOOL  OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo = RELATIVE_TO_WINDOW);
    192185
    193186#define QWOS_NEXT         0
  • trunk/src/user32/new/user32.cpp

    r330 r385  
    1 /* $Id: user32.cpp,v 1.8 1999-07-18 17:12:02 sandervl Exp $ */
     1/* $Id: user32.cpp,v 1.9 1999-07-24 14:01:44 sandervl Exp $ */
    22
    33/*
     
    7979//Coordinate transformation
    8080
    81 inline void Win32ToOS2Rect(POSRECTL dest,PRECT source,ULONG windowH)
    82 {
    83   dest->xLeft   = source->left;
    84   dest->xRight  = source->right;
    85   dest->yTop    = windowH-source->top;
    86   dest->yBottom = windowH-source->bottom;
    87 }
    88 
    89 inline void OS2ToWin32Rect(PRECT dest,POSRECTL source,ULONG windowH)
    90 {
    91   dest->left   = source->xLeft;
    92   dest->right  = source->xRight;
    93   dest->top    = windowH-source->yTop;
    94   dest->bottom = windowH-source->yBottom;
    95 }
    96 
    9781inline void OS2ToWin32ScreenPos(POINT *dest,POINT *source)
    9882{
     
    279263
    280264    return TRUE;
    281 }
    282 //******************************************************************************
    283 //******************************************************************************
    284 BOOL WIN32API InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase)
    285 {
    286 #ifdef DEBUG
    287     if(lpRect)
    288         WriteLog("USER32:  InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", hWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase);
    289     else    WriteLog("USER32:  InvalidateRect for window %X NULL, %d\n", hWnd, bErase);
    290 #endif
    291 
    292     //CB: bErase no quite the same
    293     hWnd = Win32Window::Win32ToOS2Handle(hWnd);
    294     if (lpRect)
    295     {
    296       OSRECTL rect;
    297       ULONG windowH;
    298 
    299       windowH = OSLibGetWindowHeight(hWnd);
    300       Win32ToOS2Rect(&rect,(PRECT)lpRect,windowH);
    301       return OSLibWinInvalidateRect(hWnd,&rect,bErase); //rect == RECTL
    302     } else return OSLibWinInvalidateRect(hWnd,NULL,bErase);
    303265}
    304266//******************************************************************************
  • trunk/src/user32/new/win32wnd.cpp

    r383 r385  
    1 /* $Id: win32wnd.cpp,v 1.19 1999-07-24 12:39:53 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.20 1999-07-24 14:01:45 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    708708        return 0; //todo
    709709  }
     710  return 0;
    710711}
    711712//******************************************************************************
     
    14091410BOOL Win32Window::IsWindowEnabled()
    14101411{
    1411   return OSLibWinIsWindowEnabled(OS2Hwnd);
     1412    return OSLibWinIsWindowEnabled(OS2Hwnd);
    14121413}
    14131414//******************************************************************************
     
    14151416BOOL Win32Window::IsWindowVisible()
    14161417{
    1417   return OSLibWinIsWindowVisible(OS2Hwnd);
     1418    return OSLibWinIsWindowVisible(OS2Hwnd);
    14181419}
    14191420//******************************************************************************
     
    14211422BOOL Win32Window::GetWindowRect(PRECT pRect)
    14221423{
    1423 //  return OSLibWinIsWindowVisible(OS2Hwnd);
     1424    return OSLibWinQueryWindowRect(OS2Hwnd, pRect, RELATIVE_TO_SCREEN);
    14241425}
    14251426//******************************************************************************
     
    14271428int Win32Window::GetWindowTextLengthA()
    14281429{
    1429   return OSLibWinQueryWindowTextLength(OS2Hwnd);
     1430    return OSLibWinQueryWindowTextLength(OS2Hwnd);
    14301431}
    14311432//******************************************************************************
     
    14331434int Win32Window::GetWindowTextA(LPSTR lpsz, int cch)
    14341435{
    1435   return OSLibWinQueryWindowText(OS2Hwnd, cch, lpsz);
     1436    return OSLibWinQueryWindowText(OS2Hwnd, cch, lpsz);
    14361437}
    14371438//******************************************************************************
  • trunk/src/user32/new/window.cpp

    r378 r385  
    1 /* $Id: window.cpp,v 1.8 1999-07-23 19:09:25 cbratschi Exp $ */
     1/* $Id: window.cpp,v 1.9 1999-07-24 14:01:45 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    2020#include <win32wnd.h>
    2121#include <oslibwin.h>
     22#include <oslibgdi.h>
    2223#include "user32.h"
    2324#include "icon.h"
     
    588589//******************************************************************************
    589590//******************************************************************************
    590 BOOL WIN32API GetClientRect( HWND arg1, PRECT  arg2)
    591 {
    592 #ifdef DEBUG
    593     WriteLog("USER32:  GetClientRect of %X\n", arg1);
    594 #endif
    595     arg1 = Win32Window::Win32ToOS2Handle(arg1);
    596     return O32_GetClientRect(arg1, arg2);
     591BOOL WIN32API GetClientRect( HWND hwnd, PRECT pRect)
     592{
     593#ifdef DEBUG
     594    WriteLog("USER32:  GetClientRect of %X\n", hwnd);
     595#endif
     596    hwnd = Win32Window::Win32ToOS2Handle(hwnd);
     597    return OSLibWinQueryWindowRect(hwnd, pRect);
     598//    return O32_GetClientRect(hwnd, arg2);
    597599}
    598600//******************************************************************************
     
    860862    if (!lpRect) return FALSE;
    861863
    862     return OSLibWinQueryUpdateRect(Win32Window::Win32ToOS2Handle(hwnd), (PVOID)&lpRect);
     864    return OSLibWinQueryUpdateRect(Win32Window::Win32ToOS2Handle(hwnd), lpRect);
     865}
     866//******************************************************************************
     867//******************************************************************************
     868BOOL WIN32API InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase)
     869{
     870#ifdef DEBUG
     871    if(lpRect)
     872         WriteLog("USER32:  InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", hWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase);
     873    else WriteLog("USER32:  InvalidateRect for window %X NULL, %d\n", hWnd, bErase);
     874#endif
     875
     876    //CB: bErase no quite the same
     877    hWnd = Win32Window::Win32ToOS2Handle(hWnd);
     878    if (lpRect)
     879    {
     880         return OSLibWinInvalidateRect(hWnd, (PRECT)lpRect, bErase);
     881    }
     882    else return OSLibWinInvalidateRect(hWnd,NULL,bErase);
    863883}
    864884//******************************************************************************
  • trunk/src/user32/new/wingdi.cpp

    r378 r385  
    1 /* $Id: wingdi.cpp,v 1.5 1999-07-23 19:09:26 cbratschi Exp $ */
     1/* $Id: wingdi.cpp,v 1.6 1999-07-24 14:01:45 sandervl Exp $ */
    22/*
    33 * Win32 Window graphics apis for OS/2
     
    1717#include <oslibgdi.h>
    1818
     19#define OPEN32_GDI
     20
    1921//******************************************************************************
    2022//TODO: Not complete
     
    2325{
    2426  Win32Window *window;
     27  HDC hdc;
    2528
    2629    window = Win32Window::GetWindowFromHandle(hwnd);
     
    2932        return 0;
    3033    }
    31     dprintf(("BeginPaint %X\n", hwnd));
    32     return O32_BeginPaint(window->getOS2WindowHandle(),lps);
     34#ifdef OPEN32_GDI
     35    hdc = O32_BeginPaint(window->getOS2WindowHandle(),lps);
    3336    //CB: conflict with Open32 mechanism
    34     //lps->hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), &lps->rcPaint);
     37#else
     38    hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), &lps->rcPaint);
     39    lps->hdc = hdc;
     40#endif
     41    dprintf(("BeginPaint %X returned %x\n", hwnd, hdc));
     42    return hdc;
    3543
    36     return lps->hdc;
     44//    return lps->hdc;
    3745}
    3846//******************************************************************************
     
    4149{
    4250    dprintf(("EndPaint %x\n", hwnd));
     51#ifdef OPEN32_GDI
    4352    return O32_EndPaint(hwnd,lps);
    4453    //CB: dito
    45     //return OSLibWinEndPaint(lps->hdc);
     54#else
     55    return OSLibWinEndPaint(lps->hdc);
     56#endif
    4657}
    4758//******************************************************************************
     
    5869   }
    5970   dprintf(("GetDC %x", hwnd));
     71#ifdef OPEN32_GDI
    6072   return O32_GetDC(window->getOS2WindowHandle());
    61    //return OSLibWinGetPS(window->getOS2WindowHandle());
     73#else
     74   return OSLibWinGetPS(window->getOS2WindowHandle());
     75#endif
    6276}
    6377//******************************************************************************
     
    7589int WIN32API ReleaseDC(HWND hwnd, HDC hdc)
    7690{
     91#ifdef OPEN32_GDI
    7792    return O32_ReleaseDC(hwnd,hdc);
    78     //return OSLibWinReleasePS(hdc);
     93#else
     94    return OSLibWinReleasePS(hdc);
     95#endif
    7996}
    8097//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.