Ignore:
Timestamp:
Jul 4, 1999, 9:03:36 PM (26 years ago)
Author:
sandervl
Message:

Dialog changes + fixes

File:
1 edited

Legend:

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

    r217 r265  
    1 /* $Id: dialog.cpp,v 1.5 1999-06-26 13:46:21 sandervl Exp $ */
     1/* $Id: dialog.cpp,v 1.6 1999-07-04 19:02:38 sandervl Exp $ */
    22
    33/*
     
    2020//******************************************************************************
    2121//******************************************************************************
    22 HWND WIN32API CreateDialogParamA(HINSTANCE hinst, LPCSTR lpszTemplate, 
    23                                  HWND hwndOwner, DLGPROC dlgproc,
    24                                 LPARAM lParamInit)
     22HWND WIN32API CreateDialogParamA(HINSTANCE hinst, LPCSTR lpszTemplate,
     23                                 HWND hwndOwner, DLGPROC dlgproc,
     24                                LPARAM lParamInit)
    2525{
    2626 HWND rc;
     
    3131         WriteLog("OS2CreateDialogParamA %s\n", lpszTemplate);
    3232#endif
    33         lpszTemplate = (LPCSTR)ConvertNameId(hinst, (char *)lpszTemplate);
     33        lpszTemplate = (LPCSTR)ConvertNameId(hinst, (char *)lpszTemplate);
    3434    }
    3535#ifdef DEBUG
     
    3838
    3939    if(dlgproc) {
    40         dialog = new Win32WindowProc((WNDPROC)dlgproc);
    41         rc = O32_CreateDialogParam(hinst, lpszTemplate, hwndOwner, (DLGPROC_O32)dialog->GetOS2Callback(), lParamInit);
     40        dialog = new Win32WindowProc((WNDPROC)dlgproc);
     41        rc = O32_CreateDialogParam(hinst, lpszTemplate, hwndOwner, (DLGPROC_O32)dialog->GetOS2Callback(), lParamInit);
    4242    }
    4343    else rc = O32_CreateDialogParam(hinst, lpszTemplate, hwndOwner, (DLGPROC_O32)O32_DefDlgProc, lParamInit);
    44    
     44
    4545    if(rc == 0 && dialog) {
    46         delete(dialog);
     46        delete(dialog);
    4747    }
    4848
     
    5454//******************************************************************************
    5555//******************************************************************************
    56 HWND WIN32API CreateDialogParamW(HINSTANCE hinst, LPCWSTR lpszTemplate, 
    57                                  HWND hwndOwner, DLGPROC dlgproc,
    58                                 LPARAM lParamInit)
     56HWND WIN32API CreateDialogParamW(HINSTANCE hinst, LPCWSTR lpszTemplate,
     57                                 HWND hwndOwner, DLGPROC dlgproc,
     58                                LPARAM lParamInit)
    5959{
    6060 HWND rc;
    6161
    6262    if((int)lpszTemplate >> 16 != 0) {//convert string name identifier to numeric id
    63         char *astring = UnicodeToAsciiString((LPWSTR)lpszTemplate);
     63        char *astring = UnicodeToAsciiString((LPWSTR)lpszTemplate);
    6464#ifdef DEBUG
    6565         WriteLog("OS2CreateDialogParamW %s\n", astring);
    6666#endif
    67         lpszTemplate = (LPWSTR)ConvertNameId(hinst, astring);
    68         FreeAsciiString(astring);
     67        lpszTemplate = (LPWSTR)ConvertNameId(hinst, astring);
     68        FreeAsciiString(astring);
    6969    }
    7070#ifdef DEBUG
     
    7373
    7474    Win32WindowProc *dialog = new Win32WindowProc((WNDPROC)dlgproc);
    75    
     75
    7676    rc = O32_CreateDialogParam(hinst, (LPCSTR)lpszTemplate, hwndOwner, (DLGPROC_O32)dialog->GetOS2Callback(), lParamInit);
    7777    if(rc == 0) {
    78         delete(dialog);
     78        delete(dialog);
    7979    }
    8080
     
    8686//******************************************************************************
    8787//******************************************************************************
    88 HWND WIN32API CreateDialogIndirectParamA(HINSTANCE hinst, 
    89                                          DLGTEMPLATE *dlgtemplate,
    90                                          HWND hwndParent, DLGPROC dlgproc,
    91                                          LPARAM lParamInit)
    92 {
    93  HWND         hwnd;
     88HWND WIN32API CreateDialogIndirectParamA(HINSTANCE hinst,
     89                                         DLGTEMPLATE *dlgtemplate,
     90                                         HWND hwndParent, DLGPROC dlgproc,
     91                                         LPARAM lParamInit)
     92{
     93 HWND         hwnd;
    9494 DLGTEMPLATE *os2dlg;
    9595
     
    9999    hwnd = O32_CreateDialogIndirectParam(hinst, os2dlg, hwndParent, (DLGPROC_O32)dialog->GetOS2Callback(), lParamInit);
    100100    if(hwnd == 0) {
    101         delete(dialog);
     101        delete(dialog);
    102102    }
    103103#ifdef DEBUG
     
    108108//******************************************************************************
    109109//******************************************************************************
    110 HWND WIN32API CreateDialogIndirectParamW(HINSTANCE hinst, 
    111                                          DLGTEMPLATE *dlgtemplate,
    112                                          HWND hwndParent, DLGPROC dlgproc,
    113                                          LPARAM lParamInit)
    114 {
    115  HWND         hwnd;
     110HWND WIN32API CreateDialogIndirectParamW(HINSTANCE hinst,
     111                                         DLGTEMPLATE *dlgtemplate,
     112                                         HWND hwndParent, DLGPROC dlgproc,
     113                                         LPARAM lParamInit)
     114{
     115 HWND         hwnd;
    116116 DLGTEMPLATE *os2dlg;
    117117
     
    121121    hwnd = O32_CreateDialogIndirectParam(hinst, os2dlg, hwndParent, (DLGPROC_O32)dialog->GetOS2Callback(), lParamInit);
    122122    if(hwnd == 0) {
    123         delete(dialog);
     123        delete(dialog);
    124124    }
    125125    dprintf(("CreateDialogIndirectParamW returned %X\n", hwnd));
     
    128128//******************************************************************************
    129129//******************************************************************************
    130 BOOL WIN32API DialogBoxIndirectParamA(HINSTANCE hinst, 
    131                                       DLGTEMPLATE *dlgtemplate,
    132                                       HWND hwndParent, DLGPROC dlgproc,
    133                                       LPARAM lParamInit)
     130BOOL WIN32API DialogBoxIndirectParamA(HINSTANCE hinst,
     131                                      DLGTEMPLATE *dlgtemplate,
     132                                      HWND hwndParent, DLGPROC dlgproc,
     133                                      LPARAM lParamInit)
    134134{
    135135 BOOL rc;
     
    137137
    138138    os2dlg = ConvertWin32DlgTemplate(dlgtemplate);
     139
    139140    Win32WindowProc *dialog = new Win32WindowProc((WNDPROC)dlgproc, os2dlg);
    140141
     
    146147//******************************************************************************
    147148//******************************************************************************
    148 BOOL WIN32API DialogBoxIndirectParamW(HINSTANCE hinst, 
    149                                       DLGTEMPLATE *dlgtemplate,
    150                                       HWND hwndParent, DLGPROC dlgproc,
    151                                       LPARAM lParamInit)
     149BOOL WIN32API DialogBoxIndirectParamW(HINSTANCE hinst,
     150                                      DLGTEMPLATE *dlgtemplate,
     151                                      HWND hwndParent, DLGPROC dlgproc,
     152                                      LPARAM lParamInit)
    152153{
    153154 BOOL rc;
     
    165166//******************************************************************************
    166167int WIN32API DialogBoxParamA(HINSTANCE hinst, LPCSTR lpszTemplate, HWND hwndOwner,
    167                              DLGPROC dlgprc, LPARAM  lParamInit)
     168                             DLGPROC dlgprc, LPARAM  lParamInit)
    168169{
    169170 int rc;
    170171
    171172    if((int)lpszTemplate >> 16 != 0) {//convert string name identifier to numeric id
    172         dprintf(("DialogBoxParam %s\n", lpszTemplate));
    173         lpszTemplate = (LPCSTR)ConvertNameId(hinst, (char *)lpszTemplate);
    174     }
    175     else {     
    176         dprintf(("DialogBoxParam %d\n", (int)lpszTemplate));
     173        dprintf(("DialogBoxParam %s\n", lpszTemplate));
     174        lpszTemplate = (LPCSTR)ConvertNameId(hinst, (char *)lpszTemplate);
     175    }
     176    else {
     177        dprintf(("DialogBoxParam %d\n", (int)lpszTemplate));
    177178    }
    178179
     
    185186//******************************************************************************
    186187//******************************************************************************
    187 int WIN32API DialogBoxParamW(HINSTANCE arg1, LPCWSTR arg2, HWND arg3, 
    188                              DLGPROC arg4, LPARAM arg5)
     188int WIN32API DialogBoxParamW(HINSTANCE arg1, LPCWSTR arg2, HWND arg3,
     189                             DLGPROC arg4, LPARAM arg5)
    189190{
    190191 int   rc;
     
    193194
    194195    if((int)arg2 >> 16 != 0) {
    195             astring = UnicodeToAsciiString((LPWSTR)arg2);
     196            astring = UnicodeToAsciiString((LPWSTR)arg2);
    196197    }
    197198    else    astring = (char *)arg2;
     
    200201    Win32WindowProc *dialog = new Win32WindowProc((WNDPROC)arg4);
    201202    rc = DialogBoxParamA(arg1, astring, arg3, arg4, arg5);
    202  
    203     if((int)astring >> 16 != 0) FreeAsciiString(astring);
     203
     204    if((int)astring >> 16 != 0) FreeAsciiString(astring);
    204205
    205206    dprintf(("OS2DialogBoxIndirectParamA returned %d\n", rc));
     
    208209}
    209210//******************************************************************************
    210 //******************************************************************************
    211 
     211// CB: Loads and starts a native OS/2 dialog with Win32 DlgProc
     212//     (used in COMCTL32)
     213// full name: NativeDialogBoxIndirectParam
     214//******************************************************************************
     215INT WINAPI NativeDlgBoxIP(HMODULE hmodule,
     216                          HINSTANCE hinst, LPCSTR lpszName,
     217                          HWND hwndParent, DLGPROC dlgproc,
     218                          LPARAM lParamInit)
     219{
     220  BOOL rc;
     221  DLGTEMPLATE *os2dlg;
     222  HRSRC hRes;
     223
     224  dprintf(("NativeDlgBoxIP"));
     225
     226  hRes = O32_FindResource(hmodule,lpszName,RT_DIALOGA);
     227  if (hRes == 0) return (INT)-1;
     228
     229  dprintf((" hRes = %d",hRes));
     230
     231  os2dlg = (DLGTEMPLATE*)O32_LoadResource(hmodule,hRes);
     232  if (os2dlg == NULL) return (INT)-1;
     233
     234  dprintf((" os2dlg = %d",os2dlg));
     235
     236  Win32WindowProc *dialog = new Win32WindowProc((WNDPROC)dlgproc,os2dlg);
     237  rc = O32_DialogBoxIndirectParam(hinst,os2dlg,hwndParent,(DLGPROC_O32)dialog->GetOS2Callback(),lParamInit);
     238  //dialog already destroyed when this returns
     239  dprintf(("NativeDlgBoxIP returned %X\n", rc));
     240
     241  return rc;
     242}
     243//******************************************************************************
     244//******************************************************************************
     245//******************************************************************************
     246// CB: Loads and starts a native OS/2 dialog with Win32 DlgProc
     247//     (used in COMCTL32)
     248// full name: NativeCreateDialogIndirectParam
     249//******************************************************************************
     250INT WINAPI NativeCreateDlgIP(HMODULE hmodule,
     251                                HINSTANCE hinst, LPCSTR lpszName,
     252                                HWND hwndParent, DLGPROC dlgproc,
     253                                LPARAM lParamInit)
     254{
     255  BOOL rc;
     256  DLGTEMPLATE *os2dlg;
     257  HRSRC hRes;
     258
     259  dprintf(("NativeCreateDlgBoxIP"));
     260
     261  hRes = O32_FindResource(hmodule,lpszName,RT_DIALOGA);
     262  if (hRes == 0) return (INT)-1;
     263
     264  dprintf((" hRes = %d",hRes));
     265
     266  os2dlg = (DLGTEMPLATE*)O32_LoadResource(hmodule,hRes);
     267  if (os2dlg == NULL) return (INT)-1;
     268
     269  dprintf((" os2dlg = %d",os2dlg));
     270
     271  Win32WindowProc *dialog = new Win32WindowProc((WNDPROC)dlgproc,os2dlg);
     272  rc = O32_CreateDialogIndirectParam(hinst,os2dlg,hwndParent,(DLGPROC_O32)dialog->GetOS2Callback(),lParamInit);
     273  //dialog already destroyed when this returns
     274  dprintf(("NativeDlgBoxIP returned %X\n", rc));
     275
     276  return rc;
     277}
     278//******************************************************************************
     279//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.