- Timestamp:
- Sep 5, 1999, 2:03:34 PM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/defwndproc.cpp
r821 r833 1 /* $Id: defwndproc.cpp,v 1. 8 1999-09-04 19:42:27sandervl Exp $ */1 /* $Id: defwndproc.cpp,v 1.9 1999-09-05 12:03:32 sandervl Exp $ */ 2 2 3 3 /* … … 56 56 57 57 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); 58 if(!dialog || dialog->IsWindow()) {58 if(!dialog || !dialog->IsDialog()) { 59 59 dprintf(("DefDlgProcA, window %x not found", hwnd)); 60 60 return 0; … … 69 69 70 70 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); 71 if(!dialog || dialog->IsWindow()) {71 if(!dialog || !dialog->IsDialog()) { 72 72 dprintf(("DefDlgProcW, window %x not found", hwnd)); 73 73 return 0; -
trunk/src/user32/new/makefile
r822 r833 1 # $Id: makefile,v 1.4 3 1999-09-04 19:51:46sandervl Exp $1 # $Id: makefile,v 1.44 1999-09-05 12:03:32 sandervl Exp $ 2 2 3 3 # … … 21 21 TARGET = user32 22 22 23 OBJS = user32.obj dialog.objloadres.obj \23 OBJS = user32.obj loadres.obj \ 24 24 dde.obj heapshared.obj win32wndhandle.obj \ 25 25 icon.obj hook.obj hooks.obj winmenu.obj \ … … 64 64 syscolor.obj: syscolor.cpp syscolor.h 65 65 usrcall.obj: usrcall.cpp usrcall.h 66 dialog.obj: dialog.cpp67 66 dde.obj: dde.cpp 68 67 hook.obj: hook.cpp hooks.h -
trunk/src/user32/new/win32dlg.cpp
r821 r833 1 /* $Id: win32dlg.cpp,v 1. 3 1999-09-04 19:42:28sandervl Exp $ */1 /* $Id: win32dlg.cpp,v 1.4 1999-09-05 12:03:33 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 … … 32 32 hUserFont = 0; 33 33 hMenu = 0; 34 34 hwndFocus = 0; 35 35 Win32DlgProc = 0; 36 36 msgResult = 0; … … 40 40 memset(&dlgInfo, 0, sizeof(dlgInfo)); 41 41 42 dprintf(("********* CREATE DIALOG ************")); 42 43 if(fInitialized == FALSE) { 43 44 if(DIALOG_Init() == FALSE) { … … 127 128 128 129 /* Find the class atom */ 129 if ( HIWORD(dlgInfo.className))130 if (!HIWORD(dlgInfo.className)) 130 131 { 131 132 classAtom = (ATOM)LOWORD(dlgInfo.className); 132 133 } 133 134 else 134 if(!(classAtom = GlobalFindAtom A(dlgInfo.className)))135 if(!(classAtom = GlobalFindAtomW((LPWSTR)dlgInfo.className))) 135 136 { 136 137 SetLastError(ERROR_INVALID_PARAMETER); … … 147 148 cs.cy = rect.bottom; 148 149 cs.style = dlgInfo.style & ~WS_VISIBLE; 149 cs.lpszName = dlgInfo.caption; 150 cs.lpszClass = dlgInfo.className; 150 if(!isUnicode) { 151 if(dlgInfo.caption) { 152 cs.lpszName = UnicodeToAsciiString((LPWSTR)dlgInfo.caption); 153 } 154 else cs.lpszName = 0; 155 if(HIWORD(cs.lpszClass)) { 156 cs.lpszClass = UnicodeToAsciiString((LPWSTR)dlgInfo.className); 157 } 158 else cs.lpszClass = dlgInfo.className; 159 } 160 else { 161 cs.lpszName = dlgInfo.caption; 162 cs.lpszClass = dlgInfo.className; 163 } 151 164 cs.dwExStyle = dlgInfo.exStyle; 152 165 166 fIsDialog = TRUE; 153 167 CreateWindowExA(&cs, classAtom); 168 169 if(!isUnicode) { 170 if(cs.lpszName) FreeAsciiString((LPSTR)cs.lpszName); 171 if(HIWORD(cs.lpszClass)) { 172 FreeAsciiString((LPSTR)cs.lpszClass); 173 } 174 } 154 175 155 176 if (!getWindowHandle()) … … 159 180 return; 160 181 } 161 fIsDialog = TRUE;162 182 163 183 //TODO: … … 182 202 ::UpdateWindow( getWindowHandle() ); 183 203 } 204 dprintf(("********* DIALOG CREATED ************")); 184 205 return; 185 206 } … … 335 356 { 336 357 case 0x0000: 337 result->className = (LPCSTR)DIALOG_CLASS_ ATOM;358 result->className = (LPCSTR)DIALOG_CLASS_NAMEW; 338 359 p++; 339 360 break; … … 442 463 if (GET_WORD(p) == 0xffff) /* Is it an integer id? */ 443 464 { 444 445 465 info->windowName = (LPCSTR)(UINT)GET_WORD(p + 1); 466 p += 2; 446 467 } 447 468 else 448 469 { 449 470 info->windowName = (LPCSTR)p; 450 471 p += lstrlenW( (LPCWSTR)p ) + 1; 451 472 } … … 528 549 if ((rc == SIMPLEREGION) || (rc == COMPLEXREGION)) 529 550 FillRect( (HDC)wParam, &rect, windowClass->getBackgroundBrush()); 530 531 } 532 533 534 #if 0 535 536 537 538 539 540 551 return 1; 552 } 553 case WM_NCDESTROY: 554 /* Free dialog heap (if created) */ 555 #if 0 556 if (dlgInfo->hDialogHeap) 557 { 558 GlobalUnlock16(dlgInfo->hDialogHeap); 559 GlobalFree16(dlgInfo->hDialogHeap); 560 dlgInfo->hDialogHeap = 0; 561 } 541 562 #endif 542 543 544 545 546 547 548 549 550 551 { 552 553 554 563 /* Delete font */ 564 if (hUserFont) 565 { 566 DeleteObject( hUserFont ); 567 hUserFont = 0; 568 } 569 570 /* Delete menu */ 571 if (hMenu) 572 { 573 DestroyMenu( hMenu ); 574 hMenu = 0; 575 } 555 576 556 577 /* Delete window procedure */ … … 558 579 dialogFlags |= DF_END; /* just in case */ 559 580 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 581 /* Window clean-up */ 582 return DefWindowProcA(msg, wParam, lParam ); 583 584 case WM_SHOWWINDOW: 585 if (!wParam) saveFocus(); 586 return DefWindowProcA(msg, wParam, lParam ); 587 588 case WM_ACTIVATE: 589 if (wParam) { 590 restoreFocus(); 591 } 592 else saveFocus(); 593 return 0; 594 595 case WM_SETFOCUS: 596 restoreFocus(); 597 return 0; 577 598 578 599 case DM_SETDEFID: … … 592 613 return MAKELONG( GetDlgCtrlID( hwndDefId ), DC_HASDEFID); 593 614 594 595 } 596 597 598 615 return 0; 616 } 617 618 case WM_NEXTDLGCTL: 619 { 599 620 HWND hwndDest = (HWND)wParam; 600 621 if (!lParam) … … 627 648 #endif 628 649 } 629 630 } 631 632 650 return DefWindowProcA( msg, wParam, lParam ); 651 } 652 653 case WM_GETFONT: 633 654 return hUserFont; 634 655 … … 638 659 639 660 case WM_NOTIFYFORMAT: 640 661 return DefWindowProcA(msg, wParam, lParam ); 641 662 } 642 663 return 0; … … 737 758 /* see SDK 3.1 */ 738 759 if ((msg >= WM_CTLCOLORMSGBOX && msg <= WM_CTLCOLORSTATIC) || 739 760 msg == WM_CTLCOLOR || msg == WM_COMPAREITEM || 740 761 msg == WM_VKEYTOITEM || msg == WM_CHARTOITEM || 741 762 msg == WM_QUERYDRAGICON || msg == WM_INITDIALOG) … … 844 865 //****************************************************************************** 845 866 //****************************************************************************** 867 HWND Win32Dialog::getNextDlgTabItem(HWND hwndCtrl, BOOL fPrevious) 868 { 869 return 0; 870 } 871 //****************************************************************************** 872 //****************************************************************************** 873 Win32BaseWindow *Win32Dialog::getDlgItem(int id) 874 { 875 return 0; 876 } 877 //****************************************************************************** 878 //****************************************************************************** 879 BOOL Win32Dialog::endDialog(int retval) 880 { 881 return TRUE; 882 } 883 //****************************************************************************** 884 //****************************************************************************** 846 885 ULONG Win32Dialog::MsgOS2Create(HWND hwndOS2, ULONG initParam) 847 886 { 848 OS2Hwnd = hwndOS2;849 return win32wndproc(Win32Hwnd, WM_CREATE, 0, initParam);887 OS2Hwnd = hwndOS2; 888 return win32wndproc(Win32Hwnd, WM_CREATE, 0, initParam); 850 889 } 851 890 //****************************************************************************** … … 853 892 LONG Win32Dialog::SetWindowLongA(int index, ULONG value) 854 893 { 855 LONG oldval;856 857 switch(index)858 {894 LONG oldval; 895 896 switch(index) 897 { 859 898 case DWL_DLGPROC: 860 899 oldval = (LONG)Win32DlgProc; … … 871 910 default: 872 911 return Win32BaseWindow::SetWindowLongA(index, value); 873 }912 } 874 913 } 875 914 //****************************************************************************** … … 877 916 ULONG Win32Dialog::GetWindowLongA(int index) 878 917 { 879 switch(index)880 {918 switch(index) 919 { 881 920 case DWL_DLGPROC: 882 921 return (ULONG)Win32DlgProc; … … 887 926 default: 888 927 return Win32BaseWindow::GetWindowLongA(index); 889 }928 } 890 929 } 891 930 //****************************************************************************** … … 894 933 { 895 934 WNDCLASSA wndClass; 896 897 if (GlobalFindAtomA(DIALOG_CLASS_NAME)) return FALSE;898 935 899 936 ZeroMemory(&wndClass,sizeof(WNDCLASSA)); … … 904 941 wndClass.hCursor = (HCURSOR)IDC_ARROWA; 905 942 wndClass.hbrBackground = LTGRAY_BRUSH; 906 wndClass.lpszClassName = DIALOG_CLASS_NAME ;943 wndClass.lpszClassName = DIALOG_CLASS_NAMEA; 907 944 908 945 return RegisterClassA(&wndClass); … … 912 949 BOOL DIALOG_Unregister() 913 950 { 914 if (GlobalFindAtomA(DIALOG_CLASS_NAME ))915 return UnregisterClassA(DIALOG_CLASS_NAME ,(HINSTANCE)NULL);951 if (GlobalFindAtomA(DIALOG_CLASS_NAMEA)) 952 return UnregisterClassA(DIALOG_CLASS_NAMEA,(HINSTANCE)NULL); 916 953 else return FALSE; 917 954 } -
trunk/src/user32/new/win32dlg.h
r821 r833 1 /* $Id: win32dlg.h,v 1. 4 1999-09-04 19:42:29sandervl Exp $ */1 /* $Id: win32dlg.h,v 1.5 1999-09-05 12:03:33 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 … … 67 67 LRESULT DefDlgProcW(UINT Msg, WPARAM wParam, LPARAM lParam); 68 68 69 LRESULT DefDlg_Epilog(UINT msg, BOOL fResult); 69 Win32BaseWindow *getDlgItem(int id); 70 71 HWND getNextDlgTabItem(HWND hwndCtrl, BOOL fPrevious); 72 BOOL endDialog(int retval); 70 73 71 74 virtual ULONG MsgOS2Create(HWND hwndOS2, ULONG initParam); … … 73 76 virtual LONG SetWindowLongA(int index, ULONG value); 74 77 virtual ULONG GetWindowLongA(int index); 78 79 static ULONG GetDialogBaseUnits() { return MAKELONG(xBaseUnit, yBaseUnit); }; 75 80 76 81 protected: … … 83 88 84 89 LRESULT DefDlg_Proc(UINT msg, WPARAM wParam, LPARAM lParam); 90 LRESULT DefDlg_Epilog(UINT msg, BOOL fResult); 91 85 92 BOOL setDefButton(HWND hwndNew ); 86 93 HWND findDefButton(); … … 110 117 111 118 /* Built-in class names (see _Undocumented_Windows_ p.418) */ 112 #define DIALOG_CLASS_NAME "#32770" /* Dialog */ 113 #define DIALOG_CLASS_ATOM 32770 /* Dialog */ 119 #define DIALOG_CLASS_NAMEA "#32770" /* Dialog */ 120 #define DIALOG_CLASS_NAMEW L"#32770" /* Dialog */ 121 #define DIALOG_CLASS_ATOM 32770 /* Dialog */ 114 122 115 123 BOOL DIALOG_Register(); -
trunk/src/user32/new/win32wbase.cpp
r822 r833 1 /* $Id: win32wbase.cpp,v 1. 8 1999-09-04 19:51:46sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.9 1999-09-05 12:03:33 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 385 385 386 386 if(cs->lpszName) 387 SetWindowText ((LPSTR)cs->lpszName);387 SetWindowTextA((LPSTR)cs->lpszName); 388 388 389 389 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP, … … 1159 1159 return 1; 1160 1160 } 1161 case WM_GETDLGCODE: 1162 return 0; 1161 1163 1162 1164 case WM_NCLBUTTONDOWN: … … 1911 1913 //****************************************************************************** 1912 1914 //****************************************************************************** 1913 int Win32BaseWindow::GetWindowText(LPSTR lpsz, int cch) 1914 { 1915 if(isUnicode == FALSE) { 1916 strncpy(lpsz, windowNameA, cch); 1917 } 1918 else { 1919 lstrcpynW((LPWSTR)lpsz, windowNameW, cch); 1920 } 1915 int Win32BaseWindow::GetWindowTextA(LPSTR lpsz, int cch) 1916 { 1917 strncpy(lpsz, windowNameA, cch); 1921 1918 return wndNameLength; 1922 1919 } 1923 1920 //****************************************************************************** 1924 1921 //****************************************************************************** 1925 BOOL Win32BaseWindow::SetWindowText(LPSTR lpsz) 1922 int Win32BaseWindow::GetWindowTextW(LPWSTR lpsz, int cch) 1923 { 1924 lstrcpynW((LPWSTR)lpsz, windowNameW, cch); 1925 return wndNameLength; 1926 } 1927 //****************************************************************************** 1928 //****************************************************************************** 1929 BOOL Win32BaseWindow::SetWindowTextA(LPSTR lpsz) 1926 1930 { 1927 1931 if(lpsz == NULL) 1928 return FALSE; 1929 1930 if(isUnicode == FALSE) { 1931 windowNameA = (LPSTR)_smalloc(strlen(lpsz)+1); 1932 strcpy(windowNameA, lpsz); 1933 windowNameW = (LPWSTR)_smalloc((strlen(lpsz)+1)*sizeof(WCHAR)); 1934 lstrcpyAtoW(windowNameW, windowNameA); 1935 } 1936 else { 1937 windowNameW = (LPWSTR)_smalloc((lstrlenW((LPWSTR)lpsz)+1)*sizeof(WCHAR)); 1938 lstrcpyW(windowNameW, (LPWSTR)lpsz); 1939 windowNameA = (LPSTR)_smalloc(lstrlenW((LPWSTR)lpsz)+1); 1940 lstrcpyWtoA(windowNameA, windowNameW); 1941 } 1932 return FALSE; 1933 1934 windowNameA = (LPSTR)_smalloc(strlen(lpsz)+1); 1935 strcpy(windowNameA, lpsz); 1936 windowNameW = (LPWSTR)_smalloc((strlen(lpsz)+1)*sizeof(WCHAR)); 1937 lstrcpyAtoW(windowNameW, windowNameA); 1938 wndNameLength = strlen(windowNameA)+1; //including 0 terminator 1939 1940 if(OS2HwndFrame) 1941 return OSLibWinSetWindowText(OS2HwndFrame, (LPSTR)windowNameA); 1942 1943 return TRUE; 1944 } 1945 //****************************************************************************** 1946 //****************************************************************************** 1947 BOOL Win32BaseWindow::SetWindowTextW(LPWSTR lpsz) 1948 { 1949 if(lpsz == NULL) 1950 return FALSE; 1951 1952 windowNameW = (LPWSTR)_smalloc((lstrlenW((LPWSTR)lpsz)+1)*sizeof(WCHAR)); 1953 lstrcpyW(windowNameW, (LPWSTR)lpsz); 1954 windowNameA = (LPSTR)_smalloc(lstrlenW((LPWSTR)lpsz)+1); 1955 lstrcpyWtoA(windowNameA, windowNameW); 1942 1956 wndNameLength = strlen(windowNameA)+1; //including 0 terminator 1943 1957 -
trunk/src/user32/new/win32wbase.h
r822 r833 1 /* $Id: win32wbase.h,v 1. 6 1999-09-04 19:51:47sandervl Exp $ */1 /* $Id: win32wbase.h,v 1.7 1999-09-05 12:03:33 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 150 150 //Window handle has already been verified, so just return true 151 151 BOOL IsWindow() { return TRUE; }; 152 BOOL IsDialog() { return fIsDialog; }; 153 152 154 BOOL IsWindowEnabled(); 153 155 BOOL IsWindowVisible(); 154 156 BOOL IsUnicode() { return isUnicode; }; 155 156 157 BOOL GetWindowRect(PRECT pRect); 157 158 int GetWindowTextLength(); 158 int GetWindowText(LPSTR lpsz, int cch); 159 BOOL SetWindowText(LPSTR lpsz); 160 BOOL hasWindowName(LPSTR wndname, BOOL fUnicode = 0); 159 int GetWindowTextA(LPSTR lpsz, int cch); 160 int GetWindowTextW(LPWSTR lpsz, int cch); 161 BOOL SetWindowTextA(LPSTR lpsz); 162 BOOL SetWindowTextW(LPWSTR lpsz); 163 BOOL hasWindowName(LPSTR wndname, BOOL fUnicode = 0); 161 164 Win32WndClass *getClass() { return windowClass; }; 162 165 char *getWindowNameA() { return windowNameA; }; -
trunk/src/user32/new/win32wmdiclient.cpp
r821 r833 1 /* $Id: win32wmdiclient.cpp,v 1. 5 1999-09-04 19:42:29sandervl Exp $ */1 /* $Id: win32wmdiclient.cpp,v 1.6 1999-09-05 12:03:34 sandervl Exp $ */ 2 2 /* 3 3 * Win32 MDI Client Window Class for OS/2 … … 520 520 lpBuffer[0] = '\0'; 521 521 522 getParent()->SetWindowText (lpBuffer);522 getParent()->SetWindowTextA(lpBuffer); 523 523 if( repaint == MDI_REPAINTFRAME) 524 524 getParent()->SetWindowPos(0,0,0,0,0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER ); -
trunk/src/user32/new/windlg.cpp
r327 r833 1 /* $Id: windlg.cpp,v 1. 2 1999-07-18 13:57:48 cbratschiExp $ */1 /* $Id: windlg.cpp,v 1.3 1999-09-05 12:03:34 sandervl Exp $ */ 2 2 /* 3 3 * Win32 dialog apis for OS/2 … … 5 5 * Copyright 1999 Sander van Leeuwen 6 6 * 7 * Parts based on Wine code (990815; window\dialog.c) 8 * 9 * Copyright 1993, 1994, 1996 Alexandre Julliard 7 10 * 8 11 * Project Odin Software License can be found in LICENSE.TXT 9 12 * 10 13 */ 14 #include <ctype.h> 11 15 #include <wchar.h> 12 16 #include <os2win.h> … … 14 18 #include <string.h> 15 19 #include <stdlib.h> 16 17 //****************************************************************************** 18 //****************************************************************************** 19 BOOL WIN32API IsDlgButtonChecked( HWND arg1, UINT arg2) 20 { 21 #ifdef DEBUG 22 WriteLog("USER32: IsDlgButtonChecked\n"); 23 #endif 20 #include "win32wbase.h" 21 #include "win32dlg.h" 22 #include <heapstring.h> 23 #include <win\drive.h> 24 25 static INT DIALOG_DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox, INT idStatic, UINT attrib, BOOL combo ); 26 static INT DIALOG_DlgDirList( HWND hDlg, LPSTR spec, INT idLBox, INT idStatic, UINT attrib, BOOL combo ); 27 static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPSTR str, INT len, INT id, BOOL win32, BOOL unicode, BOOL combo ); 28 29 //****************************************************************************** 30 //****************************************************************************** 31 HWND WIN32API CreateDialogParamA(HINSTANCE hInst, LPCSTR lpszTemplate, 32 HWND hwndOwner, DLGPROC dlgproc, 33 LPARAM lParamInit) 34 { 35 HANDLE hrsrc = FindResourceA( hInst, lpszTemplate, RT_DIALOGA ); 36 37 if (!hrsrc) 38 return 0; 39 40 return CreateDialogIndirectParamA(hInst, (DLGTEMPLATE*)LoadResource(hInst, hrsrc), 41 hwndOwner, dlgproc, lParamInit); 42 } 43 //****************************************************************************** 44 //****************************************************************************** 45 HWND WIN32API CreateDialogParamW(HINSTANCE hInst, LPCWSTR lpszTemplate, 46 HWND hwndOwner, DLGPROC dlgproc, 47 LPARAM lParamInit) 48 { 49 HANDLE hrsrc = FindResourceW( hInst, lpszTemplate, RT_DIALOGW ); 50 51 if (!hrsrc) 52 return 0; 53 54 return CreateDialogIndirectParamW(hInst, (DLGTEMPLATE*)LoadResource(hInst, hrsrc), 55 hwndOwner, dlgproc, lParamInit); 56 } 57 //****************************************************************************** 58 //****************************************************************************** 59 HWND WIN32API CreateDialogIndirectParamA(HINSTANCE hInst, 60 DLGTEMPLATE *dlgtemplate, 61 HWND hwndParent, DLGPROC dlgproc, 62 LPARAM lParamInit) 63 { 64 Win32Dialog *dialog; 65 66 dprintf(("CreateDialogIndirectParamA: %x %x %x %x %x", hInst, dlgtemplate, hwndParent, dlgproc, lParamInit)); 67 68 if (!dlgtemplate) return 0; 69 70 dialog = new Win32Dialog(hInst, (LPCSTR)dlgtemplate, hwndParent, dlgproc, lParamInit, FALSE); 71 72 if(dialog == NULL) 73 { 74 dprintf(("Win32Dialog creation failed!!")); 75 return 0; 76 } 77 if(GetLastError() != 0) 78 { 79 dprintf(("Win32Dialog error found!!")); 80 delete dialog; 81 return 0; 82 } 83 return dialog->getWindowHandle(); 84 } 85 //****************************************************************************** 86 //****************************************************************************** 87 HWND WIN32API CreateDialogIndirectParamW(HINSTANCE hInst, 88 DLGTEMPLATE *dlgtemplate, 89 HWND hwndParent, DLGPROC dlgproc, 90 LPARAM lParamInit) 91 { 92 Win32Dialog *dialog; 93 94 dprintf(("CreateDialogIndirectParamW: %x %x %x %x %x", hInst, dlgtemplate, hwndParent, dlgproc, lParamInit)); 95 96 if (!dlgtemplate) return 0; 97 98 dialog = new Win32Dialog(hInst, (LPCSTR)dlgtemplate, hwndParent, dlgproc, lParamInit, TRUE); 99 100 if(dialog == NULL) 101 { 102 dprintf(("Win32Dialog creation failed!!")); 103 return 0; 104 } 105 if(GetLastError() != 0) 106 { 107 dprintf(("Win32Dialog error found!!")); 108 delete dialog; 109 return 0; 110 } 111 return dialog->getWindowHandle(); 112 } 113 //****************************************************************************** 114 //****************************************************************************** 115 INT WIN32API DialogBoxIndirectParamA(HINSTANCE hInst, 116 DLGTEMPLATE *dlgtemplate, 117 HWND hwndParent, DLGPROC dlgproc, 118 LPARAM lParamInit) 119 { 120 HWND hwnd = CreateDialogIndirectParamA(hInst, dlgtemplate, hwndParent, dlgproc, 121 lParamInit); 122 //TODO: 123 if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner ); 124 return -1; 125 } 126 //****************************************************************************** 127 //****************************************************************************** 128 INT WIN32API DialogBoxIndirectParamW(HINSTANCE hInst, DLGTEMPLATE *dlgtemplate, 129 HWND hwndParent, DLGPROC dlgproc, 130 LPARAM lParamInit) 131 { 132 HWND hwnd = CreateDialogIndirectParamW(hInst, dlgtemplate, hwndParent, dlgproc, 133 lParamInit); 134 //TODO: 135 if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner ); 136 return -1; 137 } 138 //****************************************************************************** 139 //****************************************************************************** 140 int WIN32API DialogBoxParamA(HINSTANCE hInst, LPCSTR lpszTemplate, HWND hwndOwner, 141 DLGPROC dlgproc, LPARAM lParamInit) 142 { 143 HWND hwnd = CreateDialogParamA( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit); 144 //TODO: 145 if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner ); 146 return -1; 147 } 148 //****************************************************************************** 149 //****************************************************************************** 150 int WIN32API DialogBoxParamW(HINSTANCE hInst, LPCWSTR lpszTemplate, HWND hwndOwner, 151 DLGPROC dlgproc, LPARAM lParamInit) 152 { 153 HWND hwnd = CreateDialogParamW( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit); 154 //TODO: 155 if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner ); 156 return -1; 157 } 158 //****************************************************************************** 159 //****************************************************************************** 160 BOOL WIN32API IsDlgButtonChecked( HWND hwnd, UINT id) 161 { 162 dprintf(("USER32: IsDlgButtonChecked\n")); 24 163 //CB: get button state 25 return (BOOL)SendDlgItemMessageA(arg1,arg2,BM_GETCHECK,0,0); 26 } 27 //****************************************************************************** 28 //****************************************************************************** 29 HWND WIN32API GetNextDlgTabItem( HWND arg1, HWND arg2, BOOL arg3) 30 { 164 return (BOOL)SendDlgItemMessageA(hwnd, id,BM_GETCHECK,0,0); 165 } 166 //****************************************************************************** 167 //****************************************************************************** 168 HWND WIN32API GetNextDlgTabItem(HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious) 169 { 170 Win32Dialog *dialog; 171 172 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwndDlg); 173 if(!dialog || !dialog->IsDialog()) { 174 dprintf(("GetNextDlgTabItem, window %x not found", hwndDlg)); 175 return 0; 176 } 31 177 dprintf(("USER32: GetNextDlgTabItem\n")); 32 //get next WS_TABSTOP 33 return O32_GetNextDlgTabItem(arg1, arg2, arg3); 34 } 35 //****************************************************************************** 36 //****************************************************************************** 37 HWND WIN32API GetDlgItem(HWND arg1, int arg2) 38 { 39 HWND rc; 40 //return OSLibWinWindowFromID(arg1,arg2); 41 rc = O32_GetDlgItem(arg1, arg2); 42 dprintf(("USER32: GetDlgItem %d returned %d\n", arg2, rc)); 43 return(rc); 44 } 45 //****************************************************************************** 46 //****************************************************************************** 47 int WIN32API GetDlgCtrlID( HWND arg1) 48 { 178 return dialog->getNextDlgTabItem(hwndCtrl, fPrevious); 179 } 180 //****************************************************************************** 181 //****************************************************************************** 182 HWND WIN32API GetDlgItem(HWND hwnd, int id) 183 { 184 Win32Dialog *dialog; 185 Win32BaseWindow *dlgcontrol; 186 187 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); 188 if(!dialog || !dialog->IsDialog()) { 189 dprintf(("GetDlgItem, window %x not found", hwnd)); 190 return 0; 191 } 192 dprintf(("USER32: GetDlgItem\n")); 193 dlgcontrol = dialog->getDlgItem(id); 194 if(dlgcontrol) { 195 return dlgcontrol->getWindowHandle(); 196 } 197 return 0; 198 } 199 //****************************************************************************** 200 //****************************************************************************** 201 int WIN32API GetDlgCtrlID(HWND hwnd) 202 { 203 Win32BaseWindow *dlgcontrol; 204 205 dlgcontrol = Win32BaseWindow::GetWindowFromHandle(hwnd); 206 if(!dlgcontrol) { 207 dprintf(("GetDlgCtrlID, control %x not found", hwnd)); 208 return 0; 209 } 49 210 dprintf(("USER32: GetDlgCtrlID\n")); 50 //return OSLibWinQueryWindowUShort(arg1,QWS_ID); 51 //use internal ID -> DWORD 52 return O32_GetDlgCtrlID(arg1); 53 } 54 //****************************************************************************** 55 //****************************************************************************** 56 BOOL WIN32API EndDialog( HWND arg1, int arg2) 57 { 58 BOOL rc; 59 60 dprintf(("USER32: EndDialog\n")); 61 //return OSLibDismissDialog(arg1,arg2); 62 rc = O32_EndDialog(arg1, arg2); 63 return(rc); 64 } 65 //****************************************************************************** 66 //****************************************************************************** 67 BOOL WIN32API CheckDlgButton( HWND arg1, int arg2, UINT arg3) 68 { 69 #ifdef DEBUG 70 WriteLog("USER32: CheckDlgButton\n"); 71 #endif 211 return dlgcontrol->getWindowId(); 212 } 213 //****************************************************************************** 214 //****************************************************************************** 215 BOOL WIN32API EndDialog(HWND hwnd, int retval) 216 { 217 Win32Dialog *dialog; 218 219 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); 220 if(!dialog || !dialog->IsDialog()) { 221 dprintf(("GetDlgItem, window %x not found", hwnd)); 222 return 0; 223 } 224 dprintf(("USER32: EndDialog\n")); 225 return dialog->endDialog(retval); 226 } 227 //****************************************************************************** 228 //****************************************************************************** 229 BOOL WIN32API CheckDlgButton( HWND hwnd, int id, UINT check) 230 { 231 dprintf(("USER32: CheckDlgButton\n")); 72 232 //CB: set button state 73 return (BOOL)SendDlgItemMessageA(arg1,arg2,BM_SETCHECK,arg3,0); 74 } 75 //****************************************************************************** 76 //****************************************************************************** 77 UINT WIN32API GetDlgItemTextA(HWND arg1, int arg2, LPSTR arg3, UINT arg4) 78 { 79 UINT rc; 80 81 //WinQueryDlgItemText(arg1,arg2,arg4,arg3); 82 rc = O32_GetDlgItemText(arg1, arg2, arg3, arg4); 83 #ifdef DEBUG 84 if(rc) 85 WriteLog("USER32: GetDlgItemTextA returned %s\n", arg3); 86 else WriteLog("USER32: GetDlgItemTextA returned 0 (%d)\n", GetLastError()); 87 #endif 88 return(rc); 89 } 90 //****************************************************************************** 91 //****************************************************************************** 92 BOOL WIN32API SetDlgItemInt( HWND hwndDlg, int idControl, UINT uValue, BOOL fSigned) 93 { 94 char buf[30]; 95 96 #ifdef DEBUG 97 WriteLog("USER32: SetDlgItemInt\n"); 98 #endif 99 if (fSigned) sprintf(buf,"%u",uValue); 100 else sprintf(buf,"%d",uValue); 101 102 return SetDlgItemTextA(hwndDlg,idControl,buf); 103 } 104 //****************************************************************************** 105 //****************************************************************************** 106 BOOL WIN32API SetDlgItemTextA( HWND arg1, int arg2, LPCSTR arg3) 107 { 108 #ifdef DEBUG 109 WriteLog("USER32: SetDlgItemText to %s\n", arg3); 110 #endif 111 //WinSetDlgItemText(arg1,arg2,arg3); 112 return O32_SetDlgItemText(arg1, arg2, arg3); 113 } 114 //****************************************************************************** 115 //****************************************************************************** 116 int WIN32API DlgDirListA( HWND arg1, LPSTR arg2, int arg3, int arg4, UINT arg5) 117 { 118 #ifdef DEBUG 119 WriteLog("USER32: DlgDirListA\n"); 120 #endif 121 return O32_DlgDirList(arg1, arg2, arg3, arg4, arg5); 122 } 123 //****************************************************************************** 124 //****************************************************************************** 125 int WIN32API DlgDirListComboBoxA( HWND arg1, LPSTR arg2, int arg3, int arg4, UINT arg5) 126 { 127 #ifdef DEBUG 128 WriteLog("USER32: DlgDirListComboBoxA\n"); 129 #endif 130 return O32_DlgDirListComboBox(arg1, arg2, arg3, arg4, arg5); 131 } 132 //****************************************************************************** 133 //****************************************************************************** 134 int WIN32API DlgDirListComboBoxW( HWND arg1, LPWSTR arg2, int arg3, int arg4, UINT arg5) 135 { 136 #ifdef DEBUG 137 WriteLog("USER32: DlgDirListComboBoxW NOT WORKING\n"); 138 #endif 139 // NOTE: This will not work as is (needs UNICODE support) 140 return 0; 141 // return O32_DlgDirListComboBox(arg1, arg2, arg3, arg4, arg5); 142 } 143 //****************************************************************************** 144 //****************************************************************************** 145 int WIN32API DlgDirListW( HWND arg1, LPWSTR arg2, int arg3, int arg4, UINT arg5) 146 { 147 #ifdef DEBUG 148 WriteLog("USER32: DlgDirListW NOT WORKING\n"); 149 #endif 150 // NOTE: This will not work as is (needs UNICODE support) 151 return 0; 152 // return O32_DlgDirList(arg1, arg2, arg3, arg4, arg5); 153 } 154 //****************************************************************************** 155 //****************************************************************************** 156 BOOL WIN32API DlgDirSelectComboBoxExA( HWND arg1, LPSTR arg2, int arg3, int arg4) 157 { 158 #ifdef DEBUG 159 WriteLog("USER32: DlgDirSelectComboBoxExA\n"); 160 #endif 161 return O32_DlgDirSelectComboBoxEx(arg1, arg2, arg3, arg4); 162 } 163 //****************************************************************************** 164 //****************************************************************************** 165 BOOL WIN32API DlgDirSelectComboBoxExW( HWND arg1, LPWSTR arg2, int arg3, int arg4) 166 { 167 #ifdef DEBUG 168 WriteLog("USER32: DlgDirSelectComboBoxExW NOT WORKING\n"); 169 #endif 170 // NOTE: This will not work as is (needs UNICODE support) 171 return 0; 172 // return O32_DlgDirSelectComboBoxEx(arg1, arg2, arg3, arg4); 173 } 174 //****************************************************************************** 175 //****************************************************************************** 176 BOOL WIN32API DlgDirSelectExA( HWND arg1, LPSTR arg2, int arg3, int arg4) 177 { 178 #ifdef DEBUG 179 WriteLog("USER32: DlgDirSelectExA\n"); 180 #endif 181 return O32_DlgDirSelectEx(arg1, arg2, arg3, arg4); 182 } 183 //****************************************************************************** 184 //****************************************************************************** 185 BOOL WIN32API DlgDirSelectExW( HWND arg1, LPWSTR arg2, int arg3, int arg4) 186 { 187 #ifdef DEBUG 188 WriteLog("USER32: DlgDirSelectExW NOT WORKING\n"); 189 #endif 190 // NOTE: This will not work as is (needs UNICODE support) 191 return 0; 192 // return O32_DlgDirSelectEx(arg1, arg2, arg3, arg4); 193 } 194 //****************************************************************************** 195 //****************************************************************************** 196 DWORD WIN32API GetDialogBaseUnits(void) 197 { 198 #ifdef DEBUG 199 WriteLog("USER32: GetDialogBaseUnits\n"); 200 #endif 201 return O32_GetDialogBaseUnits(); 233 return (BOOL)SendDlgItemMessageA(hwnd, id, BM_SETCHECK, check,0); 234 } 235 //****************************************************************************** 236 //****************************************************************************** 237 UINT WIN32API GetDlgItemTextA(HWND hwnd, int id, LPSTR lpszName, UINT cch) 238 { 239 return SendDlgItemMessageA( hwnd, id, WM_GETTEXT, cch, (LPARAM)lpszName); 240 } 241 //***************************************************************************** 242 //***************************************************************************** 243 UINT WIN32API GetDlgItemTextW(HWND hwnd, int id, LPWSTR lpszName, UINT cch) 244 { 245 return SendDlgItemMessageW( hwnd, id, WM_GETTEXT, cch, (LPARAM)lpszName); 246 } 247 //****************************************************************************** 248 //****************************************************************************** 249 BOOL WIN32API SetDlgItemInt( HWND hwnd, int idControl, UINT uValue, BOOL fSigned) 250 { 251 char str[20]; 252 253 dprintf(("USER32: SetDlgItemInt\n")); 254 255 if (fSigned) 256 sprintf( str, "%d", (INT)uValue ); 257 else sprintf( str, "%u", uValue ); 258 259 return SendDlgItemMessageA( hwnd, idControl, WM_SETTEXT, 0, (LPARAM)str ); 260 } 261 //****************************************************************************** 262 //****************************************************************************** 263 BOOL WIN32API SetDlgItemTextA( HWND hwnd, int id, LPCSTR lpszName) 264 { 265 return SendDlgItemMessageA( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpszName ); 266 } 267 //****************************************************************************** 268 //****************************************************************************** 269 BOOL WIN32API SetDlgItemTextW( HWND hwnd, int id, LPCWSTR lpszName) 270 { 271 return SendDlgItemMessageW( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpszName ); 202 272 } 203 273 //****************************************************************************** … … 210 280 return O32_GetDlgItemInt(arg1, arg2, arg3, arg4); 211 281 } 212 213 214 /*****************************************************************************215 * Name : UINT WIN32API GetDlgItemTextW216 * Purpose : Determine the text of a window control217 * Parameters: HWND arg1218 * int arg2219 * LPWSTR arg3220 * UINT arg4221 * Variables :222 * Result :223 * Remark :224 * Status : UNTESTED UNKNOWN STUB225 *226 * Author : Patrick Haller [Wed, 1998/06/16 11:55]227 *****************************************************************************/228 229 UINT WIN32API GetDlgItemTextW(HWND arg1,230 int arg2,231 LPWSTR arg3,232 UINT arg4)233 {234 LPSTR lpBuffer; /* temporary buffer for the ascii result */235 UINT uiResult; /* return value of the ascii variant */236 237 dprintf(("USER32: GetDlgItemTextW(%08xh,%08xh,%08xh,%08xh)\n",238 arg1,239 arg2,240 arg3,241 arg4));242 243 244 lpBuffer = (LPSTR)malloc(arg4); /* allocate temporary buffer */245 uiResult = GetDlgItemTextA(arg1, /* call ascii variant */246 arg2,247 lpBuffer,248 arg4);249 250 AsciiToUnicodeN(lpBuffer, /* now convert result to unicode */251 arg3,252 arg4);253 254 free(lpBuffer); /* free the temporary buffer */255 256 return (uiResult); /* OK, that's it */257 }258 282 //****************************************************************************** 259 283 //****************************************************************************** … … 265 289 return O32_GetNextDlgGroupItem(arg1, arg2, arg3); 266 290 } 267 //****************************************************************************** 268 //****************************************************************************** 269 BOOL WIN32API SetDlgItemTextW( HWND arg1, int arg2, LPCWSTR arg3) 270 { 271 char *astring = UnicodeToAsciiString((LPWSTR)arg3); 272 BOOL rc; 273 274 #ifdef DEBUG 275 WriteLog("USER32: SetDlgItemTextW\n"); 276 #endif 277 // NOTE: This will not work as is (needs UNICODE support) 278 rc = O32_SetDlgItemText(arg1, arg2, astring); 279 FreeAsciiString(astring); 280 return rc; 281 } 282 //****************************************************************************** 283 //****************************************************************************** 291 /*********************************************************************** 292 * GetDialogBaseUnits (USER.243) (USER32.233) 293 */ 294 DWORD WIN32API GetDialogBaseUnits(void) 295 { 296 return Win32Dialog::GetDialogBaseUnits(); 297 } 298 //****************************************************************************** 299 //****************************************************************************** 300 INT WIN32API DlgDirListA(HWND hDlg, LPSTR spec, INT idLBox, INT idStatic, UINT attrib ) 301 { 302 return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE ); 303 } 304 //****************************************************************************** 305 //****************************************************************************** 306 int WIN32API DlgDirListW(HWND hDlg, LPWSTR spec, INT idLBox, INT idStatic, UINT attrib ) 307 { 308 return DIALOG_DlgDirListW( hDlg, spec, idLBox, idStatic, attrib, FALSE ); 309 } 310 //****************************************************************************** 311 //****************************************************************************** 312 INT WIN32API DlgDirListComboBoxA(HWND hDlg, LPSTR spec, INT idCBox, INT idStatic, UINT attrib ) 313 { 314 return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE ); 315 } 316 //****************************************************************************** 317 //****************************************************************************** 318 INT WIN32API DlgDirListComboBoxW( HWND hDlg, LPWSTR spec, INT idCBox, INT idStatic, UINT attrib ) 319 { 320 return DIALOG_DlgDirListW( hDlg, spec, idCBox, idStatic, attrib, TRUE ); 321 } 322 //****************************************************************************** 323 //****************************************************************************** 324 BOOL WIN32API DlgDirSelectComboBoxExA(HWND hwnd, LPSTR str, INT len, INT id ) 325 { 326 return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, TRUE ); 327 } 328 //****************************************************************************** 329 //****************************************************************************** 330 BOOL WIN32API DlgDirSelectComboBoxExW(HWND hwnd, LPWSTR str, INT len, INT id) 331 { 332 return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, TRUE ); 333 } 334 //****************************************************************************** 335 //****************************************************************************** 336 BOOL WIN32API DlgDirSelectExA(HWND hwnd, LPSTR str, INT len, INT id) 337 { 338 return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, FALSE ); 339 } 340 //****************************************************************************** 341 //****************************************************************************** 342 BOOL WIN32API DlgDirSelectExW(HWND hwnd, LPWSTR str, INT len, INT id) 343 { 344 return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, FALSE ); 345 } 346 /********************************************************************** 347 * DIALOG_DlgDirSelect 348 * 349 * Helper function for DlgDirSelect* 350 */ 351 static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPSTR str, INT len, 352 INT id, BOOL win32, BOOL unicode, 353 BOOL combo ) 354 { 355 char *buffer, *ptr; 356 INT item, size; 357 BOOL ret; 358 HWND listbox = GetDlgItem( hwnd, id ); 359 360 if (!listbox) return FALSE; 361 362 item = SendMessageA(listbox, combo ? CB_GETCURSEL 363 : LB_GETCURSEL, 0, 0 ); 364 if (item == LB_ERR) return FALSE; 365 size = SendMessageA(listbox, combo ? CB_GETLBTEXTLEN 366 : LB_GETTEXTLEN, 0, 0 ); 367 if (size == LB_ERR) return FALSE; 368 369 if (!(buffer = (char *)malloc( size+1 ))) return FALSE; 370 371 SendMessageA( listbox, combo ? CB_GETLBTEXT : LB_GETTEXT, 372 item, (LPARAM)buffer ); 373 374 if ((ret = (buffer[0] == '['))) /* drive or directory */ 375 { 376 if (buffer[1] == '-') /* drive */ 377 { 378 buffer[3] = ':'; 379 buffer[4] = 0; 380 ptr = buffer + 2; 381 } 382 else 383 { 384 buffer[strlen(buffer)-1] = '\\'; 385 ptr = buffer + 1; 386 } 387 } 388 else ptr = buffer; 389 390 if (unicode) lstrcpynAtoW( (LPWSTR)str, ptr, len ); 391 else lstrcpynA( str, ptr, len ); 392 393 free( buffer ); 394 return ret; 395 } 396 397 398 /********************************************************************** 399 * DIALOG_DlgDirList 400 * 401 * Helper function for DlgDirList* 402 */ 403 static INT DIALOG_DlgDirList( HWND hDlg, LPSTR spec, INT idLBox, 404 INT idStatic, UINT attrib, BOOL combo ) 405 { 406 int drive; 407 HWND hwnd; 408 LPSTR orig_spec = spec; 409 410 #define SENDMSG(msg,wparam,lparam) \ 411 ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \ 412 : SendMessageA( hwnd, msg, wparam, lparam )) 413 414 if (spec && spec[0] && (spec[1] == ':')) 415 { 416 drive = _toupper( spec[0] ) - 'A'; 417 spec += 2; 418 if (!DRIVE_SetCurrentDrive( drive )) return FALSE; 419 } 420 else drive = DRIVE_GetCurrentDrive(); 421 422 /* If the path exists and is a directory, chdir to it */ 423 if (!spec || !spec[0] || DRIVE_Chdir( drive, spec )) spec = "*.*"; 424 else 425 { 426 char *p, *p2; 427 p = spec; 428 if ((p2 = strrchr( p, '\\' ))) p = p2; 429 if ((p2 = strrchr( p, '/' ))) p = p2; 430 if (p != spec) 431 { 432 char sep = *p; 433 *p = 0; 434 if (!DRIVE_Chdir( drive, spec )) 435 { 436 *p = sep; /* Restore the original spec */ 437 return FALSE; 438 } 439 spec = p + 1; 440 } 441 } 442 443 if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0)) 444 { 445 SENDMSG( combo ? CB_RESETCONTENT : LB_RESETCONTENT, 0, 0 ); 446 if (attrib & DDL_DIRECTORY) 447 { 448 if (!(attrib & DDL_EXCLUSIVE)) 449 { 450 if (SENDMSG( combo ? CB_DIR : LB_DIR, 451 attrib & ~(DDL_DIRECTORY | DDL_DRIVES), 452 (LPARAM)spec ) == LB_ERR) 453 return FALSE; 454 } 455 if (SENDMSG( combo ? CB_DIR : LB_DIR, 456 (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE, 457 (LPARAM)"*.*" ) == LB_ERR) 458 return FALSE; 459 } 460 else 461 { 462 if (SENDMSG( combo ? CB_DIR : LB_DIR, attrib, 463 (LPARAM)spec ) == LB_ERR) 464 return FALSE; 465 } 466 } 467 468 if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0)) 469 { 470 char temp[512], curpath[512]; 471 int drive = DRIVE_GetCurrentDrive(); 472 strcpy( temp, "A:\\" ); 473 temp[0] += drive; 474 lstrcpynA( temp + 3, DRIVE_GetDosCwd(curpath, drive), sizeof(temp)-3 ); 475 CharLowerA( temp ); 476 /* Can't use PostMessage() here, because the string is on the stack */ 477 SetDlgItemTextA( hDlg, idStatic, temp ); 478 } 479 480 if (orig_spec && (spec != orig_spec)) 481 { 482 /* Update the original file spec */ 483 char *p = spec; 484 while ((*orig_spec++ = *p++)); 485 } 486 487 return TRUE; 488 #undef SENDMSG 489 } 490 491 492 /********************************************************************** 493 * DIALOG_DlgDirListW 494 * 495 * Helper function for DlgDirList*32W 496 */ 497 static INT DIALOG_DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox, 498 INT idStatic, UINT attrib, BOOL combo ) 499 { 500 if (spec) 501 { 502 LPSTR specA = HEAP_strdupWtoA( GetProcessHeap(), 0, spec ); 503 INT ret = DIALOG_DlgDirList( hDlg, specA, idLBox, idStatic, 504 attrib, combo ); 505 lstrcpyAtoW( spec, specA ); 506 HeapFree( GetProcessHeap(), 0, specA ); 507 return ret; 508 } 509 return DIALOG_DlgDirList( hDlg, NULL, idLBox, idStatic, attrib, combo ); 510 } 511 //****************************************************************************** 512 //****************************************************************************** 513 -
trunk/src/user32/new/windlgmsg.cpp
r309 r833 1 /* $Id: windlgmsg.cpp,v 1. 1 1999-07-15 18:03:03sandervl Exp $ */1 /* $Id: windlgmsg.cpp,v 1.2 1999-09-05 12:03:34 sandervl Exp $ */ 2 2 /* 3 3 * Win32 dialog message APIs for OS/2 4 4 * 5 * Copyright 1999 Sander van Leeuwen 6 * 5 * Copyright 1999 Sander van Leeuwen (OS/2 port & adaption) 6 * 7 * Based on Wine code (990815: window\dialog.c) 8 * 9 * Copyright 1993, 1994, 1996 Alexandre Julliard 10 * 11 * TODO: Dialog accelerator 7 12 * 8 13 * Project Odin Software License can be found in LICENSE.TXT … … 11 16 #include <os2win.h> 12 17 #include <misc.h> 13 14 15 //****************************************************************************** 16 //****************************************************************************** 17 LONG WIN32API SendDlgItemMessageA( HWND arg1, int arg2, UINT arg3, WPARAM arg4, LPARAM arg5) 18 { 19 #ifdef DEBUG 20 WriteLog("USER32: SendDlgItemMessageA\n"); 18 #include "win32wbase.h" 19 #include "win32dlg.h" 20 21 //****************************************************************************** 22 //****************************************************************************** 23 LONG WIN32API SendDlgItemMessageA( HWND hwnd, int id, UINT Msg, WPARAM wParam, LPARAM lParam) 24 { 25 Win32Dialog *dialog; 26 Win32BaseWindow *dlgcontrol; 27 28 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); 29 if(!dialog || !dialog->IsDialog()) { 30 dprintf(("SendDlgItemMessageA, window %x not found", hwnd)); 31 return 0; 32 } 33 dlgcontrol = dialog->getDlgItem(id); 34 if(dlgcontrol) { 35 return dlgcontrol->SendMessageA(Msg, wParam, lParam); 36 } 37 return 0; 38 } 39 //****************************************************************************** 40 //****************************************************************************** 41 LONG WIN32API SendDlgItemMessageW( HWND hwnd, int id, UINT Msg, WPARAM wParam, LPARAM lParam) 42 { 43 Win32Dialog *dialog; 44 Win32BaseWindow *dlgcontrol; 45 46 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); 47 if(!dialog || !dialog->IsDialog()) { 48 dprintf(("SendDlgItemMessageW, window %x not found", hwnd)); 49 return 0; 50 } 51 dlgcontrol = dialog->getDlgItem(id); 52 if(dlgcontrol) { 53 return dlgcontrol->SendMessageW(Msg, wParam, lParam); 54 } 55 return 0; 56 } 57 //TODO 58 #if 0 59 /*********************************************************************** 60 * DIALOG_IsAccelerator 61 */ 62 static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey ) 63 { 64 HWND hwndControl = hwnd; 65 HWND hwndNext; 66 WND *wndPtr; 67 BOOL RetVal = FALSE; 68 INT dlgCode; 69 70 if (vKey == VK_SPACE) 71 { 72 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 ); 73 if (dlgCode & DLGC_BUTTON) 74 { 75 SendMessageA( hwndControl, WM_LBUTTONDOWN, 0, 0); 76 SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0); 77 RetVal = TRUE; 78 } 79 } 80 else 81 { 82 do 83 { 84 wndPtr = WIN_FindWndPtr( hwndControl ); 85 if ( (wndPtr != NULL) && 86 ((wndPtr->dwStyle & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE) ) 87 { 88 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 ); 89 if ( (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) && 90 (wndPtr->text!=NULL)) 91 { 92 /* find the accelerator key */ 93 LPSTR p = wndPtr->text - 2; 94 do 95 { 96 p = strchr( p + 2, '&' ); 97 } 98 while (p != NULL && p[1] == '&'); 99 100 /* and check if it's the one we're looking for */ 101 if (p != NULL && toupper( p[1] ) == toupper( vKey ) ) 102 { 103 if ((dlgCode & DLGC_STATIC) || 104 (wndPtr->dwStyle & 0x0f) == BS_GROUPBOX ) 105 { 106 /* set focus to the control */ 107 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 108 hwndControl, 1); 109 /* and bump it on to next */ 110 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0); 111 } 112 else if (dlgCode & 113 (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON)) 114 { 115 /* send command message as from the control */ 116 SendMessageA( hwndDlg, WM_COMMAND, 117 MAKEWPARAM( LOWORD(wndPtr->wIDmenu), 118 BN_CLICKED ), 119 (LPARAM)hwndControl ); 120 } 121 else 122 { 123 /* click the control */ 124 SendMessageA( hwndControl, WM_LBUTTONDOWN, 0, 0); 125 SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0); 126 } 127 RetVal = TRUE; 128 WIN_ReleaseWndPtr(wndPtr); 129 break; 130 } 131 } 132 hwndNext = GetWindow( hwndControl, GW_CHILD ); 133 } 134 else 135 { 136 hwndNext = 0; 137 } 138 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 } 159 hwndControl = hwndNext; 160 } 161 while (hwndControl != hwnd); 162 } 163 return RetVal; 164 } 21 165 #endif 22 return O32_SendDlgItemMessage(arg1, arg2, arg3, arg4, arg5); 23 } 24 //****************************************************************************** 25 //****************************************************************************** 26 LONG WIN32API SendDlgItemMessageW( HWND arg1, int arg2, UINT arg3, WPARAM arg4, LPARAM arg5) 27 { 28 #ifdef DEBUG 29 WriteLog("USER32: SendDlgItemMessageW\n"); 166 /*********************************************************************** 167 * DIALOG_IsDialogMessage 168 */ 169 static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg, 170 UINT message, WPARAM wParam, 171 LPARAM lParam, BOOL *translate, 172 BOOL *dispatch, INT dlgCode ) 173 { 174 *translate = *dispatch = FALSE; 175 176 if (message == WM_PAINT) 177 { 178 /* Apparently, we have to handle this one as well */ 179 *dispatch = TRUE; 180 return TRUE; 181 } 182 183 /* Only the key messages get special processing */ 184 if ((message != WM_KEYDOWN) && 185 (message != WM_SYSCHAR) && 186 (message != WM_CHAR)) 187 return FALSE; 188 189 if (dlgCode & DLGC_WANTMESSAGE) 190 { 191 *translate = *dispatch = TRUE; 192 return TRUE; 193 } 194 195 switch(message) 196 { 197 case WM_KEYDOWN: 198 switch(wParam) 199 { 200 case VK_TAB: 201 if (!(dlgCode & DLGC_WANTTAB)) 202 { 203 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 204 (GetKeyState(VK_SHIFT) & 0x8000), 0 ); 205 return TRUE; 206 } 207 break; 208 209 case VK_RIGHT: 210 case VK_DOWN: 211 case VK_LEFT: 212 case VK_UP: 213 if (!(dlgCode & DLGC_WANTARROWS)) 214 { 215 BOOL fPrevious = (wParam == VK_LEFT || wParam == VK_UP); 216 HWND hwndNext = 217 GetNextDlgGroupItem (hwndDlg, GetFocus(), fPrevious ); 218 SendMessageA( hwndDlg, WM_NEXTDLGCTL, hwndNext, 1 ); 219 return TRUE; 220 } 221 break; 222 223 case VK_ESCAPE: 224 SendMessageA( hwndDlg, WM_COMMAND, IDCANCEL, 225 (LPARAM)GetDlgItem( hwndDlg, IDCANCEL ) ); 226 return TRUE; 227 228 case VK_RETURN: 229 { 230 DWORD dw = SendMessageA( hwndDlg, DM_GETDEFID, 0, 0 ); 231 if (HIWORD(dw) == DC_HASDEFID) 232 { 233 SendMessageA( hwndDlg, WM_COMMAND, 234 MAKEWPARAM( LOWORD(dw), BN_CLICKED ), 235 (LPARAM)GetDlgItem(hwndDlg, LOWORD(dw))); 236 } 237 else 238 { 239 SendMessageA( hwndDlg, WM_COMMAND, IDOK, 240 (LPARAM)GetDlgItem( hwndDlg, IDOK ) ); 241 242 } 243 } 244 return TRUE; 245 } 246 *translate = TRUE; 247 break; /* case WM_KEYDOWN */ 248 249 case WM_CHAR: 250 if (dlgCode & DLGC_WANTCHARS) break; 251 /* drop through */ 252 253 //TODO: 254 #if 0 255 case WM_SYSCHAR: 256 if (DIALOG_IsAccelerator( hwnd, hwndDlg, wParam )) 257 { 258 /* don't translate or dispatch */ 259 return TRUE; 260 } 261 break; 30 262 #endif 31 return O32_SendDlgItemMessage(arg1, arg2, arg3, arg4, arg5); 32 } 33 //****************************************************************************** 34 //****************************************************************************** 35 BOOL WIN32API IsDialogMessageA( HWND arg1, LPMSG arg2) 36 { 37 #ifdef DEBUG 38 //// WriteLog("USER32: IsDialogMessage\n"); 39 #endif 40 return O32_IsDialogMessage(arg1, arg2); 41 } 42 //****************************************************************************** 43 //****************************************************************************** 44 BOOL WIN32API IsDialogMessageW( HWND arg1, LPMSG arg2) 45 { 46 #ifdef DEBUG 47 WriteLog("USER32: IsDialogMessageW\n"); 48 #endif 49 // NOTE: This will not work as is (needs UNICODE support) 50 return O32_IsDialogMessage(arg1, arg2); 51 } 52 //****************************************************************************** 53 //****************************************************************************** 263 } 264 265 /* If we get here, the message has not been treated specially */ 266 /* and can be sent to its destination window. */ 267 *dispatch = TRUE; 268 return TRUE; 269 } 270 //****************************************************************************** 271 //****************************************************************************** 272 BOOL WIN32API IsDialogMessageA( HWND hwndDlg, LPMSG msg) 273 { 274 BOOL ret, translate, dispatch; 275 INT dlgCode; 276 277 if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd )) 278 return FALSE; 279 280 dlgCode = SendMessageA( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg); 281 ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message, 282 msg->wParam, msg->lParam, 283 &translate, &dispatch, dlgCode ); 284 if (translate) TranslateMessage( msg ); 285 if (dispatch) DispatchMessageA( msg ); 286 287 return ret; 288 } 289 //****************************************************************************** 290 //****************************************************************************** 291 BOOL WIN32API IsDialogMessageW(HWND hwndDlg, LPMSG msg) 292 { 293 BOOL ret, translate, dispatch; 294 INT dlgCode; 295 296 if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd )) 297 return FALSE; 298 299 dlgCode = SendMessageW( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg); 300 ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message, 301 msg->wParam, msg->lParam, 302 &translate, &dispatch, dlgCode ); 303 if (translate) TranslateMessage( msg ); 304 if (dispatch) DispatchMessageW( msg ); 305 return ret; 306 } 307 //****************************************************************************** 308 //****************************************************************************** -
trunk/src/user32/new/window.cpp
r821 r833 1 /* $Id: window.cpp,v 1.2 2 1999-09-04 19:42:30sandervl Exp $ */1 /* $Id: window.cpp,v 1.23 1999-09-05 12:03:34 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 572 572 return 0; 573 573 } 574 rc = window->GetWindowText (lpsz, cch);574 rc = window->GetWindowTextA(lpsz, cch); 575 575 dprintf(("GetWindowTextA %x %s", hwnd, lpsz)); 576 576 return rc; … … 595 595 } 596 596 dprintf(("GetWindowTextW %x", hwnd)); 597 return window->GetWindowText ((LPSTR)lpsz, cch);597 return window->GetWindowTextW(lpsz, cch); 598 598 } 599 599 //****************************************************************************** … … 609 609 } 610 610 dprintf(("SetWindowTextA %x %s", hwnd, lpsz)); 611 return window->SetWindowText ((LPSTR)lpsz);611 return window->SetWindowTextA((LPSTR)lpsz); 612 612 } 613 613 //****************************************************************************** … … 623 623 } 624 624 dprintf(("SetWindowTextW %x", hwnd)); 625 return window->SetWindowText ((LPSTR)lpsz);625 return window->SetWindowTextW((LPWSTR)lpsz); 626 626 } 627 627 /*******************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.