- imported uxtheme.dll from WINE-20050703

- added missing definitions in w32api
- imported schemadef.h from WINE and replaced most of tmschema.h with WINE's version (which is much more correct)

svn path=/trunk/; revision=16394
This commit is contained in:
Thomas Bluemel 2005-07-03 18:32:22 +00:00
parent 89ac547ef5
commit 4be9703fa6
23 changed files with 6661 additions and 637 deletions

View file

@ -1,6 +1,7 @@
<property name="BASEADDRESS_REGTESTS" value="0x07000000" />
<property name="BASEADDRESS_NOTIFYHOOK" value="0x08000000" />
<property name="BASEADDRESS_DEVENUM" value="0x35680000" />
<property name="BASEADDRESS_UXTHEME" value="0x5AD70000" />
<property name="BASEADDRESS_DINPUT" value="0x5F580000" />
<property name="BASEADDRESS_TIMEDATE" value="0x64DA0000" />
<property name="BASEADDRESS_SYSDM" value="0x64DD0000" />

View file

@ -65,6 +65,7 @@ reactos/lib/shdocvw # Synced to Wine-20050419
reactos/lib/shlwapi # Synced to Wine-20050419
reactos/lib/twain # Out of sync
reactos/lib/urlmon # Synced to Wine-20050419
reactos/lib/uxtheme # Synced to Wine-20050703
reactos/lib/version # Out of sync
reactos/lib/wininet # Out of sync
reactos/lib/winmm # Synced to Wine-20050419

View file

@ -21,4 +21,14 @@ typedef struct tagCWPSTRUCT *LPCWPSTRUCT;
#define WM_ALTTABACTIVE 0x0029
#ifndef E_PROP_ID_UNSUPPORTED
#define E_PROP_ID_UNSUPPORTED ((HRESULT)0x80070490)
#endif
#ifndef E_PROP_SET_UNSUPPORTED
#define E_PROP_SET_UNSUPPORTED ((HRESULT)0x80070492)
#endif
#define MAKEINTATOMA(atom) ((LPCSTR)((ULONG_PTR)((WORD)(atom))))
#define MAKEINTATOMW(atom) ((LPCWSTR)((ULONG_PTR)((WORD)(atom))))
#endif /* __WINE_WINUSER_H */

View file

@ -271,6 +271,9 @@
<directory name="uuid">
<xi:include href="uuid/uuid.xml" />
</directory>
<directory name="uxtheme">
<xi:include href="uxtheme/uxtheme.xml" />
</directory>
<directory name="version">
<xi:include href="version/version.xml" />
</directory>

View file

@ -0,0 +1,25 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = uxtheme.dll
IMPORTLIB = libuxtheme.$(IMPLIBEXT)
IMPORTS = shlwapi user32 gdi32 advapi32 kernel32 ntdll
DELAYIMPORTS = msimg32
EXTRALIBS = $(LIBUNICODE)
C_SRCS = \
draw.c \
main.c \
metric.c \
msstyles.c \
property.c \
stylemap.c \
system.c \
uxini.c
RC_SRCS = version.rc
@MAKE_DLL_RULES@
### Dependencies:

1037
reactos/lib/uxtheme/draw.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,48 @@
/*
* Win32 5.1 Themes
*
* Copyright (C) 2003 Kevin Koltzau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "uxthemedll.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
/***********************************************************************/
/* For the moment, do nothing here. */
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
TRACE("%p 0x%lx %p: stub\n", hInstDLL, fdwReason, lpv);
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstDLL);
UXTHEME_InitSystem(hInstDLL);
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View file

