Ignore:
Timestamp:
Nov 9, 1999, 8:23:17 PM (26 years ago)
Author:
sandervl
Message:

dprintf2 addition + Rene Pronk's mnemonics changes

File:
1 edited

Legend:

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

    r1629 r1671  
    1 /* $Id: win32wbase.cpp,v 1.77 1999-11-08 13:44:15 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.78 1999-11-09 19:23:17 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    10361036
    10371037    if(ISMOUSE_CAPTURED()) {
    1038         if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_BUTTON, ncx, ncy, msg))
    1039                 return 0;
     1038    if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_BUTTON, ncx, ncy, msg))
     1039        return 0;
    10401040    }
    10411041
     
    11071107    }
    11081108
    1109     if(fClick) 
     1109    if(fClick)
    11101110    {
    11111111     HWND hwndTop;
    11121112
    11131113        /* Activate the window if needed */
    1114         if(isSubclassedOS2Wnd()) {
    1115                 Win32BaseWindow *parentwnd = GetWindowFromOS2FrameHandle(OSLibWinQueryWindow(OS2Hwnd, QWOS_PARENT));
    1116                 if(parentwnd) {
    1117                         hwndTop = (parentwnd->GetTopParent()) ? parentwnd->GetTopParent()->getWindowHandle() : 0;
    1118                 }
    1119                 else    hwndTop = 0;
    1120         }
    1121         else    hwndTop = (GetTopParent()) ? GetTopParent()->getWindowHandle() : 0;
     1114    if(isSubclassedOS2Wnd()) {
     1115        Win32BaseWindow *parentwnd = GetWindowFromOS2FrameHandle(OSLibWinQueryWindow(OS2Hwnd, QWOS_PARENT));
     1116        if(parentwnd) {
     1117            hwndTop = (parentwnd->GetTopParent()) ? parentwnd->GetTopParent()->getWindowHandle() : 0;
     1118        }
     1119        else    hwndTop = 0;
     1120    }
     1121    else    hwndTop = (GetTopParent()) ? GetTopParent()->getWindowHandle() : 0;
    11221122
    11231123        if (hwndTop && getWindowHandle() != GetActiveWindow())
     
    11541154
    11551155    if(ISMOUSE_CAPTURED()) {
    1156         POINT point = {x,y};
    1157        
     1156    POINT point = {x,y};
     1157
    11581158        MapWindowPoints(getWindowHandle(), HWND_DESKTOP, &point, 1);
    1159         if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_MOVE, point.x, point.y, keystate))
    1160                 return 0;
     1159    if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_MOVE, point.x, point.y, keystate))
     1160        return 0;
    11611161    }
    11621162
     
    15651565
    15661566    case WM_SYSKEYDOWN:
    1567         if(HIWORD(lParam) & KEYDATA_ALT)
    1568         {
    1569             if(wParam == VK_F4) /* try to close the window */
    1570             {
    1571                 Win32BaseWindow *window = GetTopParent();
    1572                 if(window && !(window->getClass()->getStyle() & CS_NOCLOSE) )
    1573                     window->PostMessageA(WM_SYSCOMMAND, SC_CLOSE, 0);
     1567        if(wParam == VK_F4) /* try to close the window */
     1568        {
     1569            Win32BaseWindow *window = GetTopParent();
     1570            if(window && !(window->getClass()->getStyle() & CS_NOCLOSE))
     1571                window->PostMessageA(WM_SYSCOMMAND, SC_CLOSE, 0);
     1572        }
     1573
     1574        Win32BaseWindow *siblingWindow;
     1575        HWND sibling;
     1576        char nameBuffer [40], mnemonic;
     1577        int nameLength;
     1578
     1579        GetWindowTextA (nameBuffer, 40);
     1580
     1581        // search all sibling to see it this key is their mnemonic
     1582        sibling = GetWindow (GW_HWNDFIRST);
     1583        while (sibling != 0) {
     1584          siblingWindow = GetWindowFromHandle (sibling);
     1585          nameLength = siblingWindow->GetWindowTextA (nameBuffer, 40);
     1586
     1587          // find the siblings mnemonic
     1588          mnemonic = '\0';
     1589          for (int i=0 ; i<nameLength ; i++) {
     1590            if (nameBuffer [i] == '&') {
     1591              mnemonic = nameBuffer [i+1];
     1592              if ((mnemonic >= 'a') && (mnemonic <= 'z'))
     1593                mnemonic -= 32; // make it uppercase
     1594              break;  // stop searching
    15741595            }
    1575         }
     1596          }
     1597
     1598          // key matches siblings mnemonic, send mouseclick
     1599          if (mnemonic == (char) wParam) {
     1600            siblingWindow->SendMessageA (BM_CLICK, 0, 0);
     1601          }
     1602
     1603          sibling = siblingWindow->GetNextWindow (GW_HWNDNEXT);
     1604        }
     1605
    15761606        return 0;
    15771607
     
    25012531{
    25022532    if(wndname == NULL)
    2503       return FALSE; 
     2533      return FALSE;
    25042534
    25052535    if(fUnicode) {
Note: See TracChangeset for help on using the changeset viewer.