Ignore:
Timestamp:
Oct 16, 1999, 4:51:43 PM (26 years ago)
Author:
sandervl
Message:

isFrameWindow bugfix + MDI creation & WM_NCCALCSIZE bugfix

File:
1 edited

Legend:

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

    r1256 r1322  
    1 /* $Id: win32wmdichild.cpp,v 1.4 1999-10-12 14:47:24 sandervl Exp $ */
     1/* $Id: win32wmdichild.cpp,v 1.5 1999-10-16 14:51:43 sandervl Exp $ */
    22/*
    33 * Win32 MDI Child Window Class for OS/2
     
    4545//******************************************************************************
    4646Win32MDIChildWindow::Win32MDIChildWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
    47                 : Win32BaseWindow(lpCreateStructA, classAtom, isUnicode)
     47                    : Win32BaseWindow(lpCreateStructA, classAtom, isUnicode)
    4848{
    4949}
     
    8080    }
    8181    else return 1;
     82}
     83//******************************************************************************
     84//******************************************************************************
     85BOOL Win32MDIChildWindow::isMDIChild()
     86{
     87    return TRUE;
    8288}
    8389//******************************************************************************
     
    277283HWND Win32MDIChildWindow::createChild(Win32MDIClientWindow *client, LPMDICREATESTRUCTA cs )
    278284{
    279     POINT        pos[2];
    280     DWORD        style = cs->style | (WS_CHILD | WS_CLIPSIBLINGS);
    281     HWND         hwnd;
    282     WORD         wIDmenu = client->getFirstChildId() + client->getNrOfChildren();
    283     char         lpstrDef[]="junk!";
    284     Win32MDIChildWindow *maximizedChild, *newchild;
     285  POINT        pos[2];
     286  DWORD        style = cs->style | (WS_CHILD | WS_CLIPSIBLINGS);
     287  WORD         wIDmenu = client->getFirstChildId() + client->getNrOfChildren();
     288  char         lpstrDef[]="junk!";
     289  Win32MDIChildWindow *maximizedChild, *newchild;
     290  CREATESTRUCTA createstruct;
     291  ATOM         classAtom;
     292  char         tmpClassA[20] = "";
     293  WCHAR        tmpClassW[20];
     294  LPSTR        className;
    285295
    286296    dprintf(("Win32MDIChildWindow::createChild %i,%i - dim %i,%i, style %08x\n",
     
    326336    }
    327337
    328     if(!client->IsUnicode())
    329         hwnd = ::CreateWindowA(cs->szClass, cs->szTitle, style,
    330                                cs->x, cs->y, cs->cx, cs->cy, client->getWindowHandle(),
    331                                (HMENU)wIDmenu, cs->hOwner, cs );
    332     else
    333         hwnd = ::CreateWindowW((LPWSTR)cs->szClass, (LPWSTR)cs->szTitle, style,
    334                                cs->x, cs->y, cs->cx, cs->cy, client->getWindowHandle(),
    335                                (HMENU)wIDmenu, cs->hOwner, cs );
    336 
    337     /* MDI windows are WS_CHILD so they won't be activated by CreateWindow */
    338     newchild = (Win32MDIChildWindow *)GetWindowFromHandle(hwnd);
    339     if (hwnd && newchild)
     338    createstruct.lpszName  = cs->szTitle;
     339    createstruct.style     = style;
     340    createstruct.dwExStyle = 0;
     341    createstruct.x         = cs->x;
     342    createstruct.y         = cs->y;
     343    createstruct.cx        = cs->cx;
     344    createstruct.cy        = cs->cy;
     345    createstruct.hInstance = cs->hOwner;
     346    createstruct.hMenu     = wIDmenu;
     347    createstruct.hwndParent= client->getWindowHandle();
     348    createstruct.lpCreateParams = (LPVOID)cs;
     349
     350    className = (LPSTR)cs->szClass;
     351    /* Find the class atom */
     352    if (!(classAtom = (client->IsUnicode() ? GlobalFindAtomW((LPWSTR)cs->szClass) :
     353                                             GlobalFindAtomA(cs->szClass))))
     354    {
     355        if (!HIWORD(cs->szClass))
     356        {
     357            if(!client->IsUnicode())
     358            {
     359                sprintf(tmpClassA,"#%d", (int) className);
     360                classAtom = GlobalFindAtomA(tmpClassA);
     361                className = tmpClassA;
     362            }
     363            else
     364            {
     365              sprintf(tmpClassA,"#%d", (int) className);
     366              AsciiToUnicode(tmpClassA, tmpClassW);
     367              classAtom = GlobalFindAtomW(tmpClassW);
     368              className = (LPSTR)tmpClassW;
     369            }
     370        }
     371        if (!classAtom)
     372        {
     373          if (!HIWORD(cs->szClass)) {
     374                  dprintf(("createChild: bad class name %04x\n", LOWORD(className)));
     375          }
     376          else    dprintf(("createChild: bad class name '%s'\n", tmpClassA ));
     377
     378          SetLastError(ERROR_INVALID_PARAMETER);
     379          return 0;
     380        }
     381    }
     382    createstruct.lpszClass = className;
     383
     384    newchild = new Win32MDIChildWindow(&createstruct, classAtom, client->IsUnicode());
     385
     386    if(newchild && GetLastError() == 0)
    340387    {
    341388        newchild->menuModifyItem();
     
    368415                    client->setMaximizedChild(newchild);
    369416#if 0
    370                     MDI_AugmentFrameMenu( ci, w->parent, hwnd );
     417                    MDI_AugmentFrameMenu( ci, w->parent, newchild->getWindowHandle() );
    371418#endif
    372419                    client->updateFrameText(MDI_REPAINTFRAME, NULL );
     
    387434        if( maximizedChild && maximizedChild->IsWindow() )
    388435            maximizedChild->ShowWindow(SW_SHOWMAXIMIZED);
    389     }
    390     return hwnd;
     436
     437        dprintf(("MDI child creation failed!!"));
     438        return 0;
     439    }
     440    return newchild->getWindowHandle();
    391441}
    392442/**********************************************************************
Note: See TracChangeset for help on using the changeset viewer.