@ -0,0 +1,225 @@
/*
* Win32 5.1 Theme metrics
*
* Copyright (C) 2003 Kevin Koltzau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "uxtheme.h"
#include "tmschema.h"
#include "msstyles.h"
#include "uxthemedll.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
/***********************************************************************
* GetThemeSysBool (UXTHEME.@)
*/
BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID)
{
HRESULT hr;
PTHEME_PROPERTY tp;
BOOL ret;
TRACE("(%p, %d)\n", hTheme, iBoolID);
SetLastError(0);
if(hTheme) {
if((tp = MSSTYLES_FindMetric(TMT_BOOL, iBoolID))) {
hr = MSSTYLES_GetPropertyBool(tp, &ret);
if(SUCCEEDED(hr))
return ret;
else
SetLastError(hr);
}
}
if(iBoolID == TMT_FLATMENUS) {
if(SystemParametersInfoW(SPI_GETFLATMENU, 0, &ret, 0))
return ret;
}
else {
FIXME("Unknown bool id: %d\n", iBoolID);
SetLastError(STG_E_INVALIDPARAMETER);
}
return FALSE;
}
/***********************************************************************
* GetThemeSysColor (UXTHEME.@)
*/
COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
{
HRESULT hr;
PTHEME_PROPERTY tp;
TRACE("(%p, %d)\n", hTheme, iColorID);
SetLastError(0);
if(hTheme) {
if((tp = MSSTYLES_FindMetric(TMT_COLOR, iColorID))) {
COLORREF color;
hr = MSSTYLES_GetPropertyColor(tp, &color);
if(SUCCEEDED(hr))
return color;
else
SetLastError(hr);
}
}
return GetSysColor(iColorID - TMT_FIRSTCOLOR);
}
/***********************************************************************
* GetThemeSysColorBrush (UXTHEME.@)
*/
HBRUSH WINAPI GetThemeSysColorBrush(HTHEME hTheme, int iColorID)
{
TRACE("(%p, %d)\n", hTheme, iColorID);
return CreateSolidBrush(GetThemeSysColor(hTheme, iColorID));
}
/***********************************************************************
* GetThemeSysFont (UXTHEME.@)
*/
HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf)
{
HRESULT hr = S_OK;
PTHEME_PROPERTY tp;
TRACE("(%p, %d)\n", hTheme, iFontID);
if(hTheme) {
if((tp = MSSTYLES_FindMetric(TMT_FONT, iFontID))) {
HDC hdc = GetDC(NULL);
hr = MSSTYLES_GetPropertyFont(tp, hdc, plf);
ReleaseDC(NULL, hdc);
if(SUCCEEDED(hr))
return S_OK;
}
}
if(iFontID == TMT_ICONTITLEFONT) {
if(!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(LOGFONTW), &plf, 0))
return HRESULT_FROM_WIN32(GetLastError());
}
else {
NONCLIENTMETRICSW ncm;
LOGFONTW *font = NULL;
ncm.cbSize = sizeof(NONCLIENTMETRICSW);
if(!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0))
return HRESULT_FROM_WIN32(GetLastError());
switch(iFontID) {
case TMT_CAPTIONFONT: font = &ncm.lfCaptionFont; break;
case TMT_SMALLCAPTIONFONT: font = &ncm.lfSmCaptionFont; break;
case TMT_MENUFONT: font = &ncm.lfMenuFont; break;
case TMT_STATUSFONT: font = &ncm.lfStatusFont; break;
case TMT_MSGBOXFONT: font = &ncm.lfMessageFont; break;
default: FIXME("Unknown FontID: %d\n", iFontID); break;
}
if(font) CopyMemory(plf, font, sizeof(LOGFONTW));
else hr = STG_E_INVALIDPARAMETER;
}
return hr;
}
/***********************************************************************
* GetThemeSysInt (UXTHEME.@)
*/
HRESULT WINAPI GetThemeSysInt(HTHEME hTheme, int iIntID, int *piValue)
{
PTHEME_PROPERTY tp;
TRACE("(%p, %d)\n", hTheme, iIntID);
if(!hTheme)
return E_HANDLE;
if(iIntID <= TMT_FIRSTINT || iIntID >= TMT_LASTINT) {
TRACE("Unknown IntID: %d\n", iIntID);
return STG_E_INVALIDPARAMETER;
}
if((tp = MSSTYLES_FindMetric(TMT_INT, iIntID)))
return MSSTYLES_GetPropertyInt(tp, piValue);
return E_PROP_ID_UNSUPPORTED;
}
/***********************************************************************
* GetThemeSysSize (UXTHEME.@)
*/
int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID)
{
PTHEME_PROPERTY tp;
int i, id = -1;
int metricMap[] = {
SM_CXVSCROLL, TMT_SCROLLBARWIDTH,
SM_CYHSCROLL, TMT_SCROLLBARHEIGHT,
SM_CXSIZE, TMT_CAPTIONBARWIDTH,
SM_CYSIZE, TMT_CAPTIONBARHEIGHT,
SM_CXFRAME, TMT_SIZINGBORDERWIDTH,
SM_CYFRAME, TMT_SIZINGBORDERWIDTH, /* There is no TMT_SIZINGBORDERHEIGHT, but this works in windows.. */
SM_CXSMSIZE, TMT_SMCAPTIONBARWIDTH,
SM_CYSMSIZE, TMT_SMCAPTIONBARHEIGHT,
SM_CXMENUSIZE, TMT_MENUBARWIDTH,
SM_CYMENUSIZE, TMT_MENUBARHEIGHT
};
if(hTheme) {
for(i=0; i<sizeof(metricMap)/sizeof(metricMap[0]); i+=2) {
if(metricMap[i] == iSizeID) {
id = metricMap[i+1];
break;
}
}
SetLastError(0);
if(id != -1) {
if((tp = MSSTYLES_FindMetric(TMT_SIZE, id))) {
if(SUCCEEDED(MSSTYLES_GetPropertyInt(tp, &i))) {
return i;
}
}
TRACE("Size %d not found in theme, using system metric\n", iSizeID);
}
else {
SetLastError(STG_E_INVALIDPARAMETER);
return 0;
}
}
return GetSystemMetrics(iSizeID);
}
/***********************************************************************
* GetThemeSysString (UXTHEME.@)
*/
HRESULT WINAPI GetThemeSysString(HTHEME hTheme, int iStringID,
LPWSTR pszStringBuff, int cchMaxStringChars)
{
PTHEME_PROPERTY tp;
TRACE("(%p, %d)\n", hTheme, iStringID);
if(!hTheme)
return E_HANDLE;
if(iStringID <= TMT_FIRSTSTRING || iStringID >= TMT_LASTSTRING) {
TRACE("Unknown StringID: %d\n", iStringID);
return STG_E_INVALIDPARAMETER;
}
if((tp = MSSTYLES_FindMetric(TMT_STRING, iStringID)))
return MSSTYLES_GetPropertyString(tp, pszStringBuff, cchMaxStringChars);
return E_PROP_ID_UNSUPPORTED;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,108 @@
/*
* Internal msstyles related defines & declarations
*
* Copyright (C) 2003 Kevin Koltzau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_MSSTYLES_H
#define __WINE_MSSTYLES_H
#define TMT_ENUM 200
#define MAX_THEME_APP_NAME 60
#define MAX_THEME_CLASS_NAME 60
#define MAX_THEME_VALUE_NAME 60
typedef struct _THEME_PROPERTY {
int iPrimitiveType;
int iPropertyId;
PROPERTYORIGIN origin;
LPCWSTR lpValue;
DWORD dwValueLen;
struct _THEME_PROPERTY *next;
} THEME_PROPERTY, *PTHEME_PROPERTY;
typedef struct _THEME_PARTSTATE {
int iPartId;
int iStateId;
PTHEME_PROPERTY properties;
struct _THEME_PARTSTATE *next;
} THEME_PARTSTATE, *PTHEME_PARTSTATE;
typedef struct _THEME_CLASS {
HMODULE hTheme;
WCHAR szAppName[MAX_THEME_APP_NAME];
WCHAR szClassName[MAX_THEME_CLASS_NAME];
PTHEME_PARTSTATE partstate;
struct _THEME_CLASS *overrides;
struct _THEME_CLASS *next;
} THEME_CLASS, *PTHEME_CLASS;
typedef struct _THEME_FILE {
DWORD dwRefCount;
HMODULE hTheme;
WCHAR szThemeFile[MAX_PATH];
LPWSTR pszAvailColors;
LPWSTR pszAvailSizes;
LPWSTR pszSelectedColor;
LPWSTR pszSelectedSize;
PTHEME_CLASS classes;
PTHEME_PROPERTY metrics;
} THEME_FILE, *PTHEME_FILE;
typedef void* PUXINI_FILE;
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf);
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf);
HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf);
PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList);
HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc);
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId);
BOOL MSSTYLES_LookupEnum(LPCWSTR pszValueName, int dwEnum, int *dwValue);
BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszState, int *iPartId, int *iStateId);
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);
PTHEME_PROPERTY MSSTYLES_FindMetric(int iPropertyPrimitive, int iPropertyId);
HBITMAP MSSTYLES_LoadBitmap(HDC hdc, PTHEME_CLASS tc, LPCWSTR lpFilename);
HRESULT MSSTYLES_GetPropertyBool(PTHEME_PROPERTY tp, BOOL *pfVal);
HRESULT MSSTYLES_GetPropertyColor(PTHEME_PROPERTY tp, COLORREF *pColor);
HRESULT MSSTYLES_GetPropertyFont(PTHEME_PROPERTY tp, HDC hdc, LOGFONTW *pFont);
HRESULT MSSTYLES_GetPropertyInt(PTHEME_PROPERTY tp, int *piVal);
HRESULT MSSTYLES_GetPropertyIntList(PTHEME_PROPERTY tp, INTLIST *pIntList);
HRESULT MSSTYLES_GetPropertyPosition(PTHEME_PROPERTY tp, POINT *pPoint);
HRESULT MSSTYLES_GetPropertyString(PTHEME_PROPERTY tp, LPWSTR pszBuff, int cchMaxBuffChars);
HRESULT MSSTYLES_GetPropertyRect(PTHEME_PROPERTY tp, RECT *pRect);
HRESULT MSSTYLES_GetPropertyMargins(PTHEME_PROPERTY tp, RECT *prc, MARGINS *pMargins);
PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName);
void UXINI_CloseINI(PUXINI_FILE uf);
void UXINI_ResetINI(PUXINI_FILE uf);
LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen);
BOOL UXINI_FindSection(PUXINI_FILE uf, LPCWSTR lpName);
LPCWSTR UXINI_GetNextValue(PUXINI_FILE uf, DWORD *dwNameLen, LPCWSTR *lpValue, DWORD *dwValueLen);
BOOL UXINI_FindValue(PUXINI_FILE uf, LPCWSTR lpName, LPCWSTR *lpValue, DWORD *dwValueLen);
#endif

View file

@ -0,0 +1,296 @@
/*
* Win32 5.1 Theme properties
*
* Copyright (C) 2003 Kevin Koltzau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "uxtheme.h"
#include "tmschema.h"
#include "msstyles.h"
#include "uxthemedll.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
/***********************************************************************
* GetThemeBool (UXTHEME.@)
*/
HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, BOOL *pfVal)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_BOOL, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyBool(tp, pfVal);
}
/***********************************************************************
* GetThemeColor (UXTHEME.@)
*/
HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, COLORREF *pColor)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_COLOR, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyColor(tp, pColor);
}
/***********************************************************************
* GetThemeEnumValue (UXTHEME.@)
*/
HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, int *piVal)
{
HRESULT hr;
WCHAR val[60];
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_ENUM, iPropId)))
return E_PROP_ID_UNSUPPORTED;
hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0]));
if(FAILED(hr))
return hr;
if(!MSSTYLES_LookupEnum(val, iPropId, piVal))
return E_PROP_ID_UNSUPPORTED;
return S_OK;
}
/***********************************************************************
* GetThemeFilename (UXTHEME.@)
*/
HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, LPWSTR pszThemeFilename,
int cchMaxBuffChars)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyString(tp, pszThemeFilename, cchMaxBuffChars);
}
/***********************************************************************
* GetThemeFont (UXTHEME.@)
*/
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, int iPropId, LOGFONTW *pFont)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyFont(tp, hdc, pFont);
}
/***********************************************************************
* GetThemeInt (UXTHEME.@)
*/
HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, int *piVal)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INT, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyInt(tp, piVal);
}
/***********************************************************************
* GetThemeIntList (UXTHEME.@)
*/
HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, INTLIST *pIntList)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyIntList(tp, pIntList);
}
/***********************************************************************
* GetThemePosition (UXTHEME.@)
*/
HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, POINT *pPoint)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_POSITION, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyPosition(tp, pPoint);
}
/***********************************************************************
* GetThemeRect (UXTHEME.@)
*/
HRESULT WINAPI GetThemeRect(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, RECT *pRect)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_RECT, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyRect(tp, pRect);
}
/***********************************************************************
* GetThemeString (UXTHEME.@)
*/
HRESULT WINAPI GetThemeString(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, LPWSTR pszBuff, int cchMaxBuffChars)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyString(tp, pszBuff, cchMaxBuffChars);
}
/***********************************************************************
* GetThemeMargins (UXTHEME.@)
*/
HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, int iPropId, RECT *prc,
MARGINS *pMargins)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_MARGINS, iPropId)))
return E_PROP_ID_UNSUPPORTED;
return MSSTYLES_GetPropertyMargins(tp, prc, pMargins);
}
/***********************************************************************
* GetThemeMetric (UXTHEME.@)
*/
HRESULT WINAPI GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, int iPropId, int *piVal)
{
PTHEME_PROPERTY tp;
WCHAR val[60];
HRESULT hr;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId)))
return E_PROP_ID_UNSUPPORTED;
switch(tp->iPrimitiveType) {
case TMT_POSITION: /* Only the X coord is retrieved */
case TMT_MARGINS: /* Only the cxLeftWidth member is retrieved */
case TMT_INTLIST: /* Only the first int is retrieved */
case TMT_SIZE:
case TMT_INT:
return MSSTYLES_GetPropertyInt(tp, piVal);
case TMT_BOOL:
return MSSTYLES_GetPropertyBool(tp, piVal);
case TMT_COLOR:
return MSSTYLES_GetPropertyColor(tp, (COLORREF*)piVal);
case TMT_ENUM:
hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0]));
if(FAILED(hr))
return hr;
if(!MSSTYLES_LookupEnum(val, iPropId, piVal))
return E_PROP_ID_UNSUPPORTED;
return S_OK;
case TMT_FILENAME:
/* Windows does return a value for this, but its value doesn't make sense */
FIXME("Filename\n");
break;
}
return E_PROP_ID_UNSUPPORTED;
}
/***********************************************************************
* GetThemePropertyOrigin (UXTHEME.@)
*/
HRESULT WINAPI GetThemePropertyOrigin(HTHEME hTheme, int iPartId, int iStateId,
int iPropId, PROPERTYORIGIN *pOrigin)
{
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
if(!hTheme)
return E_HANDLE;
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) {
*pOrigin = PO_NOTFOUND;
return S_OK;
}
*pOrigin = tp->origin;
return S_OK;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,806 @@
/*
* Win32 5.1 Theme system
*
* Copyright (C) 2003 Kevin Koltzau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "winreg.h"
#include "shlwapi.h"
#include "uxtheme.h"
#include "tmschema.h"
#include "uxthemedll.h"
#include "msstyles.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
/***********************************************************************
* Defines and global variables
*/
static const WCHAR szThemeManager[] = {
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'W','i','n','d','o','w','s','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'T','h','e','m','e','M','a','n','a','g','e','r','\0'
};
static const WCHAR szThemeActive[] = {'T','h','e','m','e','A','c','t','i','v','e','\0'};
static const WCHAR szSizeName[] = {'S','i','z','e','N','a','m','e','\0'};
static const WCHAR szColorName[] = {'C','o','l','o','r','N','a','m','e','\0'};
static const WCHAR szDllName[] = {'D','l','l','N','a','m','e','\0'};
static const WCHAR szIniDocumentation[] = {'d','o','c','u','m','e','n','t','a','t','i','o','n','\0'};
HINSTANCE hDllInst;
DWORD dwThemeAppProperties = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS;
ATOM atWindowTheme;
ATOM atSubAppName;
ATOM atSubIdList;
BOOL bThemeActive = FALSE;
WCHAR szCurrentTheme[MAX_PATH];
WCHAR szCurrentColor[64];
WCHAR szCurrentSize[64];
/***********************************************************************/
/***********************************************************************
* UXTHEME_LoadTheme
*
* Set the current active theme from the registry
*/
static void UXTHEME_LoadTheme(void)
{
HKEY hKey;
LONG buffsize;
HRESULT hr;
WCHAR tmp[10];
PTHEME_FILE pt;
/* Get current theme configuration */
if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
TRACE("Loading theme config\n");
buffsize = sizeof(tmp)/sizeof(tmp[0]);
if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) {
bThemeActive = (tmp[0] != '0');
}
else {
bThemeActive = FALSE;
TRACE("Failed to get ThemeActive: %ld\n", GetLastError());
}
buffsize = sizeof(szCurrentColor)/sizeof(szCurrentColor[0]);
if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize))
szCurrentColor[0] = '\0';
buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]);
if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize))
szCurrentSize[0] = '\0';
if(SHRegGetPathW(hKey, NULL, szDllName, szCurrentTheme, 0))
szCurrentTheme[0] = '\0';
RegCloseKey(hKey);
}
else
TRACE("Failed to open theme registry key\n");
if(bThemeActive) {
/* Make sure the theme requested is actually valid */
hr = MSSTYLES_OpenThemeFile(szCurrentTheme,
szCurrentColor[0]?szCurrentColor:NULL,
szCurrentSize[0]?szCurrentSize:NULL,
&pt);
if(FAILED(hr)) {
bThemeActive = FALSE;
szCurrentTheme[0] = '\0';
szCurrentColor[0] = '\0';
szCurrentSize[0] = '\0';
}
else {
/* Make sure the global color & size match the theme */
lstrcpynW(szCurrentColor, pt->pszSelectedColor, sizeof(szCurrentColor)/sizeof(szCurrentColor[0]));
lstrcpynW(szCurrentSize, pt->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0]));
MSSTYLES_SetActiveTheme(pt);
TRACE("Theme active: %s %s %s\n", debugstr_w(szCurrentTheme),
debugstr_w(szCurrentColor), debugstr_w(szCurrentSize));
MSSTYLES_CloseThemeFile(pt);
}
}
if(!bThemeActive) {
MSSTYLES_SetActiveTheme(NULL);
TRACE("Themeing not active\n");
}
}
/***********************************************************************
* UXTHEME_SetActiveTheme
*
* Change the current active theme
*/
HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
{
HKEY hKey;
WCHAR tmp[2];
HRESULT hr;
hr = MSSTYLES_SetActiveTheme(tf);
if(FAILED(hr))
return hr;
if(tf) {
bThemeActive = TRUE;
lstrcpynW(szCurrentTheme, tf->szThemeFile, sizeof(szCurrentTheme)/sizeof(szCurrentTheme[0]));
lstrcpynW(szCurrentColor, tf->pszSelectedColor, sizeof(szCurrentColor)/sizeof(szCurrentColor[0]));
lstrcpynW(szCurrentSize, tf->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0]));
}
else {
bThemeActive = FALSE;
szCurrentTheme[0] = '\0';
szCurrentColor[0] = '\0';
szCurrentSize[0] = '\0';
}
TRACE("Writing theme config to registry\n");
if(!RegCreateKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
tmp[0] = bThemeActive?'1':'0';
tmp[1] = '\0';
RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (const BYTE*)tmp, sizeof(WCHAR)*2);
if(bThemeActive) {
RegSetValueExW(hKey, szColorName, 0, REG_SZ, (const BYTE*)szCurrentColor, lstrlenW(szCurrentColor)+1);
RegSetValueExW(hKey, szSizeName, 0, REG_SZ, (const BYTE*)szCurrentSize, lstrlenW(szCurrentSize)+1);
RegSetValueExW(hKey, szDllName, 0, REG_SZ, (const BYTE*)szCurrentTheme, lstrlenW(szCurrentTheme)+1);
}
else {
RegDeleteValueW(hKey, szColorName);
RegDeleteValueW(hKey, szSizeName);
RegDeleteValueW(hKey, szDllName);
}
RegCloseKey(hKey);
}
else
TRACE("Failed to open theme registry key\n");
return hr;
}
/***********************************************************************
* UXTHEME_InitSystem
*/
void UXTHEME_InitSystem(HINSTANCE hInst)
{
static const WCHAR szWindowTheme[] = {
'u','x','_','t','h','e','m','e','\0'
};
static const WCHAR szSubAppName[] = {
'u','x','_','s','u','b','a','p','p','\0'
};
static const WCHAR szSubIdList[] = {
'u','x','_','s','u','b','i','d','l','s','t','\0'
};
hDllInst = hInst;
atWindowTheme = GlobalAddAtomW(szWindowTheme);
atSubAppName = GlobalAddAtomW(szSubAppName);
atSubIdList = GlobalAddAtomW(szSubIdList);
UXTHEME_LoadTheme();
}
/***********************************************************************
* IsAppThemed (UXTHEME.@)
*/
BOOL WINAPI IsAppThemed(void)
{
return IsThemeActive();
}
/***********************************************************************
* IsThemeActive (UXTHEME.@)
*/
BOOL WINAPI IsThemeActive(void)
{
TRACE("\n");
return bThemeActive;
}
/***********************************************************************
* EnableTheming (UXTHEME.@)
*
* NOTES
* This is a global and persistent change
*/
HRESULT WINAPI EnableTheming(BOOL fEnable)
{
HKEY hKey;
WCHAR szEnabled[] = {'0','\0'};
TRACE("(%d)\n", fEnable);
if(fEnable != bThemeActive) {
bThemeActive = fEnable;
if(bThemeActive) szEnabled[0] = '1';
if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (LPBYTE)szEnabled, sizeof(WCHAR));
RegCloseKey(hKey);
}
PostMessageW(HWND_BROADCAST, WM_THEMECHANGED, 0, 0);
}
return S_OK;
}
/***********************************************************************
* UXTHEME_SetWindowProperty
*
* I'm using atoms as there may be large numbers of duplicated strings
* and they do the work of keeping memory down as a cause of that quite nicely
*/
HRESULT UXTHEME_SetWindowProperty(HWND hwnd, ATOM aProp, LPCWSTR pszValue)
{
ATOM oldValue = (ATOM)(size_t)RemovePropW(hwnd, MAKEINTATOMW(aProp));
if(oldValue)
DeleteAtom(oldValue);
if(pszValue) {
ATOM atValue = AddAtomW(pszValue);
if(!atValue
|| !SetPropW(hwnd, MAKEINTATOMW(aProp), (LPWSTR)MAKEINTATOMW(atValue))) {
HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
if(atValue) DeleteAtom(atValue);
return hr;
}
}
return S_OK;
}
LPWSTR UXTHEME_GetWindowProperty(HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen)
{
ATOM atValue = (ATOM)(size_t)GetPropW(hwnd, MAKEINTATOMW(aProp));
if(atValue) {
if(GetAtomNameW(atValue, pszBuffer, dwLen))
return pszBuffer;
TRACE("property defined, but unable to get value\n");
}
return NULL;
}
/***********************************************************************
* OpenThemeData (UXTHEME.@)
*/
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
{
WCHAR szAppBuff[256];
WCHAR szClassBuff[256];
LPCWSTR pszAppName;
LPCWSTR pszUseClassList;
HTHEME hTheme;
TRACE("(%p,%s)\n", hwnd, debugstr_w(pszClassList));
if(!bThemeActive)
return NULL;
pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0]));
/* If SetWindowTheme was used on the window, that overrides the class list passed to this function */
pszUseClassList = UXTHEME_GetWindowProperty(hwnd, atSubIdList, szClassBuff, sizeof(szClassBuff)/sizeof(szClassBuff[0]));
if(!pszUseClassList)
pszUseClassList = pszClassList;
hTheme = MSSTYLES_OpenThemeClass(pszAppName, pszUseClassList);
if(IsWindow(hwnd))
SetPropW(hwnd, MAKEINTATOMW(atWindowTheme), hTheme);
return hTheme;
}
/***********************************************************************
* GetWindowTheme (UXTHEME.@)
*
* Retrieve the last theme opened for a window
*/
HTHEME WINAPI GetWindowTheme(HWND hwnd)
{
TRACE("(%p)\n", hwnd);
return GetPropW(hwnd, MAKEINTATOMW(atWindowTheme));
}
/***********************************************************************
* SetWindowTheme (UXTHEME.@)
*
* Persistent through the life of the window, even after themes change
*/
HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName,
LPCWSTR pszSubIdList)
{
HRESULT hr;
TRACE("(%p,%s,%s)\n", hwnd, debugstr_w(pszSubAppName),
debugstr_w(pszSubIdList));
hr = UXTHEME_SetWindowProperty(hwnd, atSubAppName, pszSubAppName);
if(SUCCEEDED(hr))
hr = UXTHEME_SetWindowProperty(hwnd, atSubIdList, pszSubIdList);
if(SUCCEEDED(hr))
PostMessageW(hwnd, WM_THEMECHANGED, 0, 0);
return hr;
}
/***********************************************************************
* GetCurrentThemeName (UXTHEME.@)
*/
HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars,
LPWSTR pszColorBuff, int cchMaxColorChars,
LPWSTR pszSizeBuff, int cchMaxSizeChars)
{
if(!bThemeActive)
return E_PROP_ID_UNSUPPORTED;
if(pszThemeFileName) lstrcpynW(pszThemeFileName, szCurrentTheme, dwMaxNameChars);
if(pszColorBuff) lstrcpynW(pszColorBuff, szCurrentColor, cchMaxColorChars);
if(pszSizeBuff) lstrcpynW(pszSizeBuff, szCurrentSize, cchMaxSizeChars);
return S_OK;
}
/***********************************************************************
* GetThemeAppProperties (UXTHEME.@)
*/
DWORD WINAPI GetThemeAppProperties(void)
{
return dwThemeAppProperties;
}
/***********************************************************************
* SetThemeAppProperties (UXTHEME.@)
*/
void WINAPI SetThemeAppProperties(DWORD dwFlags)
{
TRACE("(0x%08lx)\n", dwFlags);
dwThemeAppProperties = dwFlags;
}
/***********************************************************************
* CloseThemeData (UXTHEME.@)
*/
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
{
TRACE("(%p)\n", hTheme);
if(!hTheme)
return E_HANDLE;
return MSSTYLES_CloseThemeClass(hTheme);
}
/***********************************************************************
* HitTestThemeBackground (UXTHEME.@)
*/
HRESULT WINAPI HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, DWORD dwOptions,
const RECT *pRect, HRGN hrgn,
POINT ptTest, WORD *pwHitTestCode)
{
FIXME("%d %d 0x%08lx: stub\n", iPartId, iStateId, dwOptions);
if(!hTheme)
return E_HANDLE;
return ERROR_CALL_NOT_IMPLEMENTED;
}
/***********************************************************************
* IsThemePartDefined (UXTHEME.@)
*/
BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
{
TRACE("(%p,%d,%d)\n", hTheme, iPartId, iStateId);
if(!hTheme) {
SetLastError(E_HANDLE);
return FALSE;
}
if(MSSTYLES_FindPartState(hTheme, iPartId, iStateId, NULL))
return TRUE;
return FALSE;
}
/***********************************************************************
* GetThemeDocumentationProperty (UXTHEME.@)
*
* Try and retrieve the documentation property from string resources
* if that fails, get it from the [documentation] section of themes.ini
*/
HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
LPCWSTR pszPropertyName,
LPWSTR pszValueBuff,
int cchMaxValChars)
{
const WORD wDocToRes[] = {
TMT_DISPLAYNAME,5000,
TMT_TOOLTIP,5001,
TMT_COMPANY,5002,
TMT_AUTHOR,5003,
TMT_COPYRIGHT,5004,
TMT_URL,5005,
TMT_VERSION,5006,
TMT_DESCRIPTION,5007
};
PTHEME_FILE pt;
HRESULT hr;
unsigned int i;
int iDocId;
TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName),
pszValueBuff, cchMaxValChars);
hr = MSSTYLES_OpenThemeFile(pszThemeName, NULL, NULL, &pt);
if(FAILED(hr)) return hr;
/* Try to load from string resources */
hr = E_PROP_ID_UNSUPPORTED;
if(MSSTYLES_LookupProperty(pszPropertyName, NULL, &iDocId)) {
for(i=0; i<sizeof(wDocToRes)/sizeof(wDocToRes[0]); i+=2) {
if(wDocToRes[i] == iDocId) {
if(LoadStringW(pt->hTheme, wDocToRes[i+1], pszValueBuff, cchMaxValChars)) {
hr = S_OK;
break;
}
}
}
}
/* If loading from string resource failed, try getting it from the theme.ini */
if(FAILED(hr)) {
PUXINI_FILE uf = MSSTYLES_GetThemeIni(pt);
if(UXINI_FindSection(uf, szIniDocumentation)) {
LPCWSTR lpValue;
DWORD dwLen;
if(UXINI_FindValue(uf, pszPropertyName, &lpValue, &dwLen)) {
lstrcpynW(pszValueBuff, lpValue, min(dwLen+1,cchMaxValChars));
hr = S_OK;
}
}
UXINI_CloseINI(uf);
}
MSSTYLES_CloseThemeFile(pt);
return hr;
}
/**********************************************************************
* Undocumented functions
*/
/**********************************************************************
* QueryThemeServices (UXTHEME.1)
*
* RETURNS
* some kind of status flag
*/
DWORD WINAPI QueryThemeServices()
{
FIXME("stub\n");
return 3; /* This is what is returned under XP in most cases */
}
/**********************************************************************
* OpenThemeFile (UXTHEME.2)
*
* Opens a theme file, which can be used to change the current theme, etc
*
* PARAMS
* pszThemeFileName Path to a msstyles theme file
* pszColorName Color defined in the theme, eg. NormalColor
* pszSizeName Size defined in the theme, eg. NormalSize
* hThemeFile Handle to theme file
*/
HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName,
LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile,
DWORD unknown)
{
TRACE("(%s,%s,%s,%p,%ld)\n", debugstr_w(pszThemeFileName),
debugstr_w(pszColorName), debugstr_w(pszSizeName),
hThemeFile, unknown);
return MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, pszSizeName, (PTHEME_FILE*)hThemeFile);
}
/**********************************************************************
* CloseThemeFile (UXTHEME.3)
*
* Releases theme file handle returned by OpenThemeFile
*
* PARAMS
* hThemeFile Handle to theme file
*/
HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile)
{
TRACE("(%p)\n", hThemeFile);
MSSTYLES_CloseThemeFile(hThemeFile);
return S_OK;
}
/**********************************************************************
* ApplyTheme (UXTHEME.4)
*
* Set a theme file to be the currently active theme
*
* PARAMS
* hThemeFile Handle to theme file
* unknown See notes
* hWnd Window requesting the theme change
*
* NOTES
* I'm not sure what the second parameter is (the datatype is likely wrong), other then this:
* Under XP if I pass
* char b[] = "";
* the theme is applied with the screen redrawing really badly (flickers)
* char b[] = "\0"; where \0 can be one or more of any character, makes no difference
* the theme is applied smoothly (screen does not flicker)
* char *b = "\0" or NULL; where \0 can be zero or more of any character, makes no difference
* the function fails returning invalid parameter...very strange
*/
HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd)
{
HRESULT hr;
TRACE("(%p,%s,%p)\n", hThemeFile, unknown, hWnd);
hr = UXTHEME_SetActiveTheme(hThemeFile);
PostMessageW(HWND_BROADCAST, WM_THEMECHANGED, 0, 0);
return hr;
}
/**********************************************************************
* GetThemeDefaults (UXTHEME.7)
*
* Get the default color & size for a theme
*
* PARAMS
* pszThemeFileName Path to a msstyles theme file
* pszColorName Buffer to receive the default color name
* dwColorNameLen Length, in characters, of color name buffer
* pszSizeName Buffer to receive the default size name
* dwSizeNameLen Length, in characters, of size name buffer
*/
HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName,
DWORD dwColorNameLen, LPWSTR pszSizeName,
DWORD dwSizeNameLen)
{
PTHEME_FILE pt;
HRESULT hr;
TRACE("(%s,%p,%ld,%p,%ld)\n", debugstr_w(pszThemeFileName),
pszColorName, dwColorNameLen,
pszSizeName, dwSizeNameLen);
hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
if(FAILED(hr)) return hr;
lstrcpynW(pszColorName, pt->pszSelectedColor, dwColorNameLen);
lstrcpynW(pszSizeName, pt->pszSelectedSize, dwSizeNameLen);
MSSTYLES_CloseThemeFile(pt);
return S_OK;
}
/**********************************************************************
* EnumThemes (UXTHEME.8)
*
* Enumerate available themes, calls specified EnumThemeProc for each
* theme found. Passes lpData through to callback function.
*
* PARAMS
* pszThemePath Path containing themes
* callback Called for each theme found in path
* lpData Passed through to callback
*/
HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
LPVOID lpData)
{
WCHAR szDir[MAX_PATH];
WCHAR szPath[MAX_PATH];
static const WCHAR szStar[] = {'*','.','*','\0'};
static const WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'};
static const WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'};
static const WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'};
WCHAR szName[60];
WCHAR szTip[60];
HANDLE hFind;
WIN32_FIND_DATAW wfd;
HRESULT hr;
TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath), callback, lpData);
if(!pszThemePath || !callback)
return E_POINTER;
lstrcpyW(szDir, pszThemePath);
PathAddBackslashW(szDir);
lstrcpyW(szPath, szDir);
lstrcatW(szPath, szStar);
TRACE("searching %s\n", debugstr_w(szPath));
hFind = FindFirstFileW(szPath, &wfd);
if(hFind != INVALID_HANDLE_VALUE) {
do {
if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
&& !(wfd.cFileName[0] == '.' && ((wfd.cFileName[1] == '.' && wfd.cFileName[2] == 0) || wfd.cFileName[1] == 0))) {
wsprintfW(szPath, szFormat, szDir, wfd.cFileName, wfd.cFileName);
hr = GetThemeDocumentationProperty(szPath, szDisplayName, szName, sizeof(szName)/sizeof(szName[0]));
if(SUCCEEDED(hr))
hr = GetThemeDocumentationProperty(szPath, szTooltip, szTip, sizeof(szTip)/sizeof(szTip[0]));
if(SUCCEEDED(hr)) {
TRACE("callback(%s,%s,%s,%p)\n", debugstr_w(szPath), debugstr_w(szName), debugstr_w(szTip), lpData);
if(!callback(NULL, szPath, szName, szTip, NULL, lpData)) {
TRACE("callback ended enum\n");
break;
}
}
}
} while(FindNextFileW(hFind, &wfd));
FindClose(hFind);
}
return S_OK;
}
/**********************************************************************
* EnumThemeColors (UXTHEME.9)
*
* Enumerate theme colors available with a particular size
*
* PARAMS
* pszThemeFileName Path to a msstyles theme file
* pszSizeName Theme size to enumerate available colors
* If NULL the default theme size is used
* dwColorNum Color index to retrieve, increment from 0
* pszColorName Output color name
*
* RETURNS
* S_OK on success
* E_PROP_ID_UNSUPPORTED when dwColorName does not refer to a color
* or when pszSizeName does not refer to a valid size
*
* NOTES
* XP fails with E_POINTER when pszColorName points to a buffer smaller then 605
* characters
*
* Not very efficient that I'm opening & validating the theme every call, but
* this is undocumented and almost never called..
* (and this is how windows works too)
*/
HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
DWORD dwColorNum, LPWSTR pszColorName)
{
PTHEME_FILE pt;
HRESULT hr;
LPWSTR tmp;
TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
debugstr_w(pszSizeName), dwColorNum);
hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, pszSizeName, &pt);
if(FAILED(hr)) return hr;
tmp = pt->pszAvailColors;
while(dwColorNum && *tmp) {
dwColorNum--;
tmp += lstrlenW(tmp)+1;
}
if(!dwColorNum && *tmp) {
TRACE("%s\n", debugstr_w(tmp));
lstrcpyW(pszColorName, tmp);
}
else
hr = E_PROP_ID_UNSUPPORTED;
MSSTYLES_CloseThemeFile(pt);
return hr;
}
/**********************************************************************
* EnumThemeSizes (UXTHEME.10)
*
* Enumerate theme colors available with a particular size
*
* PARAMS
* pszThemeFileName Path to a msstyles theme file
* pszColorName Theme color to enumerate available sizes
* If NULL the default theme color is used
* dwSizeNum Size index to retrieve, increment from 0
* pszSizeName Output size name
*
* RETURNS
* S_OK on success
* E_PROP_ID_UNSUPPORTED when dwSizeName does not refer to a size
* or when pszColorName does not refer to a valid color
*
* NOTES
* XP fails with E_POINTER when pszSizeName points to a buffer smaller then 605
* characters
*
* Not very efficient that I'm opening & validating the theme every call, but
* this is undocumented and almost never called..
* (and this is how windows works too)
*/
HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
DWORD dwSizeNum, LPWSTR pszSizeName)
{
PTHEME_FILE pt;
HRESULT hr;
LPWSTR tmp;
TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
debugstr_w(pszColorName), dwSizeNum);
hr = MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, NULL, &pt);
if(FAILED(hr)) return hr;
tmp = pt->pszAvailSizes;
while(dwSizeNum && *tmp) {
dwSizeNum--;
tmp += lstrlenW(tmp)+1;
}
if(!dwSizeNum && *tmp) {
TRACE("%s\n", debugstr_w(tmp));
lstrcpyW(pszSizeName, tmp);
}
else
hr = E_PROP_ID_UNSUPPORTED;
MSSTYLES_CloseThemeFile(pt);
return hr;
}
/**********************************************************************
* ParseThemeIniFile (UXTHEME.11)
*
* Enumerate data in a theme INI file.
*
* PARAMS
* pszIniFileName Path to a theme ini file
* pszUnknown Cannot be NULL, L"" is valid
* callback Called for each found entry
* lpData Passed through to callback
*
* RETURNS
* S_OK on success
* 0x800706488 (Unknown property) when enumeration is canceled from callback
*
* NOTES
* When pszUnknown is NULL the callback is never called, the value does not seem to surve
* any other purpose
*/
HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown,
ParseThemeIniFileProc callback, LPVOID lpData)
{
FIXME("%s %s: stub\n", debugstr_w(pszIniFileName), debugstr_w(pszUnknown));
return ERROR_CALL_NOT_IMPLEMENTED;
}
/**********************************************************************
* CheckThemeSignature (UXTHEME.29)
*
* Validates the signature of a theme file
*
* PARAMS
* pszIniFileName Path to a theme file
*/
HRESULT WINAPI CheckThemeSignature(LPCWSTR pszThemeFileName)
{
PTHEME_FILE pt;
HRESULT hr;
TRACE("(%s)\n", debugstr_w(pszThemeFileName));
hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
if(FAILED(hr))
return hr;
MSSTYLES_CloseThemeFile(pt);
return S_OK;
}

