Changeset 821 for trunk/src/user32/new/dialog.cpp
- Timestamp:
- Sep 4, 1999, 9:42:30 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/dialog.cpp
r780 r821 1 /* $Id: dialog.cpp,v 1. 7 1999-09-01 19:12:20 phallerExp $ */1 /* $Id: dialog.cpp,v 1.8 1999-09-04 19:42:27 sandervl Exp $ */ 2 2 3 3 /* 4 4 * Win32 dialog API functions for OS/2 5 5 * 6 * Copyright 199 8 Sander van Leeuwen6 * Copyright 1999 Sander van Leeuwen (Wine port & OS/2 adaption) 7 7 * 8 * 9 * Based on Wine code (990815; windows\dialog.c) 10 * 11 * Copyright 1993, 1994, 1996 Alexandre Julliard 8 12 * 9 13 * Project Odin Software License can be found in LICENSE.TXT … … 11 15 */ 12 16 #include <os2win.h> 13 #include <nameid.h> 14 #include "user32.h" 15 #include "wndproc.h" 16 #include "wndclass.h" 17 #include "win32wbase.h" 18 #include "win32dlg.h" 17 19 18 20 //****************************************************************************** 19 21 //****************************************************************************** 20 HWND WIN32API CreateDialogParamA(HINSTANCE h inst, LPCSTR lpszTemplate,21 22 22 HWND WIN32API CreateDialogParamA(HINSTANCE hInst, LPCSTR lpszTemplate, 23 HWND hwndOwner, DLGPROC dlgproc, 24 LPARAM lParamInit) 23 25 { 24 HWND rc;26 HANDLE hrsrc = FindResourceA( hInst, lpszTemplate, RT_DIALOGA ); 25 27 26 if((int)lpszTemplate >> 16 != 0) {//convert string name identifier to numeric id 27 #ifdef DEBUG 28 WriteLog("OS2CreateDialogParamA %s\n", lpszTemplate); 29 #endif 30 lpszTemplate = (LPCSTR)ConvertNameId(hinst, (char *)lpszTemplate); 31 } 32 #ifdef DEBUG 33 else WriteLog("OS2CreateDialogParamA %d\n", (int)lpszTemplate); 34 #endif 28 if (!hrsrc) 29 return 0; 35 30 36 return(rc); 31 return CreateDialogIndirectParamA(hInst, (DLGTEMPLATE*)LoadResource(hInst, hrsrc), 32 hwndOwner, dlgproc, lParamInit); 37 33 } 38 34 //****************************************************************************** 39 35 //****************************************************************************** 40 HWND WIN32API CreateDialogParamW(HINSTANCE h inst, LPCWSTR lpszTemplate,41 42 36 HWND WIN32API CreateDialogParamW(HINSTANCE hInst, LPCWSTR lpszTemplate, 37 HWND hwndOwner, DLGPROC dlgproc, 38 LPARAM lParamInit) 43 39 { 44 HWND rc;40 HANDLE hrsrc = FindResourceW( hInst, lpszTemplate, RT_DIALOGW ); 45 41 46 if((int)lpszTemplate >> 16 != 0) {//convert string name identifier to numeric id 47 char *astring = UnicodeToAsciiString((LPWSTR)lpszTemplate); 48 #ifdef DEBUG 49 WriteLog("OS2CreateDialogParamW %s\n", astring); 50 #endif 51 lpszTemplate = (LPWSTR)ConvertNameId(hinst, astring); 52 FreeAsciiString(astring); 53 } 54 #ifdef DEBUG 55 else WriteLog("OS2CreateDialogParamW %d\n", (int)lpszTemplate); 56 #endif 42 if (!hrsrc) 43 return 0; 57 44 58 return(rc); 45 return CreateDialogIndirectParamW(hInst, (DLGTEMPLATE*)LoadResource(hInst, hrsrc), 46 hwndOwner, dlgproc, lParamInit); 59 47 } 60 48 //****************************************************************************** 61 49 //****************************************************************************** 62 HWND WIN32API CreateDialogIndirectParamA(HINSTANCE h inst,63 64 65 50 HWND WIN32API CreateDialogIndirectParamA(HINSTANCE hInst, 51 DLGTEMPLATE *dlgtemplate, 52 HWND hwndParent, DLGPROC dlgproc, 53 LPARAM lParamInit) 66 54 { 67 HWND hwnd;55 Win32Dialog *dialog; 68 56 69 return(0); 57 dprintf(("CreateDialogIndirectParamA: %x %x %x %x %x", hInst, dlgtemplate, hwndParent, dlgproc, lParamInit)); 58 59 if (!dlgtemplate) return 0; 60 61 dialog = new Win32Dialog(hInst, (LPCSTR)dlgtemplate, hwndParent, dlgproc, lParamInit, FALSE); 62 63 if(dialog == NULL) 64 { 65 dprintf(("Win32Dialog creation failed!!")); 66 return 0; 67 } 68 if(GetLastError() != 0) 69 { 70 dprintf(("Win32Dialog error found!!")); 71 delete dialog; 72 return 0; 73 } 74 return dialog->getWindowHandle(); 70 75 } 71 76 //****************************************************************************** 72 77 //****************************************************************************** 73 HWND WIN32API CreateDialogIndirectParamW(HINSTANCE h inst,74 75 76 78 HWND WIN32API CreateDialogIndirectParamW(HINSTANCE hInst, 79 DLGTEMPLATE *dlgtemplate, 80 HWND hwndParent, DLGPROC dlgproc, 81 LPARAM lParamInit) 77 82 { 78 HWND hwnd;83 Win32Dialog *dialog; 79 84 80 return(0); 85 dprintf(("CreateDialogIndirectParamW: %x %x %x %x %x", hInst, dlgtemplate, hwndParent, dlgproc, lParamInit)); 86 87 if (!dlgtemplate) return 0; 88 89 dialog = new Win32Dialog(hInst, (LPCSTR)dlgtemplate, hwndParent, dlgproc, lParamInit, TRUE); 90 91 if(dialog == NULL) 92 { 93 dprintf(("Win32Dialog creation failed!!")); 94 return 0; 95 } 96 if(GetLastError() != 0) 97 { 98 dprintf(("Win32Dialog error found!!")); 99 delete dialog; 100 return 0; 101 } 102 return dialog->getWindowHandle(); 81 103 } 82 104 //****************************************************************************** 83 105 //****************************************************************************** 84 INT WIN32API DialogBoxIndirectParamA(HINSTANCE h inst,85 86 87 106 INT WIN32API DialogBoxIndirectParamA(HINSTANCE hInst, 107 DLGTEMPLATE *dlgtemplate, 108 HWND hwndParent, DLGPROC dlgproc, 109 LPARAM lParamInit) 88 110 { 89 return(0); 111 HWND hwnd = CreateDialogIndirectParamA(hInst, dlgtemplate, hwndParent, dlgproc, 112 lParamInit); 113 //TODO: 114 if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner ); 115 return -1; 90 116 } 91 117 //****************************************************************************** 92 118 //****************************************************************************** 93 INT WIN32API DialogBoxIndirectParamW(HINSTANCE hinst, 94 DLGTEMPLATE *dlgtemplate, 95 HWND hwndParent, DLGPROC dlgproc, 96 LPARAM lParamInit) 119 INT WIN32API DialogBoxIndirectParamW(HINSTANCE hInst, DLGTEMPLATE *dlgtemplate, 120 HWND hwndParent, DLGPROC dlgproc, 121 LPARAM lParamInit) 97 122 { 98 return(0); 123 HWND hwnd = CreateDialogIndirectParamW(hInst, dlgtemplate, hwndParent, dlgproc, 124 lParamInit); 125 //TODO: 126 if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner ); 127 return -1; 99 128 } 100 129 //****************************************************************************** 101 130 //****************************************************************************** 102 int WIN32API DialogBoxParamA(HINSTANCE h inst, LPCSTR lpszTemplate, HWND hwndOwner,103 DLGPROC dlgprc, LPARAM lParamInit)131 int WIN32API DialogBoxParamA(HINSTANCE hInst, LPCSTR lpszTemplate, HWND hwndOwner, 132 DLGPROC dlgproc, LPARAM lParamInit) 104 133 { 105 int rc; 106 107 if((int)lpszTemplate >> 16 != 0) {//convert string name identifier to numeric id 108 dprintf(("DialogBoxParam %s\n", lpszTemplate)); 109 lpszTemplate = (LPCSTR)ConvertNameId(hinst, (char *)lpszTemplate); 110 } 111 else { 112 dprintf(("DialogBoxParam %d\n", (int)lpszTemplate)); 113 } 114 115 return(0); 134 HWND hwnd = CreateDialogParamA( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit); 135 //TODO: 136 if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner ); 137 return -1; 116 138 } 117 139 //****************************************************************************** 118 140 //****************************************************************************** 119 int WIN32API DialogBoxParamW(HINSTANCE arg1, LPCWSTR arg2, HWND arg3,120 DLGPROC arg4, LPARAM arg5)141 int WIN32API DialogBoxParamW(HINSTANCE hInst, LPCWSTR lpszTemplate, HWND hwndOwner, 142 DLGPROC dlgproc, LPARAM lParamInit) 121 143 { 122 int rc; 123 char *astring = NULL; 124 125 126 if((int)arg2 >> 16 != 0) { 127 astring = UnicodeToAsciiString((LPWSTR)arg2); 128 } 129 else astring = (char *)arg2; 130 dprintf(("OS2DialogBoxParamW\n")); 131 132 if((int)astring >> 16 != 0) FreeAsciiString(astring); 133 134 dprintf(("OS2DialogBoxIndirectParamA returned %d\n", rc)); 135 136 return(0); 144 HWND hwnd = CreateDialogParamW( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit); 145 //TODO: 146 if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner ); 147 return -1; 137 148 } 138 149 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.