Changeset 18061


Ignore:
Timestamp:
Nov 30, 2001, 7:45:51 PM (23 years ago)
Author:
sandervl
Message:

DIALOG_IsAccelerator resync (Wine)

Location:
tags/trunk/src/user32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tags/trunk/src/user32/windlg.cpp

    r17805 r18061  
    1 /* $Id: windlg.cpp,v 1.28 2001-10-28 15:24:16 sandervl Exp $ */
     1/* $Id: windlg.cpp,v 1.29 2001-11-30 18:45:51 sandervl Exp $ */
    22/*
    33 * Win32 dialog apis for OS/2
     
    310310        if(fPrevious) hChildFirst = GetWindow(hChildFirst,GW_HWNDLAST);
    311311    }
     312#if 1
     313    else if (IsChild( hwndMain, hwndCtrl ))
     314    {
     315        hChildFirst = GetWindow(hwndCtrl,wndSearch);
     316        if(!hChildFirst)
     317        {
     318            if(GetParent(hwndCtrl) != hwndMain)
     319                hChildFirst = GetWindow(GetParent(hwndCtrl),wndSearch);
     320            else
     321            {
     322                if(fPrevious)
     323                    hChildFirst = GetWindow(hwndCtrl,GW_HWNDLAST);
     324                else
     325                    hChildFirst = GetWindow(hwndCtrl,GW_HWNDFIRST);
     326            }
     327        }
     328    }
     329#else
    312330    else
    313331    {
     
    340358        }       
    341359    }
     360#endif
    342361    while(hChildFirst)
    343362    {
  • TabularUnified tags/trunk/src/user32/windlgmsg.cpp

    r17311 r18061  
    1 /* $Id: windlgmsg.cpp,v 1.10 2001-09-19 09:10:13 sandervl Exp $ */
     1/* $Id: windlgmsg.cpp,v 1.11 2001-11-30 18:45:51 sandervl Exp $ */
    22/*
    33 * Win32 dialog message APIs for OS/2
     
    2121#include "win32wbase.h"
    2222#include "win32dlg.h"
     23#include <winnls.h>
     24#include <wine\unicode.h>
    2325
    2426#define DBG_LOCALLOG    DBG_windlgmsg
     
    7072    HWND hwndControl = hwnd;
    7173    HWND hwndNext;
    72     Win32BaseWindow *win32wnd;
    7374    BOOL RetVal = FALSE;
     75    WCHAR buffer[128];
    7476    INT dlgCode;
    7577
     
    7981        if (dlgCode & DLGC_BUTTON)
    8082        {
    81             SendMessageA( hwndControl, WM_LBUTTONDOWN, 0, 0);
    82             SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0);
    83             RetVal = TRUE;
    84         }
    85     }
    86     else
    87     {
    88         do
    89         {
    90             win32wnd = Win32BaseWindow::GetWindowFromHandle(hwndControl);
    91             if ( (win32wnd != NULL) &&
    92                  ((win32wnd->getStyle() & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE) )
    93             {
    94                 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 );
    95                 if (dlgCode & (DLGC_BUTTON | DLGC_STATIC))
    96                 {
    97                     INT textLen = win32wnd->GetWindowTextLengthA();
    98 
    99                     if (textLen > 0)
     83            /* send BM_CLICK message to the control */
     84            SendMessageA( hwndControl, BM_CLICK, 0, 0 );
     85            return TRUE;
     86        }
     87    }
     88
     89    do
     90    {
     91        DWORD style = GetWindowLongW( hwndControl, GWL_STYLE );
     92        if ((style & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE)
     93        {
     94            dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 );
     95            if ( (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) &&
     96                 GetWindowTextW( hwndControl, buffer, sizeof(buffer)/sizeof(WCHAR) ))
     97            {
     98                /* find the accelerator key */
     99                LPWSTR p = buffer - 2;
     100                char a_char = vKey;
     101                WCHAR w_char = 0;
     102
     103                do
     104                {
     105                    p = strchrW( p + 2, '&' );
     106                }
     107                while (p != NULL && p[1] == '&');
     108
     109                /* and check if it's the one we're looking for */
     110                MultiByteToWideChar(CP_ACP, 0, &a_char, 1, &w_char, 1);
     111                if (p != NULL && toupperW( p[1] ) == toupperW( w_char ) )
     112                {
     113                    if ((dlgCode & DLGC_STATIC) || (style & 0x0f) == BS_GROUPBOX )
    100114                    {
    101                         /* find the accelerator key */
    102                         char* text;
    103                         LPSTR p;
    104 
    105                         text = (char*)malloc(textLen+1);
    106                         win32wnd->GetWindowTextA(text,textLen);
    107                         p = text - 2;
    108                         do
    109                         {
    110                             p = strchr( p + 2, '&' );
    111                         }
    112                         while (p != NULL && p[1] == '&');
    113 
    114                         /* and check if it's the one we're looking for */
    115                         if (p != NULL && toupper( p[1] ) == toupper( vKey ) )
    116                         {
    117                             if ((dlgCode & DLGC_STATIC) ||
    118                                 (win32wnd->getStyle() & 0x0f) == BS_GROUPBOX )
    119                             {
    120                                 /* set focus to the control */
    121                                 SendMessageA( hwndDlg, WM_NEXTDLGCTL,
    122                                               hwndControl, 1);
    123                                 /* and bump it on to next */
    124                                 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0);
    125                             }
    126                             else
    127                             //TODO: this else part was removed in Wine and above if rules out this possibility (if (dlgCode & (DLGC_BUTTON | DLGC_STATIC)))
    128                             if (dlgCode & (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON))
    129                             {
    130                                 /* send command message as from the control */
    131                                 SendMessageA( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(win32wnd->getWindowId()), BN_CLICKED ),
    132                                               (LPARAM)hwndControl );
    133                             }
    134                             else if (dlgCode & DLGC_BUTTON)
    135                             {
    136                                 /* send BM_CLICK message to the control */
    137                                 SendMessageA( hwndControl, BM_CLICK, 0, 0 );
    138                             }
    139                             RetVal = TRUE;
    140                             free(text);
    141                             RELEASE_WNDOBJ(win32wnd);
    142                             break;
    143                         }
    144                         free(text);
     115                        /* set focus to the control */
     116                        SendMessageA( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndControl, 1);
     117                        /* and bump it on to next */
     118                        SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0);
    145119                    }
    146                 }
    147                 hwndNext = GetWindow( hwndControl, GW_CHILD );
     120                    else if (dlgCode & DLGC_BUTTON)
     121                    {
     122                           /* send BM_CLICK message to the control */
     123                        SendMessageA( hwndControl, BM_CLICK, 0, 0 );
     124                    }
     125                    return TRUE;
     126                }
     127            }
     128            hwndNext = GetWindow( hwndControl, GW_CHILD );
     129        }
     130        else hwndNext = 0;
     131
     132        if (!hwndNext) hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
     133
     134        while (!hwndNext && hwndControl)
     135        {
     136            hwndControl = GetParent( hwndControl );
     137            if (hwndControl == hwndDlg)
     138            {
     139                if(hwnd==hwndDlg)   /* prevent endless loop */
     140                {
     141                    hwndNext=hwnd;
     142                    break;
     143                }
     144                hwndNext = GetWindow( hwndDlg, GW_CHILD );
    148145            }
    149146            else
    150             {
    151                 hwndNext = 0;
    152             }
    153             if(win32wnd) RELEASE_WNDOBJ(win32wnd);
    154 
    155             if (!hwndNext)
    156             {
     147#ifdef __WIN32OS2__
     148            {
     149                if(hwndControl == 0) {
     150                    dprintf(("WARNING: DIALOG_IsAccelerator %x %x -> hwndControl == 0", hwnd, hwndDlg));
     151                    return FALSE;
     152                }
    157153                hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
    158154            }
    159             while (!hwndNext)
    160             {
    161                 hwndControl = GetParent( hwndControl );
    162                 if (hwndControl == hwndDlg)
    163                 {
    164                     if(hwnd==hwndDlg){  /* prevent endless loop */
    165                         hwndNext=hwnd;
    166                         break;
    167                     }
    168                     hwndNext = GetWindow( hwndDlg, GW_CHILD );
    169                 }
    170                 else
    171                 {
    172 #ifdef __WIN32OS2__
    173                     if(hwndControl == 0) {
    174                         dprintf(("WARNING: DIALOG_IsAccelerator %x %x -> hwndControl == 0", hwnd, hwndDlg));
    175                         return FALSE;
    176                     }
     155#else
     156                hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
    177157#endif
    178                     hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
    179                 }
    180             }
    181             hwndControl = hwndNext;
    182         }
    183         while (hwndControl != hwnd);
    184     }
    185     return RetVal;
     158        }
     159        hwndControl = hwndNext;
     160    }
     161    while (hwndControl && (hwndControl != hwnd));
     162
     163    return FALSE;
    186164}
    187165/***********************************************************************
Note: See TracChangeset for help on using the changeset viewer.