Ignore:
Timestamp:
Jul 20, 1999, 9:42:36 AM (26 years ago)
Author:
sandervl
Message:

Accelerator support (not working) + bugfixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/win32wnd.cpp

    r340 r342  
    1 /* $Id: win32wnd.cpp,v 1.16 1999-07-19 18:40:44 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.17 1999-07-20 07:42:36 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    9999  owner            = NULL;
    100100  windowClass      = 0;
     101
     102  acceltableResource = NULL;
     103  menuResource       = NULL;
    101104}
    102105//******************************************************************************
     
    115118//******************************************************************************
    116119//******************************************************************************
     120BOOL Win32Window::isChild()
     121{
     122    return (dwStyle & WS_CHILD) != 0;
     123}
     124//******************************************************************************
     125//******************************************************************************
    117126BOOL Win32Window::CreateWindowExA(CREATESTRUCTA *cs, ATOM classAtom)
    118127{
     
    121130 POINT maxSize, maxPos, minTrack, maxTrack;
    122131
    123   SetLastError(0);
    124 
    125   /* Find the parent window */
    126   if (cs->hwndParent)
    127   {
    128         Win32Window *window = GetWindowFromHandle(cs->hwndParent);
    129         if(!window) {
    130                 dprintf(("Bad parent %04x\n", cs->hwndParent ));
    131                 SetLastError(ERROR_INVALID_PARAMETER);
    132         return FALSE;
    133         }
    134         /* Make sure parent is valid */
    135         if (!window->IsWindow() )
    136         {
    137                 dprintf(("Bad parent %04x\n", cs->hwndParent ));
    138                 SetLastError(ERROR_INVALID_PARAMETER);
    139                 return FALSE;
    140         }
    141   }
    142   else
    143   if ((cs->style & WS_CHILD) && !(cs->style & WS_POPUP)) {
    144         dprintf(("No parent for child window\n" ));
    145         SetLastError(ERROR_INVALID_PARAMETER);
    146         return FALSE;  /* WS_CHILD needs a parent, but WS_POPUP doesn't */
    147   }
     132    SetLastError(0);
     133
     134    /* Find the parent window */
     135    if (cs->hwndParent)
     136    {
     137            Win32Window *window = GetWindowFromHandle(cs->hwndParent);
     138            if(!window) {
     139                    dprintf(("Bad parent %04x\n", cs->hwndParent ));
     140                    SetLastError(ERROR_INVALID_PARAMETER);
     141                    return FALSE;
     142            }
     143            /* Make sure parent is valid */
     144            if (!window->IsWindow() )
     145            {
     146                    dprintf(("Bad parent %04x\n", cs->hwndParent ));
     147                    SetLastError(ERROR_INVALID_PARAMETER);
     148                    return FALSE;
     149            }
     150    }
     151    else
     152    if ((cs->style & WS_CHILD) && !(cs->style & WS_POPUP)) {
     153            dprintf(("No parent for child window\n" ));
     154            SetLastError(ERROR_INVALID_PARAMETER);
     155            return FALSE;  /* WS_CHILD needs a parent, but WS_POPUP doesn't */
     156    }
    148157
    149158  /* Find the window class */
     
    666675//******************************************************************************
    667676//******************************************************************************
    668 ULONG Win32Window::MsgMove(ULONG xParent, ULONG yParent)
    669 {
    670   return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)xParent, (USHORT)yParent));
     677ULONG Win32Window::MsgMove(ULONG x, ULONG y)
     678{
     679  dprintf(("MsgMove to (%d,%d)", x, y));
     680  return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y));
    671681}
    672682//******************************************************************************
     
    680690        return 0; //todo
    681691    case CMD_ACCELERATOR:
     692        dprintf(("accelerator command"));
    682693        return 0; //todo
    683694  }
     
    733744 ULONG win32ncmsg;
    734745
     746  dprintf(("MsgButton to (%d,%d)", x, y));
    735747  switch(msg) {
    736748        case BUTTON_LEFTDOWN:
     
    10491061 Win32Resource *winres = (Win32Resource *)hMenu;
    10501062
    1051 #if 1
    1052     if(winres == NULL) {
     1063    if(HIWORD(winres) == 0) {
    10531064        dprintf(("Win32Window:: Win32Resource *winres == 0"));
     1065    SetLastError(ERROR_INVALID_PARAMETER);
    10541066        return FALSE;
    10551067    }
     
    10651077        return FALSE;
    10661078    }
     1079    menuResource = winres;
    10671080    return TRUE;
    1068 #else
    1069    if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR)
    1070    {
    1071     OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate);
    1072     if(OS2HwndMenu == 0) {
    1073         dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
    1074         return FALSE;
    1075     }
    1076    }
    1077    dprintf(("Win32Window::SetMenu unknown hMenu (%x)", hMenu));
    1078    return FALSE;
    1079 #endif
     1081}
     1082//******************************************************************************
     1083//******************************************************************************
     1084BOOL Win32Window::SetAccelTable(ULONG hAccel)
     1085{
     1086 Win32Resource *winres = (Win32Resource *)hAccel;
     1087
     1088    if(HIWORD(hAccel) == 0) {
     1089        dprintf(("SetAccelTable: hAccel %x invalid", hAccel));
     1090            SetLastError(ERROR_INVALID_PARAMETER);
     1091            return FALSE;
     1092    }
     1093    acceltableResource = winres;
     1094        return OSLibWinSetAccelTable(OS2HwndFrame, winres->lockOS2Resource());
    10801095}
    10811096//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.