Ignore:
Timestamp:
Jun 7, 2000, 11:45:52 PM (25 years ago)
Author:
sandervl
Message:

Set/GetParent changes/fixes

File:
1 edited

Legend:

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

    r3662 r3663  
    1 /* $Id: win32wbase.cpp,v 1.198 2000-06-07 14:51:30 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.199 2000-06-07 21:45:50 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    11581158//******************************************************************************
    11591159//******************************************************************************
     1160BOOL Win32BaseWindow::isDesktopWindow()
     1161{
     1162  return FALSE;
     1163}
     1164//******************************************************************************
     1165//******************************************************************************
    11601166BOOL Win32BaseWindow::IsWindowIconic()
    11611167{
     
    23952401Win32BaseWindow *Win32BaseWindow::getParent()
    23962402{
    2397   Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::GetParent();
     2403  Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild();
    23982404  return ((ULONG)wndparent == (ULONG)windowDesktop) ? NULL : wndparent;
    23992405}
     
    24022408HWND Win32BaseWindow::GetParent()
    24032409{
     2410  if((!(getStyle() & (WS_POPUP|WS_CHILD)))) {
     2411        return 0;
     2412  }
     2413
     2414  Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild();
     2415
    24042416  if(getStyle() & WS_CHILD) {
    2405         if(getParent()) {
    2406                 return getParent()->getWindowHandle();
     2417        if(wndparent) {
     2418                return wndparent->getWindowHandle();
    24072419        }
     2420        dprintf(("WARNING: GetParent: WS_CHILD but no parent!!"));
    24082421        DebugInt3();
    24092422        return 0;
     
    24172430 HWND oldhwnd;
    24182431 Win32BaseWindow *newparent;
    2419  Win32BaseWindow *oldparent = (Win32BaseWindow *)ChildWindow::GetParent();
     2432 Win32BaseWindow *oldparent = (Win32BaseWindow *)ChildWindow::getParentOfChild();
    24202433 BOOL fShow = FALSE;
    24212434
    24222435   if(oldparent) {
    24232436        oldhwnd = oldparent->getWindowHandle();
    2424         oldparent->RemoveChild(this);
     2437        oldparent->removeChild(this);
    24252438   }
    24262439   else oldhwnd = 0;
     
    24342447
    24352448   newparent = GetWindowFromHandle(hwndNewParent);
    2436    if(newparent)
     2449   if(newparent && !newparent->isDesktopWindow())
    24372450   {
    24382451        setParent(newparent);
    2439         getParent()->AddChild(this);
     2452        getParent()->addChild(this);
    24402453        OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle());
     2454        if(!(getStyle() & WS_CHILD))
     2455        {
     2456                //TODO: Send WM_STYLECHANGED msg?
     2457                setStyle(getStyle() | WS_CHILD);
     2458                if(getWindowId())
     2459                {
     2460                        DestroyMenu( (HMENU) getWindowId() );
     2461                        setWindowId(0);
     2462                }
     2463        }
    24412464   }
    24422465   else {
    24432466        setParent(windowDesktop);
    2444         windowDesktop->AddChild(this);
     2467        windowDesktop->addChild(this);
    24452468        OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
     2469       
     2470        //TODO: Send WM_STYLECHANGED msg?
     2471        setStyle(getStyle() & ~WS_CHILD);
     2472        setWindowId(0);
    24462473   }
    24472474   /* SetParent additionally needs to make hwndChild the topmost window
Note: See TracChangeset for help on using the changeset viewer.