315
reactos/lib/uxtheme/uxini.c Normal file
View file

@ -0,0 +1,315 @@
/*
* Win32 5.1 uxtheme ini file processing
*
* Copyright (C) 2004 Kevin Koltzau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
/***********************************************************************
* Defines and global variables
*/
static const WCHAR szTextFileResource[] = {
'T','E','X','T','F','I','L','E','\0'
};
typedef struct _UXINI_FILE {
LPCWSTR lpIni;
LPCWSTR lpCurLoc;
LPCWSTR lpEnd;
} UXINI_FILE, *PUXINI_FILE;
/***********************************************************************/
/**********************************************************************
* UXINI_LoadINI
*
* Load a theme INI file out of resources from the specified
* theme
*
* PARAMS
* tf Theme to load INI file out of resources
* lpName Resource name of the INI file
*
* RETURNS
* INI file, or NULL if not found
*/
PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName) {
HRSRC hrsc;
LPCWSTR lpThemesIni = NULL;
PUXINI_FILE uf;
DWORD dwIniSize;
TRACE("Loading resource INI %s\n", debugstr_w(lpName));
if((hrsc = FindResourceW(hTheme, lpName, szTextFileResource))) {
if(!(lpThemesIni = (LPCWSTR)LoadResource(hTheme, hrsc))) {
TRACE("%s resource not found\n", debugstr_w(lpName));
return NULL;
}
}
dwIniSize = SizeofResource(hTheme, hrsc) / sizeof(WCHAR);
uf = HeapAlloc(GetProcessHeap(), 0, sizeof(UXINI_FILE));
uf->lpIni = lpThemesIni;
uf->lpCurLoc = lpThemesIni;
uf->lpEnd = lpThemesIni + dwIniSize;
return uf;
}
/**********************************************************************
* UXINI_CloseINI
*
* Close an open theme INI file
*
* PARAMS
* uf Theme INI file to close
*/
void UXINI_CloseINI(PUXINI_FILE uf)
{
HeapFree(GetProcessHeap(), 0, uf);
}
/**********************************************************************
* UXINI_ResetINI
*
* Reset the current pointer into INI file to the beginning of the file
*
* PARAMS
* uf Theme INI file to reset
*/
void UXINI_ResetINI(PUXINI_FILE uf)
{
uf->lpCurLoc = uf->lpIni;
}
/**********************************************************************
* UXINI_eof
*
* Determines if we are at the end of the INI file
*
* PARAMS
* uf Theme INI file to test
*/
static inline BOOL UXINI_eof(PUXINI_FILE uf)
{
return uf->lpCurLoc >= uf->lpEnd;
}
/**********************************************************************
* UXINI_isspace
*
* Check if a character is a space character
*
* PARAMS
* c Character to test
*/
static inline BOOL UXINI_isspace(WCHAR c)
{
if (isspace(c)) return TRUE;
if (c=='\r') return TRUE;
return FALSE;
}
/**********************************************************************
* UXINI_GetNextLine
*
* Get the next line in the INI file, non NULL terminated
* removes whitespace at beginning and end of line, and removes comments
*
* PARAMS
* uf INI file to retrieve next line
* dwLen Location to store pointer to line length
*
* RETURNS
* The section name, non NULL terminated
*/
static LPCWSTR UXINI_GetNextLine(PUXINI_FILE uf, DWORD *dwLen)
{
LPCWSTR lpLineEnd;
LPCWSTR lpLineStart;
DWORD len;
do {
if(UXINI_eof(uf)) return NULL;
/* Skip whitespace and empty lines */
while(!UXINI_eof(uf) && (UXINI_isspace(*uf->lpCurLoc) || *uf->lpCurLoc == '\n')) uf->lpCurLoc++;
lpLineStart = uf->lpCurLoc;
lpLineEnd = uf->lpCurLoc;
while(!UXINI_eof(uf) && *uf->lpCurLoc != '\n' && *uf->lpCurLoc != ';') lpLineEnd = ++uf->lpCurLoc;
/* If comment was found, skip the rest of the line */
if(*uf->lpCurLoc == ';')
while(!UXINI_eof(uf) && *uf->lpCurLoc != '\n') uf->lpCurLoc++;
len = (lpLineEnd - lpLineStart);
if(*lpLineStart != ';' && len == 0)
return NULL;
} while(*lpLineStart == ';');
/* Remove whitespace from end of line */
while(UXINI_isspace(lpLineStart[len-1])) len--;
*dwLen = len;
return lpLineStart;
}
static inline void UXINI_UnGetToLine(PUXINI_FILE uf, LPCWSTR lpLine)
{
uf->lpCurLoc = lpLine;
}
/**********************************************************************
* UXINI_GetNextSection
*
* Locate the next section in the ini file, and return pointer to
* section name, non NULL terminated. Use dwLen to determine length
*
* PARAMS
* uf INI file to search, search starts at current location
* dwLen Location to store pointer to section name length
*
* RETURNS
* The section name, non NULL terminated
*/
LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen)
{
LPCWSTR lpLine;
while((lpLine = UXINI_GetNextLine(uf, dwLen))) {
/* Assuming a ']' ending to the section name */
if(lpLine[0] == '[') {
lpLine++;
*dwLen -= 2;
break;
}
}
return lpLine;
}
/**********************************************************************
* UXINI_FindSection
*
* Locate a section with the specified name, search starts
* at current location in ini file
* to start search from start, call UXINI_ResetINI
*
* PARAMS
* uf INI file to search, search starts at current location
* lpName Name of the section to locate
*
* RETURNS
* TRUE if section was found, FALSE otherwise
*/
BOOL UXINI_FindSection(PUXINI_FILE uf, LPCWSTR lpName)
{
LPCWSTR lpSection;
DWORD dwLen;
while((lpSection = UXINI_GetNextSection(uf, &dwLen))) {
if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, lpSection, dwLen, lpName, -1) == CSTR_EQUAL) {
return TRUE;
}
}
return FALSE;
}
/**********************************************************************
* UXINI_GetNextValue
*
* Locate the next value in the current section
*
* PARAMS
* uf INI file to search, search starts at current location
* dwNameLen Location to store pointer to value name length
* lpValue Location to store pointer to the value
* dwValueLen Location to store pointer to value length
*
* RETURNS
* The value name, non NULL terminated
*/
LPCWSTR UXINI_GetNextValue(PUXINI_FILE uf, DWORD *dwNameLen, LPCWSTR *lpValue, DWORD *dwValueLen)
{
LPCWSTR lpLine;
LPCWSTR lpLineEnd;
LPCWSTR name = NULL;
LPCWSTR value = NULL;
DWORD vallen = 0;
DWORD namelen = 0;
DWORD dwLen;
lpLine = UXINI_GetNextLine(uf, &dwLen);
if(!lpLine)
return NULL;
if(lpLine[0] == '[') {
UXINI_UnGetToLine(uf, lpLine);
return NULL;
}
lpLineEnd = lpLine + dwLen;
name = lpLine;
while(namelen < dwLen && *lpLine != '=') {
lpLine++;
namelen++;
}
if(*lpLine != '=') return NULL;
lpLine++;
/* Remove whitespace from end of name */
while(UXINI_isspace(name[namelen-1])) namelen--;
/* Remove whitespace from beginning of value */
while(UXINI_isspace(*lpLine) && lpLine < lpLineEnd) lpLine++;
value = lpLine;
vallen = dwLen-(value-name);
*dwNameLen = namelen;
*dwValueLen = vallen;
*lpValue = value;
return name;
}
/**********************************************************************
* UXINI_FindValue
*
* Locate a value by name
*
* PARAMS
* uf INI file to search, search starts at current location
* lpName Value name to locate
* lpValue Location to store pointer to the value
* dwValueLen Location to store pointer to value length
*
* RETURNS
* The value name, non NULL terminated
*/
BOOL UXINI_FindValue(PUXINI_FILE uf, LPCWSTR lpName, LPCWSTR *lpValue, DWORD *dwValueLen)
{
LPCWSTR name;
DWORD namelen;
while((name = UXINI_GetNextValue(uf, &namelen, lpValue, dwValueLen))) {
if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, name, namelen, lpName, -1) == CSTR_EQUAL) {
return TRUE;
}
}
return FALSE;
}

