Changeset 5586 for trunk/src


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

IsWindowVisible & IsWindowEnabled updates + fixes

Location:
trunk/src/user32
Files:
4 edited

Legend:

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

    r5435 r5586  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.46 2001-04-02 09:52:01 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.47 2001-04-25 20:53:38 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    366366      winMsg->wParam  = 0;
    367367      winMsg->lParam  = MAKELONG(winMsg->pt.x,winMsg->pt.y);
    368       if(!win32wnd->IsWindowEnabled()) {
     368      if(!IsWindowEnabled(win32wnd->getWindowHandle())) {
    369369                if(win32wnd->getParent()) {
    370370                        winMsg->hwnd = win32wnd->getParent()->getWindowHandle();
     
    407407
    408408        //if a window is disabled, it's parent receives the mouse messages
    409         if(!win32wnd->IsWindowEnabled()) {
     409        if(!IsWindowEnabled(win32wnd->getWindowHandle())) {
    410410            if(win32wnd->getParent()) {
    411411                win32wnd = win32wnd->getParent();
     
    492492
    493493        //if a window is disabled, it's parent receives the mouse messages
    494         if(!win32wnd->IsWindowEnabled()) {
     494        if(!IsWindowEnabled(win32wnd->getWindowHandle())) {
    495495            if(win32wnd->getParent()) {
    496496                win32wnd = win32wnd->getParent();
  • trunk/src/user32/win32wbase.cpp

    r5512 r5586  
    1 /* $Id: win32wbase.cpp,v 1.251 2001-04-15 17:05:29 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.252 2001-04-25 20:53:38 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    13491349   */
    13501350  if ( (uFlags & PRF_CHECKVISIBLE) &&
    1351        !IsWindowVisible() )
     1351       !IsWindowVisible(getWindowHandle()) )
    13521352      return 0;
    13531353
     
    24822482    swp.hwnd = OS2Hwnd;
    24832483
    2484     if(fuFlags & SWP_SHOWWINDOW && !IsWindowVisible()) {
     2484    if(fuFlags & SWP_SHOWWINDOW && !IsWindowVisible(getWindowHandle())) {
    24852485        setStyle(getStyle() | WS_VISIBLE);
    24862486        if(hTaskList) {
     
    24902490    }
    24912491    else
    2492     if((fuFlags & SWP_HIDEWINDOW) && IsWindowVisible()) {
     2492    if((fuFlags & SWP_HIDEWINDOW) && IsWindowVisible(getWindowHandle())) {
    24932493        setStyle(getStyle() & ~WS_VISIBLE);
    24942494        if(hTaskList && !(getStyle() & WS_MINIMIZE)) {
     
    26972697    }
    26982698    /* Hide the window */
    2699     if(IsWindowVisible())
     2699    if(IsWindowVisible(getWindowHandle()))
    27002700    {
    27012701        SetWindowPos(0, 0, 0, 0, 0, SWP_HIDEWINDOW |
     
    32533253
    32543254  return OS2ToWin32Handle(hwndActive);
    3255 }
    3256 //******************************************************************************
    3257 //******************************************************************************
    3258 BOOL Win32BaseWindow::IsWindowEnabled()
    3259 {
    3260     return OSLibWinIsWindowEnabled(OS2Hwnd);
    3261 }
    3262 //******************************************************************************
    3263 //******************************************************************************
    3264 BOOL Win32BaseWindow::IsWindowVisible()
    3265 {
    3266     //TODO: Do we have to check the state of the parent window? (as Wine does)
    3267 #if 1
    3268     return (dwStyle & WS_VISIBLE) == WS_VISIBLE;
    3269 #else
    3270     return OSLibWinIsWindowVisible(OS2Hwnd);
    3271 #endif
    32723255}
    32733256//******************************************************************************
  • trunk/src/user32/win32wbase.h

    r5496 r5586  
    1 /* $Id: win32wbase.h,v 1.113 2001-04-12 14:04:33 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.114 2001-04-25 20:53:39 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    160160         HWND   getWindowHandle()               { return Win32Hwnd; };
    161161         HWND   getOS2WindowHandle()            { return OS2Hwnd; };
     162
    162163 Win32WndClass *getWindowClass()                { return windowClass; };
    163164
     
    254255         BOOL   IsWindowCreated()             { return fCreated; }
    255256         BOOL   IsWindowDestroyed()           { return fIsDestroyed; };
    256          BOOL   IsWindowEnabled();
    257          BOOL   IsWindowVisible();
    258257         BOOL   IsWindowIconic();
    259258         //Window procedure type
  • 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.