Sync to Wine-20050830:

Kevin Koltzau <kevin@plop.org>
- Fix 'cast to pointer from integer of different size' warnings in
  64bit.
Frank Richter <frank.richter@gmail.com>
- Add support for the BT_NONE background type.
- Better computations to have uniformly sized parts scaled in both
  directions.
- Implement GetThemeBackgroundExtent().
- Implement DrawThemeEdge().
- Implement support for the ST_TILE background stretching mode.
- Implementation for GetThemePartSize() (not entirely equivalent to
  native uxtheme, but sensibly useable).
- Enhance uxtheme to store the themed system metrics in the registry and
  also backup the old metrics. That way, themed system colors are set
  even uxtheme was not loaded and initialized yet, and when a theme is
  deactivated, the colors prior to the activation are restored as well.
- Also, not having to set the system colors in uxtheme startup works
  around weird problems where SetSystemColors() ended up being called
  from inside window creation and this seemingly led to some creation
  message being sent twice.
- Make GetThemeMargins() return default values (0 margin) if the
  function does not succeed.
- More elaborate IsThemeBackgroundPartiallyTransparent() implementation;
  also returns TRUE for theme parts with 32bpp images.
- Since theme images are reused now it's not really a good idea to
  delete them in drawing functions.
- Pass around what kind of transparency an image actually needs. Use
  alpha-blending for 32bpp images.
- Set some default values for truesize sizing that seem closer to
  Windows.
- If a MINSIZEn property is not present, fall back to actual size of nth
  image to determine whether it is suitable.
- EnumThemeColors() and EnumThemeSizes() actually do not return a single
  string with the color/size name, but rather a struct containing three
  strings - name, display name and tooltip.
- The default image layout is HORIZONTAL, not VERTICAL.
- Take a common computation out of two if-branches in
  UXTHEME_LoadImage().
- Compare result of RegQueryValueExW() with ERROR_SUCCESS.
- Another fix to use magenta as the default transparent color.
- Implement "manual" image sharing(as opposed to using LoadImage() with
  LR_SHARED) by keeping the loaded images in a list. This is needed for
  proper alpha support later on since once-per-image preparations will
  be needed then.
- Add support for horizontal & vertical alignment when doing truesize
  sizing.
- Whatever TrueSizeStretchMark is for - it's not what Wine uxtheme used
  it for. Native uxtheme always stretches "truesize" parts when the
  destination is smaller than the part image size, but
  TrueSizeStretchMark doesn't seem to have an influence.

svn path=/trunk/; revision=17719
This commit is contained in:
Gé van Geldorp 2005-09-07 16:22:51 +00:00
parent 3a0cf7d618
commit 190de1fde5
8 changed files with 1379 additions and 298 deletions

View file

@ -1,25 +0,0 @@
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:

File diff suppressed because it is too large Load diff

View file