View file

@ -0,0 +1,93 @@
# Undocumented functions - Names derived from debug symbols
1 stdcall -noname QueryThemeServices()
2 stdcall -noname OpenThemeFile(wstr wstr wstr ptr long)
3 stdcall -noname CloseThemeFile(ptr)
4 stdcall -noname ApplyTheme(ptr ptr ptr)
7 stdcall -noname GetThemeDefaults(wstr wstr long wstr long)
8 stdcall -noname EnumThemes(wstr ptr ptr)
9 stdcall -noname EnumThemeColors(wstr wstr long wstr)
10 stdcall -noname EnumThemeSizes(wstr wstr long wstr)
11 stdcall -noname ParseThemeIniFile(wstr wstr ptr ptr)
13 stub -noname DrawNCPreview
14 stub -noname RegisterDefaultTheme
15 stub -noname DumpLoadedThemeToTextFile
16 stub -noname OpenThemeDataFromFile
17 stub -noname OpenThemeFileFromData
18 stub -noname GetThemeSysSize96
19 stub -noname GetThemeSysFont96
20 stub -noname SessionAllocate
21 stub -noname SessionFree
22 stub -noname ThemeHooksOn
23 stub -noname ThemeHooksOff
24 stub -noname AreThemeHooksActive
25 stub -noname GetCurrentChangeNumber
26 stub -noname GetNewChangeNumber
27 stub -noname SetGlobalTheme
28 stub -noname GetGlobalTheme
29 stdcall -noname CheckThemeSignature(wstr)
30 stub -noname LoadTheme
31 stub -noname InitUserTheme
32 stub -noname InitUserRegistry
33 stub -noname ReestablishServerConnection
34 stub -noname ThemeHooksInstall
35 stub -noname ThemeHooksRemove
36 stub -noname RefreshThemeForTS
43 stub -noname ClassicGetSystemMetrics
44 stub -noname ClassicSystemParametersInfoA
45 stub -noname ClassicSystemParametersInfoW
46 stub -noname ClassicAdjustWindowRectEx
48 stub -noname GetThemeParseErrorInfo
60 stub -noname CreateThemeDataFromObjects
61 stub -noname OpenThemeDataEx
62 stub -noname ServerClearStockObjects
63 stub -noname MarkSelection
# Standard functions
@ stdcall CloseThemeData(ptr)
@ stdcall DrawThemeBackground(ptr ptr long long ptr ptr)
@ stdcall DrawThemeBackgroundEx(ptr ptr long long ptr ptr)
@ stdcall DrawThemeEdge(ptr ptr long long ptr long long ptr)
@ stdcall DrawThemeIcon(ptr ptr long long ptr ptr long)
@ stdcall DrawThemeParentBackground(ptr ptr ptr)
@ stdcall DrawThemeText(ptr ptr long long wstr long long long ptr)
@ stdcall EnableThemeDialogTexture(ptr long)
@ stdcall EnableTheming(long)
@ stdcall GetCurrentThemeName(wstr long wstr long wstr long)
@ stdcall GetThemeAppProperties()
@ stdcall GetThemeBackgroundContentRect(ptr ptr long long ptr ptr)
@ stdcall GetThemeBackgroundExtent(ptr ptr long long ptr ptr)
@ stdcall GetThemeBackgroundRegion(ptr ptr long long ptr ptr)
@ stdcall GetThemeBool(ptr long long long ptr)
@ stdcall GetThemeColor(ptr long long long ptr)
@ stdcall GetThemeDocumentationProperty(wstr wstr wstr long)
@ stdcall GetThemeEnumValue(ptr long long long ptr)
@ stdcall GetThemeFilename(ptr long long long wstr long)
@ stdcall GetThemeFont(ptr ptr long long long ptr)
@ stdcall GetThemeInt(ptr long long long ptr)
@ stdcall GetThemeIntList(ptr long long long ptr)
@ stdcall GetThemeMargins(ptr ptr long long long ptr ptr)
@ stdcall GetThemeMetric(ptr ptr long long long ptr)
@ stdcall GetThemePartSize(ptr ptr long long ptr long ptr)
@ stdcall GetThemePosition(ptr long long long ptr)
@ stdcall GetThemePropertyOrigin(ptr long long long ptr)
@ stdcall GetThemeRect(ptr long long long ptr)
@ stdcall GetThemeString(ptr long long long wstr long)
@ stdcall GetThemeSysBool(ptr long)
@ stdcall GetThemeSysColor(ptr long)
@ stdcall GetThemeSysColorBrush(ptr long)
@ stdcall GetThemeSysFont(ptr long ptr)
@ stdcall GetThemeSysInt(ptr long ptr)
@ stdcall GetThemeSysSize(ptr long)
@ stdcall GetThemeSysString(ptr long wstr long)
@ stdcall GetThemeTextExtent(ptr ptr long long wstr long long ptr ptr)
@ stdcall GetThemeTextMetrics(ptr ptr long long ptr)
@ stdcall GetWindowTheme(ptr)
@ stdcall HitTestThemeBackground(ptr long long long long ptr long long long ptr)
@ stdcall IsAppThemed()
@ stdcall IsThemeActive()
@ stdcall IsThemeBackgroundPartiallyTransparent(ptr long long)
@ stdcall IsThemeDialogTextureEnabled(ptr)
@ stdcall IsThemePartDefined(ptr long long)
@ stdcall OpenThemeData(ptr wstr)
@ stdcall SetThemeAppProperties(long)
@ stdcall SetWindowTheme(ptr wstr wstr)

