Sun Feb 18 16:35:54 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/desktop.c] Look for the wallpaper file in the Windows directory. * [controls/menu.c] Fixed swapped parameters in SetMenuItemBitmaps(). Create a separator in MENU_SetItemData() when the string is NULL. * [file/dosfs.c] DOSFS_FindNext: don't return '.' and '..' in a drive root dir. * [files/file.c] Added a DOS_FILE structure to store per-file information (not really used yet). Fixed _lread and _hread to check the size of the buffer before calling Unix read() to avoid EFAULT error. * [misc/exec.c] Return TRUE in WinHelp() for HELP_QUIT to quiet Notepad on exit. * [miscemu/instr.c] Call DOSMEM_Alarm() in INSTR_ReplaceSelector(). This should fix programs that poll the BIOS counter, provided they reload the selector on every read. * [miscemu/int21.c] Re-implemented FindFirst/FindNext for FCB calls. * [windows/message.c] [windows/winpos.c] Merged MSG_GetWindowForEvent() and WINPOS_WindowFromPoint(). * [windows/nonclient.c] [windows/win.c] [include/windows.h] Added a per-window WIN_MANAGED flag; only windows that have a dialog frame or a sizing border are managed. Sat Feb 17 18:25:00 1996 Thomas Sandford <tdgsandf@prds-grn.demon.co.uk> * [if1632/Makefile.in] Added -g flag to compilation of .c files generated from *32.spec. * [if1632/gdi32.spec] Numerous additional functions implemented. * if1632/user32.spec] wsprintfA maps to vsprintf not wsprintf Numerous additional functions implemented. * [include/gdi.h] [objects/gdiobj.c] New #define MAGIC_DONTCARE added. This is used in GDI_GetObjPtr to enable getting a pointer to a GDI object of unknow type. * [win32/gdi32.c] New file. * [win32/param32.c] WIN32_MoveToEx() - handle NULL pointer argument. * [win32/user32.c] USER32_InvalidateRect - handle passing of a NULL pointer. USER32_SetTimer - New function. * [files/directory.c] Fixed DIR_Init() (off by one in allocation of space for environment variables). * [files/drive.c] Added <sys/types.h> to #includes (prerequisite for <sys/stat.h> on FreeBSD). Fri Feb 16 10:26:56 1996 Andreas Kirschbaum <ank@rbg.informatik.th-darmstadt.de> * [controls/menu.c] Memory leak plugged. * [controls/edit.c] Erase space with function ExtTextOut(). This eliminates the use of xmalloc(). Memory leak in EDIT_WriteText plugged. * [debugger/db_disasm.c] Operand for scas now is di. * [files/profile.c] PROFILE_GetSection was copying too much data. PROFILE_GetSection now returns the correct value. It was returning the number of unused instead of used bytes. * [objects/dc.c] Corrected two typos in comments. * [objects/font.c] FONT_MatchFont didn't return if it couldn't find any font. * [objects/oembitmap.c] Free object only if it has been allocated. * [windows/scroll.c] Memory leak in ScrollDC plugged. Tue Feb 13 11:17:00 1996 William Magro <wmagro@tc.cornell.edu> * [controls/edit.c] Implemented ES_NOHIDESEL style, shift+click selection, shift+{arrow,home,end,pgup,pgdn} selection. Optimized (de)selection drawing. Changed selection drawing to use correct system colors instead of inverting. Fixed deleting or backspacing across a '\r\n' end of line pair. Selection now anchors correctly. Fixed text leaking and extra garbage problem bug uncovered by change in class style in wine960131. * [controls/widgets.c] Class flags now match those of Windows. Mon Feb 12 21:28:19 1996 Martin von Loewis <loewis@informatik.hu-berlin.de> * [controls/widgets.c] WIDGETS_Init: RELAY32_GetEntryPoint does not take a string anymore. * [if1632/Makefile.in][if1632/relay32.c][include/relay32.h] comctl32.spec ole32.spec winspool.spec: new files. RELAY32_Init: call initialization of new DLLs. RELAY32_GetEntryPoint: expects WIN32_builtin* now. RELAY32_MakeFakeModule: new function. * [if1632/gdi32.spec][if1632/kernel32.spec][if1632/user32.spec] Added Win95 functions. Ordinals now differ from both NT and Win95 HeapCreate, CreateDialogIndirectParamA, CreateDialogIndirectParamW, CreateDialogParamA, CreateDialogParamW, DialogBoxIndirectParamA DialogBoxIndirectParamW, DialogBoxParamA, DialogBoxParamW: new relays. * [if1632/shell32.spec] shell32.spec: renumbered all functions to take into account ordinals. These seem to be identical between NT and Win95. * [include/dialog.h][windows/dialog.c] xBaseUnit,yBaseUnit,DIALOG_DoDialogBox: made non-static. * [include/handle32.h] New handle types VRANGE, HEAP, HEAPITEM. * [include/pe_image.h][loader/pe_image.c] struct w_files: new field builtin. PE_FindExportedFunction: support ordinals. PE_GetProcAddress: call RELAY32_GetEntryPoint for builtins. fixup_imports: support ordinals. PE_LoadImage: prefer directories over segments. * [include/resource.h][win32/resource.c] FindResource32: changed parameter from LPCTSTR to LPCWSTR check LANG_NEUTRAL if LANG_ENGLISH fails. LoadAcceleratorsW,SizeofResource32,AccessResource32: disabled because it's broken. Casted to and from LPWSTR at various places. * [include/string32.h][win32/string32.c] Changed prototypes to take const arguments where appropriate. * [include/struct32.h] New structures DLGTEMPLATE32, DLGITEMTEMPLATE32. * [tools/build.c] BuildSpec32Files: generate Base value into code, generate call to RELAY32_MakeFakeModule. * [win32/heap.c] This is still not finished and needs rework. HeapAlloc: renamed to SIMPLE_HeapAlloc, implemented HeapAlloc. HeapCreate: implemented on top of VirtualAlloc, which does not work yet HeapDestroy, HEAP_GrowHeap, HeapFree: new functions. * [win32/memory.c] Support for VRANGE_OBJECT. This is not yet called from any place, and needs more platform specific support MEMORY_FindVrange, MEMORY_IsVrangeFree, MEMORY_InsertVrange, MEMORY_AllocVrange, MEMORY_ReleaseVrange: new functions. * [win32/user32.c] WIN32_CreateWindowExA: don't GlobalAlloc for integer class and window names, as in dialogs. Implemented dialog functions (see user32.spec). * [windows/caret.c] CARET_Initialize: call RELAY32_GetBuiltinDLL. Mon Feb 12 18:52:40 1996 Jim Peterson <jspeter@birch.ee.vt.edu> * [controls/edit.c] Removed commented out #ifdefs for WINELIB. * [tools/makehtml.pl] Put in error checking when trying to open a file. * [libtest/Makefile.in] [libtest/new.c] [libtest/hello4.c] Added two new targets: hello4 and new. * [include/windows.h] Added definition of DEVMODE structure, although it's not yet used. Modified various API functions from CreateDC() to Escape(), in order to make them more compliant with the strict API definitions. * [include/wintypes.h] Added 'typedef char TCHAR'. It probably should be defined as 'short', but then we would have to support such characters. Also did 'typedef const TCHAR* LPCTSTR' and 'typedef TCHAR* LPTSTR'. Also defined WNDENUMPROC, FONTENUMPROC, GOBJENUMPROC, PROPENUMPROC MFENUMPROC, and HGDIOBJ. Mon Feb 5 16:42:07 1996 Frans van Dorsselaer <dorssel@rulhm1.leidenuniv.nl> * [misc/commdlg.c] Patched a bug that occurred in the internal COMMDLG module for the FileOpen(), FileSave() and FileSaveAs() functions. The file-type combobox is now handled correctly. Fri Feb 2 22:52:58 1996 Roman Dolejsi <roman@sorry.vse.cz> * [resources/sysres_Cz.rc] Added support for Czech [Cz] language. Thu Feb 1 00:35:04 1996 Philippe De Muyter <phdm@info.ucl.ac.be> * [objects/font.c] FONT_matchfont : for fixed-spacing fonts, allow 'c' if 'm' fails; for variable-spacing fonts : allow '*' if 'p' fails; if asked lfHeight is -1, assume 0. CreateFontIndirect : if font parameter is NULL, issue an error message. CreateFont : null-terminate lfFaceName. ParseFontParms : debug code turned off : too verbose. InitFontsList : recognize *-c-* fonts as fixed-spacing fonts. * [objects/color.c] ColorToPhysical : admit 0xff...... COLORREF's as 0x00...... ones.
568 lines
16 KiB
C
568 lines
16 KiB
C
/*
|
|
* Win32 user functions
|
|
*
|
|
* Copyright 1995 Martin von Loewis
|
|
*/
|
|
|
|
/* This file contains only wrappers to existing Wine functions or trivial
|
|
stubs. 'Real' implementations go into context specific files */
|
|
|
|
#include <unistd.h>
|
|
#include <stdio.h>
|
|
#include "windows.h"
|
|
#include "winerror.h"
|
|
#include "relay32.h"
|
|
#include "alias.h"
|
|
#include "stackframe.h"
|
|
#include "xmalloc.h"
|
|
#include "handle32.h"
|
|
#include "struct32.h"
|
|
#include "resource32.h"
|
|
#include "string32.h"
|
|
#include "dialog.h"
|
|
#include "win.h"
|
|
#include "debug.h"
|
|
#include "stddebug.h"
|
|
|
|
/* Structure copy functions */
|
|
static void MSG16to32(MSG *msg16,struct WIN32_MSG *msg32)
|
|
{
|
|
msg32->hwnd=(DWORD)msg16->hwnd;
|
|
msg32->message=msg16->message;
|
|
msg32->wParam=msg16->wParam;
|
|
msg32->lParam=msg16->lParam;
|
|
msg32->time=msg16->time;
|
|
msg32->pt.x=msg16->pt.x;
|
|
msg32->pt.y=msg16->pt.y;
|
|
}
|
|
|
|
static void MSG32to16(struct WIN32_MSG *msg32,MSG *msg16)
|
|
{
|
|
msg16->hwnd=(HWND)msg32->hwnd;
|
|
msg16->message=msg32->message;
|
|
msg16->wParam=msg32->wParam;
|
|
msg16->lParam=msg32->lParam;
|
|
msg16->time=msg32->time;
|
|
msg16->pt.x=msg32->pt.x;
|
|
msg16->pt.y=msg32->pt.y;
|
|
}
|
|
|
|
void USER32_RECT32to16(const RECT32* r32,RECT *r16)
|
|
{
|
|
r16->left = r32->left;
|
|
r16->right = r32->right;
|
|
r16->top = r32->top;
|
|
r16->bottom = r32->bottom;
|
|
}
|
|
|
|
void USER32_RECT16to32(const RECT* r16,RECT32 *r32)
|
|
{
|
|
r32->left = r16->left;
|
|
r32->right = r16->right;
|
|
r32->top = r16->top;
|
|
r32->bottom = r16->bottom;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* RegisterClassA (USER32.426)
|
|
*/
|
|
ATOM USER32_RegisterClassA(WNDCLASSA* wndclass)
|
|
{
|
|
WNDCLASS copy;
|
|
HANDLE classh = 0, menuh = 0;
|
|
SEGPTR classsegp, menusegp;
|
|
char *classbuf, *menubuf;
|
|
|
|
ATOM retval;
|
|
copy.style=wndclass->style;
|
|
ALIAS_RegisterAlias(0,0,(DWORD)wndclass->lpfnWndProc);
|
|
copy.lpfnWndProc=wndclass->lpfnWndProc;
|
|
copy.cbClsExtra=wndclass->cbClsExtra;
|
|
copy.cbWndExtra=wndclass->cbWndExtra;
|
|
copy.hInstance=(HINSTANCE)wndclass->hInstance;
|
|
copy.hIcon=(HICON)wndclass->hIcon;
|
|
copy.hCursor=(HCURSOR)wndclass->hCursor;
|
|
copy.hbrBackground=(HBRUSH)wndclass->hbrBackground;
|
|
|
|
/* FIXME: There has to be a better way of doing this - but neither
|
|
malloc nor alloca will work */
|
|
|
|
if(wndclass->lpszMenuName)
|
|
{
|
|
menuh = GlobalAlloc(0, strlen(wndclass->lpszMenuName)+1);
|
|
menusegp = WIN16_GlobalLock(menuh);
|
|
menubuf = PTR_SEG_TO_LIN(menusegp);
|
|
strcpy( menubuf, wndclass->lpszMenuName);
|
|
copy.lpszMenuName=menusegp;
|
|
}else
|
|
copy.lpszMenuName=0;
|
|
if(wndclass->lpszClassName)
|
|
{
|
|
classh = GlobalAlloc(0, strlen(wndclass->lpszClassName)+1);
|
|
classsegp = WIN16_GlobalLock(classh);
|
|
classbuf = PTR_SEG_TO_LIN(classsegp);
|
|
strcpy( classbuf, wndclass->lpszClassName);
|
|
copy.lpszClassName=classsegp;
|
|
}
|
|
retval = RegisterClass(©);
|
|
GlobalFree(menuh);
|
|
GlobalFree(classh);
|
|
return retval;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* GetMessageA (USER32.269)
|
|
*/
|
|
BOOL USER32_GetMessageA(struct WIN32_MSG* lpmsg,DWORD hwnd,DWORD min,DWORD max)
|
|
{
|
|
BOOL ret;
|
|
MSG msg;
|
|
ret=GetMessage(MAKE_SEGPTR(&msg),(HWND)hwnd,min,max);
|
|
MSG16to32(&msg,lpmsg);
|
|
return ret;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* BeginPaint (USER32.9)
|
|
*/
|
|
HDC USER32_BeginPaint(DWORD hwnd,struct WIN32_PAINTSTRUCT *lpps)
|
|
{
|
|
PAINTSTRUCT ps;
|
|
HDC ret;
|
|
ret=BeginPaint((HWND)hwnd,&ps);
|
|
lpps->hdc=(DWORD)ps.hdc;
|
|
lpps->fErase=ps.fErase;
|
|
lpps->rcPaint.top=ps.rcPaint.top;
|
|
lpps->rcPaint.left=ps.rcPaint.left;
|
|
lpps->rcPaint.right=ps.rcPaint.right;
|
|
lpps->rcPaint.bottom=ps.rcPaint.bottom;
|
|
lpps->fRestore=ps.fRestore;
|
|
lpps->fIncUpdate=ps.fIncUpdate;
|
|
return ret;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* EndPaint (USER32.175)
|
|
*/
|
|
BOOL USER32_EndPaint(DWORD hwnd,struct WIN32_PAINTSTRUCT *lpps)
|
|
{
|
|
PAINTSTRUCT ps;
|
|
ps.hdc=(HDC)lpps->hdc;
|
|
ps.fErase=lpps->fErase;
|
|
ps.rcPaint.top=lpps->rcPaint.top;
|
|
ps.rcPaint.left=lpps->rcPaint.left;
|
|
ps.rcPaint.right=lpps->rcPaint.right;
|
|
ps.rcPaint.bottom=lpps->rcPaint.bottom;
|
|
ps.fRestore=lpps->fRestore;
|
|
ps.fIncUpdate=lpps->fIncUpdate;
|
|
EndPaint((HWND)hwnd,&ps);
|
|
return TRUE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* DispatchMessageA (USER32.140)
|
|
*/
|
|
LONG USER32_DispatchMessageA(struct WIN32_MSG* lpmsg)
|
|
{
|
|
MSG msg;
|
|
LONG ret;
|
|
MSG32to16(lpmsg,&msg);
|
|
ret=DispatchMessage(&msg);
|
|
MSG16to32(&msg,lpmsg);
|
|
return ret;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* TranslateMessage (USER32.555)
|
|
*/
|
|
BOOL USER32_TranslateMessage(struct WIN32_MSG* lpmsg)
|
|
{
|
|
MSG msg;
|
|
MSG32to16(lpmsg,&msg);
|
|
return TranslateMessage(&msg);
|
|
}
|
|
|
|
/***********************************************************************
|
|
* CreateWindowExA (USER32.82)
|
|
*/
|
|
DWORD USER32_CreateWindowExA(long flags,char* class,char *title,
|
|
long style,int x,int y,int width,int height,DWORD parent,DWORD menu,
|
|
DWORD instance,DWORD param)
|
|
{
|
|
DWORD retval;
|
|
HANDLE classh=0, titleh=0;
|
|
SEGPTR classsegp=0, titlesegp=0;
|
|
char *classbuf, *titlebuf;
|
|
int usec,uset;
|
|
|
|
/*Have to translate CW_USEDEFAULT */
|
|
if(x==CW_USEDEFAULT32)x=CW_USEDEFAULT;
|
|
if(y==CW_USEDEFAULT32)y=CW_USEDEFAULT;
|
|
if(width==CW_USEDEFAULT32)width=CW_USEDEFAULT;
|
|
if(height==CW_USEDEFAULT32)height=CW_USEDEFAULT;
|
|
|
|
/* FIXME: There has to be a better way of doing this - but neither
|
|
malloc nor alloca will work */
|
|
usec = HIWORD(class);
|
|
uset = HIWORD(title);
|
|
|
|
if(usec){
|
|
classh = GlobalAlloc(0, strlen(class)+1);
|
|
classsegp = WIN16_GlobalLock(classh);
|
|
classbuf = PTR_SEG_TO_LIN(classsegp);
|
|
strcpy( classbuf, class );
|
|
}
|
|
if(uset){
|
|
titleh = GlobalAlloc(0, strlen(title)+1);
|
|
titlesegp = WIN16_GlobalLock(titleh);
|
|
titlebuf = PTR_SEG_TO_LIN(titlesegp);
|
|
strcpy( titlebuf, title );
|
|
}
|
|
|
|
retval = (DWORD) CreateWindowEx(flags,(usec ? classsegp : (SEGPTR)class),
|
|
(uset ? titlesegp : (SEGPTR)title),style,x,y,width,height,
|
|
(HWND)parent,(HMENU)menu,(HINSTANCE)instance,
|
|
(DWORD)param);
|
|
if(usec)GlobalFree(classh);
|
|
if(uset)GlobalFree(titleh);
|
|
return retval;
|
|
}
|
|
|
|
DWORD USER32_CreateWindowExW(long flags,LPCWSTR class,LPCWSTR title,
|
|
long style,int x,int y,int width,int height,DWORD parent,DWORD menu,
|
|
DWORD instance,DWORD param)
|
|
{
|
|
HWND hwnd;
|
|
LPSTR c,t;
|
|
int usec,uset;
|
|
usec=HIWORD(class);
|
|
uset=HIWORD(title);
|
|
c = usec ? STRING32_DupUniToAnsi(class) : (LPSTR)class;
|
|
t = uset ? STRING32_DupUniToAnsi(title) : (LPSTR)title;
|
|
hwnd=USER32_CreateWindowExA(flags,c,t,style,x,y,width,height,parent,menu,
|
|
instance,param);
|
|
if(usec)free(c);
|
|
if(uset)free(t);
|
|
return hwnd;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* InvalidateRect (USER32.327)
|
|
*/
|
|
BOOL USER32_InvalidateRect(HWND hWnd,const RECT32 *lpRect,BOOL bErase)
|
|
{
|
|
RECT r;
|
|
|
|
if (lpRect == NULL)
|
|
InvalidateRect(hWnd, (RECT *)NULL, bErase);
|
|
else {
|
|
USER32_RECT32to16(lpRect,&r);
|
|
InvalidateRect(hWnd,&r,bErase);
|
|
}
|
|
/* FIXME: Return meaningful value */
|
|
return TRUE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* DrawTextA (USER32.163)
|
|
*/
|
|
int USER32_DrawTextA(HDC hdc,LPCSTR lpStr,int count,RECT32* r32,UINT uFormat)
|
|
{
|
|
RECT r;
|
|
USER32_RECT32to16(r32,&r);
|
|
return DrawText(hdc,lpStr,count,&r,uFormat);
|
|
}
|
|
|
|
/***********************************************************************
|
|
* GetClientRect (USER32.219)
|
|
*/
|
|
BOOL USER32_GetClientRect(HWND hwnd,RECT32 *r32)
|
|
{
|
|
RECT r;
|
|
GetClientRect(hwnd,&r);
|
|
USER32_RECT16to32(&r,r32);
|
|
/* FIXME: return value */
|
|
return 0;
|
|
}
|
|
|
|
UINT USER32_SetTimer(HWND hwnd, UINT id, UINT timeout, void *proc)
|
|
|
|
{
|
|
dprintf_win32(stddeb, "USER32_SetTimer: %d %d %d %08lx\n", hwnd, id, timeout,
|
|
(LONG)proc );
|
|
return SetTimer( hwnd, id, timeout, MAKE_SEGPTR(proc));
|
|
}
|
|
|
|
/* WARNING: It has not been verified that the signature or semantics
|
|
of the corresponding NT function is the same */
|
|
|
|
HWND USER32_CreateDialogIndirectParamAorW(HINSTANCE hInst,LPVOID templ,
|
|
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam,int A)
|
|
{
|
|
DLGTEMPLATE32 *dlgTempl=templ;
|
|
DLGITEMTEMPLATE32 *dlgitem;
|
|
WORD *ptr;
|
|
DWORD MenuName=0;
|
|
DWORD ClassName=0;
|
|
DWORD szFontName=0;
|
|
WORD wPointSize;
|
|
HFONT hFont=0;
|
|
HMENU hMenu=0;
|
|
DWORD exStyle;
|
|
DWORD szCaption;
|
|
RECT rect;
|
|
DIALOGINFO *dlgInfo;
|
|
WND *wndPtr;
|
|
WORD xUnit = xBaseUnit;
|
|
WORD yUnit = yBaseUnit;
|
|
int i;
|
|
DWORD ClassId;
|
|
DWORD Text;
|
|
HWND hwnd,hwndCtrl;
|
|
HWND hwndDefButton=0;
|
|
WCHAR buffer[200];
|
|
|
|
/* parse the dialog template header*/
|
|
exStyle = dlgTempl->dwExtendedStyle;
|
|
ptr = (WORD*)(dlgTempl+1);
|
|
switch(*ptr){
|
|
case 0: MenuName=0;ptr++;break;
|
|
case 0xFFFF: MenuName=*(ptr+1);ptr+=2;break;
|
|
default: MenuName = (DWORD)ptr;
|
|
ptr += STRING32_lstrlenW(ptr)+1;
|
|
}
|
|
switch(*ptr){
|
|
case 0: ClassName = DIALOG_CLASS_ATOM;ptr++;break;
|
|
case 0xFFFF: ClassName = *(ptr+1);ptr+=2;break;
|
|
default: ClassName = (DWORD)ptr;
|
|
ptr += STRING32_lstrlenW(ptr)+1;
|
|
}
|
|
szCaption=(DWORD)ptr;
|
|
ptr+=STRING32_lstrlenW(ptr)+1;
|
|
if(dlgTempl->style & DS_SETFONT)
|
|
{
|
|
wPointSize = *ptr;
|
|
ptr++;
|
|
szFontName = (DWORD)ptr;
|
|
ptr+=STRING32_lstrlenW(ptr)+1;
|
|
}
|
|
|
|
if(MenuName) hMenu=WIN32_LoadMenuW(hInst,(LPWSTR)MenuName);
|
|
if(dlgTempl->style & DS_SETFONT)
|
|
{
|
|
fprintf(stderr,"Win32: dialog fonts not supported yet\n");
|
|
}
|
|
|
|
/* Create dialog main window */
|
|
rect.left = rect.top = 0;
|
|
rect.right = dlgTempl->cx * xUnit / 4;
|
|
rect.bottom = dlgTempl->cy * yUnit / 8;
|
|
|
|
/* FIXME: proper modalframe handling ??*/
|
|
if (dlgTempl->style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
|
|
|
|
/* FIXME: AdjustWindowRectEx */
|
|
|
|
rect.right -= rect.left;
|
|
rect.bottom -= rect.top;
|
|
|
|
if(dlgTempl->x == CW_USEDEFAULT)
|
|
rect.left = rect.top = CW_USEDEFAULT;
|
|
else{
|
|
rect.left += dlgTempl->x * xUnit / 4;
|
|
rect.top += dlgTempl->y * yUnit / 8;
|
|
if (!(dlgTempl->style & DS_ABSALIGN))
|
|
ClientToScreen(hWndParent, (POINT *)&rect );
|
|
}
|
|
|
|
/* FIXME: Here is the place to consider A */
|
|
hwnd = USER32_CreateWindowExW(exStyle, (LPWSTR)ClassName, (LPWSTR)szCaption,
|
|
dlgTempl->style & ~WS_VISIBLE,
|
|
rect.left, rect.top, rect.right, rect.bottom,
|
|
hWndParent, hMenu, hInst, 0);
|
|
|
|
if(!hwnd)
|
|
{
|
|
if(hFont)DeleteObject(hFont);
|
|
if(hMenu)DeleteObject(hMenu);
|
|
return 0;
|
|
}
|
|
|
|
wndPtr = WIN_FindWndPtr(hwnd);
|
|
|
|
/* FIXME: should purge junk from system menu, but windows/dialog.c
|
|
says this does not belong here */
|
|
|
|
/* Create control windows */
|
|
dprintf_dialog(stddeb, " BEGIN\n" );
|
|
dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
|
|
dlgInfo->msgResult = 0; /* This is used to store the default button id */
|
|
dlgInfo->hDialogHeap = 0;
|
|
|
|
for (i = 0; i < dlgTempl->noOfItems; i++)
|
|
{
|
|
if((int)ptr&3)
|
|
{
|
|
fprintf(stddeb,"DWORD aligning\n");
|
|
ptr++;
|
|
}
|
|
dlgitem = (DLGITEMTEMPLATE32*)ptr;
|
|
ptr = (WORD*)(dlgitem+1);
|
|
if(*ptr == 0xFFFF) {
|
|
/* FIXME: ignore HIBYTE? */
|
|
ClassId = *(ptr+1);
|
|
ptr+=2;
|
|
}else{
|
|
ClassId = (DWORD)ptr;
|
|
ptr += STRING32_lstrlenW(ptr)+1;
|
|
}
|
|
if(*ptr == 0xFFFF) {
|
|
Text = *(ptr+1);
|
|
ptr+=2;
|
|
}else{
|
|
Text = (DWORD)ptr;
|
|
ptr += STRING32_lstrlenW(ptr)+1;
|
|
}
|
|
if(!HIWORD(ClassId))
|
|
{
|
|
switch(LOWORD(ClassId))
|
|
{
|
|
case 0x80: STRING32_AnsiToUni(buffer,"BUTTON" ); break;
|
|
case 0x81: STRING32_AnsiToUni( buffer, "EDIT" ); break;
|
|
case 0x82: STRING32_AnsiToUni( buffer, "STATIC" ); break;
|
|
case 0x83: STRING32_AnsiToUni( buffer, "LISTBOX" ); break;
|
|
case 0x84: STRING32_AnsiToUni( buffer, "SCROLLBAR" ); break;
|
|
case 0x85: STRING32_AnsiToUni( buffer, "COMBOBOX" ); break;
|
|
default: buffer[0] = '\0'; break;
|
|
}
|
|
ClassId = (DWORD)buffer;
|
|
}
|
|
/*FIXME: debugging output*/
|
|
/*FIXME: local edit ?*/
|
|
exStyle = dlgitem->dwExtendedStyle|WS_EX_NOPARENTNOTIFY;
|
|
if(*ptr)
|
|
{
|
|
fprintf(stderr,"having data\n");
|
|
}
|
|
ptr++;
|
|
hwndCtrl = USER32_CreateWindowExW(WS_EX_NOPARENTNOTIFY,
|
|
(LPWSTR)ClassId, (LPWSTR)Text,
|
|
dlgitem->style | WS_CHILD,
|
|
dlgitem->x * xUnit / 4,
|
|
dlgitem->y * yUnit / 8,
|
|
dlgitem->cx * xUnit / 4,
|
|
dlgitem->cy * yUnit / 8,
|
|
hwnd, (HMENU)((DWORD)dlgitem->id),
|
|
hInst, (SEGPTR)0 );
|
|
SetWindowPos( hwndCtrl, HWND_BOTTOM, 0, 0, 0, 0,
|
|
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
|
|
/* Send initialisation messages to the control */
|
|
if (hFont) SendMessage( hwndCtrl, WM_SETFONT, (WPARAM)hFont, 0 );
|
|
if (SendMessage( hwndCtrl, WM_GETDLGCODE, 0, 0 ) & DLGC_DEFPUSHBUTTON)
|
|
{
|
|
/* If there's already a default push-button, set it back */
|
|
/* to normal and use this one instead. */
|
|
if (hwndDefButton)
|
|
SendMessage( hwndDefButton, BM_SETSTYLE, BS_PUSHBUTTON, FALSE);
|
|
hwndDefButton = hwndCtrl;
|
|
dlgInfo->msgResult = GetWindowWord( hwndCtrl, GWW_ID );
|
|
}
|
|
}
|
|
dprintf_dialog(stddeb, " END\n" );
|
|
|
|
/* Initialise dialog extra data */
|
|
ALIAS_RegisterAlias(0,0,lpDialogFunc);
|
|
dlgInfo->dlgProc = lpDialogFunc;
|
|
dlgInfo->hUserFont = hFont;
|
|
dlgInfo->hMenu = hMenu;
|
|
dlgInfo->xBaseUnit = xUnit;
|
|
dlgInfo->yBaseUnit = yUnit;
|
|
dlgInfo->hwndFocus = DIALOG_GetFirstTabItem( hwnd );
|
|
|
|
/* Send initialisation messages and set focus */
|
|
if (dlgInfo->hUserFont)
|
|
SendMessage( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
|
|
if (SendMessage( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, dwInitParam ))
|
|
SetFocus( dlgInfo->hwndFocus );
|
|
if (dlgTempl->style & WS_VISIBLE) ShowWindow(hwnd, SW_SHOW);
|
|
return hwnd;
|
|
}
|
|
|
|
HWND USER32_CreateDialogIndirectParamW(HINSTANCE hInst,LPVOID dlgTempl,
|
|
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
|
|
{
|
|
return USER32_CreateDialogIndirectParamAorW(hInst,dlgTempl,hWndParent,
|
|
lpDialogFunc,dwInitParam,0);
|
|
}
|
|
|
|
HWND USER32_CreateDialogIndirectParamA(HINSTANCE hInst,LPVOID dlgTempl,
|
|
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
|
|
{
|
|
return USER32_CreateDialogIndirectParamAorW(hInst,dlgTempl,hWndParent,
|
|
lpDialogFunc,dwInitParam,1);
|
|
}
|
|
|
|
HWND USER32_CreateDialogParamW(HINSTANCE hInst,LPCWSTR lpszName,
|
|
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
|
|
{
|
|
HANDLE32 hrsrc;
|
|
hrsrc=FindResource32(hInst,lpszName,(LPWSTR)RT_DIALOG);
|
|
if(!hrsrc)return 0;
|
|
return USER32_CreateDialogIndirectParamW(hInst,
|
|
LoadResource32(hInst, hrsrc),hWndParent,lpDialogFunc,dwInitParam);
|
|
}
|
|
|
|
HWND USER32_CreateDialogParamA(HINSTANCE hInst,LPCSTR lpszName,
|
|
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
|
|
{
|
|
HWND res;
|
|
if(!HIWORD(lpszName))
|
|
res = USER32_CreateDialogParamW(hInst,(LPCWSTR)lpszName,hWndParent,
|
|
lpDialogFunc,dwInitParam);
|
|
else{
|
|
LPWSTR uni=STRING32_DupAnsiToUni(lpszName);
|
|
res=USER32_CreateDialogParamW(hInst,uni,hWndParent,
|
|
lpDialogFunc,dwInitParam);
|
|
}
|
|
return res;
|
|
}
|
|
|
|
int USER32_DialogBoxIndirectParamW(HINSTANCE hInstance,LPVOID dlgTempl,
|
|
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
|
|
{
|
|
HWND hwnd;
|
|
hwnd = USER32_CreateDialogIndirectParamW(hInstance,dlgTempl,
|
|
hWndParent,lpDialogFunc,dwInitParam);
|
|
if(hwnd)return DIALOG_DoDialogBox(hwnd,hWndParent);
|
|
return -1;
|
|
}
|
|
|
|
int USER32_DialogBoxIndirectParamA(HINSTANCE hInstance,LPVOID dlgTempl,
|
|
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
|
|
{
|
|
HWND hwnd;
|
|
hwnd = USER32_CreateDialogIndirectParamA(hInstance,dlgTempl,
|
|
hWndParent,lpDialogFunc,dwInitParam);
|
|
if(hwnd)return DIALOG_DoDialogBox(hwnd,hWndParent);
|
|
return -1;
|
|
}
|
|
|
|
int USER32_DialogBoxParamW(HINSTANCE hInstance,LPCWSTR lpszName,
|
|
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
|
|
{
|
|
HWND hwnd;
|
|
hwnd = USER32_CreateDialogParamW(hInstance,lpszName,
|
|
hWndParent,lpDialogFunc,dwInitParam);
|
|
if(hwnd)return DIALOG_DoDialogBox(hwnd,hWndParent);
|
|
return -1;
|
|
}
|
|
|
|
int USER32_DialogBoxParamA(HINSTANCE hInstance,LPCSTR lpszName,
|
|
HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam)
|
|
{
|
|
HWND hwnd;
|
|
hwnd = USER32_CreateDialogParamA(hInstance,lpszName,
|
|
hWndParent,lpDialogFunc,dwInitParam);
|
|
if(hwnd)return DIALOG_DoDialogBox(hwnd,hWndParent);
|
|
return -1;
|
|
}
|