From 2f3e32bfea506cc750402f43f5d505a4ad76678b Mon Sep 17 00:00:00 2001 From: Jason Filby Date: Fri, 20 Sep 2002 21:55:50 +0000 Subject: [PATCH] Windows now show captions svn path=/trunk/; revision=3526 --- reactos/lib/user32/misc/desktop.c | 16 +++++++++++++++- reactos/lib/user32/windows/defwnd.c | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/reactos/lib/user32/misc/desktop.c b/reactos/lib/user32/misc/desktop.c index 4db10d5b683..3a305f4238d 100644 --- a/reactos/lib/user32/misc/desktop.c +++ b/reactos/lib/user32/misc/desktop.c @@ -1,4 +1,4 @@ -/* $Id: desktop.c,v 1.7 2002/09/17 23:46:23 dwelch Exp $ +/* $Id: desktop.c,v 1.8 2002/09/20 21:55:50 jfilby Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -33,6 +33,13 @@ SystemParametersInfoW(UINT uiAction, PVOID pvParam, UINT fWinIni) { + NONCLIENTMETRICS *nclm; + + /* FIXME: This should be obtained from the registry */ + static LOGFONT CaptionFont = + { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET, + 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"Timmons" }; + switch (uiAction) { case SPI_GETWORKAREA: @@ -43,6 +50,13 @@ SystemParametersInfoW(UINT uiAction, ((PRECT)pvParam)->bottom = 480; return(TRUE); } + case SPI_GETNONCLIENTMETRICS: + { + nclm = pvParam; + memcpy(&nclm->lfCaptionFont, &CaptionFont, sizeof(LOGFONT)); + memcpy(&nclm->lfSmCaptionFont, &CaptionFont, sizeof(LOGFONT)); + return(TRUE); + } } return(FALSE); } diff --git a/reactos/lib/user32/windows/defwnd.c b/reactos/lib/user32/windows/defwnd.c index cf3f71ea14f..409d4e3d840 100644 --- a/reactos/lib/user32/windows/defwnd.c +++ b/reactos/lib/user32/windows/defwnd.c @@ -1,4 +1,4 @@ -/* $Id: defwnd.c,v 1.10 2002/09/17 23:46:23 dwelch Exp $ +/* $Id: defwnd.c,v 1.11 2002/09/20 21:55:15 jfilby Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -317,12 +317,24 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd, if (GetWindowTextA( hwnd, buffer, sizeof(buffer) )) { + NONCLIENTMETRICS nclm; + HFONT hFont, hOldFont; + + nclm.cbSize = sizeof(NONCLIENTMETRICS); + SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); + if (style & WS_EX_TOOLWINDOW) + hFont = CreateFontIndirectW(&nclm.lfSmCaptionFont); + else + hFont = CreateFontIndirectW(&nclm.lfCaptionFont); + hOldFont = SelectObject(hdc, hFont); + if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) ); else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ); SetBkMode( hdc, TRANSPARENT ); /*DrawTextA( hdc, buffer, -1, &r, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );*/ - TextOutA(hdc, r.left, r.top, buffer, strlen(buffer)); + TextOutA(hdc, r.left+5, r.top+2, buffer, strlen(buffer)); + DeleteObject (SelectObject (hdc, hOldFont)); } } -- 2.17.1