@ -45,9 +45,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value);
BOOL MSSTYLES_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize);
void MSSTYLES_ParseThemeIni(PTHEME_FILE tf);
void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics);
extern HINSTANCE hDllInst;
extern int alphaBlendMode;
#define MSSTYLES_VERSION 0x0003
@ -214,6 +215,13 @@ void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
HeapFree(GetProcessHeap(), 0, pcls);
}
}
while (tf->images)
{
PTHEME_IMAGE img = tf->images;
tf->images = img->next;
DeleteObject (img->image);
HeapFree (GetProcessHeap(), 0, img);
}
HeapFree(GetProcessHeap(), 0, tf);
}
}
@ -224,7 +232,7 @@ void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
*
* Set the current active theme
*/
HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf)
HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf, BOOL setMetrics)
{
if(tfActiveTheme)
MSSTYLES_CloseThemeFile(tfActiveTheme);
@ -233,7 +241,7 @@ HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf)
{
tfActiveTheme->dwRefCount++;
if(!tfActiveTheme->classes)
MSSTYLES_ParseThemeIni(tfActiveTheme);
MSSTYLES_ParseThemeIni(tfActiveTheme, setMetrics);
}
return S_OK;
}
@ -664,7 +672,7 @@ static PTHEME_PROPERTY MSSTYLES_AddMetric(PTHEME_FILE tf, int iPropertyPrimitive
* PARAMS
* tf Theme to parse
*/
void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
{
static const WCHAR szSysMetrics[] = {'S','y','s','M','e','t','r','i','c','s','\0'};
static const WCHAR szGlobals[] = {'g','l','o','b','a','l','s','\0'};
@ -709,9 +717,9 @@ void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
FIXME("Invalid color value for %s\n", debugstr_w(szPropertyName));
}
}
else if (iPropertyId == TMT_FLATMENUS) {
else if (setMetrics && (iPropertyId == TMT_FLATMENUS)) {
BOOL flatMenus = (*lpValue == 'T') || (*lpValue == 't');
SystemParametersInfoW (SPI_SETFLATMENU, 0, (PVOID)flatMenus, 0);
SystemParametersInfoW (SPI_SETFLATMENU, 0, (PVOID)(INT_PTR)flatMenus, 0);
}
/* Catch all metrics, including colors */
MSSTYLES_AddMetric(tf, iPropertyPrimitive, iPropertyId, lpValue, dwValueLen);
@ -720,7 +728,7 @@ void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
TRACE("Unknown system metric %s\n", debugstr_w(szPropertyName));
}
}
if(colorCount > 0)
if (setMetrics && (colorCount > 0))
SetSysColors(colorCount, colorElements, colorRgb);
continue;
}
@ -868,10 +876,43 @@ PTHEME_PROPERTY MSSTYLES_FindProperty(PTHEME_CLASS tc, int iPartId, int iStateId
return NULL;
}
HBITMAP MSSTYLES_LoadBitmap(HDC hdc, PTHEME_CLASS tc, LPCWSTR lpFilename)
/* Prepare a bitmap to be used for alpha blending */
static BOOL prepare_alpha (HBITMAP bmp, BOOL* hasAlpha)
{
DIBSECTION dib;
int n;
BYTE* p;
*hasAlpha = FALSE;
if (!bmp || GetObjectW( bmp, sizeof(dib), &dib ) != sizeof(dib))
return FALSE;
if(dib.dsBm.bmBitsPixel != 32)
/* nothing to do */
return TRUE;
*hasAlpha = TRUE;
p = (BYTE*)dib.dsBm.bmBits;
n = abs(dib.dsBmih.biHeight) * dib.dsBmih.biWidth;
/* AlphaBlend() wants premultiplied alpha, so do that now */
while (n-- > 0)
{
int a = p[3]+1;
p[0] = (p[0] * a) >> 8;
p[1] = (p[1] * a) >> 8;
p[2] = (p[2] * a) >> 8;
p += 4;
}
return TRUE;
}
HBITMAP MSSTYLES_LoadBitmap (PTHEME_CLASS tc, LPCWSTR lpFilename, BOOL* hasAlpha)
{
WCHAR szFile[MAX_PATH];
LPWSTR tmp;
PTHEME_IMAGE img;
lstrcpynW(szFile, lpFilename, sizeof(szFile)/sizeof(szFile[0]));
tmp = szFile;
do {
@ -879,7 +920,30 @@ HBITMAP MSSTYLES_LoadBitmap(HDC hdc, PTHEME_CLASS tc, LPCWSTR lpFilename)
if(*tmp == '/') *tmp = '_';
if(*tmp == '.') *tmp = '_';
} while(*tmp++);
return LoadImageW(tc->hTheme, szFile, IMAGE_BITMAP, 0, 0, LR_SHARED|LR_CREATEDIBSECTION);
/* Try to locate in list of loaded images */
img = tc->tf->images;
while (img)
{
if (lstrcmpiW (szFile, img->name) == 0)
{
TRACE ("found %p %s: %p\n", img, debugstr_w (img->name), img->image);
*hasAlpha = img->hasAlpha;
return img->image;
}
img = img->next;
}
/* Not found? Load from resources */
img = HeapAlloc (GetProcessHeap(), 0, sizeof (THEME_IMAGE));
img->image = LoadImageW(tc->hTheme, szFile, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
prepare_alpha (img->image, hasAlpha);
img->hasAlpha = *hasAlpha;
/* ...and stow away for later reuse. */
lstrcpyW (img->name, szFile);
img->next = tc->tf->images;
tc->tf->images = img;
TRACE ("new %p %s: %p\n", img, debugstr_w (img->name), img->image);
return img->image;
}
BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value)

View file

@ -59,6 +59,14 @@ typedef struct _THEME_CLASS {
struct _THEME_CLASS *next;
} THEME_CLASS, *PTHEME_CLASS;
typedef struct _THEME_IMAGE {
WCHAR name[MAX_PATH];
HBITMAP image;
BOOL hasAlpha;
struct _THEME_IMAGE *next;
} THEME_IMAGE, *PTHEME_IMAGE;
typedef struct _THEME_FILE {
DWORD dwRefCount;
HMODULE hTheme;
@ -71,13 +79,14 @@ typedef struct _THEME_FILE {
PTHEME_CLASS classes;
PTHEME_PROPERTY metrics;
PTHEME_IMAGE images;
} 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);
HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf, BOOL setMetrics);
PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList);
HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc);
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId);
@ -88,7 +97,7 @@ PTHEME_PARTSTATE MSSTYLES_FindPartState(PTHEME_CLASS tc, int iPartId, int iState
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);
HBITMAP MSSTYLES_LoadBitmap(PTHEME_CLASS tc, LPCWSTR lpFilename, BOOL* hasAlpha);
HRESULT MSSTYLES_GetPropertyBool(PTHEME_PROPERTY tp, BOOL *pfVal);
HRESULT MSSTYLES_GetPropertyColor(PTHEME_PROPERTY tp, COLORREF *pColor);