View file

@ -0,0 +1,28 @@
<module name="uxtheme" type="win32dll" baseaddress="${BASEADDRESS_UXTHEME}" installbase="system32" installname="uxtheme.dll" warnings="true">
<importlibrary definition="uxtheme.spec.def" />
<include base="uxtheme">.</include>
<include base="ReactOS">include/wine</include>
<define name="__REACTOS__" />
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x501</define>
<library>wine</library>
<library>shlwapi</library>
<library>ntdll</library>
<library>advapi32</library>
<library>kernel32</library>
<library>gdi32</library>
<library>user32</library>
<library>msimg32</library>
<file>draw.c</file>
<file>main.c</file>
<file>metric.c</file>
<file>msstyles.c</file>
<file>property.c</file>
<file>stylemap.c</file>
<file>system.c</file>
<file>uxini.c</file>
<file>version.rc</file>
<file>uxtheme.spec</file>
</module>

View file

@ -0,0 +1,90 @@
/*
* Internal uxtheme defines & declarations
*
* Copyright (C) 2003 Kevin Koltzau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_UXTHEMEDLL_H
#define __WINE_UXTHEMEDLL_H
typedef HANDLE HTHEMEFILE;
/**********************************************************************
* EnumThemeProc
*
* Callback function for EnumThemes.
*
* RETURNS
* TRUE to continue enumeration, FALSE to stop
*
* PARAMS
* lpReserved Always 0
* pszThemeFileName Full path to theme msstyles file
* pszThemeName Display name for theme
* pszToolTip Tooltip name for theme
* lpReserved2 Always 0
* lpData Value passed through lpData from EnumThemes
*/
typedef BOOL (CALLBACK *EnumThemeProc)(LPVOID lpReserved, LPCWSTR pszThemeFileName,
LPCWSTR pszThemeName, LPCWSTR pszToolTip, LPVOID lpReserved2,
LPVOID lpData);
/**********************************************************************
* ParseThemeIniFileProc
*
* Callback function for ParseThemeIniFile.
*
* RETURNS
* TRUE to continue enumeration, FALSE to stop
*
* PARAMS
* dwType Entry type
* pszParam1 Use defined by entry type
* pszParam2 Use defined by entry type
* pszParam3 Use defined by entry type
* dwParam Use defined by entry type
* lpData Value passed through lpData from ParseThemeIniFile
*
* NOTES
* I don't know what the valid entry types are
*/
typedef BOOL (CALLBACK*ParseThemeIniFileProc)(DWORD dwType, LPWSTR pszParam1,
LPWSTR pszParam2, LPWSTR pszParam3,
DWORD dwParam, LPVOID lpData);
/* Declarations for undocumented functions for use internally */
DWORD WINAPI QueryThemeServices(void);
HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName,
LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile,
DWORD unknown);
HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile);
HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd);
HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName,
DWORD dwColorNameLen, LPWSTR pszSizeName,
DWORD dwSizeNameLen);
HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
LPVOID lpData);
HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
DWORD dwColorNum, LPWSTR pszColorName);
HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
DWORD dwSizeNum, LPWSTR pszSizeName);
HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown,
ParseThemeIniFileProc callback, LPVOID lpData);
extern void UXTHEME_InitSystem(HINSTANCE hInst);
#endif

