mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
1285c2f9e9
Mon May 6 12:56:26 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [DEVELOPERS-HINTS] Added paragraph on naming conventions for Win16/Win32/Winelib. * [controls/menu.c] Create a default system menu that is the same for all windows instead of making a copy every time. * [include/wintypes.h] Added WINELIB_NAME and DECL_WINELIB_TYPE macros. Added xx16 and xx32 definitions for most types. General clean-up. * [memory/global.c] [memory/local.c] [*/*] Renamed Global and Local heap functions to xxx16. Added all xxx32 versions of the same functions. * [memory/selector.c] Mask out lower bits of selector in FreeSelector(). * [misc/lstr.c] Fixed wvsprintf(). * [windows/class.c] Changed the class structure to make Win32 support easier. * [windows/defwnd.c] Added handling of WM_INITMENUPOPUP for system menu to gray out invalid options. * [windows/winpos.c] Bug fix: the WINDOSPOS structure pointer in WM_NCCALCSIZE must be a SEGPTR. Sun May 5 03:51:26 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk> * [memory/local.c] Implementation of moveable and (rudimentary) support for discardable local memory, plus several bug fixes. Sat May 4 18:33:35 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [include/windows.h] [windows/win.c] [if1632/user.spec] FindWindowEx() implemented (someone reported it was missing for FrameMaker 4.1). * [if1632/kernel32.spec] [if1632/user32.spec] [win32/memory.c] [win32/resource.c] Misc small stubs/small functions which bring win95 binaries further down the road. (IsBadCodePtr, LocalReAlloc,GetCursorPos) Small fix in WIN32_LoadAcceleratorsA. Fri May 3 19:43:12 1996 Frans van Dorsselaer <dorssel@rulhm1.LeidenUniv.nl> * [controls/edit.c] [controls/EDIT.TODO] Changed / fixed some types and typecasts. Fixed the scrollbar reset after WM_SETHANDLE / WM_SETTEXT. Added heap initialization in WM_CREATE. Fri May 3 19:30:02 1996 Greg Kreider <kreider@natlab.research.philips.com> * [controls/combo.c] [controls/listbox.c] Pass WM_[HV]SCROLL to listbox, but not combo. Don't try to redraw non-existant scroll bars (changes dwStyle flags). Combo box gets border. Combo box includes button (otherwise button won't trigger dropdown). Proper border around RectButton. Check size consistancy of combo, listbox, and button after resizing or before painting. These routines still aren't completely correct. Localize size checks in separate routines. Listboxes are white. Thu May 2 19:21:23 1996 Albrecht Kleine <kleine@ak.sax.de> * [controls/combo.c][include/commdlg.h][include/commdlg.c] [resources/sysres_De.rc][resources/sysres_En.rc] Introduced ChooseFont dialog, but needed some patches in handling of comboboxes with edit controls. Tue Apr 30 00:33:27 1996 Ulrich Schmid <uschmid@mail.hh.provi.de> * [programs/winhelp/*] Added a help viewer and a simple `.hlp' to `.sgml' converter. Mon Apr 29 14:17:57 1996 Tristan Tarrant <tst@sthinc.demon.co.uk> * [resources/sysres_*.rc] [misc/shell.c] Modified size of "About" dialog boxes. Sat Apr 27 18:10:11 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/Makefile.in][loader/builtin.c] crtdll.spec, ntdll.spec, wsock32.spec: new files. * [loader/pe_image.c] Fix error message if import by ordinal failed.
223 lines
6.0 KiB
C
223 lines
6.0 KiB
C
/*
|
|
* Default dialog procedure
|
|
*
|
|
* Copyright 1993 Alexandre Julliard
|
|
*
|
|
*/
|
|
|
|
#include "windows.h"
|
|
#include "dialog.h"
|
|
#include "win.h"
|
|
#include "stddebug.h"
|
|
/* #define DEBUG_DIALOG */
|
|
#include "debug.h"
|
|
|
|
/***********************************************************************
|
|
* DEFDLG_SetFocus
|
|
*
|
|
* Set the focus to a control of the dialog, selecting the text if
|
|
* the control is an edit dialog.
|
|
*/
|
|
static void DEFDLG_SetFocus( HWND hwndDlg, HWND hwndCtrl )
|
|
{
|
|
HWND hwndPrev = GetFocus();
|
|
|
|
if (IsChild( hwndDlg, hwndPrev ))
|
|
{
|
|
if (SendMessage( hwndPrev, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
|
|
SendMessage( hwndPrev, EM_SETSEL, TRUE, MAKELONG( -1, 0 ) );
|
|
}
|
|
if (SendMessage( hwndCtrl, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
|
|
SendMessage( hwndCtrl, EM_SETSEL, FALSE, MAKELONG( 0, -1 ) );
|
|
SetFocus( hwndCtrl );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* DEFDLG_SaveFocus
|
|
*/
|
|
static BOOL DEFDLG_SaveFocus( HWND hwnd, DIALOGINFO *infoPtr )
|
|
{
|
|
HWND hwndFocus = GetFocus();
|
|
|
|
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return FALSE;
|
|
if (!infoPtr->hwndFocus) return FALSE; /* Already saved */
|
|
infoPtr->hwndFocus = hwndFocus;
|
|
/* Remove default button */
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* DEFDLG_RestoreFocus
|
|
*/
|
|
static BOOL DEFDLG_RestoreFocus( HWND hwnd, DIALOGINFO *infoPtr )
|
|
{
|
|
if (!infoPtr->hwndFocus || IsIconic(hwnd)) return FALSE;
|
|
if (!IsWindow( infoPtr->hwndFocus )) return FALSE;
|
|
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
|
|
infoPtr->hwndFocus = 0;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
#ifdef SUPERFLUOUS_FUNCTIONS
|
|
/***********************************************************************
|
|
* DEFDLG_FindDefButton
|
|
*
|
|
* Find the current default push-button.
|
|
*/
|
|
static HWND DEFDLG_FindDefButton( HWND hwndDlg )
|
|
{
|
|
HWND hwndChild = GetWindow( hwndDlg, GW_CHILD );
|
|
while (hwndChild)
|
|
{
|
|
if (SendMessage( hwndChild, WM_GETDLGCODE, 0, 0 ) & DLGC_DEFPUSHBUTTON)
|
|
break;
|
|
hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
|
|
}
|
|
return hwndChild;
|
|
}
|
|
#endif
|
|
|
|
|
|
/***********************************************************************
|
|
* DEFDLG_SetDefButton
|
|
*
|
|
* Set the new default button to be hwndNew.
|
|
*/
|
|
static BOOL DEFDLG_SetDefButton( HWND hwndDlg, DIALOGINFO *dlgInfo,
|
|
HWND hwndNew )
|
|
{
|
|
if (hwndNew &&
|
|
!(SendMessage( hwndNew, WM_GETDLGCODE, 0, 0 ) & DLGC_UNDEFPUSHBUTTON))
|
|
return FALSE; /* Destination is not a push button */
|
|
|
|
if (dlgInfo->msgResult) /* There's already a default pushbutton */
|
|
{
|
|
HWND hwndOld = GetDlgItem( hwndDlg, dlgInfo->msgResult );
|
|
if (SendMessage( hwndOld, WM_GETDLGCODE, 0, 0 ) & DLGC_DEFPUSHBUTTON)
|
|
SendMessage( hwndOld, BM_SETSTYLE, BS_PUSHBUTTON, TRUE );
|
|
}
|
|
if (hwndNew)
|
|
{
|
|
SendMessage( hwndNew, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
|
|
dlgInfo->msgResult = GetDlgCtrlID( hwndNew );
|
|
}
|
|
else dlgInfo->msgResult = 0;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* DefDlgProc (USER.308)
|
|
*/
|
|
LRESULT DefDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
|
{
|
|
DIALOGINFO * dlgInfo;
|
|
BOOL result = FALSE;
|
|
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
|
|
|
if (!wndPtr) return 0;
|
|
dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
|
|
|
|
dlgInfo->msgResult = 0;
|
|
if (dlgInfo->dlgProc)
|
|
{
|
|
/* Call dialog procedure */
|
|
result = (BOOL)CallWindowProc( dlgInfo->dlgProc, hwnd,
|
|
msg, wParam, lParam );
|
|
|
|
/* Check if window destroyed by dialog procedure */
|
|
wndPtr = WIN_FindWndPtr( hwnd );
|
|
if (!wndPtr) return result;
|
|
}
|
|
|
|
if (!result) switch(msg)
|
|
{
|
|
case WM_INITDIALOG:
|
|
break;
|
|
|
|
case WM_ERASEBKGND:
|
|
FillWindow( hwnd, hwnd, (HDC)wParam, (HBRUSH)CTLCOLOR_DLG );
|
|
return TRUE;
|
|
|
|
case WM_NCDESTROY:
|
|
|
|
/* Free dialog heap (if created) */
|
|
if (dlgInfo->hDialogHeap)
|
|
{
|
|
GlobalUnlock16(dlgInfo->hDialogHeap);
|
|
GlobalFree16(dlgInfo->hDialogHeap);
|
|
dlgInfo->hDialogHeap = 0;
|
|
}
|
|
|
|
/* Delete font */
|
|
if (dlgInfo->hUserFont)
|
|
{
|
|
DeleteObject( dlgInfo->hUserFont );
|
|
dlgInfo->hUserFont = 0;
|
|
}
|
|
|
|
/* Delete menu */
|
|
if (dlgInfo->hMenu)
|
|
{
|
|
DestroyMenu( dlgInfo->hMenu );
|
|
dlgInfo->hMenu = 0;
|
|
}
|
|
|
|
/* Window clean-up */
|
|
DefWindowProc( hwnd, msg, wParam, lParam );
|
|
break;
|
|
|
|
case WM_SHOWWINDOW:
|
|
if (!wParam) DEFDLG_SaveFocus( hwnd, dlgInfo );
|
|
return DefWindowProc( hwnd, msg, wParam, lParam );
|
|
|
|
case WM_ACTIVATE:
|
|
if (wParam) DEFDLG_RestoreFocus( hwnd, dlgInfo );
|
|
else DEFDLG_SaveFocus( hwnd, dlgInfo );
|
|
break;
|
|
|
|
case WM_SETFOCUS:
|
|
DEFDLG_RestoreFocus( hwnd, dlgInfo );
|
|
break;
|
|
|
|
case DM_SETDEFID:
|
|
if (dlgInfo->fEnd) return TRUE;
|
|
DEFDLG_SetDefButton( hwnd, dlgInfo,
|
|
wParam ? GetDlgItem( hwnd, wParam ) : 0 );
|
|
return TRUE;
|
|
|
|
case DM_GETDEFID:
|
|
if (dlgInfo->fEnd || !dlgInfo->msgResult) return 0;
|
|
return MAKELONG( dlgInfo->msgResult, DC_HASDEFID );
|
|
|
|
case WM_NEXTDLGCTL:
|
|
{
|
|
HWND hwndDest = (HWND)wParam;
|
|
if (!lParam)
|
|
{
|
|
HWND hwndPrev = GetFocus();
|
|
if (!hwndPrev) /* Set focus to the first item */
|
|
hwndDest = DIALOG_GetFirstTabItem( hwnd );
|
|
else
|
|
hwndDest = GetNextDlgTabItem( hwnd, hwndPrev, wParam );
|
|
}
|
|
if (hwndDest) DEFDLG_SetFocus( hwnd, hwndDest );
|
|
DEFDLG_SetDefButton( hwnd, dlgInfo, hwndDest );
|
|
}
|
|
break;
|
|
|
|
case WM_CLOSE:
|
|
EndDialog( hwnd, TRUE );
|
|
DestroyWindow( hwnd );
|
|
return 0;
|
|
|
|
default:
|
|
return DefWindowProc( hwnd, msg, wParam, lParam );
|
|
}
|
|
|
|
return result;
|
|
}
|