From 08d8551910ed12b5ba1678d6b7653eaff3266552 Mon Sep 17 00:00:00 2001 From: Kevin Koltzau Date: Fri, 27 Feb 2004 04:34:00 +0000 Subject: [PATCH] Implement GetThemeTextMetrics. --- dlls/uxtheme/draw.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/dlls/uxtheme/draw.c b/dlls/uxtheme/draw.c index 5bdfef9e79c..2e3eac4f924 100644 --- a/dlls/uxtheme/draw.c +++ b/dlls/uxtheme/draw.c @@ -930,12 +930,6 @@ HRESULT WINAPI GetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId, DeleteObject(hFont); } return S_OK; - - - FIXME("%d %d: stub\n", iPartId, iStateId); - if(!hTheme) - return E_HANDLE; - return ERROR_CALL_NOT_IMPLEMENTED; } /*********************************************************************** @@ -944,10 +938,32 @@ HRESULT WINAPI GetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId, HRESULT WINAPI GetThemeTextMetrics(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, TEXTMETRICW *ptm) { - FIXME("%d %d: stub\n", iPartId, iStateId); + HRESULT hr; + HFONT hFont = NULL; + HGDIOBJ oldFont = NULL; + LOGFONTW logfont; + + TRACE("(%p, %p, %d, %d)\n", hTheme, hdc, iPartId, iStateId); if(!hTheme) return E_HANDLE; - return ERROR_CALL_NOT_IMPLEMENTED; + + hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont); + if(SUCCEEDED(hr)) { + hFont = CreateFontIndirectW(&logfont); + if(!hFont) + TRACE("Failed to create font\n"); + } + if(hFont) + oldFont = SelectObject(hdc, hFont); + + if(!GetTextMetricsW(hdc, ptm)) + hr = HRESULT_FROM_WIN32(GetLastError()); + + if(hFont) { + SelectObject(hdc, oldFont); + DeleteObject(hFont); + } + return hr; } /***********************************************************************