Ignore:
Timestamp:
Aug 31, 1999, 12:36:24 PM (26 years ago)
Author:
sandervl
Message:

Added MDI class + ChildWindowFromPointEx by Rene Pronk

File:
1 edited

Legend:

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

    r741 r750  
    1 /* $Id: window.cpp,v 1.19 1999-08-30 11:59:54 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.20 1999-08-31 10:36:24 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    784784//******************************************************************************
    785785//******************************************************************************
    786 HWND WIN32API ChildWindowFromPointEx(HWND arg1, POINT arg2, UINT uFlags)
    787 {
    788 #ifdef DEBUG
    789     WriteLog("USER32:  ChildWindowFromPointEx, not completely supported!\n");
    790 #endif
    791     return O32_ChildWindowFromPoint(arg1, arg2);
     786/*****************************************************************************
     787 * Name      : HWND WIN32API ChildWindowFromPointEx
     788 * Purpose   : The GetWindowRect function retrieves the dimensions of the
     789 *             bounding rectangle of the specified window. The dimensions are
     790 *             given in screen coordinates that are relative to the upper-left
     791 *             corner of the screen.
     792 * Parameters:
     793 * Variables :
     794 * Result    : If the function succeeds, the return value is the window handle.
     795 *             If the function fails, the return value is zero
     796 * Remark    :
     797 * Status    : FULLY IMPLEMENTED AND TESTED
     798 *
     799 * Author    : Rene Pronk [Sun, 1999/08/08 23:30]
     800 *****************************************************************************/
     801
     802HWND WIN32API ChildWindowFromPointEx (HWND hwndParent, POINT pt, UINT uFlags)
     803{
     804        RECT rect;
     805        HWND hWnd;
     806        POINT absolutePt;
     807
     808        dprintf(("USER32: ChildWindowFromPointEx(%08xh,%08xh,%08xh).\n",
     809                 hwndParent, pt, uFlags));
     810
     811        if (GetWindowRect (hwndParent, &rect) == 0) {
     812                // oops, invalid handle
     813                return NULL;
     814        }
     815
     816        // absolutePt has its top in the upper-left corner of the screen
     817        absolutePt = pt;
     818        ClientToScreen (hwndParent, &absolutePt);
     819
     820        // make rect the size of the parent window
     821        GetWindowRect (hwndParent, &rect);
     822        rect.right = rect.right - rect.left;
     823        rect.bottom = rect.bottom - rect.top;
     824        rect.left = 0;
     825        rect.top = 0;
     826
     827        if (PtInRect (&rect, pt) == 0) {
     828                // point is outside window
     829                return NULL;
     830        }
     831
     832        // get first child
     833        hWnd = GetWindow (hwndParent, GW_CHILD);
     834
     835        while (hWnd != NULL) {
     836
     837                // do I need to skip this window?
     838                if (((uFlags & CWP_SKIPINVISIBLE) &&
     839                     (IsWindowVisible (hWnd) == FALSE)) ||
     840                    ((uFlags & CWP_SKIPDISABLED) &&
     841                     (IsWindowEnabled (hWnd) == FALSE)) ||
     842                    ((uFlags & CWP_SKIPTRANSPARENT) &&
     843                     (GetWindowLongA (hWnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
     844
     845                {
     846                        hWnd = GetWindow (hWnd, GW_HWNDNEXT);
     847                        continue;
     848                }
     849
     850                // is the point in this window's rect?
     851                GetWindowRect (hWnd, &rect);
     852                if (PtInRect (&rect, absolutePt) == FALSE) {
     853                        hWnd = GetWindow (hWnd, GW_HWNDNEXT);
     854                        continue;
     855                }
     856
     857                // found it!
     858                return hWnd;
     859        }
     860
     861        // the point is in the parentwindow but the parentwindow has no child
     862        // at this coordinate
     863        return hwndParent;
    792864}
    793865//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.