Commit 533a999a authored by Kevin Koltzau's avatar Kevin Koltzau Committed by Alexandre Julliard

Implement DrawThemeBackgroundEx, DrawThemeText, GetThemeTextExtent.

parent d496eb08
......@@ -4,6 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = uxtheme.dll
IMPORTS = shlwapi user32 gdi32 advapi32 kernel32 ntdll
DELAYIMPORTS = msimg32
EXTRALIBS = $(LIBUNICODE)
C_SRCS = \
......
......@@ -765,3 +765,17 @@ PTHEME_PROPERTY MSSTYLES_FindProperty(PTHEME_CLASS tc, int iPartId, int iStateId
return tp;
return NULL;
}
HBITMAP MSSTYLES_LoadBitmap(HDC hdc, PTHEME_CLASS tc, LPCWSTR lpFilename)
{
WCHAR szFile[MAX_PATH];
LPWSTR tmp;
lstrcpynW(szFile, lpFilename, sizeof(szFile)/sizeof(szFile[0]));
tmp = szFile;
do {
if(*tmp == '\\') *tmp = '_';
if(*tmp == '/') *tmp = '_';
if(*tmp == '.') *tmp = '_';
} while(*tmp++);
return LoadImageW(tc->hTheme, szFile, IMAGE_BITMAP, 0, 0, LR_SHARED|LR_CREATEDIBSECTION);
}
......@@ -82,6 +82,7 @@ PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf);
PTHEME_PARTSTATE MSSTYLES_FindPartState(PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext);
PTHEME_CLASS MSSTYLES_FindClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName);
PTHEME_PROPERTY MSSTYLES_FindProperty(PTHEME_CLASS tc, int iPartId, int iStateId, int iPropertyPrimitive, int iPropertyId);
HBITMAP MSSTYLES_LoadBitmap(HDC hdc, PTHEME_CLASS tc, LPCWSTR lpFilename);
PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName);
void UXINI_CloseINI(PUXINI_FILE uf);
......
......@@ -60,6 +60,26 @@ BOOL UXTHEME_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR
return TRUE;
}
BOOL UXTHEME_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize) {
LPCWSTR cur = lpStringStart;
LPCWSTR start;
LPCWSTR end;
while(cur < lpStringEnd && (isspace(*cur) || *cur == ',')) cur++;
if(cur >= lpStringEnd) {
return FALSE;
}
start = cur;
while(cur < lpStringEnd && *cur != ',') cur++;
end = cur;
while(isspace(*end)) end--;
lstrcpynW(lpBuff, start, min(buffSize, end-start+1));
if(lpValEnd) *lpValEnd = cur;
return TRUE;
}
/***********************************************************************
* GetThemeBool (UXTHEME.@)
*/
......@@ -156,10 +176,46 @@ HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId,
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, int iPropId, LOGFONTW *pFont)
{
FIXME("%d %d %d: stub\n", iPartId, iStateId, iPropId);
LPCWSTR lpCur;
LPCWSTR lpEnd;
PTHEME_PROPERTY tp;
int pointSize;
WCHAR attr[32];
const WCHAR szBold[] = {'b','o','l','d','\0'};
const WCHAR szItalic[] = {'i','t','a','l','i','c','\0'};
const WCHAR szUnderline[] = {'u','n','d','e','r','l','i','n','e','\0'};
const WCHAR szStrikeOut[] = {'s','t','r','i','k','e','o','u','t','\0'};
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
return ERROR_CALL_NOT_IMPLEMENTED;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId)))
return E_PROP_ID_UNSUPPORTED;
lpCur = tp->lpValue;
lpEnd = tp->lpValue + tp->dwValueLen;
ZeroMemory(pFont, sizeof(LOGFONTW));
if(!UXTHEME_GetNextToken(lpCur, lpEnd, &lpCur, pFont->lfFaceName, LF_FACESIZE)) {
TRACE("Property is there, but failed to get face name\n");
return E_PROP_ID_UNSUPPORTED;
}
if(!UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &pointSize)) {
TRACE("Property is there, but failed to get point size\n");
return E_PROP_ID_UNSUPPORTED;
}
pFont->lfHeight = -MulDiv(pointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
pFont->lfWeight = FW_REGULAR;
pFont->lfCharSet = DEFAULT_CHARSET;
while(UXTHEME_GetNextToken(lpCur, lpEnd, &lpCur, attr, sizeof(attr)/sizeof(attr[0]))) {
if(!lstrcmpiW(szBold, attr)) pFont->lfWeight = FW_BOLD;
else if(!!lstrcmpiW(szItalic, attr)) pFont->lfItalic = TRUE;
else if(!!lstrcmpiW(szUnderline, attr)) pFont->lfUnderline = TRUE;
else if(!!lstrcmpiW(szStrikeOut, attr)) pFont->lfStrikeOut = TRUE;
}
return S_OK;
}
/***********************************************************************
......@@ -189,10 +245,26 @@ HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId,
HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, INTLIST *pIntList)
{
FIXME("%d %d %d: stub\n", iPartId, iStateId, iPropId);
LPCWSTR lpCur;
LPCWSTR lpEnd;
int i;
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
return ERROR_CALL_NOT_IMPLEMENTED;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId)))
return E_PROP_ID_UNSUPPORTED;
lpCur = tp->lpValue;
lpEnd = tp->lpValue + tp->dwValueLen;
for(i=0; i < MAX_INTLIST_COUNT; i++) {
if(!UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &pIntList->iValues[i]))
break;
}
pIntList->iValueCount = i;
return S_OK;
}
/***********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment