2003-12-04 21:55:30 +01:00
|
|
|
/*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-12-04 21:55:30 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "wingdi.h"
|
2006-11-08 00:57:55 +01:00
|
|
|
#include "vfwmsgs.h"
|
2003-12-04 21:55:30 +01:00
|
|
|
#include "uxtheme.h"
|
2021-11-02 07:27:31 +01:00
|
|
|
#include "vssym32.h"
|
2003-12-04 21:55:30 +01:00
|
|
|
|
2004-01-23 05:34:02 +01:00
|
|
|
#include "msstyles.h"
|
2003-12-04 21:55:30 +01:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeBool (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, BOOL *pfVal)
|
|
|
|
{
|
2004-01-23 05:34:02 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_BOOL, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyBool(tp, pfVal);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeColor (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, COLORREF *pColor)
|
|
|
|
{
|
2004-01-23 05:34:02 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_COLOR, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyColor(tp, pColor);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeEnumValue (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, int *piVal)
|
|
|
|
{
|
2004-02-20 06:12:21 +01:00
|
|
|
HRESULT hr;
|
2004-01-23 05:34:02 +01:00
|
|
|
WCHAR val[60];
|
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_ENUM, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
|
2018-09-18 20:38:19 +02:00
|
|
|
hr = MSSTYLES_GetPropertyString(tp, val, ARRAY_SIZE(val));
|
2004-02-20 06:12:21 +01:00
|
|
|
if(FAILED(hr))
|
|
|
|
return hr;
|
2004-01-23 05:34:02 +01:00
|
|
|
if(!MSSTYLES_LookupEnum(val, iPropId, piVal))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
|
|
|
return S_OK;
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeFilename (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, LPWSTR pszThemeFilename,
|
|
|
|
int cchMaxBuffChars)
|
|
|
|
{
|
2004-01-23 05:34:02 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyString(tp, pszThemeFilename, cchMaxBuffChars);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeFont (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
|
|
|
|
int iStateId, int iPropId, LOGFONTW *pFont)
|
|
|
|
{
|
2004-02-16 21:32:59 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-02-16 21:32:59 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyFont(tp, hdc, pFont);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeInt (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, int *piVal)
|
|
|
|
{
|
2004-01-23 05:34:02 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INT, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyInt(tp, piVal);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeIntList (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, INTLIST *pIntList)
|
|
|
|
{
|
2004-02-16 21:32:59 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-02-16 21:32:59 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyIntList(tp, pIntList);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemePosition (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, POINT *pPoint)
|
|
|
|
{
|
2004-01-23 05:34:02 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_POSITION, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyPosition(tp, pPoint);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeRect (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeRect(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, RECT *pRect)
|
|
|
|
{
|
2004-01-23 05:34:02 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_RECT, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyRect(tp, pRect);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeString (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeString(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, LPWSTR pszBuff, int cchMaxBuffChars)
|
|
|
|
{
|
2004-01-23 05:34:02 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
2015-04-10 00:45:51 +02:00
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_STRING, iPropId)))
|
2004-01-23 05:34:02 +01:00
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyString(tp, pszBuff, cchMaxBuffChars);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeMargins (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
|
|
|
|
int iStateId, int iPropId, RECT *prc,
|
|
|
|
MARGINS *pMargins)
|
|
|
|
{
|
2004-01-23 05:34:02 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2005-07-27 17:15:09 +02:00
|
|
|
memset (pMargins, 0, sizeof (MARGINS));
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_MARGINS, iPropId)))
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2004-02-20 06:12:21 +01:00
|
|
|
return MSSTYLES_GetPropertyMargins(tp, prc, pMargins);
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemeMetric (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId,
|
|
|
|
int iStateId, int iPropId, int *piVal)
|
|
|
|
{
|
2004-02-20 06:12:21 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
WCHAR val[60];
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-02-20 06:12:21 +01:00
|
|
|
|
|
|
|
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:
|
2018-09-18 20:38:19 +02:00
|
|
|
hr = MSSTYLES_GetPropertyString(tp, val, ARRAY_SIZE(val));
|
2004-02-20 06:12:21 +01:00
|
|
|
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;
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetThemePropertyOrigin (UXTHEME.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetThemePropertyOrigin(HTHEME hTheme, int iPartId, int iStateId,
|
|
|
|
int iPropId, PROPERTYORIGIN *pOrigin)
|
|
|
|
{
|
2004-01-23 05:34:02 +01:00
|
|
|
PTHEME_PROPERTY tp;
|
|
|
|
|
|
|
|
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
2003-12-04 21:55:30 +01:00
|
|
|
if(!hTheme)
|
|
|
|
return E_HANDLE;
|
2004-01-23 05:34:02 +01:00
|
|
|
|
|
|
|
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) {
|
|
|
|
*pOrigin = PO_NOTFOUND;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
*pOrigin = tp->origin;
|
|
|
|
return S_OK;
|
2003-12-04 21:55:30 +01:00
|
|
|
}
|