Ignore:
Timestamp:
Oct 11, 1999, 10:54:26 PM (26 years ago)
Author:
sandervl
Message:

Lots of changes

File:
1 edited

Legend:

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

    r1231 r1253  
    1 /* $Id: window.cpp,v 1.12 1999-10-09 18:16:57 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.13 1999-10-11 20:54:26 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    1919#include <os2win.h>
    2020#include <misc.h>
     21#include <string.h>
     22#include <stdio.h>
    2123#include <win32wbase.h>
    2224#include <win32wmdiclient.h>
    2325#include <win32wdesktop.h>
     26#include "win32dlg.h"
    2427#include <oslibwin.h>
    2528#include <oslibgdi.h>
     
    2730#include "winicon.h"
    2831
    29 //******************************************************************************
    30 //******************************************************************************
    31 #ifdef DEBUG
    32 void PrintWindowStyle(DWORD dwStyle, DWORD dwExStyle)
    33 {
    34  char style[256] = "";
    35  char exstyle[256] = "";
    36 
    37   /* Window styles */
    38   if(dwStyle & WS_CHILD)
    39         strcat(style, "WS_CHILD ");
    40   if(dwStyle & WS_POPUP)
    41         strcat(style, "WS_POPUP ");
    42   if(dwStyle & WS_VISIBLE)
    43         strcat(style, "WS_VISIBLE ");
    44   if(dwStyle & WS_DISABLED)
    45         strcat(style, "WS_DISABLED ");
    46   if(dwStyle & WS_CLIPSIBLINGS)
    47         strcat(style, "WS_CLIPSIBLINGS ");
    48   if(dwStyle & WS_CLIPCHILDREN)
    49         strcat(style, "WS_CLIPCHILDREN ");
    50   if(dwStyle & WS_MAXIMIZE)
    51         strcat(style, "WS_MAXIMIZE ");
    52   if(dwStyle & WS_MINIMIZE)
    53         strcat(style, "WS_MINIMIZE ");
    54   if(dwStyle & WS_GROUP)
    55         strcat(style, "WS_GROUP ");
    56   if(dwStyle & WS_TABSTOP)
    57         strcat(style, "WS_TABSTOP ");
    58 
    59   if(dwStyle & WS_CAPTION)
    60         strcat(style, "WS_CAPTION ");
    61   if(dwStyle & WS_DLGFRAME)
    62         strcat(style, "WS_DLGFRAME ");
    63   if(dwStyle & WS_BORDER)
    64         strcat(style, "WS_BORDER ");
    65 
    66   if(dwStyle & WS_VSCROLL)
    67         strcat(style, "WS_VSCROLL ");
    68   if(dwStyle & WS_HSCROLL)
    69         strcat(style, "WS_HSCROLL ");
    70   if(dwStyle & WS_SYSMENU)
    71         strcat(style, "WS_SYSMENU ");
    72   if(dwStyle & WS_THICKFRAME)
    73         strcat(style, "WS_THICKFRAME ");
    74   if(dwStyle & WS_MINIMIZEBOX)
    75         strcat(style, "WS_MINIMIZEBOX ");
    76   if(dwStyle & WS_MAXIMIZEBOX)
    77         strcat(style, "WS_MAXIMIZEBOX ");
    78 
    79   if(dwExStyle & WS_EX_DLGMODALFRAME)
    80         strcat(exstyle, "WS_EX_DLGMODALFRAME ");
    81   if(dwExStyle & WS_EX_ACCEPTFILES)
    82         strcat(exstyle, "WS_EX_ACCEPTFILES ");
    83   if(dwExStyle & WS_EX_NOPARENTNOTIFY)
    84         strcat(exstyle, "WS_EX_NOPARENTNOTIFY ");
    85   if(dwExStyle & WS_EX_TOPMOST)
    86         strcat(exstyle, "WS_EX_TOPMOST ");
    87   if(dwExStyle & WS_EX_TRANSPARENT)
    88         strcat(exstyle, "WS_EX_TRANSPARENT ");
    89 
    90   if(dwExStyle & WS_EX_MDICHILD)
    91         strcat(exstyle, "WS_EX_MDICHILD ");
    92   if(dwExStyle & WS_EX_TOOLWINDOW)
    93         strcat(exstyle, "WS_EX_TOOLWINDOW ");
    94   if(dwExStyle & WS_EX_WINDOWEDGE)
    95         strcat(exstyle, "WS_EX_WINDOWEDGE ");
    96   if(dwExStyle & WS_EX_CLIENTEDGE)
    97         strcat(exstyle, "WS_EX_CLIENTEDGE ");
    98   if(dwExStyle & WS_EX_CONTEXTHELP)
    99         strcat(exstyle, "WS_EX_CONTEXTHELP ");
    100   if(dwExStyle & WS_EX_RIGHT)
    101         strcat(exstyle, "WS_EX_RIGHT ");
    102   if(dwExStyle & WS_EX_LEFT)
    103         strcat(exstyle, "WS_EX_LEFT ");
    104   if(dwExStyle & WS_EX_RTLREADING)
    105         strcat(exstyle, "WS_EX_RTLREADING ");
    106   if(dwExStyle & WS_EX_LTRREADING)
    107         strcat(exstyle, "WS_EX_LTRREADING ");
    108   if(dwExStyle & WS_EX_LEFTSCROLLBAR)
    109         strcat(exstyle, "WS_EX_LEFTSCROLLBAR ");
    110   if(dwExStyle & WS_EX_RIGHTSCROLLBAR)
    111         strcat(exstyle, "WS_EX_RIGHTSCROLLBAR ");
    112   if(dwExStyle & WS_EX_CONTROLPARENT)
    113         strcat(exstyle, "WS_EX_CONTROLPARENT ");
    114   if(dwExStyle & WS_EX_STATICEDGE)
    115         strcat(exstyle, "WS_EX_STATICEDGE ");
    116   if(dwExStyle & WS_EX_APPWINDOW)
    117         strcat(exstyle, "WS_EX_APPWINDOW ");
    118 
    119   dprintf(("Window style:   %x %s", dwStyle, style));
    120   dprintf(("Window exStyle: %x %s", dwExStyle, exstyle));
    121 }
    122 #endif
    12332//******************************************************************************
    12433//******************************************************************************
     
    13241  ATOM classAtom;
    13342  CREATESTRUCTA cs;
    134 
    135 #ifdef DEBUG
    136     PrintWindowStyle(style, exStyle);
    137 #endif
     43  char tmpClass[20];
    13844
    13945    if(exStyle & WS_EX_MDICHILD)
    14046        return CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
    14147
    142     //TODO: According to the docs className can be a 16 bits atom
    143     //      Wine seems to assume it's a string though...
    14448    /* Find the class atom */
    14549    if (!(classAtom = GlobalFindAtomA(className)))
    14650    {
    147         dprintf(("CreateWindowEx32A: bad class name "));
    148         if (!HIWORD(className)) {
    149                 dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
     51        if (!HIWORD(className))
     52        {
     53          sprintf(tmpClass,"#%d", (int) className);
     54          classAtom = GlobalFindAtomA(tmpClass);
     55          className = tmpClass;
    15056        }
    151         else    dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
    152         SetLastError(ERROR_INVALID_PARAMETER);
    153         return 0;
     57        if (!classAtom)
     58        {
     59          if (!HIWORD(className)) {
     60                  dprintf(("CreateWindowEx32W: bad class name %04x\n", LOWORD(className)));
     61          }
     62          else    dprintf(("CreateWindowEx32W: bad class name '%s'\n", className ));
     63
     64          SetLastError(ERROR_INVALID_PARAMETER);
     65          return 0;
     66        }
    15467    }
    15568
     
    17285    else dprintf(("CreateWindowExA: class %d parent %x (%d,%d) (%d,%d), %x %x", className, parent, x, y, width, height, style, exStyle));
    17386
    174     //TODO: According to the docs className can be a 16 bits atom
    175     //      Wine seems to assume it's a string though...
    17687    if(!strcmpi(className, MDICLIENTCLASSNAMEA)) {
    17788        window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, FALSE);
     89    }
     90    else
     91    if(!strcmpi((char *) className, DIALOG_CLASS_NAMEA))
     92    {
     93      DLG_TEMPLATE dlgTemplate = {0};
     94      dlgTemplate.style = cs.style;
     95      dlgTemplate.exStyle = cs.dwExStyle;
     96      dlgTemplate.x = cs.x;
     97      dlgTemplate.y = cs.y;
     98      dlgTemplate.cx = cs.cx;
     99      dlgTemplate.cy = cs.cy;
     100      dlgTemplate.className = cs.lpszClass;
     101      dlgTemplate.caption = cs.lpszName;
     102      window = (Win32BaseWindow *) new Win32Dialog(cs.hInstance,
     103                                                   (LPCSTR) &dlgTemplate,
     104                                                   cs.hwndParent,
     105                                                   NULL,
     106                                                   (LPARAM) data,
     107                                                   FALSE);
    178108    }
    179109    else {
     
    204134  ATOM classAtom;
    205135  CREATESTRUCTA cs;
     136  char tmpClassA[20];
     137  WCHAR tmpClassW[20];
    206138
    207139    if(exStyle & WS_EX_MDICHILD)
    208140        return CreateMDIWindowW(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
    209141
    210     //TODO: According to the docs className can be a 16 bits atom
    211     //      Wine seems to assume it's a string though...
    212142    /* Find the class atom */
    213143    if (!(classAtom = GlobalFindAtomW(className)))
    214144    {
    215         dprintf(("CreateWindowEx32A: bad class name "));
    216         if (!HIWORD(className)) {
    217                 dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
     145        if (!HIWORD(className))
     146        {
     147          sprintf(tmpClassA,"#%d", (int) className);
     148          AsciiToUnicode(tmpClassA, tmpClassW);
     149          classAtom = GlobalFindAtomW(tmpClassW);
     150          className = (LPCWSTR)tmpClassW;
    218151        }
    219 //        else    dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
    220         SetLastError(ERROR_INVALID_PARAMETER);
    221         return 0;
     152        if (!classAtom)
     153        {
     154          if (!HIWORD(className)) {
     155                  dprintf(("CreateWindowEx32W: bad class name %04x\n", LOWORD(className)));
     156          }
     157          else    dprintf(("CreateWindowEx32W: bad class name "));
     158
     159          SetLastError(ERROR_INVALID_PARAMETER);
     160          return 0;
     161        }
    222162    }
    223163
     
    236176    cs.dwExStyle      = exStyle;
    237177
    238     //TODO: According to the docs className can be a 16 bits atom
    239     //      Wine seems to assume it's a string though...
    240178    if(!lstrcmpiW(className, (LPWSTR)MDICLIENTCLASSNAMEW)) {
    241179        window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, TRUE);
     180    }
     181    if(!lstrcmpiW(className, (LPWSTR)DIALOG_CLASS_NAMEW))
     182    {
     183      DLG_TEMPLATE dlgTemplate = {0};
     184      dlgTemplate.style = cs.style;
     185      dlgTemplate.exStyle = cs.dwExStyle;
     186      dlgTemplate.x = cs.x;
     187      dlgTemplate.y = cs.y;
     188      dlgTemplate.cx = cs.cx;
     189      dlgTemplate.cy = cs.cy;
     190      dlgTemplate.className = cs.lpszClass;
     191      dlgTemplate.caption = cs.lpszName;
     192      window = (Win32BaseWindow *) new Win32Dialog(cs.hInstance,
     193                                                   (LPCSTR) &dlgTemplate,
     194                                                   cs.hwndParent,
     195                                                   NULL,
     196                                                   (LPARAM) data,
     197                                                   TRUE);
    242198    }
    243199    else {
Note: See TracChangeset for help on using the changeset viewer.