mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 13:10:28 +00:00
b1bac32007
Sun Dec 15 16:18:15 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [graphics/x11drv/bitblt.c] Fixed BITBLT_StretchImage for partially covered or inverted bitmaps. * [objects/dib.c] Fixed the upside-down bitmap problem. Sat Dec 14 02:49:57 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk> * [if1632/user32.spec] IsMenu and RemoveMenu added (use existing Win16 functions). * [include/windows.h] Corrections to BITMAPINFOHEADER structure. * [loader/module.c] [if1632/kernel32.spec] New function GetModuleFileName32A (heavily based on original Win16 version). * [loader/pe_image.c] Hack to allow files with short PE header to be loaded (e.g. COMDLG32.DLL from Win32s). * [misc/winsock_async.c] #if out EIDRM case (not present in FreeBSD). * [tools/build.c] Remove trailing comments from .s files generated by build as these break assembly when not run through pre-processor. * [windows/graphics.c] [if1632/gdi32.spec] New function Polyline32 - based on original Polyline. Needs metafile support adding still. Fri Dec 13 13:04:06 1996 Bruce Milner <Bruce.Milner@genetics.utah.edu> * [win32/findfile.c] [if1632/kernel.spec] FindFirstFile32A(): Use dos current directory for drive prefixes. FindNextFile32A(): Fill in file attribute information. Implement FindFirstFile16, FindNextFile16, FindClose16. * [files/drive.c] GetCurrentDirectory32A - Fix problem with null 3rd character in string. Tue Dec 10 14:49:07 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [windows/painting.c][windows/message.c] Don't use linked lists to call SendMessage(), for it might destroy the current listentry. * [misc/registry.c] Fixed temporary file saving (rename doesn't work across partitions). * [files/*.c] GetFullPathName*,GetDriveType32A fixed, CreateDirectoryEx*, GetVolumeInformation32W fixed. * [win32/process.c][if1632/kernel.spec][if1632/kernel32.spec] LoadLibrary* updated to new naming std., *32W added. * [win32/console.c] [include/wincon.h] Additions for NT commandline executables. * [if1632/advapi32.spec][if1632/kernel32.spec][win32/init.c] GetUserName32W added, GetComputerName32W added, GetStartupInfo32W added, GetSystemInfo updated to NT standard. * [windows/msgbox.c][misc/shell.c][windows/graphics.c] MessageBox32W, ShellAbout32W, CommandLineToArgvW, Polygon32 added. * [misc/crtdll.c][include/crtdll.h][if1632/crtdll.spec][misc/ntdll.c] [if1632/ntdll.spec] Lot of new unicode functions added (needed for NT). * [loader/pe_image.c] NtCurrentTeb added. Tue Dec 10 22:39:33 1996 Albrecht Kleine <kleine@ak.sax.de> * [windows/keyboard.c] Rewrote function TranslateAccelerator(). Mon Dec 9 14:52:13 1996 Slaven Rezic <eserte@cs.tu-berlin.de> * [windows/defwnd.c] DEFWND_SetText(): Set icon name. Sun Dec 8 23:30:00 1996 Alex Korobka <alex@trantor.pharm.sunysb.edu> * [loader/signal.c] [misc/winsock.c] [misc/winsock_async.c] [if1632/winsock.spec] IPC resource cleanup, bugfixes. * [windows/dialog.c] [windows/defdlg.c] More DefDlgProc() fixes. Sun Dec 8 14:01:42 1996 Vadim Strizhevsky <striv@ms.com> * [misc/clipboard.c] [objects/font.c] [win32/init.c] [win32/newfns.c] [windows/graphics.c] Added a few WIN32 functions which needed to run some win32 accessories. Clock should now work almost as well as 16 bit version. Add: RegisterClipboardFormat32W GetTextExtentExPoint32* GetModuleHandleW, DisableThreadLibraryCalls (empty stub), Polygon32 Fix: Polygon16 possible memory leak on error return.
242 lines
7.2 KiB
C
242 lines
7.2 KiB
C
/*
|
|
* Message boxes
|
|
*
|
|
* Copyright 1995 Bernd Schmidt
|
|
*
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <malloc.h>
|
|
#include "windows.h"
|
|
#include "dlgs.h"
|
|
#include "module.h"
|
|
#include "win.h"
|
|
#include "resource.h"
|
|
#include "task.h"
|
|
#include "string32.h"
|
|
|
|
typedef struct {
|
|
LPCSTR title;
|
|
LPCSTR text;
|
|
WORD type;
|
|
} MSGBOX, *LPMSGBOX;
|
|
|
|
LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM16 wParam,LPARAM lParam)
|
|
{
|
|
LPMSGBOX lpmb;
|
|
RECT16 rect, textrect;
|
|
HWND hItem;
|
|
HDC32 hdc;
|
|
LONG lRet;
|
|
int i, buttons, bwidth, bheight, theight, wwidth, bpos;
|
|
int borheight, iheight, tiheight;
|
|
|
|
switch(message) {
|
|
case WM_INITDIALOG:
|
|
lpmb = (LPMSGBOX)lParam;
|
|
if (lpmb->title) SetWindowText32A(hwnd, lpmb->title);
|
|
SetWindowText32A(GetDlgItem(hwnd, 100), lpmb->text);
|
|
/* Hide not selected buttons */
|
|
switch(lpmb->type & MB_TYPEMASK) {
|
|
case MB_OK:
|
|
ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
|
|
/* fall through */
|
|
case MB_OKCANCEL:
|
|
ShowWindow(GetDlgItem(hwnd, 3), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 4), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 5), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 6), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 7), SW_HIDE);
|
|
break;
|
|
case MB_ABORTRETRYIGNORE:
|
|
ShowWindow(GetDlgItem(hwnd, 1), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 6), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 7), SW_HIDE);
|
|
break;
|
|
case MB_YESNO:
|
|
ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
|
|
/* fall through */
|
|
case MB_YESNOCANCEL:
|
|
ShowWindow(GetDlgItem(hwnd, 1), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 3), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 4), SW_HIDE);
|
|
ShowWindow(GetDlgItem(hwnd, 5), SW_HIDE);
|
|
break;
|
|
}
|
|
/* Set the icon */
|
|
switch(lpmb->type & MB_ICONMASK) {
|
|
case MB_ICONEXCLAMATION:
|
|
SendDlgItemMessage16(hwnd, stc1, STM_SETICON,
|
|
(WPARAM16)LoadIcon16(0, IDI_EXCLAMATION), 0);
|
|
break;
|
|
case MB_ICONQUESTION:
|
|
SendDlgItemMessage16(hwnd, stc1, STM_SETICON,
|
|
(WPARAM16)LoadIcon16(0, IDI_QUESTION), 0);
|
|
break;
|
|
case MB_ICONASTERISK:
|
|
SendDlgItemMessage16(hwnd, stc1, STM_SETICON,
|
|
(WPARAM16)LoadIcon16(0, IDI_ASTERISK), 0);
|
|
break;
|
|
case MB_ICONHAND:
|
|
default:
|
|
SendDlgItemMessage16(hwnd, stc1, STM_SETICON,
|
|
(WPARAM16)LoadIcon16(0, IDI_HAND), 0);
|
|
break;
|
|
}
|
|
|
|
/* Position everything */
|
|
GetWindowRect16(hwnd, &rect);
|
|
borheight = rect.bottom - rect.top;
|
|
wwidth = rect.right - rect.left;
|
|
GetClientRect16(hwnd, &rect);
|
|
borheight -= rect.bottom - rect.top;
|
|
|
|
/* Get the icon height */
|
|
GetWindowRect16(GetDlgItem(hwnd, 1088), &rect);
|
|
iheight = rect.bottom - rect.top;
|
|
|
|
/* Get the number of visible buttons and their width */
|
|
GetWindowRect16(GetDlgItem(hwnd, 2), &rect);
|
|
bheight = rect.bottom - rect.top;
|
|
bwidth = rect.left;
|
|
GetWindowRect16(GetDlgItem(hwnd, 1), &rect);
|
|
bwidth -= rect.left;
|
|
for (buttons = 0, i = 1; i < 8; i++)
|
|
{
|
|
hItem = GetDlgItem(hwnd, i);
|
|
if (GetWindowLong32A(hItem, GWL_STYLE) & WS_VISIBLE) buttons++;
|
|
}
|
|
|
|
/* Get the text size */
|
|
hItem = GetDlgItem(hwnd, 100);
|
|
GetWindowRect16(hItem, &textrect);
|
|
MapWindowPoints16(0, hwnd, (LPPOINT16)&textrect, 2);
|
|
|
|
GetClientRect16(hItem, &rect);
|
|
hdc = GetDC32(hItem);
|
|
lRet = DrawText16( hdc, lpmb->text, -1, &rect,
|
|
DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT);
|
|
theight = rect.bottom - rect.top;
|
|
tiheight = 16 + MAX(iheight, theight);
|
|
ReleaseDC32(hItem, hdc);
|
|
|
|
/* Position the text */
|
|
SetWindowPos(hItem, 0, textrect.left, (tiheight - theight) / 2,
|
|
rect.right - rect.left, theight,
|
|
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
|
|
|
|
/* Position the icon */
|
|
hItem = GetDlgItem(hwnd, 1088);
|
|
GetWindowRect16(hItem, &rect);
|
|
MapWindowPoints16(0, hwnd, (LPPOINT16)&rect, 2);
|
|
SetWindowPos(hItem, 0, rect.left, (tiheight - iheight) / 2, 0, 0,
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
|
|
|
|
/* Resize the window */
|
|
SetWindowPos(hwnd, 0, 0, 0, wwidth, 8 + tiheight + bheight + borheight,
|
|
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
|
|
|
|
/* Position the buttons */
|
|
bpos = (wwidth - bwidth * buttons) / 2;
|
|
GetWindowRect16(GetDlgItem(hwnd, 1), &rect);
|
|
for (buttons = i = 0; i < 7; i++) {
|
|
/* some arithmetic to get the right order for YesNoCancel windows */
|
|
hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
|
|
if (GetWindowLong32A(hItem, GWL_STYLE) & WS_VISIBLE) {
|
|
if (buttons++ == ((lpmb->type & MB_DEFMASK) >> 8)) {
|
|
SetFocus32(hItem);
|
|
SendMessage32A( hItem, BM_SETSTYLE32, BS_DEFPUSHBUTTON, TRUE );
|
|
}
|
|
SetWindowPos(hItem, 0, bpos, tiheight, 0, 0,
|
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
|
|
bpos += bwidth;
|
|
}
|
|
}
|
|
return 0;
|
|
break;
|
|
|
|
case WM_COMMAND:
|
|
switch (wParam) {
|
|
case IDOK:
|
|
case IDCANCEL:
|
|
case IDABORT:
|
|
case IDRETRY:
|
|
case IDIGNORE:
|
|
case IDYES:
|
|
case IDNO:
|
|
EndDialog(hwnd, wParam);
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* MessageBox16 (USER.1)
|
|
*/
|
|
INT16 MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
|
|
{
|
|
return MessageBox32A( hwnd, text, title, type );
|
|
}
|
|
|
|
/**************************************************************************
|
|
* MessageBox32A (USER32.390)
|
|
*/
|
|
INT32 MessageBox32A( HWND32 hWnd, LPCSTR text, LPCSTR title, UINT32 type )
|
|
{
|
|
HANDLE16 handle;
|
|
MSGBOX mbox;
|
|
int ret;
|
|
|
|
mbox.title = title;
|
|
mbox.text = text;
|
|
mbox.type = type;
|
|
|
|
handle = SYSRES_LoadResource( SYSRES_DIALOG_MSGBOX );
|
|
if (!handle) return 0;
|
|
ret = DialogBoxIndirectParam16( WIN_GetWindowInstance(hWnd),
|
|
handle, hWnd,
|
|
MODULE_GetWndProcEntry16("SystemMessageBoxProc"),
|
|
(LONG)&mbox );
|
|
SYSRES_FreeResource( handle );
|
|
return ret;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* MessageBox32W (USER32.395)
|
|
*/
|
|
INT32 MessageBox32W( HWND32 hWnd, LPCWSTR text, LPCWSTR title, UINT32 type )
|
|
{
|
|
HANDLE16 handle;
|
|
MSGBOX mbox;
|
|
int ret;
|
|
|
|
mbox.title = title?STRING32_DupUniToAnsi(title):NULL;
|
|
mbox.text = text?STRING32_DupUniToAnsi(text):NULL;
|
|
mbox.type = type;
|
|
|
|
fprintf(stderr,"MessageBox(%s,%s)\n",mbox.text,mbox.title);
|
|
handle = SYSRES_LoadResource( SYSRES_DIALOG_MSGBOX );
|
|
if (!handle) return 0;
|
|
ret = DialogBoxIndirectParam16( WIN_GetWindowInstance(hWnd),
|
|
handle, hWnd,
|
|
MODULE_GetWndProcEntry16("SystemMessageBoxProc"),
|
|
(LONG)&mbox );
|
|
SYSRES_FreeResource( handle );
|
|
if (title) free(mbox.title);
|
|
if (text) free(mbox.text);
|
|
return ret;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* FatalAppExit [USER.137]
|
|
*/
|
|
|
|
void FatalAppExit(UINT fuAction, LPCSTR str)
|
|
{
|
|
MessageBox16(0, str, NULL, MB_SYSTEMMODAL | MB_OK);
|
|
TASK_KillCurrentTask(0);
|
|
}
|