Changeset 835 for trunk/src


Ignore:
Timestamp:
Sep 5, 1999, 5:53:10 PM (26 years ago)
Author:
sandervl
Message:

More dialog update

Location:
trunk/src/user32/new
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/makefile

    r833 r835  
    1 # $Id: makefile,v 1.44 1999-09-05 12:03:32 sandervl Exp $
     1# $Id: makefile,v 1.45 1999-09-05 15:53:08 sandervl Exp $
    22
    33#
     
    8787msgbox.obj:    msgbox.cpp
    8888window.obj:    window.cpp win32class.h win32wbase.h win32wndchild.h oslibwin.h win32wmdiclient.h
    89 windowmsg.obj: windowmsg.cpp win32class.h win32wbase.h win32wndchild.h
     89windowmsg.obj: windowmsg.cpp win32class.h win32wbase.h win32wndchild.h oslibmsg.h
    9090winprop.obj:   winprop.cpp
    9191wingdi.obj:    wingdi.cpp win32wbase.h oslibgdi.h
     
    103103win32wbase.obj:   win32wbase.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h
    104104win32wnd.obj:   win32wnd.cpp win32class.h win32wbase.h win32wnd.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h oslibmenu.h
    105 win32dlg.obj:   win32dlg.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h
     105win32dlg.obj:   win32dlg.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h oslibmsg.h
    106106win32wndchild.obj: win32wndchild.cpp win32wndchild.h
    107107win32wmdiclient.obj: win32wmdiclient.cpp win32wbase.h win32wmdiclient.h win32wmdichild.h
  • trunk/src/user32/new/oslibmsg.cpp

    r740 r835  
    1 /* $Id: oslibmsg.cpp,v 1.3 1999-08-29 20:05:07 sandervl Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.4 1999-09-05 15:53:08 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    7575//******************************************************************************
    7676//******************************************************************************
    77 BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, BOOL isUnicode)
     77BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
     78                    BOOL isUnicode)
    7879{
    7980 BOOL rc;
     
    8586//******************************************************************************
    8687//******************************************************************************
     88BOOL  OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
     89                      BOOL fRemove, BOOL isUnicode)
     90{
     91 BOOL rc;
     92
     93  rc = WinPeekMsg(GetThreadHAB(), MsgThreadPtr, hwnd, TranslateWinMsg(uMsgFilterMin),
     94                  TranslateWinMsg(uMsgFilterMax), (fRemove == MSG_REMOVE) ? PM_REMOVE : PM_NOREMOVE);
     95  OS2ToWinMsgTranslate(MsgThreadPtr, pMsg, isUnicode);
     96  return rc;
     97}
     98//******************************************************************************
     99//******************************************************************************
  • trunk/src/user32/new/oslibmsg.h

    r342 r835  
    1 /* $Id: oslibmsg.h,v 1.2 1999-07-20 07:42:35 sandervl Exp $ */
     1/* $Id: oslibmsg.h,v 1.3 1999-09-05 15:53:08 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    1313#define __OSLIBMSG_H__
    1414
     15#define MSG_NOREMOVE  0
     16#define MSG_REMOVE    1
     17
    1518ULONG TranslateWinMsg(ULONG msg);
     19
     20#ifdef OS2DEF_INCLUDED
    1621void  OS2ToWinMsgTranslate(QMSG *os2Msg, MSG *winMsg, BOOL isUnicode);
    1722void  WinToOS2MsgTranslate(MSG *winMsg, QMSG *os2Msg, BOOL isUnicode);
     23#endif
     24
     25BOOL  OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, BOOL isUnicode = FALSE);
     26BOOL  OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, BOOL fRemove, BOOL isUnicode = FALSE);
     27void  OSLibWinPostQuitMessage(ULONG nExitCode);
     28LONG  OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode = FALSE);
    1829
    1930BOOL  OSLibInitMsgQueue();
  • trunk/src/user32/new/oslibwin.h

    r724 r835  
    1 /* $Id: oslibwin.h,v 1.23 1999-08-28 14:09:29 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.24 1999-09-05 15:53:09 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    217217HWND  OSLibWinQueryWindow(HWND hwnd, ULONG lCode);
    218218
    219 
    220 void  OSLibWinPostQuitMessage(ULONG nExitCode);
    221 LONG  OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode = FALSE);
    222 
    223 BOOL  OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, BOOL isUnicode = FALSE);
    224 
    225219LONG  OSLibWinQueryWindowTextLength(HWND hwnd);
    226220LONG  OSLibWinQueryWindowText(HWND hwnd, LONG length, LPSTR lpsz);
  • trunk/src/user32/new/win32dlg.cpp

    r833 r835  
    1 /* $Id: win32dlg.cpp,v 1.4 1999-09-05 12:03:33 sandervl Exp $ */
     1/* $Id: win32dlg.cpp,v 1.5 1999-09-05 15:53:09 sandervl Exp $ */
    22/*
    33 * Win32 Dialog Code for OS/2
     
    1818#include <misc.h>
    1919#include <win32dlg.h>
     20#include "oslibmsg.h"
    2021
    2122//******************************************************************************
     
    214215    if (hMenu) DestroyMenu( hMenu );
    215216
     217}
     218/***********************************************************************
     219 *           DIALOG_DoDialogBox
     220 */
     221INT Win32Dialog::doDialogBox()
     222{
     223  Win32BaseWindow *topOwner;
     224  MSG msg;
     225  INT retval;
     226
     227    /* Owner must be a top-level window */
     228    if(getOwner() == NULL) {
     229        dprintf(("Dialog box has no owner!!!"));
     230        return -1;
     231    }
     232    topOwner = getOwner()->getTopParent();
     233    if(topOwner == NULL) {
     234        dprintf(("Dialog box has no top owner!!!"));
     235        return -1;
     236    }
     237
     238    if (!dialogFlags & DF_END) /* was EndDialog called in WM_INITDIALOG ? */
     239    {
     240        topOwner->EnableWindow( FALSE );
     241        ShowWindow( SW_SHOW );
     242
     243        while (OSLibWinPeekMsg(&msg, getOS2FrameWindowHandle(), topOwner->getOS2FrameWindowHandle(),
     244                               0, 0, MSG_REMOVE))
     245//        while (OSLibWinPeekMsg(&msg, getWindowHandle(), owner, MSGF_DIALOGBOX,
     246//                                       MSG_REMOVE, !(getStyle() & DS_NOIDLEMSG), NULL ))
     247        {
     248            if (!IsDialogMessageA( getWindowHandle(), &msg))
     249            {
     250                TranslateMessage( &msg );
     251                DispatchMessageA( &msg );
     252            }
     253            if (dialogFlags & DF_END) break;
     254        }
     255        topOwner->EnableWindow( TRUE );
     256    }
     257    retval = idResult;
     258    DestroyWindow();
     259    return retval;
    216260}
    217261/***********************************************************************
  • trunk/src/user32/new/win32dlg.h

    r833 r835  
    1 /* $Id: win32dlg.h,v 1.5 1999-09-05 12:03:33 sandervl Exp $ */
     1/* $Id: win32dlg.h,v 1.6 1999-09-05 15:53:09 sandervl Exp $ */
    22/*
    33 * Win32 Dialog Code for OS/2
     
    7979static   ULONG  GetDialogBaseUnits()  { return MAKELONG(xBaseUnit, yBaseUnit); };
    8080
     81           INT  doDialogBox();
     82
    8183protected:
    8284        BOOL    DIALOG_Init(void);
  • trunk/src/user32/new/win32wbase.cpp

    r833 r835  
    1 /* $Id: win32wbase.cpp,v 1.9 1999-09-05 12:03:33 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.10 1999-09-05 15:53:09 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    11601160    }
    11611161    case WM_GETDLGCODE:
    1162             return 0;
     1162        return 0;
    11631163
    11641164    case WM_NCLBUTTONDOWN:
     
    12111211        case WM_CREATE:
    12121212        {
    1213                 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
    1214                         dprintf(("WM_NCCREATE returned FALSE\n"));
    1215                         return(-1); //don't create window
    1216                 }
    12171213                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
    12181214                        dprintf(("WM_CREATE returned -1\n"));
     
    12541250        case WM_CREATE:
    12551251        {
    1256                 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
    1257                         dprintf(("WM_NCCREATE returned FALSE\n"));
    1258                         return(0); //don't create window
    1259                 }
    12601252                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
    12611253                        dprintf(("WM_CREATE returned FALSE\n"));
     
    12991291        case WM_CREATE:
    13001292        {
    1301                 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
    1302                         dprintf(("WM_NCCREATE returned FALSE\n"));
    1303                         return(0); //don't create window
    1304                 }
    13051293                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
    13061294                        dprintf(("WM_CREATE returned FALSE\n"));
     
    13411329        case WM_CREATE:
    13421330        {
    1343                 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
    1344                         dprintf(("WM_NCCREATE returned FALSE\n"));
    1345                         return(0); //don't create window
    1346                 }
    13471331                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
    13481332                        dprintf(("WM_CREATE returned FALSE\n"));
     
    14041388        window = parentwindow;
    14051389   }
     1390}
     1391//******************************************************************************
     1392//******************************************************************************
     1393Win32BaseWindow *Win32BaseWindow::getTopParent()
     1394{
     1395 Win32BaseWindow *tmpWnd = this;
     1396
     1397    while( tmpWnd && (tmpWnd->getStyle() & WS_CHILD))
     1398    {
     1399        tmpWnd = tmpWnd->getParent();
     1400    }
     1401    return tmpWnd;
    14061402}
    14071403//******************************************************************************
  • trunk/src/user32/new/win32wbase.h

    r833 r835  
    1 /* $Id: win32wbase.h,v 1.7 1999-09-05 12:03:33 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.8 1999-09-05 15:53:10 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    166166Win32BaseWindow *getOwner()                   { return owner; };
    167167
     168Win32BaseWindow *getTopParent();
     169
    168170       LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
    169171       LRESULT  SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
  • trunk/src/user32/new/windlg.cpp

    r833 r835  
    1 /* $Id: windlg.cpp,v 1.3 1999-09-05 12:03:34 sandervl Exp $ */
     1/* $Id: windlg.cpp,v 1.4 1999-09-05 15:53:10 sandervl Exp $ */
    22/*
    33 * Win32 dialog apis for OS/2
     
    120120    HWND hwnd = CreateDialogIndirectParamA(hInst, dlgtemplate, hwndParent, dlgproc,
    121121                                           lParamInit);
    122     //TODO:
    123     if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner );
     122    if (hwnd)
     123    {
     124        Win32Dialog *dialog;
     125
     126        dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
     127        if(!dialog || !dialog->IsDialog()) {
     128            dprintf(("DialogBoxIndirectParamA, dialog %x not found", hwnd));
     129            return 0;
     130        }
     131        return dialog->doDialogBox();
     132    }
    124133    return -1;
    125134}
     
    132141    HWND hwnd = CreateDialogIndirectParamW(hInst, dlgtemplate, hwndParent, dlgproc,
    133142                                           lParamInit);
    134     //TODO:
    135     if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner );
     143    if (hwnd)
     144    {
     145        Win32Dialog *dialog;
     146
     147        dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
     148        if(!dialog || !dialog->IsDialog()) {
     149            dprintf(("DialogBoxIndirectParamW, dialog %x not found", hwnd));
     150            return 0;
     151        }
     152        return dialog->doDialogBox();
     153    }
    136154    return -1;
    137155}
     
    142160{
    143161    HWND hwnd = CreateDialogParamA( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit);
    144     //TODO:
    145     if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner );
     162
     163    if (hwnd)
     164    {
     165        Win32Dialog *dialog;
     166
     167        dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
     168        if(!dialog || !dialog->IsDialog()) {
     169            dprintf(("DialogBoxParamA, dialog %x not found", hwnd));
     170            return 0;
     171        }
     172        return dialog->doDialogBox();
     173    }
    146174    return -1;
    147175}
     
    152180{
    153181    HWND hwnd = CreateDialogParamW( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit);
    154     //TODO:
    155     if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner );
     182
     183    if (hwnd)
     184    {
     185        Win32Dialog *dialog;
     186
     187        dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
     188        if(!dialog || !dialog->IsDialog()) {
     189            dprintf(("DialogBoxParamW, dialog %x not found", hwnd));
     190            return 0;
     191        }
     192        return dialog->doDialogBox();
     193    }
    156194    return -1;
    157195}
  • trunk/src/user32/new/windlgmsg.cpp

    r833 r835  
    1 /* $Id: windlgmsg.cpp,v 1.2 1999-09-05 12:03:34 sandervl Exp $ */
     1/* $Id: windlgmsg.cpp,v 1.3 1999-09-05 15:53:10 sandervl Exp $ */
    22/*
    33 * Win32 dialog message APIs for OS/2
     
    111111                        }
    112112                        else if (dlgCode &
    113                             (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON))
     113                (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON))
    114114                        {
    115115                            /* send command message as from the control */
     
    126126                        }
    127127                        RetVal = TRUE;
    128                         WIN_ReleaseWndPtr(wndPtr);
     128            WIN_ReleaseWndPtr(wndPtr);
    129129                        break;
    130130                    }
    131131                }
    132                 hwndNext = GetWindow( hwndControl, GW_CHILD );
    133             }
    134             else
    135             {
    136                 hwndNext = 0;
    137             }
     132        hwndNext = GetWindow( hwndControl, GW_CHILD );
     133            }
     134        else
     135        {
     136        hwndNext = 0;
     137        }
    138138            WIN_ReleaseWndPtr(wndPtr);
    139             if (!hwndNext)
    140             {
    141                 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
    142             }
    143             while (!hwndNext)
    144             {
    145                 hwndControl = GetParent( hwndControl );
    146                 if (hwndControl == hwndDlg)
    147                 {
    148                     if(hwnd==hwndDlg){  /* prevent endless loop */
    149                         hwndNext=hwnd;
    150                         break;
    151                     }
    152                     hwndNext = GetWindow( hwndDlg, GW_CHILD );
    153                 }
    154                 else
    155                 {
    156                     hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
    157                 }
    158             }
     139        if (!hwndNext)
     140        {
     141            hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
     142        }
     143        while (!hwndNext)
     144        {
     145        hwndControl = GetParent( hwndControl );
     146        if (hwndControl == hwndDlg)
     147        {
     148            if(hwnd==hwndDlg){  /* prevent endless loop */
     149                hwndNext=hwnd;
     150            break;
     151            }
     152            hwndNext = GetWindow( hwndDlg, GW_CHILD );
     153        }
     154        else
     155        {
     156            hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
     157        }
     158        }
    159159            hwndControl = hwndNext;
    160160        }
     
    184184    if ((message != WM_KEYDOWN) &&
    185185        (message != WM_SYSCHAR) &&
    186         (message != WM_CHAR))
     186        (message != WM_CHAR))
    187187        return FALSE;
    188188
  • trunk/src/user32/new/windowmsg.cpp

    r741 r835  
    1 /* $Id: windowmsg.cpp,v 1.9 1999-08-30 11:59:54 sandervl Exp $ */
     1/* $Id: windowmsg.cpp,v 1.10 1999-09-05 15:53:10 sandervl Exp $ */
    22/*
    33 * Win32 window message APIs for OS/2
     
    1919#include <hooks.h>
    2020#include "oslibwin.h"
     21#include "oslibmsg.h"
    2122
    2223//******************************************************************************
     
    6061//******************************************************************************
    6162//******************************************************************************
     63BOOL WIN32API PeekMessageA(LPMSG msg, HWND hwndOwner, UINT uMsgFilterMin,
     64                           UINT uMsgFilterMax, UINT fuRemoveMsg)
     65{
     66 BOOL fFoundMsg;
     67
     68    fFoundMsg = OSLibWinPeekMsg(msg, 0, uMsgFilterMin, uMsgFilterMax,
     69                                (fuRemoveMsg & PM_REMOVE) ? 1 : 0, FALSE);
     70    if(fFoundMsg) {
     71        if (msg->message == WM_QUIT && (fuRemoveMsg & (PM_REMOVE))) {
     72            //TODO: Post WM_QUERYENDSESSION message when WM_QUIT received and system is shutting down
     73        }
     74    }
     75    return fFoundMsg;
     76}
     77//******************************************************************************
     78//******************************************************************************
     79BOOL WIN32API PeekMessageW(LPMSG msg, HWND hwndOwner, UINT uMsgFilterMin,
     80                           UINT uMsgFilterMax, UINT fuRemoveMsg)
     81{
     82 BOOL fFoundMsg;
     83
     84    fFoundMsg = OSLibWinPeekMsg(msg, 0, uMsgFilterMin, uMsgFilterMax,
     85                                (fuRemoveMsg & PM_REMOVE) ? 1 : 0, FALSE);
     86    if(fFoundMsg) {
     87        if (msg->message == WM_QUIT && (fuRemoveMsg & (PM_REMOVE))) {
     88            //TODO: Post WM_QUERYENDSESSION message when WM_QUIT received and system is shutting down
     89        }
     90    }
     91    return fFoundMsg;
     92}
     93//******************************************************************************
     94//******************************************************************************
    6295LONG WIN32API GetMessageExtraInfo(void)
    6396{
     
    88121    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    89122    if(!window) {
    90     dprintf(("SendMessageA, window %x not found", hwnd));
    91     return 0;
     123        dprintf(("SendMessageA, window %x not found", hwnd));
     124        return 0;
    92125    }
    93126    return window->SendMessageA(msg, wParam, lParam);
     
    102135    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    103136    if(!window) {
    104     dprintf(("SendMessageW, window %x not found", hwnd));
    105     return 0;
     137        dprintf(("SendMessageW, window %x not found", hwnd));
     138        return 0;
    106139    }
    107140    return window->SendMessageW(msg, wParam, lParam);
     
    115148
    116149    if(hwnd == NULL)
    117     return PostThreadMessageA(GetCurrentThreadId(), msg, wParam, lParam);
     150        return PostThreadMessageA(GetCurrentThreadId(), msg, wParam, lParam);
    118151
    119152    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    120153    if(!window) {
    121     dprintf(("PostMessageA, window %x not found", hwnd));
    122     return 0;
     154        dprintf(("PostMessageA, window %x not found", hwnd));
     155        return 0;
    123156    }
    124157    dprintf(("PostMessageA, %x %x %x %x", hwnd, msg, wParam, lParam));
     
    133166
    134167    if(hwnd == NULL)
    135     return PostThreadMessageW(GetCurrentThreadId(), msg, wParam, lParam);
     168        return PostThreadMessageW(GetCurrentThreadId(), msg, wParam, lParam);
    136169
    137170    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    138171    if(!window) {
    139     dprintf(("PostMessageW, window %x not found", hwnd));
    140     return 0;
     172        dprintf(("PostMessageW, window %x not found", hwnd));
     173        return 0;
    141174    }
    142175    dprintf(("PostMessageW, %x %x %x %x", hwnd, msg, wParam, lParam));
     
    151184#endif
    152185    return O32_WaitMessage();
    153 }
    154 //******************************************************************************
    155 //******************************************************************************
    156 BOOL WIN32API PeekMessageA(LPMSG arg1, HWND arg2, UINT arg3, UINT arg4, UINT arg5)
    157 {
    158 #ifdef DEBUG
    159 //    WriteLog("USER32:  PeekMessage\n");
    160 #endif
    161     return O32_PeekMessage(arg1, arg2, arg3, arg4, arg5);
    162 }
    163 //******************************************************************************
    164 //******************************************************************************
    165 BOOL WIN32API PeekMessageW( LPMSG arg1, HWND arg2, UINT arg3, UINT arg4, UINT  arg5)
    166 {
    167 #ifdef DEBUG
    168     WriteLog("USER32:  PeekMessageW\n");
    169 #endif
    170     // NOTE: This will not work as is (needs UNICODE support)
    171     return O32_PeekMessage(arg1, arg2, arg3, arg4, arg5);
    172186}
    173187//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.