Implement GetThemeTextMetrics.

This commit is contained in:
Kevin Koltzau 2004-02-27 04:34:00 +00:00 committed by Alexandre Julliard
parent d1d89a64a6
commit 08d8551910
1 changed files with 24 additions and 8 deletions

View File

@ -930,12 +930,6 @@ HRESULT WINAPI GetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId,
DeleteObject(hFont); DeleteObject(hFont);
} }
return S_OK; 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, HRESULT WINAPI GetThemeTextMetrics(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, TEXTMETRICW *ptm) 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) if(!hTheme)
return E_HANDLE; 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;
} }
/*********************************************************************** /***********************************************************************