Ignore:
Timestamp:
Oct 12, 1999, 4:47:24 PM (26 years ago)
Author:
sandervl
Message:

MDI fix, extra message support etc

File:
1 edited

Legend:

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

    r1253 r1256  
    1 /* $Id: win32wbase.cpp,v 1.36 1999-10-11 20:54:25 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.37 1999-10-12 14:47:23 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    5858    !(style & (WS_CHILD | WS_POPUP))
    5959
     60/* bits in the dwKeyData */
     61#define KEYDATA_ALT         0x2000
     62#define KEYDATA_PREVSTATE   0x4000
     63
    6064void PrintWindowStyle(DWORD dwStyle, DWORD dwExStyle);
    6165
     
    551555
    552556  //Subclass frame
    553   if (isFrameWindow())
     557  if (isFrameWindow() && HAS_3DFRAME(dwExStyle))
    554558  {
    555559    pOldFrameProc = FrameSubclassFrameWindow(this);
     
    10861090                                                    // bit 24, 1=extended key
    10871091                                                    // bit 25-28, reserved
    1088     lParam |= 0 << 29;                              // bit 29, key is released, always 0 for WM_KEYUP ?? <- conflict according to the MS docs
     1092    lParam |= 0 << 29;                              // bit 29, key is released, always 1 for WM_SYSKEYUP ?? <- conflict according to the MS docs
    10891093    lParam |= 1 << 30;                              // bit 30, previous state, always 1 for a WM_KEYUP message
    10901094    lParam |= 1 << 31;                              // bit 31, transition state, always 1 for WM_KEYUP
     
    11051109                                                    // bit 24, 1=extended key
    11061110                                                    // bit 25-28, reserved
    1107                                                     // bit 29, key is pressed, always 0 for WM_KEYDOWN ?? <- conflict according to the MS docs
     1111                                            // bit 29, key is released, always 1 for WM_SYSKEYUP ?? <- conflict according to the MS docs
    11081112    if (keyWasPressed)
    11091113        lParam |= 1 << 30;                          // bit 30, previous state, 1 means key was pressed
     
    14451449    return infoPtr->CurVal;
    14461450}
     1451/***********************************************************************
     1452 *           NC_HandleSysCommand
     1453 *
     1454 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
     1455 *
     1456 * TODO: Not done (see #if 0)
     1457 */
     1458LONG Win32BaseWindow::HandleSysCommand(WPARAM wParam, POINT *pt32)
     1459{
     1460    UINT uCommand = wParam & 0xFFF0;
     1461
     1462    if (getStyle() & WS_CHILD && uCommand != SC_KEYMENU )
     1463        ScreenToClient(getParent()->getWindowHandle(), pt32 );
     1464
     1465    switch (uCommand)
     1466    {
     1467#if 0
     1468    case SC_SIZE:
     1469    case SC_MOVE:
     1470        NC_DoSizeMove( hwnd, wParam );
     1471        break;
     1472#endif
     1473
     1474    case SC_MINIMIZE:
     1475        ShowWindow(SW_MINIMIZE);
     1476        break;
     1477
     1478    case SC_MAXIMIZE:
     1479        ShowWindow(SW_MAXIMIZE);
     1480        break;
     1481
     1482    case SC_RESTORE:
     1483        ShowWindow(SW_RESTORE);
     1484        break;
     1485
     1486    case SC_CLOSE:
     1487        return SendMessageA(WM_CLOSE, 0, 0);
     1488
     1489#if 0
     1490    case SC_VSCROLL:
     1491    case SC_HSCROLL:
     1492        NC_TrackScrollBar( hwnd, wParam, pt32 );
     1493        break;
     1494
     1495    case SC_MOUSEMENU:
     1496        MENU_TrackMouseMenuBar( wndPtr, wParam & 0x000F, pt32 );
     1497        break;
     1498
     1499    case SC_KEYMENU:
     1500        MENU_TrackKbdMenuBar( wndPtr , wParam , pt.x );
     1501        break;
     1502
     1503    case SC_TASKLIST:
     1504        WinExec( "taskman.exe", SW_SHOWNORMAL );
     1505        break;
     1506
     1507    case SC_SCREENSAVE:
     1508        if (wParam == SC_ABOUTWINE)
     1509            ShellAboutA(hwnd, "Odin", WINE_RELEASE_INFO, 0);
     1510        else
     1511        if (wParam == SC_PUTMARK)
     1512            dprintf(("Mark requested by user\n"));
     1513        break;
     1514
     1515    case SC_HOTKEY:
     1516    case SC_ARRANGE:
     1517    case SC_NEXTWINDOW:
     1518    case SC_PREVWINDOW:
     1519        break;
     1520#endif
     1521    }
     1522    return 0;
     1523}
    14471524//******************************************************************************
    14481525//******************************************************************************
     
    15781655    }
    15791656    case WM_MOUSEMOVE:
    1580         return 0;
     1657        return 1; //Let OS/2 change the mouse cursor back to the default
    15811658
    15821659    case WM_WINDOWPOSCHANGED:
     
    16341711        return HTCLIENT;
    16351712
    1636 #if 0
     1713    case WM_SYSCOMMAND:
     1714    {
     1715     POINT point;
     1716
     1717        point.x = LOWORD(lParam);
     1718        point.y = HIWORD(lParam);
     1719        return HandleSysCommand(wParam, &point);
     1720    }
     1721
    16371722    case WM_SYSKEYDOWN:
    16381723        if(HIWORD(lParam) & KEYDATA_ALT)
     
    16401725            if(wParam == VK_F4) /* try to close the window */
    16411726            {
    1642                 HWND hWnd = WIN_GetTopParent( wndPtr->hwndSelf );
    1643                 wndPtr = WIN_FindWndPtr( hWnd );
    1644                 if( wndPtr && !(getClass()->getStyle() & CS_NOCLOSE) )
    1645                     PostMessage(WM_SYSCOMMAND, SC_CLOSE, 0);
     1727                Win32BaseWindow *window = GetTopParent();
     1728                if(window && !(window->getClass()->getStyle() & CS_NOCLOSE) )
     1729                    window->PostMessageA(WM_SYSCOMMAND, SC_CLOSE, 0);
    16461730            }
    16471731        }
    16481732        return 0;
    1649 #endif
     1733
     1734    case WM_QUERYOPEN:
     1735    case WM_QUERYENDSESSION:
     1736        return 1;
     1737
     1738    case WM_NOTIFYFORMAT:
     1739        if (IsUnicode()) return NFR_UNICODE;
     1740        else return NFR_ANSI;
     1741
     1742    case WM_SETICON:
     1743    case WM_GETICON:
     1744    {
     1745            LRESULT result = 0;
     1746            int index = GCL_HICON;
     1747
     1748            if (wParam == ICON_SMALL)
     1749                index = GCL_HICONSM;
     1750
     1751            result = windowClass->getClassLongA(index);
     1752
     1753            if (Msg == WM_SETICON)
     1754                windowClass->setClassLongA(index, lParam);
     1755
     1756            return result;
     1757    }
    16501758
    16511759    default:
     
    19742082 ULONG showstate = 0;
    19752083
    1976     dprintf(("ShowWindow %x", nCmdShow));
     2084    dprintf(("ShowWindow %x %x", getWindowHandle(), nCmdShow));
    19772085    if(fFirstShow) {
    19782086        if(isFrameWindow() && IS_OVERLAPPED(getStyle()) && !isChild()) {
     
    20192127        break;
    20202128    }
     2129
    20212130    BOOL rc = OSLibWinShowWindow(OS2HwndFrame, showstate);
    20222131    return rc;
     
    21562265BOOL Win32BaseWindow::IsChild(HWND hwndParent)
    21572266{
    2158   if(getParent()) {
     2267    if(getParent()) {
    21592268        return getParent()->getWindowHandle() == hwndParent;
    2160   }
    2161   else  return 0;
     2269    }
     2270    else  return 0;
    21622271}
    21632272//******************************************************************************
     
    21652274HWND Win32BaseWindow::GetTopWindow()
    21662275{
    2167   return GetWindow(GW_CHILD);
     2276    return GetWindow(GW_CHILD);
     2277}
     2278//******************************************************************************
     2279// Get the top-level parent for a child window.
     2280//******************************************************************************
     2281Win32BaseWindow *Win32BaseWindow::GetTopParent()
     2282{
     2283 Win32BaseWindow *window = this;
     2284
     2285    while(window && (window->getStyle() & WS_CHILD))
     2286    {
     2287        window = window->getParent();
     2288    }
     2289    return window;
    21682290}
    21692291//******************************************************************************
     
    26162738Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2FrameHandle(HWND hwnd)
    26172739{
    2618   return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT));
     2740    return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT));
    26192741}
    26202742//******************************************************************************
     
    26222744HWND Win32BaseWindow::Win32ToOS2Handle(HWND hwnd)
    26232745{
    2624         Win32BaseWindow *window = GetWindowFromHandle(hwnd);
    2625 
    2626         if(window) {
    2627                 return window->getOS2WindowHandle();
    2628         }
    2629         else  return hwnd;    //OS/2 window handle
     2746    Win32BaseWindow *window = GetWindowFromHandle(hwnd);
     2747
     2748    if(window) {
     2749            return window->getOS2WindowHandle();
     2750    }
     2751    else    return hwnd;
     2752}
     2753//******************************************************************************
     2754//******************************************************************************
     2755HWND Win32BaseWindow::Win32ToOS2FrameHandle(HWND hwnd)
     2756{
     2757    Win32BaseWindow *window = GetWindowFromHandle(hwnd);
     2758
     2759    if(window) {
     2760            return window->getOS2FrameWindowHandle();
     2761    }
     2762    else    return hwnd;
    26302763}
    26312764//******************************************************************************
     
    26332766HWND Win32BaseWindow::OS2ToWin32Handle(HWND hwnd)
    26342767{
    2635         Win32BaseWindow *window = GetWindowFromOS2Handle(hwnd);
    2636 
    2637         if(window) {
    2638                 return window->getWindowHandle();
    2639         }
    2640         window = GetWindowFromOS2FrameHandle(hwnd);
    2641         if(window) {
    2642                 return window->getWindowHandle();
    2643         }
    2644         else    return hwnd;    //OS/2 window handle
     2768    Win32BaseWindow *window = GetWindowFromOS2Handle(hwnd);
     2769
     2770    if(window) {
     2771            return window->getWindowHandle();
     2772    }
     2773    window = GetWindowFromOS2FrameHandle(hwnd);
     2774    if(window) {
     2775            return window->getWindowHandle();
     2776    }
     2777    else    return hwnd;    //OS/2 window handle
    26452778}
    26462779//******************************************************************************
     
    26522785 char exstyle[256] = "";
    26532786
    2654   /* Window styles */
    2655   if(dwStyle & WS_CHILD)
     2787    /* Window styles */
     2788    if(dwStyle & WS_CHILD)
    26562789        strcat(style, "WS_CHILD ");
    2657   if(dwStyle & WS_POPUP)
     2790    if(dwStyle & WS_POPUP)
    26582791        strcat(style, "WS_POPUP ");
    2659   if(dwStyle & WS_VISIBLE)
     2792    if(dwStyle & WS_VISIBLE)
    26602793        strcat(style, "WS_VISIBLE ");
    2661   if(dwStyle & WS_DISABLED)
     2794    if(dwStyle & WS_DISABLED)
    26622795        strcat(style, "WS_DISABLED ");
    2663   if(dwStyle & WS_CLIPSIBLINGS)
     2796    if(dwStyle & WS_CLIPSIBLINGS)
    26642797        strcat(style, "WS_CLIPSIBLINGS ");
    2665   if(dwStyle & WS_CLIPCHILDREN)
     2798    if(dwStyle & WS_CLIPCHILDREN)
    26662799        strcat(style, "WS_CLIPCHILDREN ");
    2667   if(dwStyle & WS_MAXIMIZE)
     2800    if(dwStyle & WS_MAXIMIZE)
    26682801        strcat(style, "WS_MAXIMIZE ");
    2669   if(dwStyle & WS_MINIMIZE)
     2802    if(dwStyle & WS_MINIMIZE)
    26702803        strcat(style, "WS_MINIMIZE ");
    2671   if(dwStyle & WS_GROUP)
     2804    if(dwStyle & WS_GROUP)
    26722805        strcat(style, "WS_GROUP ");
    2673   if(dwStyle & WS_TABSTOP)
     2806    if(dwStyle & WS_TABSTOP)
    26742807        strcat(style, "WS_TABSTOP ");
    26752808
    2676   if((dwStyle & WS_CAPTION) == WS_CAPTION)
     2809    if((dwStyle & WS_CAPTION) == WS_CAPTION)
    26772810        strcat(style, "WS_CAPTION ");
    2678   if(dwStyle & WS_DLGFRAME)
     2811    if(dwStyle & WS_DLGFRAME)
    26792812        strcat(style, "WS_DLGFRAME ");
    2680   if(dwStyle & WS_BORDER)
     2813    if(dwStyle & WS_BORDER)
    26812814        strcat(style, "WS_BORDER ");
    26822815
    2683   if(dwStyle & WS_VSCROLL)
     2816    if(dwStyle & WS_VSCROLL)
    26842817        strcat(style, "WS_VSCROLL ");
    2685   if(dwStyle & WS_HSCROLL)
     2818    if(dwStyle & WS_HSCROLL)
    26862819        strcat(style, "WS_HSCROLL ");
    2687   if(dwStyle & WS_SYSMENU)
     2820    if(dwStyle & WS_SYSMENU)
    26882821        strcat(style, "WS_SYSMENU ");
    2689   if(dwStyle & WS_THICKFRAME)
     2822    if(dwStyle & WS_THICKFRAME)
    26902823        strcat(style, "WS_THICKFRAME ");
    2691   if(dwStyle & WS_MINIMIZEBOX)
     2824    if(dwStyle & WS_MINIMIZEBOX)
    26922825        strcat(style, "WS_MINIMIZEBOX ");
    2693   if(dwStyle & WS_MAXIMIZEBOX)
     2826    if(dwStyle & WS_MAXIMIZEBOX)
    26942827        strcat(style, "WS_MAXIMIZEBOX ");
    26952828
    2696   if(dwExStyle & WS_EX_DLGMODALFRAME)
     2829    if(dwExStyle & WS_EX_DLGMODALFRAME)
    26972830        strcat(exstyle, "WS_EX_DLGMODALFRAME ");
    2698   if(dwExStyle & WS_EX_ACCEPTFILES)
     2831    if(dwExStyle & WS_EX_ACCEPTFILES)
    26992832        strcat(exstyle, "WS_EX_ACCEPTFILES ");
    2700   if(dwExStyle & WS_EX_NOPARENTNOTIFY)
     2833    if(dwExStyle & WS_EX_NOPARENTNOTIFY)
    27012834        strcat(exstyle, "WS_EX_NOPARENTNOTIFY ");
    2702   if(dwExStyle & WS_EX_TOPMOST)
     2835    if(dwExStyle & WS_EX_TOPMOST)
    27032836        strcat(exstyle, "WS_EX_TOPMOST ");
    2704   if(dwExStyle & WS_EX_TRANSPARENT)
     2837    if(dwExStyle & WS_EX_TRANSPARENT)
    27052838        strcat(exstyle, "WS_EX_TRANSPARENT ");
    27062839
    2707   if(dwExStyle & WS_EX_MDICHILD)
     2840    if(dwExStyle & WS_EX_MDICHILD)
    27082841        strcat(exstyle, "WS_EX_MDICHILD ");
    2709   if(dwExStyle & WS_EX_TOOLWINDOW)
     2842    if(dwExStyle & WS_EX_TOOLWINDOW)
    27102843        strcat(exstyle, "WS_EX_TOOLWINDOW ");
    2711   if(dwExStyle & WS_EX_WINDOWEDGE)
     2844    if(dwExStyle & WS_EX_WINDOWEDGE)
    27122845        strcat(exstyle, "WS_EX_WINDOWEDGE ");
    2713   if(dwExStyle & WS_EX_CLIENTEDGE)
     2846    if(dwExStyle & WS_EX_CLIENTEDGE)
    27142847        strcat(exstyle, "WS_EX_CLIENTEDGE ");
    2715   if(dwExStyle & WS_EX_CONTEXTHELP)
     2848    if(dwExStyle & WS_EX_CONTEXTHELP)
    27162849        strcat(exstyle, "WS_EX_CONTEXTHELP ");
    2717   if(dwExStyle & WS_EX_RIGHT)
     2850    if(dwExStyle & WS_EX_RIGHT)
    27182851        strcat(exstyle, "WS_EX_RIGHT ");
    2719   if(dwExStyle & WS_EX_LEFT)
     2852    if(dwExStyle & WS_EX_LEFT)
    27202853        strcat(exstyle, "WS_EX_LEFT ");
    2721   if(dwExStyle & WS_EX_RTLREADING)
     2854    if(dwExStyle & WS_EX_RTLREADING)
    27222855        strcat(exstyle, "WS_EX_RTLREADING ");
    2723   if(dwExStyle & WS_EX_LTRREADING)
     2856    if(dwExStyle & WS_EX_LTRREADING)
    27242857        strcat(exstyle, "WS_EX_LTRREADING ");
    2725   if(dwExStyle & WS_EX_LEFTSCROLLBAR)
     2858    if(dwExStyle & WS_EX_LEFTSCROLLBAR)
    27262859        strcat(exstyle, "WS_EX_LEFTSCROLLBAR ");
    2727   if(dwExStyle & WS_EX_RIGHTSCROLLBAR)
     2860    if(dwExStyle & WS_EX_RIGHTSCROLLBAR)
    27282861        strcat(exstyle, "WS_EX_RIGHTSCROLLBAR ");
    2729   if(dwExStyle & WS_EX_CONTROLPARENT)
     2862    if(dwExStyle & WS_EX_CONTROLPARENT)
    27302863        strcat(exstyle, "WS_EX_CONTROLPARENT ");
    2731   if(dwExStyle & WS_EX_STATICEDGE)
     2864    if(dwExStyle & WS_EX_STATICEDGE)
    27322865        strcat(exstyle, "WS_EX_STATICEDGE ");
    2733   if(dwExStyle & WS_EX_APPWINDOW)
     2866    if(dwExStyle & WS_EX_APPWINDOW)
    27342867        strcat(exstyle, "WS_EX_APPWINDOW ");
    27352868
    2736   dprintf(("Window style:   %x %s", dwStyle, style));
    2737   dprintf(("Window exStyle: %x %s", dwExStyle, exstyle));
     2869    dprintf(("Window style:   %x %s", dwStyle, style));
     2870    dprintf(("Window exStyle: %x %s", dwExStyle, exstyle));
    27382871}
    27392872#endif
Note: See TracChangeset for help on using the changeset viewer.