Ignore:
Timestamp:
Oct 21, 1999, 12:35:54 AM (26 years ago)
Author:
sandervl
Message:

Combobox fixes + scrollbar position fix

File:
1 edited

Legend:

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

    r1351 r1387  
    1 /* $Id: window.cpp,v 1.21 1999-10-18 11:59:58 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.22 1999-10-20 22:35:54 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    318318        return 0;
    319319    }
    320     dprintf(("GetParent %x", hwnd));
     320//    dprintf(("GetParent %x", hwnd));
    321321    return window->GetParent();
    322322}
     
    715715 HWND hwndWin32 = hwnd;
    716716
    717 #if 1
    718717 Win32BaseWindow *window;
    719718
     
    728727    dprintf(("GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwndWin32, pRect->left, pRect->top, pRect->right, pRect->bottom));
    729728    return TRUE;
    730 #else
    731     hwnd = Win32BaseWindow::Win32ToOS2Handle(hwnd);
    732     rc = OSLibWinQueryWindowRect(hwnd, pRect);
    733     dprintf(("GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwndWin32, pRect->left, pRect->top, pRect->right, pRect->bottom));
    734     return rc;
    735 #endif
    736729}
    737730//******************************************************************************
     
    747740    dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d)\n", style, exStyle, menu, rect->right, rect->top, rect->left, rect->bottom));
    748741
    749 #if 0
    750     O32_AdjustWindowRectEx(rect, style, menu, exStyle);
    751 #else
    752742    /* Correct the window style */
    753743    if (!(style & (WS_POPUP | WS_CHILD)))  /* Overlapped window */
     
    761751    Win32BaseWindow::NC_AdjustRectOuter( rect, style, menu, exStyle );
    762752    Win32BaseWindow::NC_AdjustRectInner( rect, style, exStyle );
    763 #endif
    764753
    765754    dprintf(("AdjustWindowRectEx returned (%d,%d)(%d,%d)\n", rect->right, rect->top, rect->left, rect->bottom));
    766755    return TRUE;
     756}
     757//******************************************************************************
     758/* Coordinate Space and Transformation Functions */
     759//******************************************************************************
     760int WIN32API MapWindowPoints(HWND hwndFrom, HWND hwndTo, LPPOINT lpPoints,
     761                             UINT cPoints)
     762{
     763 Win32BaseWindow *wndfrom, *wndto;
     764 int retval = 0;
     765 OSLIBPOINT point;
     766
     767    if(lpPoints == NULL || cPoints == 0) {
     768        SetLastError(ERROR_INVALID_PARAMETER);
     769        return 0;
     770    }
     771    if(hwndFrom)
     772    {
     773        wndfrom = Win32BaseWindow::GetWindowFromHandle(hwndFrom);
     774        if(!wndfrom) {
     775            dprintf(("MapWindowPoints, window %x not found", hwndFrom));
     776            SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     777            return 0;
     778        }
     779    }
     780    else wndfrom = windowDesktop;
     781
     782    if(hwndTo)
     783    {
     784        wndto = Win32BaseWindow::GetWindowFromHandle(hwndTo);
     785        if(!wndto) {
     786            dprintf(("MapWindowPoints, window %x not found", hwndTo));
     787            SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     788            return 0;
     789        }
     790    }
     791    else wndto = windowDesktop;
     792
     793    if(wndto == wndfrom)
     794        return 0; //nothing to do
     795
     796    dprintf(("USER32: MapWindowPoints %x to %x (%d,%d) (%d)", hwndFrom, hwndTo, lpPoints->x, lpPoints->y, cPoints));
     797    point.x = lpPoints->x;
     798    point.y = wndfrom->getWindowHeight() - lpPoints->y;
     799
     800    OSLibWinMapWindowPoints(wndfrom->getOS2WindowHandle(), wndto->getOS2WindowHandle(), &point, 1);
     801    point.y = wndto->getWindowHeight() - point.y;
     802
     803    WORD xinc = point.x - lpPoints->x;
     804    WORD yinc = point.y - lpPoints->y;
     805
     806    for(int i=1;i<cPoints;i++)
     807    {
     808        lpPoints[i].x += xinc;
     809        lpPoints[i].y += yinc;
     810    }
     811    retval = ((DWORD)yinc << 16) | xinc;
     812    return retval;
     813}
     814//******************************************************************************
     815//******************************************************************************
     816BOOL WIN32API ScreenToClient (HWND hwnd, LPPOINT pt)
     817{
     818    Win32BaseWindow *wnd;
     819    PRECT rcl;
     820
     821    dprintf(("ScreenToClient %x (%d,%d)\n", hwnd, pt->x, pt->y));
     822
     823    if (!hwnd) return (TRUE);
     824    wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
     825    if (!wnd) return (TRUE);
     826
     827    rcl   = wnd->getClientRect();
     828    pt->y = ScreenHeight - pt->y;
     829    OSLibWinMapWindowPoints (OSLIB_HWND_DESKTOP, wnd->getOS2WindowHandle(), (OSLIBPOINT *)pt, 1);
     830    pt->y = (rcl->bottom - rcl->top) - pt->y;
     831    dprintf(("ScreenToClient %x returned (%d,%d)\n", hwnd, pt->x, pt->y));
     832    return (TRUE);
    767833}
    768834//******************************************************************************
     
    12801346
    12811347  if(lpfn == NULL) {
    1282         dprintf(("EnumChildWindows invalid parameter %x %x\n", hwnd, lParam));
     1348    dprintf(("EnumChildWindows invalid parameter %x %x\n", hwnd, lParam));
    12831349        SetLastError(ERROR_INVALID_PARAMETER);
    12841350        return FALSE;
Note: See TracChangeset for help on using the changeset viewer.