Changeset 3663 for trunk/src


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

Set/GetParent changes/fixes

Location:
trunk/src/user32
Files:
7 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
  • trunk/src/user32/win32wbase.h

    r3662 r3663  
    1 /* $Id: win32wbase.h,v 1.97 2000-06-07 14:51:31 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.98 2000-06-07 21:45:52 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    156156virtual  BOOL   isMDIClient();
    157157virtual  BOOL   isMDIChild();
     158virtual  BOOL   isDesktopWindow();
    158159
    159160         BOOL   fHasParentDC()                  { return fParentDC; };
    160161
    161162Win32BaseWindow *getParent();
    162          void   setParent(Win32BaseWindow *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
     163         void   setParent(Win32BaseWindow *pwindow) { setParentOfChild((ChildWindow *)pwindow); };
    163164       WNDPROC  getWindowProc()                 { return win32wndproc; };
    164165         void   setWindowProc(WNDPROC newproc)  { win32wndproc = newproc; };
  • trunk/src/user32/win32wdesktop.cpp

    r3662 r3663  
    1 /* $Id: win32wdesktop.cpp,v 1.13 2000-06-07 14:51:33 sandervl Exp $ */
     1/* $Id: win32wdesktop.cpp,v 1.14 2000-06-07 21:45:52 sandervl Exp $ */
    22/*
    33 * Win32 Desktop Window for OS/2
     
    7272}
    7373//******************************************************************************
     74//******************************************************************************
     75BOOL Win32Desktop::isDesktopWindow()
     76{
     77  return TRUE;
     78}
     79//******************************************************************************
    7480//Disabling the desktop is not a good idea (mouse no longer responds)
    7581//******************************************************************************
  • trunk/src/user32/win32wdesktop.h

    r2469 r3663  
    1 /* $Id: win32wdesktop.h,v 1.6 2000-01-18 20:08:17 sandervl Exp $ */
     1/* $Id: win32wdesktop.h,v 1.7 2000-06-07 21:45:52 sandervl Exp $ */
    22/*
    33 * Win32 Desktop Window for OS/2
     
    2525 virtual BOOL   EnableWindow(BOOL fEnable);
    2626
     27virtual  BOOL   isDesktopWindow();
     28
    2729protected:
    2830private:
  • trunk/src/user32/win32wndchild.cpp

    r2803 r3663  
    1 /* $Id: win32wndchild.cpp,v 1.5 2000-02-16 14:28:25 sandervl Exp $ */
     1/* $Id: win32wndchild.cpp,v 1.6 2000-06-07 21:45:52 sandervl Exp $ */
    22/*
    33 * Win32 Child/Parent window class for OS/2
     
    3030{
    3131  if(parent) {
    32         parent->RemoveChild(this);
     32        parent->removeChild(this);
    3333  }
    3434//SvL: PM sends WM_DESTROY for all the children
     
    4343//FIFO insertion
    4444//******************************************************************************
    45 BOOL ChildWindow::AddChild(ChildWindow *child)
     45BOOL ChildWindow::addChild(ChildWindow *child)
    4646{
    4747 ChildWindow *curchild;
     
    6767//Remove child from linked list. Doesn't delete it!
    6868//******************************************************************************
    69 BOOL ChildWindow::RemoveChild(ChildWindow *child)
     69BOOL ChildWindow::removeChild(ChildWindow *child)
    7070{
    7171 ChildWindow *curchild = children;
     
    9999//******************************************************************************
    100100//******************************************************************************
    101 BOOL ChildWindow::DestroyChildren()
     101BOOL ChildWindow::destroyChildren()
    102102{
    103103   while(children) {
  • trunk/src/user32/win32wndchild.h

    r2469 r3663  
    1 /* $Id: win32wndchild.h,v 1.4 2000-01-18 20:08:17 sandervl Exp $ */
     1/* $Id: win32wndchild.h,v 1.5 2000-06-07 21:45:52 sandervl Exp $ */
    22/*
    33 * Win32 Child/Parent window class for OS/2
     
    2828protected:
    2929
    30  ChildWindow *GetParent()                       { return parent; };
    31  ChildWindow *SetParent(ChildWindow *newParent)
     30 ChildWindow *getParentOfChild()                { return parent; };
     31 ChildWindow *setParentOfChild(ChildWindow *newParent)
    3232 {
    3333  ChildWindow *oldparent = parent;
     
    3737 }                   
    3838
    39         BOOL   AddChild(ChildWindow *child);
    40         BOOL   RemoveChild(ChildWindow *child);
     39        BOOL   addChild(ChildWindow *child);
     40        BOOL   removeChild(ChildWindow *child);
    4141
    4242        void   setNextChild(ChildWindow *child) { nextchild = child; };
    4343
    44         BOOL   DestroyChildren();
     44        BOOL   destroyChildren();
    4545
    4646private:
  • trunk/src/user32/window.cpp

    r3662 r3663  
    1 /* $Id: window.cpp,v 1.68 2000-06-07 14:51:33 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.69 2000-06-07 21:45:52 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    318318        return 0;
    319319    }
     320    if(window->isDesktopWindow()) {
     321        dprintf(("WARNING: Trying to destroy desktop window!"));
     322        return FALSE;
     323    }
    320324    return window->DestroyWindow();
    321325}
     
    353357HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent)
    354358{
    355   Win32BaseWindow *window;
     359  Win32BaseWindow *window, *parent;
    356360
    357361    window = Win32BaseWindow::GetWindowFromHandle(hwndChild);
     
    360364        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    361365        return 0;
     366    }
     367    if(hwndNewParent == HWND_DESKTOP) {
     368        hwndNewParent = GetDesktopWindow();
     369    }
     370    else {
     371        parent = Win32BaseWindow::GetWindowFromHandle(hwndNewParent);
     372        if(!window) {
     373                dprintf(("SetParent, parent %x not found", hwndNewParent));
     374                SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     375                return 0;
     376        }
    362377    }
    363378    dprintf(("SetParent %x %x", hwndChild, hwndNewParent));
Note: See TracChangeset for help on using the changeset viewer.