View file

@ -0,0 +1,21 @@
/*
* Copyright (C) 2003 Kevin Koltzau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define WINE_FILENAME_STR "uxtheme.dll"
#include <wine/wine_common_ver.rc>

View file

@ -0,0 +1,45 @@
/*
* Copyright (C) 2003 Kevin Koltzau
* Copyright (C) 2004 Francois Gouget
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SCHEMADEF_H
#define SCHEMADEF_H
#define BEGIN_TM_SCHEMA(name)
#define END_TM_SCHEMA(name)
#define BEGIN_TM_ENUM(name) enum name {
#define TM_ENUM(value, prefix, name) prefix##_##name = (value),
#define END_TM_ENUM() };
#define BEGIN_TM_PROPS() enum PropValues { \
DummyProp = 49,
#define TM_PROP(value, prefix, name, type) prefix##_##name = (value),
#define END_TM_PROPS() };
#define BEGIN_TM_CLASS_PARTS(name) enum name##PARTS { \
name##PartFiller0,
#define TM_PART(value, prefix, name) prefix##_##name = (value),
#define END_TM_CLASS_PARTS() };
#define BEGIN_TM_PART_STATES(name) enum name##STATES { \
name##StateFiller0,
#define TM_STATE(value, prefix, name) prefix##_##name = (value),
#define END_TM_PART_STATES() };
#endif

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,8 @@
#pragma GCC system_header
#endif
#include <commctrl.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -45,7 +47,7 @@ typedef enum THEMESIZE {
TS_MIN,
TS_TRUE,
TS_DRAW
} THEME_SIZE;
} THEMESIZE;
typedef struct _DTBGOPTS {
DWORD dwSize;
DWORD dwFlags;
@ -83,12 +85,12 @@ HRESULT WINAPI GetThemeColor(HTHEME,int,int,int,COLORREF*);
HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR,LPCWSTR,LPWSTR,int);
HRESULT WINAPI GetThemeEnumValue(HTHEME,int,int,int,int*);
HRESULT WINAPI GetThemeFilename(HTHEME,int,int,int,LPWSTR,int);
HRESULT WINAPI GetThemeFont(HTHEME,HDC,int,int,int,LOGFONT*);
HRESULT WINAPI GetThemeFont(HTHEME,HDC,int,int,int,LOGFONTW*);
HRESULT WINAPI GetThemeInt(HTHEME,int,int,int,int*);
HRESULT WINAPI GetThemeIntList(HTHEME,int,int,int,INTLIST*);
HRESULT WINAPI GetThemeMargins(HTHEME,HDC,int,int,int,RECT*,MARGINS*);
HRESULT WINAPI GetThemeMetric(HTHEME,HDC,int,int,int,int*);
HRESULT WINAPI GetThemePartSize(HTHEME,HDC,int,int,RECT*,THEME_SIZE,SIZE*);
HRESULT WINAPI GetThemePartSize(HTHEME,HDC,int,int,RECT*,THEMESIZE,SIZE*);
HRESULT WINAPI GetThemePosition(HTHEME,int,int,int,POINT*);
HRESULT WINAPI GetThemePropertyOrigin(HTHEME,int,int,int,PROPERTYORIGIN*);
HRESULT WINAPI GetThemeRect(HTHEME,int,int,int,RECT*);
@ -96,12 +98,12 @@ HRESULT WINAPI GetThemeString(HTHEME,int,int,int,LPWSTR,int);
BOOL WINAPI GetThemeSysBool(HTHEME,int);
COLORREF WINAPI GetThemeSysColor(HTHEME,int);
HBRUSH WINAPI GetThemeSysColorBrush(HTHEME,int);
HRESULT WINAPI GetThemeSysFont(HTHEME,int,LOGFONT*);
HRESULT WINAPI GetThemeSysFont(HTHEME,int,LOGFONTW*);
HRESULT WINAPI GetThemeSysInt(HTHEME,int,int*);
int WINAPI GetThemeSysSize(HTHEME,int);
HRESULT WINAPI GetThemeSysString(HTHEME,int,LPWSTR,int);
HRESULT WINAPI GetThemeTextExtent(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,const RECT*,RECT*);
HRESULT WINAPI GetThemeTextMetrics(HTHEME,HDC,int,int,TEXTMETRIC*);
HRESULT WINAPI GetThemeTextMetrics(HTHEME,HDC,int,int,TEXTMETRICW*);
HTHEME WINAPI GetWindowTheme(HWND);
HRESULT WINAPI HitTestThemeBackground(HTHEME,HDC,int,int,DWORD,const RECT*,HRGN,POINT,WORD*);
BOOL WINAPI IsAppThemed();

View file

@ -1039,7 +1039,7 @@ typedef void(CALLBACK *PTIMERAPCROUTINE)(PVOID,DWORD,DWORD);
#if (_WIN32_WINNT >= 0x0500)
typedef void(CALLBACK *WAITORTIMERCALLBACK)(PVOID,BOOLEAN);
#endif
#define MAKEINTATOM(i) (LPTSTR)((DWORD)((WORD)(i)))
#define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i)))
/* Functions */
#ifndef UNDER_CE
int APIENTRY WinMain(HINSTANCE,HINSTANCE,LPSTR,int);

