From ff7ea1c1f55618ea626b42de00ea7a48138a03cc Mon Sep 17 00:00:00 2001 From: Andrew Greenwood Date: Sun, 17 Aug 2003 20:29:57 +0000 Subject: [PATCH] * Implemented EnabledWindow and IsWindowEnabled (seem to work OK) * Modified DrawState slightly (still doesn't work very well) svn path=/trunk/; revision=5622 --- reactos/lib/user32/misc/stubs.c | 15 +-------------- reactos/lib/user32/windows/draw.c | 11 ++++++++++- reactos/lib/user32/windows/input.c | 14 ++++++++++---- reactos/lib/user32/windows/window.c | 18 +++++++++++++++++- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/reactos/lib/user32/misc/stubs.c b/reactos/lib/user32/misc/stubs.c index 423f293c728..c6e6310c101 100644 --- a/reactos/lib/user32/misc/stubs.c +++ b/reactos/lib/user32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.30 2003/08/14 20:25:52 royce Exp $ +/* $Id: stubs.c,v 1.31 2003/08/17 20:29:56 silverblade Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -220,19 +220,6 @@ GetSystemMenu( } -/* - * @unimplemented - */ -WINBOOL -STDCALL -IsWindowEnabled( - HWND hWnd) -{ - UNIMPLEMENTED; - return FALSE; -} - - /* * @unimplemented */ diff --git a/reactos/lib/user32/windows/draw.c b/reactos/lib/user32/windows/draw.c index a890f4be2a5..2a8c4e8239e 100644 --- a/reactos/lib/user32/windows/draw.c +++ b/reactos/lib/user32/windows/draw.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: draw.c,v 1.21 2003/08/17 19:07:11 silverblade Exp $ +/* $Id: draw.c,v 1.22 2003/08/17 20:29:57 silverblade Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/input.c @@ -1615,12 +1615,16 @@ WINBOOL INTERNAL_DrawStateDraw(HDC hdc, UINT type, DRAWSTATEPROC lpOutputFunc, BOOL retval = FALSE; INT cx = rc->right - rc->left; INT cy = rc->bottom - rc->top; + + if (((type == DST_TEXT) || (type == DST_PREFIXTEXT)) && (lpOutputFunc)) + type = DST_COMPLEX; switch(type) { case DST_TEXT : case DST_PREFIXTEXT : { + DbgPrint("DST_TEXT\n"); if (unicode) return DrawTextW(hdc, (LPWSTR)lData, (INT)wData, rc, dtflags); else @@ -1641,10 +1645,12 @@ WINBOOL INTERNAL_DrawStateDraw(HDC hdc, UINT type, DRAWSTATEPROC lpOutputFunc, case DST_COMPLEX : { + DbgPrint("DST_COMPLEX\n"); // Call lpOutputFunc, if necessary if (lpOutputFunc) { OffsetViewportOrgEx(hdc, rc->left, rc->top, NULL); + DbgPrint("Calling lpOutputFunc\n"); retval = lpOutputFunc(hdc, lData, wData, cx, cy); OffsetViewportOrgEx(hdc, -rc->left, -rc->top, NULL); return retval; @@ -1769,8 +1775,11 @@ WINBOOL INTERNAL_DrawState( { DbgPrint("DSS_NORMAL\n"); SetRect(&rect, x, y, x + cx, y + cy); + DbgPrint("L == %d R == %d T == %d B == %d\n", rect.left, rect.right, rect.top, rect.bottom); return INTERNAL_DrawStateDraw(hdc, type, lpOutputFunc, lData, wData, &rect, dtflags, unicode); } + + // WARNING: FROM THIS POINT ON THE CODE IS VERY BUGGY // Set the rectangle to that of the memory DC SetRect(&rect, 0, 0, cx, cy); diff --git a/reactos/lib/user32/windows/input.c b/reactos/lib/user32/windows/input.c index c2c1d5fb39e..a06d3466cbf 100644 --- a/reactos/lib/user32/windows/input.c +++ b/reactos/lib/user32/windows/input.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: input.c,v 1.11 2003/08/04 16:56:40 gdalsnes Exp $ +/* $Id: input.c,v 1.12 2003/08/17 20:29:57 silverblade Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/input.c @@ -72,14 +72,20 @@ BlockInput(WINBOOL fBlockIt) /* - * @unimplemented + * @implemented */ WINBOOL STDCALL EnableWindow(HWND hWnd, WINBOOL bEnable) { - UNIMPLEMENTED; - return FALSE; + LONG Style = GetWindowLongW(hWnd, GWL_STYLE); + Style = bEnable ? Style & ~WS_DISABLED : Style | WS_DISABLED; + SetWindowLongW(hWnd, GWL_STYLE, Style); + + SendMessageA(hWnd, WM_ENABLE, (LPARAM) IsWindowEnabled(hWnd), 0); + + // Return nonzero if it was disabled, or zero if it wasn't: + return IsWindowEnabled(hWnd); } diff --git a/reactos/lib/user32/windows/window.c b/reactos/lib/user32/windows/window.c index b89ed726dbf..a7241005f45 100644 --- a/reactos/lib/user32/windows/window.c +++ b/reactos/lib/user32/windows/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.61 2003/08/17 19:07:11 silverblade Exp $ +/* $Id: window.c,v 1.62 2003/08/17 20:29:57 silverblade Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -1287,6 +1287,22 @@ IsWindowVisible(HWND hWnd) } +/* + * @implemented + */ +WINBOOL +STDCALL +IsWindowEnabled( + HWND hWnd) +{ + // AG: I don't know if child windows are affected if the parent is + // disabled. I think they stop processing messages but stay appearing + // as enabled. + + return (! (GetWindowLongW(hWnd, GWL_STYLE) & WS_DISABLED)); +} + + /* * @implemented */