View file

@ -225,6 +225,7 @@ HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
PTHEME_PROPERTY tp;
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
memset (pMargins, 0, sizeof (MARGINS));
if(!hTheme)
return E_HANDLE;

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
@ -146,18 +147,210 @@ static void UXTHEME_LoadTheme(void)
lstrcpynW(szCurrentColor, pt->pszSelectedColor, sizeof(szCurrentColor)/sizeof(szCurrentColor[0]));
lstrcpynW(szCurrentSize, pt->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0]));
MSSTYLES_SetActiveTheme(pt);
MSSTYLES_SetActiveTheme(pt, FALSE);
TRACE("Theme active: %s %s %s\n", debugstr_w(szCurrentTheme),
debugstr_w(szCurrentColor), debugstr_w(szCurrentSize));
MSSTYLES_CloseThemeFile(pt);
}
}
if(!bThemeActive) {
MSSTYLES_SetActiveTheme(NULL);
MSSTYLES_SetActiveTheme(NULL, FALSE);
TRACE("Themeing not active\n");
}
}
/***********************************************************************/
static const char * const SysColorsNames[] =
{
"Scrollbar", /* COLOR_SCROLLBAR */
"Background", /* COLOR_BACKGROUND */
"ActiveTitle", /* COLOR_ACTIVECAPTION */
"InactiveTitle", /* COLOR_INACTIVECAPTION */
"Menu", /* COLOR_MENU */
"Window", /* COLOR_WINDOW */
"WindowFrame", /* COLOR_WINDOWFRAME */
"MenuText", /* COLOR_MENUTEXT */
"WindowText", /* COLOR_WINDOWTEXT */
"TitleText", /* COLOR_CAPTIONTEXT */
"ActiveBorder", /* COLOR_ACTIVEBORDER */
"InactiveBorder", /* COLOR_INACTIVEBORDER */
"AppWorkSpace", /* COLOR_APPWORKSPACE */
"Hilight", /* COLOR_HIGHLIGHT */
"HilightText", /* COLOR_HIGHLIGHTTEXT */
"ButtonFace", /* COLOR_BTNFACE */
"ButtonShadow", /* COLOR_BTNSHADOW */
"GrayText", /* COLOR_GRAYTEXT */
"ButtonText", /* COLOR_BTNTEXT */
"InactiveTitleText", /* COLOR_INACTIVECAPTIONTEXT */
"ButtonHilight", /* COLOR_BTNHIGHLIGHT */
"ButtonDkShadow", /* COLOR_3DDKSHADOW */
"ButtonLight", /* COLOR_3DLIGHT */
"InfoText", /* COLOR_INFOTEXT */
"InfoWindow", /* COLOR_INFOBK */
"ButtonAlternateFace", /* COLOR_ALTERNATEBTNFACE */
"HotTrackingColor", /* COLOR_HOTLIGHT */
"GradientActiveTitle", /* COLOR_GRADIENTACTIVECAPTION */
"GradientInactiveTitle", /* COLOR_GRADIENTINACTIVECAPTION */
"MenuHilight", /* COLOR_MENUHILIGHT */
"MenuBar", /* COLOR_MENUBAR */
};
static const WCHAR strColorKey[] =
{ 'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
'C','o','l','o','r','s',0 };
static const WCHAR keyFlatMenus[] = { 'F','l','a','t','M','e','n','u', 0};
static const struct BackupSysParam
{
int spiGet, spiSet;
const WCHAR* keyName;
} backupSysParams[] =
{
{SPI_GETFLATMENU, SPI_SETFLATMENU, keyFlatMenus},
{-1, -1, 0}
};
#define NUM_SYS_COLORS (COLOR_MENUBAR+1)
static void save_sys_colors (HKEY baseKey)
{
char colorStr[13];
HKEY hKey;
int i;
if (RegCreateKeyExW( baseKey, strColorKey,
0, 0, 0, KEY_ALL_ACCESS,
0, &hKey, 0 ) == ERROR_SUCCESS)
{
for (i = 0; i < NUM_SYS_COLORS; i++)
{
COLORREF col = GetSysColor (i);
sprintf (colorStr, "%d %d %d",
GetRValue (col), GetGValue (col), GetBValue (col));
RegSetValueExA (hKey, SysColorsNames[i], 0, REG_SZ,
(BYTE*)colorStr, strlen (colorStr)+1);
}
RegCloseKey (hKey);
}
}
/* Before activating a theme, query current system colors, certain settings
* and backup them in the registry, so they can be restored when the theme
* is deactivated */
static void UXTHEME_BackupSystemMetrics(void)
{
HKEY hKey;
const struct BackupSysParam* bsp = backupSysParams;
if (RegCreateKeyExW( HKEY_CURRENT_USER, szThemeManager,
0, 0, 0, KEY_ALL_ACCESS,
0, &hKey, 0) == ERROR_SUCCESS)
{
save_sys_colors (hKey);
while (bsp->spiGet >= 0)
{
DWORD value;
SystemParametersInfoW (bsp->spiGet, 0, &value, 0);
RegSetValueExW (hKey, bsp->keyName, 0, REG_DWORD,
(LPBYTE)&value, sizeof (value));
bsp++;
}
RegCloseKey (hKey);
}
}
/* Read back old settings after a theme was deactivated */
static void UXTHEME_RestoreSystemMetrics(void)
{
HKEY hKey;
const struct BackupSysParam* bsp = backupSysParams;
if (RegOpenKeyExW (HKEY_CURRENT_USER, szThemeManager,
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
HKEY colorKey;
/* read backed-up colors */
if (RegOpenKeyExW (hKey, strColorKey,
0, KEY_QUERY_VALUE, &colorKey) == ERROR_SUCCESS)
{
int i;
COLORREF sysCols[NUM_SYS_COLORS];
int sysColsIndices[NUM_SYS_COLORS];
int sysColCount = 0;
for (i = 0; i < NUM_SYS_COLORS; i++)
{
DWORD type;
char colorStr[13];
DWORD count = sizeof(colorStr);
if (RegQueryValueExA (colorKey, SysColorsNames[i], 0,
&type, colorStr, &count) == ERROR_SUCCESS)
{
int r, g, b;
if (sscanf (colorStr, "%d %d %d", &r, &g, &b) == 3)
{
sysColsIndices[sysColCount] = i;
sysCols[sysColCount] = RGB(r, g, b);
sysColCount++;
}
}
}
RegCloseKey (colorKey);
SetSysColors (sysColCount, sysColsIndices, sysCols);
}
/* read backed-up other settings */
while (bsp->spiGet >= 0)
{
DWORD value;
DWORD count = sizeof(value);
DWORD type;
if (RegQueryValueExW (hKey, bsp->keyName, 0,
&type, (LPBYTE)&value, &count) == ERROR_SUCCESS)
{
SystemParametersInfoW (bsp->spiSet, 0, (LPVOID)value,
SPIF_UPDATEINIFILE);
}
bsp++;
}
RegCloseKey (hKey);
}
}
/* Make system settings persistent, so they're in effect even w/o uxtheme
* loaded */
static void UXTHEME_SaveSystemMetrics(void)
{
const struct BackupSysParam* bsp = backupSysParams;
save_sys_colors (HKEY_CURRENT_USER);
while (bsp->spiGet >= 0)
{
DWORD value;
SystemParametersInfoW (bsp->spiGet, 0, &value, 0);
SystemParametersInfoW (bsp->spiSet, 0, (LPVOID)value,
SPIF_UPDATEINIFILE);
bsp++;
}
}
/***********************************************************************
* UXTHEME_SetActiveTheme
*
@ -169,7 +362,8 @@ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
WCHAR tmp[2];
HRESULT hr;
hr = MSSTYLES_SetActiveTheme(tf);
if(tf) UXTHEME_BackupSystemMetrics();
hr = MSSTYLES_SetActiveTheme(tf, TRUE);
if(FAILED(hr))
return hr;
if(tf) {
@ -179,6 +373,7 @@ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
lstrcpynW(szCurrentSize, tf->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0]));
}
else {
UXTHEME_RestoreSystemMetrics();
bThemeActive = FALSE;
szCurrentTheme[0] = '\0';
szCurrentColor[0] = '\0';
@ -208,6 +403,9 @@ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
}
else
TRACE("Failed to open theme registry key\n");
UXTHEME_SaveSystemMetrics ();
return hr;
}
@ -270,6 +468,11 @@ HRESULT WINAPI EnableTheming(BOOL fEnable)
TRACE("(%d)\n", fEnable);
if(fEnable != bThemeActive) {
if(fEnable)
UXTHEME_BackupSystemMetrics();
else
UXTHEME_RestoreSystemMetrics();
UXTHEME_SaveSystemMetrics ();
bThemeActive = fEnable;
if(bThemeActive) szEnabled[0] = '1';
if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
@ -695,7 +898,7 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
* 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
* pszColorNames Output color names
*
* RETURNS
* S_OK on success
@ -703,19 +906,20 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
* 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
* XP fails with E_POINTER when pszColorNames points to a buffer smaller than
* sizeof(THEMENAMES).
*
* 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)
DWORD dwColorNum, PTHEMENAMES pszColorNames)
{
PTHEME_FILE pt;
HRESULT hr;
LPWSTR tmp;
UINT resourceId = dwColorNum + 1000;
TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
debugstr_w(pszSizeName), dwColorNum);
@ -729,7 +933,13 @@ HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
}
if(!dwColorNum && *tmp) {
TRACE("%s\n", debugstr_w(tmp));
lstrcpyW(pszColorName, tmp);
lstrcpyW(pszColorNames->szName, tmp);
LoadStringW (pt->hTheme, resourceId,
pszColorNames->szDisplayName,
sizeof (pszColorNames->szDisplayName) / sizeof (WCHAR));
LoadStringW (pt->hTheme, resourceId+1000,
pszColorNames->szTooltip,
sizeof (pszColorNames->szTooltip) / sizeof (WCHAR));
}
else
hr = E_PROP_ID_UNSUPPORTED;
@ -748,7 +958,7 @@ HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
* 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
* pszSizeNames Output size names
*
* RETURNS
* S_OK on success
@ -756,19 +966,20 @@ HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
* 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
* XP fails with E_POINTER when pszSizeNames points to a buffer smaller than
* sizeof(THEMENAMES).
*
* 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)
DWORD dwSizeNum, PTHEMENAMES pszSizeNames)
{
PTHEME_FILE pt;
HRESULT hr;
LPWSTR tmp;
UINT resourceId = dwSizeNum + 3000;
TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
debugstr_w(pszColorName), dwSizeNum);
@ -782,7 +993,13 @@ HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
}
if(!dwSizeNum && *tmp) {
TRACE("%s\n", debugstr_w(tmp));
lstrcpyW(pszSizeName, tmp);
lstrcpyW(pszSizeNames->szName, tmp);
LoadStringW (pt->hTheme, resourceId,
pszSizeNames->szDisplayName,
sizeof (pszSizeNames->szDisplayName) / sizeof (WCHAR));
LoadStringW (pt->hTheme, resourceId+1000,
pszSizeNames->szTooltip,
sizeof (pszSizeNames->szTooltip) / sizeof (WCHAR));
}
else
hr = E_PROP_ID_UNSUPPORTED;

View file

@ -1,93 +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)
# 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 ptr)
10 stdcall -noname EnumThemeSizes(wstr wstr long ptr)
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

@ -66,6 +66,15 @@ typedef BOOL (CALLBACK*ParseThemeIniFileProc)(DWORD dwType, LPWSTR pszParam1,
LPWSTR pszParam2, LPWSTR pszParam3,
DWORD dwParam, LPVOID lpData);
/* Structure filled in by EnumThemeColors() and EnumeThemeSizes() with the
* various strings for a theme color or size. */
typedef struct tagTHEMENAMES
{
WCHAR szName[MAX_PATH+1];
WCHAR szDisplayName[MAX_PATH+1];
WCHAR szTooltip[MAX_PATH+1];
} THEMENAMES, *PTHEMENAMES;
/* Declarations for undocumented functions for use internally */
DWORD WINAPI QueryThemeServices(void);
HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName,
@ -79,12 +88,19 @@ HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName,
HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
LPVOID lpData);
HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
DWORD dwColorNum, LPWSTR pszColorName);
DWORD dwColorNum, PTHEMENAMES pszColorNames);
HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
DWORD dwSizeNum, LPWSTR pszSizeName);
DWORD dwSizeNum, PTHEMENAMES pszColorNames);
HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown,
ParseThemeIniFileProc callback, LPVOID lpData);
extern void UXTHEME_InitSystem(HINSTANCE hInst);
#endif
/* No alpha blending */
#define ALPHABLEND_NONE 0
/* "Cheap" binary alpha blending - but possibly faster */
#define ALPHABLEND_BINARY 1
/* Full alpha blending */
#define ALPHABLEND_FULL 2
#endif /* __WINE_UXTHEMEDLL_H */