View file

@ -1159,7 +1159,9 @@ extern "C" {
#define SPI_GETSCREENSAVEACTIVE 16
#define SPI_GETSCREENSAVETIMEOUT 14
#define SPI_GETSERIALKEYS 62
#define SPI_GETSHOWIMEUI 110
#define SPI_GETSHOWSOUNDS 56
#define SPI_GETSNAPTODEFBUTTON 95
#define SPI_GETSOUNDSENTRY 64
#define SPI_GETSTICKYKEYS 58
#define SPI_GETTOGGLEKEYS 52
@ -1220,7 +1222,9 @@ extern "C" {
#define SPI_SETSCREENSAVERRUNNING 97
#define SPI_SETSCREENSAVETIMEOUT 15
#define SPI_SETSERIALKEYS 63
#define SPI_SETSHOWIMEUI 111
#define SPI_SETSHOWSOUNDS 57
#define SPI_SETSNAPTODEFBUTTON 96
#define SPI_SETSOUNDSENTRY 65
#define SPI_SETSTICKYKEYS 59
#define SPI_SETTOGGLEKEYS 53
@ -1232,8 +1236,12 @@ extern "C" {
#define SPI_GETSCREENSAVERRUNNING 114
#define SPI_GETACTIVEWINDOWTRACKING 0x1000
#define SPI_GETACTIVEWNDTRKZORDER 0x100C
#define SPI_GETCARETWIDTH 0x2006
#define SPI_GETCOMBOBOXANIMATION 0x1004
#define SPI_GETCURSORSHADOW 0x101A
#define SPI_GETDROPSHADOW 0x1024
#define SPI_GETFOREGROUNDFLASHCOUNT 0x2004
#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000
#define SPI_GETGRADIENTCAPTIONS 0x1008
#define SPI_GETHOTTRACKING 0x100E
#define SPI_GETKEYBOARDCUES 0x100A
@ -1244,8 +1252,12 @@ extern "C" {
#define SPI_GETSELECTIONFADE 0x1014
#define SPI_GETTOOLTIPANIMATION 0x1016
#define SPI_GETTOOLTIPFADE 0x1018
#define SPI_SETCARETWIDTH 0x2007
#define SPI_SETCOMBOBOXANIMATION 0x1005
#define SPI_SETCURSORSHADOW 0x101B
#define SPI_SETDROPSHADOW 0x1025
#define SPI_SETFOREGROUNDFLASHCOUNT 0x2005
#define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001
#define SPI_SETGRADIENTCAPTIONS 0x1009
#define SPI_SETHOTTRACKING 0x100F
#define SPI_SETKEYBOARDCUES 0x100B
@ -1263,8 +1275,18 @@ extern "C" {
#define FE_FONTSMOOTHINGSTANDARD 1
#define FE_FONTSMOOTHINGCLEARTYPE 2
#define FE_FONTSMOOTHINGDOCKING 32768
#define SPI_GETBLOCKSENDINPUTRESETS 0x1026
#define SPI_SETBLOCKSENDINPUTRESETS 0x1027
#define SPI_GETUIEFFECTS 0x103E
#define SPI_SETUIEFFECTS 0x103F
#define SPI_GETMOUSECLICKLOCKTIME 8200
#define SPI_SETMOUSECLICKLOCKTIME 8201
#define SPI_GETMOUSESONAR 0x101C
#define SPI_SETMOUSESONAR 0x101D
#define SPI_GETMOUSEVANISH 0x1020
#define SPI_SETMOUSEVANISH 0x1021
#define SPI_GETFLATMENU 0x1022
#define SPI_SETFLATMENU 0x1023
#define SPI_GETFONTSMOOTHINGTYPE 8202
#define SPI_SETFONTSMOOTHINGTYPE 8203
#define SPI_GETFONTSMOOTHINGCONTRAST 8204
@ -1488,6 +1510,10 @@ extern "C" {
#define GET_WHEEL_DELTA_WPARAM(wparam) ((short)HIWORD (wparam))
#define WHEEL_PAGESCROLL UINT_MAX
#endif
#if (_WIN32_WINNT >= 0x0501)
#define WM_THEMECHANGED 794
#endif
#define BM_CLICK 245
#define BM_GETCHECK 240
#define BM_GETIMAGE 246