Ignore:
Timestamp:
Apr 25, 2001, 10:53:39 PM (24 years ago)
Author:
sandervl
Message:

IsWindowVisible & IsWindowEnabled updates + fixes

File:
1 edited

Legend:

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

    r5496 r5586  
    1 /* $Id: window.cpp,v 1.93 2001-04-12 14:04:33 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.94 2001-04-25 20:53:39 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    653653{
    654654  Win32BaseWindow *window;
     655  DWORD            dwStyle;
    655656
    656657    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     
    661662    }
    662663    dprintf(("IsWindowEnabled %x", hwnd));
    663     return window->IsWindowEnabled();
    664 }
    665 //******************************************************************************
    666 //******************************************************************************
    667 BOOL WIN32API IsWindowVisible( HWND hwnd)
    668 {
    669   Win32BaseWindow *window;
    670   BOOL rc;
    671 
    672     if (hwnd)
    673       window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    674     else
    675       window = windowDesktop;
     664    dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     665    if(dwStyle & WS_DISABLED) {
     666        return FALSE;
     667    }
     668    return TRUE;
     669}
     670//******************************************************************************
     671//******************************************************************************
     672BOOL WIN32API IsWindowVisible(HWND hwnd)
     673{
     674  Win32BaseWindow *window;
     675  BOOL             ret;
     676  HWND             hwndParent;
     677  DWORD            dwStyle;
     678
     679    if(!hwnd) {//TODO: verify in NT!
     680        dprintf(("IsWindowVisible DESKTOP returned TRUE"));
     681        return TRUE;    //desktop is always visible
     682    }
     683    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     684
    676685    if(!window) {
    677686        dprintf(("IsWindowVisible, window %x not found", hwnd));
     
    679688        return 0;
    680689    }
    681     rc = window->IsWindowVisible();
    682     dprintf(("IsWindowVisible %x returned %d", hwnd, rc));
    683     return rc;
    684 }
    685 //******************************************************************************
    686 //******************************************************************************
    687 HWND WIN32API SetFocus (HWND hwnd)
     690    //check visibility of this window
     691    dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     692    if(!(dwStyle & WS_VISIBLE)) {
     693        ret = FALSE;
     694        goto end;
     695    }
     696    ret = TRUE;
     697
     698    //check visibility of parents
     699    hwndParent = GetParent(hwnd);
     700    while(hwndParent) {
     701        dwStyle = GetWindowLongA(hwndParent, GWL_STYLE);
     702        if(!(dwStyle & WS_VISIBLE)) {
     703            dprintf(("IsWindowVisible %x returned FALSE (parent %x invisible)", hwnd, hwndParent));
     704            return FALSE;
     705        }
     706        hwndParent = GetParent(hwndParent);
     707    }
     708
     709end:
     710    dprintf(("IsWindowVisible %x returned %d", hwnd, ret));
     711    return ret;
     712}
     713//******************************************************************************
     714//******************************************************************************
     715HWND WIN32API SetFocus(HWND hwnd)
    688716{
    689717 HWND lastFocus, lastFocus_W, hwnd_O;
Note: See TracChangeset for help on using the changeset viewer.