Implemented system metric functions.
This commit is contained in:
parent
a21cf075a8
commit
92002d924b
|
@ -620,7 +620,6 @@ HRESULT UXTHEME_DrawBackgroundFill(HTHEME hTheme, HDC hdc, int iPartId,
|
|||
if(filltype == FT_SOLID) {
|
||||
HBRUSH hBrush;
|
||||
COLORREF fillcolor = RGB(255,255,255);
|
||||
FIXME("Solid\n");
|
||||
|
||||
GetThemeColor(hTheme, iPartId, iStateId, TMT_FILLCOLOR, &fillcolor);
|
||||
hBrush = CreateSolidBrush(fillcolor);
|
||||
|
@ -640,7 +639,7 @@ HRESULT UXTHEME_DrawBackgroundFill(HTHEME hTheme, HDC hdc, int iPartId,
|
|||
TRIVERTEX vert[2];
|
||||
GRADIENT_RECT gRect;
|
||||
|
||||
FIXME("Gradient\n");
|
||||
FIXME("Gradient implementation not complete\n");
|
||||
|
||||
GetThemeColor(hTheme, iPartId, iStateId, TMT_GRADIENTCOLOR1, &gradient1);
|
||||
GetThemeColor(hTheme, iPartId, iStateId, TMT_GRADIENTCOLOR2, &gradient2);
|
||||
|
|
|
@ -24,9 +24,10 @@
|
|||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "uxtheme.h"
|
||||
#include "tmschema.h"
|
||||
|
||||
#include "msstyles.h"
|
||||
#include "uxthemedll.h"
|
||||
|
@ -40,7 +41,29 @@ WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
|
|||
*/
|
||||
BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID)
|
||||
{
|
||||
FIXME("%d: stub\n", 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;
|
||||
}
|
||||
|
||||
|
@ -49,8 +72,22 @@ BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID)
|
|||
*/
|
||||
COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
|
||||
{
|
||||
FIXME("%d: stub\n", iColorID);
|
||||
return FALSE;
|
||||
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);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -58,8 +95,8 @@ COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
|
|||
*/
|
||||
HBRUSH WINAPI GetThemeSysColorBrush(HTHEME hTheme, int iColorID)
|
||||
{
|
||||
FIXME("%d: stub\n", iColorID);
|
||||
return FALSE;
|
||||
TRACE("(%p, %d)\n", hTheme, iColorID);
|
||||
return CreateSolidBrush(GetThemeSysColor(hTheme, iColorID));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -67,10 +104,41 @@ HBRUSH WINAPI GetThemeSysColorBrush(HTHEME hTheme, int iColorID)
|
|||
*/
|
||||
HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf)
|
||||
{
|
||||
FIXME("%d: stub\n", iFontID);
|
||||
if(!hTheme)
|
||||
return E_HANDLE;
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
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;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -78,10 +146,18 @@ HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf)
|
|||
*/
|
||||
HRESULT WINAPI GetThemeSysInt(HTHEME hTheme, int iIntID, int *piValue)
|
||||
{
|
||||
FIXME("%d: stub\n", iIntID);
|
||||
PTHEME_PROPERTY tp;
|
||||
|
||||
TRACE("(%p, %d)\n", hTheme, iIntID);
|
||||
if(!hTheme)
|
||||
return E_HANDLE;
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
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;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -89,8 +165,43 @@ HRESULT WINAPI GetThemeSysInt(HTHEME hTheme, int iIntID, int *piValue)
|
|||
*/
|
||||
int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID)
|
||||
{
|
||||
FIXME("%d: stub\n", 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);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -99,8 +210,16 @@ int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID)
|
|||
HRESULT WINAPI GetThemeSysString(HTHEME hTheme, int iStringID,
|
||||
LPWSTR pszStringBuff, int cchMaxStringChars)
|
||||
{
|
||||
FIXME("%d: stub\n", iStringID);
|
||||
PTHEME_PROPERTY tp;
|
||||
|
||||
TRACE("(%p, %d)\n", hTheme, iStringID);
|
||||
if(!hTheme)
|
||||
return E_HANDLE;
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
|
|||
* Defines and global variables
|
||||
*/
|
||||
|
||||
BOOL UXTHEME_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value);
|
||||
BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value);
|
||||
BOOL MSSTYLES_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize);
|
||||
|
||||
extern HINSTANCE hDllInst;
|
||||
|
||||
|
@ -489,21 +490,21 @@ PTHEME_PARTSTATE MSSTYLES_AddPartState(PTHEME_CLASS tc, int iPartId, int iStateI
|
|||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_PSFindProperty
|
||||
* MSSTYLES_LFindProperty
|
||||
*
|
||||
* Find a value within a part/state
|
||||
* Find a property within a property list
|
||||
*
|
||||
* PARAMS
|
||||
* ps Part/state to search
|
||||
* tp property list to scan
|
||||
* iPropertyPrimitive Type of value expected
|
||||
* iPropertyId ID of the required value
|
||||
*
|
||||
* RETURNS
|
||||
* The property found, or NULL
|
||||
*/
|
||||
PTHEME_PROPERTY MSSTYLES_PSFindProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId)
|
||||
PTHEME_PROPERTY MSSTYLES_LFindProperty(PTHEME_PROPERTY tp, int iPropertyPrimitive, int iPropertyId)
|
||||
{
|
||||
PTHEME_PROPERTY cur = ps->properties;
|
||||
PTHEME_PROPERTY cur = tp;
|
||||
while(cur) {
|
||||
if(cur->iPropertyId == iPropertyId) {
|
||||
if(cur->iPrimitiveType == iPropertyPrimitive) {
|
||||
|
@ -520,6 +521,61 @@ PTHEME_PROPERTY MSSTYLES_PSFindProperty(PTHEME_PARTSTATE ps, int iPropertyPrimit
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_PSFindProperty
|
||||
*
|
||||
* Find a value within a part/state
|
||||
*
|
||||
* PARAMS
|
||||
* ps Part/state to search
|
||||
* iPropertyPrimitive Type of value expected
|
||||
* iPropertyId ID of the required value
|
||||
*
|
||||
* RETURNS
|
||||
* The property found, or NULL
|
||||
*/
|
||||
static inline PTHEME_PROPERTY MSSTYLES_PSFindProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId)
|
||||
{
|
||||
return MSSTYLES_LFindProperty(ps->properties, iPropertyPrimitive, iPropertyId);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_FFindMetric
|
||||
*
|
||||
* Find a metric property for a theme file
|
||||
*
|
||||
* PARAMS
|
||||
* tf Theme file
|
||||
* iPropertyPrimitive Type of value expected
|
||||
* iPropertyId ID of the required value
|
||||
*
|
||||
* RETURNS
|
||||
* The property found, or NULL
|
||||
*/
|
||||
static inline PTHEME_PROPERTY MSSTYLES_FFindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
|
||||
{
|
||||
return MSSTYLES_LFindProperty(tf->metrics, iPropertyPrimitive, iPropertyId);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_FindMetric
|
||||
*
|
||||
* Find a metric property for the current installed theme
|
||||
*
|
||||
* PARAMS
|
||||
* tf Theme file
|
||||
* iPropertyPrimitive Type of value expected
|
||||
* iPropertyId ID of the required value
|
||||
*
|
||||
* RETURNS
|
||||
* The property found, or NULL
|
||||
*/
|
||||
PTHEME_PROPERTY MSSTYLES_FindMetric(int iPropertyPrimitive, int iPropertyId)
|
||||
{
|
||||
if(!tfActiveTheme) return NULL;
|
||||
return MSSTYLES_FFindMetric(tfActiveTheme, iPropertyPrimitive, iPropertyId);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_AddProperty
|
||||
*
|
||||
|
@ -561,6 +617,40 @@ PTHEME_PROPERTY MSSTYLES_AddProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive
|
|||
return cur;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_AddMetric
|
||||
*
|
||||
* Add a property to a part/state
|
||||
*
|
||||
* PARAMS
|
||||
* tf Theme file
|
||||
* iPropertyPrimitive Primitive type of the property
|
||||
* iPropertyId ID of the property
|
||||
* lpValue Raw value (non-NULL terminated)
|
||||
* dwValueLen Length of the value
|
||||
*
|
||||
* RETURNS
|
||||
* The property added, or a property previously added with the same IDs
|
||||
*/
|
||||
PTHEME_PROPERTY MSSTYLES_AddMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen)
|
||||
{
|
||||
PTHEME_PROPERTY cur = MSSTYLES_FFindMetric(tf, iPropertyPrimitive, iPropertyId);
|
||||
/* Should duplicate properties overwrite the original, or be ignored? */
|
||||
if(cur) return cur;
|
||||
|
||||
cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_PROPERTY));
|
||||
cur->iPrimitiveType = iPropertyPrimitive;
|
||||
cur->iPropertyId = iPropertyId;
|
||||
cur->lpValue = lpValue;
|
||||
cur->dwValueLen = dwValueLen;
|
||||
|
||||
cur->origin = PO_GLOBAL;
|
||||
|
||||
cur->next = tf->metrics;
|
||||
tf->metrics = cur;
|
||||
return cur;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_ParseThemeIni
|
||||
*
|
||||
|
@ -604,9 +694,9 @@ void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
|
|||
if(iPropertyId >= TMT_FIRSTCOLOR && iPropertyId <= TMT_LASTCOLOR) {
|
||||
int r,g,b;
|
||||
lpValueEnd = lpValue + dwValueLen;
|
||||
UXTHEME_GetNextInteger(lpValue, lpValueEnd, &lpValue, &r);
|
||||
UXTHEME_GetNextInteger(lpValue, lpValueEnd, &lpValue, &g);
|
||||
if(UXTHEME_GetNextInteger(lpValue, lpValueEnd, &lpValue, &b)) {
|
||||
MSSTYLES_GetNextInteger(lpValue, lpValueEnd, &lpValue, &r);
|
||||
MSSTYLES_GetNextInteger(lpValue, lpValueEnd, &lpValue, &g);
|
||||
if(MSSTYLES_GetNextInteger(lpValue, lpValueEnd, &lpValue, &b)) {
|
||||
colorElements[colorCount] = iPropertyId - TMT_FIRSTCOLOR;
|
||||
colorRgb[colorCount++] = RGB(r,g,b);
|
||||
}
|
||||
|
@ -614,9 +704,8 @@ void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
|
|||
FIXME("Invalid color value for %s\n", debugstr_w(szPropertyName));
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* FIXME: Handle non-color metrics */
|
||||
}
|
||||
/* Catch all metrics, including colors */
|
||||
MSSTYLES_AddMetric(tf, iPropertyPrimitive, iPropertyId, lpValue, dwValueLen);
|
||||
}
|
||||
else {
|
||||
TRACE("Unknown system metric %s\n", debugstr_w(szPropertyName));
|
||||
|
@ -782,3 +871,227 @@ HBITMAP MSSTYLES_LoadBitmap(HDC hdc, PTHEME_CLASS tc, LPCWSTR lpFilename)
|
|||
} while(*tmp++);
|
||||
return LoadImageW(tc->hTheme, szFile, IMAGE_BITMAP, 0, 0, LR_SHARED|LR_CREATEDIBSECTION);
|
||||
}
|
||||
|
||||
BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value)
|
||||
{
|
||||
LPCWSTR cur = lpStringStart;
|
||||
int total = 0;
|
||||
BOOL gotNeg = FALSE;
|
||||
|
||||
while(cur < lpStringEnd && (*cur < '0' || *cur > '9' || *cur == '-')) cur++;
|
||||
if(cur >= lpStringEnd) {
|
||||
return FALSE;
|
||||
}
|
||||
if(*cur == '-') {
|
||||
cur++;
|
||||
gotNeg = TRUE;
|
||||
}
|
||||
while(cur < lpStringEnd && (*cur >= '0' && *cur <= '9')) {
|
||||
total = total * 10 + (*cur - '0');
|
||||
cur++;
|
||||
}
|
||||
if(gotNeg) total = -total;
|
||||
*value = total;
|
||||
if(lpValEnd) *lpValEnd = cur;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL MSSTYLES_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize) {
|
||||
LPCWSTR cur = lpStringStart;
|
||||
LPCWSTR start;
|
||||
LPCWSTR end;
|
||||
|
||||
while(cur < lpStringEnd && (isspace(*cur) || *cur == ',')) cur++;
|
||||
if(cur >= lpStringEnd) {
|
||||
return FALSE;
|
||||
}
|
||||
start = cur;
|
||||
while(cur < lpStringEnd && *cur != ',') cur++;
|
||||
end = cur;
|
||||
while(isspace(*end)) end--;
|
||||
|
||||
lstrcpynW(lpBuff, start, min(buffSize, end-start+1));
|
||||
|
||||
if(lpValEnd) *lpValEnd = cur;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_GetPropertyBool
|
||||
*
|
||||
* Retrieve a color value for a property
|
||||
*/
|
||||
HRESULT MSSTYLES_GetPropertyBool(PTHEME_PROPERTY tp, BOOL *pfVal)
|
||||
{
|
||||
*pfVal = FALSE;
|
||||
if(*tp->lpValue == 't' || *tp->lpValue == 'T')
|
||||
*pfVal = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_GetPropertyColor
|
||||
*
|
||||
* Retrieve a color value for a property
|
||||
*/
|
||||
HRESULT MSSTYLES_GetPropertyColor(PTHEME_PROPERTY tp, COLORREF *pColor)
|
||||
{
|
||||
LPCWSTR lpEnd;
|
||||
LPCWSTR lpCur;
|
||||
int red, green, blue;
|
||||
|
||||
lpCur = tp->lpValue;
|
||||
lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &red);
|
||||
MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &green);
|
||||
if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &blue)) {
|
||||
TRACE("Could not parse color property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
*pColor = RGB(red,green,blue);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_GetPropertyColor
|
||||
*
|
||||
* Retrieve a color value for a property
|
||||
*/
|
||||
HRESULT MSSTYLES_GetPropertyFont(PTHEME_PROPERTY tp, HDC hdc, LOGFONTW *pFont)
|
||||
{
|
||||
const WCHAR szBold[] = {'b','o','l','d','\0'};
|
||||
const WCHAR szItalic[] = {'i','t','a','l','i','c','\0'};
|
||||
const WCHAR szUnderline[] = {'u','n','d','e','r','l','i','n','e','\0'};
|
||||
const WCHAR szStrikeOut[] = {'s','t','r','i','k','e','o','u','t','\0'};
|
||||
int pointSize;
|
||||
WCHAR attr[32];
|
||||
LPCWSTR lpCur = tp->lpValue;
|
||||
LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
ZeroMemory(pFont, sizeof(LOGFONTW));
|
||||
|
||||
if(!MSSTYLES_GetNextToken(lpCur, lpEnd, &lpCur, pFont->lfFaceName, LF_FACESIZE)) {
|
||||
TRACE("Property is there, but failed to get face name\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pointSize)) {
|
||||
TRACE("Property is there, but failed to get point size\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
pFont->lfHeight = -MulDiv(pointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
|
||||
pFont->lfWeight = FW_REGULAR;
|
||||
pFont->lfCharSet = DEFAULT_CHARSET;
|
||||
while(MSSTYLES_GetNextToken(lpCur, lpEnd, &lpCur, attr, sizeof(attr)/sizeof(attr[0]))) {
|
||||
if(!lstrcmpiW(szBold, attr)) pFont->lfWeight = FW_BOLD;
|
||||
else if(!!lstrcmpiW(szItalic, attr)) pFont->lfItalic = TRUE;
|
||||
else if(!!lstrcmpiW(szUnderline, attr)) pFont->lfUnderline = TRUE;
|
||||
else if(!!lstrcmpiW(szStrikeOut, attr)) pFont->lfStrikeOut = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_GetPropertyInt
|
||||
*
|
||||
* Retrieve an int value for a property
|
||||
*/
|
||||
HRESULT MSSTYLES_GetPropertyInt(PTHEME_PROPERTY tp, int *piVal)
|
||||
{
|
||||
if(!MSSTYLES_GetNextInteger(tp->lpValue, (tp->lpValue + tp->dwValueLen), NULL, piVal)) {
|
||||
TRACE("Could not parse int property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_GetPropertyIntList
|
||||
*
|
||||
* Retrieve an int list value for a property
|
||||
*/
|
||||
HRESULT MSSTYLES_GetPropertyIntList(PTHEME_PROPERTY tp, INTLIST *pIntList)
|
||||
{
|
||||
int i;
|
||||
LPCWSTR lpCur = tp->lpValue;
|
||||
LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
for(i=0; i < MAX_INTLIST_COUNT; i++) {
|
||||
if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pIntList->iValues[i]))
|
||||
break;
|
||||
}
|
||||
pIntList->iValueCount = i;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_GetPropertyPosition
|
||||
*
|
||||
* Retrieve a position value for a property
|
||||
*/
|
||||
HRESULT MSSTYLES_GetPropertyPosition(PTHEME_PROPERTY tp, POINT *pPoint)
|
||||
{
|
||||
int x,y;
|
||||
LPCWSTR lpCur = tp->lpValue;
|
||||
LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &x);
|
||||
if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &y)) {
|
||||
TRACE("Could not parse position property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
pPoint->x = x;
|
||||
pPoint->y = y;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_GetPropertyString
|
||||
*
|
||||
* Retrieve a string value for a property
|
||||
*/
|
||||
HRESULT MSSTYLES_GetPropertyString(PTHEME_PROPERTY tp, LPWSTR pszBuff, int cchMaxBuffChars)
|
||||
{
|
||||
lstrcpynW(pszBuff, tp->lpValue, min(tp->dwValueLen+1, cchMaxBuffChars));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_GetPropertyRect
|
||||
*
|
||||
* Retrieve a rect value for a property
|
||||
*/
|
||||
HRESULT MSSTYLES_GetPropertyRect(PTHEME_PROPERTY tp, RECT *pRect)
|
||||
{
|
||||
LPCWSTR lpCur = tp->lpValue;
|
||||
LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->left);
|
||||
MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->top);
|
||||
MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->right);
|
||||
if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->bottom)) {
|
||||
TRACE("Could not parse rect property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSSTYLES_GetPropertyMargins
|
||||
*
|
||||
* Retrieve a margins value for a property
|
||||
*/
|
||||
HRESULT MSSTYLES_GetPropertyMargins(PTHEME_PROPERTY tp, RECT *prc, MARGINS *pMargins)
|
||||
{
|
||||
LPCWSTR lpCur = tp->lpValue;
|
||||
LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxLeftWidth);
|
||||
MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxRightWidth);
|
||||
MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyTopHeight);
|
||||
if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyBottomHeight)) {
|
||||
TRACE("Could not parse margins property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ typedef struct _THEME_FILE {
|
|||
LPWSTR pszSelectedSize;
|
||||
|
||||
PTHEME_CLASS classes;
|
||||
PTHEME_PROPERTY metrics;
|
||||
} THEME_FILE, *PTHEME_FILE;
|
||||
|
||||
typedef void* PUXINI_FILE;
|
||||
|
@ -83,8 +84,19 @@ 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);
|
||||
|
|
|
@ -36,50 +36,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
|
||||
|
||||
BOOL UXTHEME_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value)
|
||||
{
|
||||
LPCWSTR cur = lpStringStart;
|
||||
int total = 0;
|
||||
BOOL gotNeg = FALSE;
|
||||
|
||||
while(cur < lpStringEnd && (*cur < '0' || *cur > '9' || *cur == '-')) cur++;
|
||||
if(cur >= lpStringEnd) {
|
||||
return FALSE;
|
||||
}
|
||||
if(*cur == '-') {
|
||||
cur++;
|
||||
gotNeg = TRUE;
|
||||
}
|
||||
while(cur < lpStringEnd && (*cur >= '0' && *cur <= '9')) {
|
||||
total = total * 10 + (*cur - '0');
|
||||
cur++;
|
||||
}
|
||||
if(gotNeg) total = -total;
|
||||
*value = total;
|
||||
if(lpValEnd) *lpValEnd = cur;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL UXTHEME_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize) {
|
||||
LPCWSTR cur = lpStringStart;
|
||||
LPCWSTR start;
|
||||
LPCWSTR end;
|
||||
|
||||
while(cur < lpStringEnd && (isspace(*cur) || *cur == ',')) cur++;
|
||||
if(cur >= lpStringEnd) {
|
||||
return FALSE;
|
||||
}
|
||||
start = cur;
|
||||
while(cur < lpStringEnd && *cur != ',') cur++;
|
||||
end = cur;
|
||||
while(isspace(*end)) end--;
|
||||
|
||||
lstrcpynW(lpBuff, start, min(buffSize, end-start+1));
|
||||
|
||||
if(lpValEnd) *lpValEnd = cur;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetThemeBool (UXTHEME.@)
|
||||
*/
|
||||
|
@ -94,10 +50,7 @@ HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_BOOL, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
*pfVal = FALSE;
|
||||
if(*tp->lpValue == 't' || *tp->lpValue == 'T')
|
||||
*pfVal = TRUE;
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyBool(tp, pfVal);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -106,9 +59,6 @@ HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId,
|
|||
HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId,
|
||||
int iPropId, COLORREF *pColor)
|
||||
{
|
||||
LPCWSTR lpEnd;
|
||||
LPCWSTR lpCur;
|
||||
int red, green, blue;
|
||||
PTHEME_PROPERTY tp;
|
||||
|
||||
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
||||
|
@ -117,17 +67,7 @@ HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_COLOR, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
lpCur = tp->lpValue;
|
||||
lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &red);
|
||||
UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &green);
|
||||
if(!UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &blue)) {
|
||||
TRACE("Could not parse color property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
*pColor = RGB(red,green,blue);
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyColor(tp, pColor);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -136,6 +76,7 @@ HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId,
|
|||
HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId,
|
||||
int iPropId, int *piVal)
|
||||
{
|
||||
HRESULT hr;
|
||||
WCHAR val[60];
|
||||
PTHEME_PROPERTY tp;
|
||||
|
||||
|
@ -145,7 +86,10 @@ HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_ENUM, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
lstrcpynW(val, tp->lpValue, min(tp->dwValueLen+1, sizeof(val)/sizeof(val[0])));
|
||||
|
||||
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;
|
||||
|
@ -166,8 +110,7 @@ HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
lstrcpynW(pszThemeFilename, tp->lpValue, min(tp->dwValueLen+1, cchMaxBuffChars));
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyString(tp, pszThemeFilename, cchMaxBuffChars);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -176,15 +119,7 @@ HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId,
|
|||
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
|
||||
int iStateId, int iPropId, LOGFONTW *pFont)
|
||||
{
|
||||
LPCWSTR lpCur;
|
||||
LPCWSTR lpEnd;
|
||||
PTHEME_PROPERTY tp;
|
||||
int pointSize;
|
||||
WCHAR attr[32];
|
||||
const WCHAR szBold[] = {'b','o','l','d','\0'};
|
||||
const WCHAR szItalic[] = {'i','t','a','l','i','c','\0'};
|
||||
const WCHAR szUnderline[] = {'u','n','d','e','r','l','i','n','e','\0'};
|
||||
const WCHAR szStrikeOut[] = {'s','t','r','i','k','e','o','u','t','\0'};
|
||||
|
||||
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
||||
if(!hTheme)
|
||||
|
@ -192,30 +127,7 @@ HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
|
||||
lpCur = tp->lpValue;
|
||||
lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
ZeroMemory(pFont, sizeof(LOGFONTW));
|
||||
|
||||
if(!UXTHEME_GetNextToken(lpCur, lpEnd, &lpCur, pFont->lfFaceName, LF_FACESIZE)) {
|
||||
TRACE("Property is there, but failed to get face name\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
if(!UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &pointSize)) {
|
||||
TRACE("Property is there, but failed to get point size\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
pFont->lfHeight = -MulDiv(pointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
|
||||
pFont->lfWeight = FW_REGULAR;
|
||||
pFont->lfCharSet = DEFAULT_CHARSET;
|
||||
while(UXTHEME_GetNextToken(lpCur, lpEnd, &lpCur, attr, sizeof(attr)/sizeof(attr[0]))) {
|
||||
if(!lstrcmpiW(szBold, attr)) pFont->lfWeight = FW_BOLD;
|
||||
else if(!!lstrcmpiW(szItalic, attr)) pFont->lfItalic = TRUE;
|
||||
else if(!!lstrcmpiW(szUnderline, attr)) pFont->lfUnderline = TRUE;
|
||||
else if(!!lstrcmpiW(szStrikeOut, attr)) pFont->lfStrikeOut = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyFont(tp, hdc, pFont);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -232,11 +144,7 @@ HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INT, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
if(!UXTHEME_GetNextInteger(tp->lpValue, (tp->lpValue + tp->dwValueLen), NULL, piVal)) {
|
||||
TRACE("Could not parse int property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyInt(tp, piVal);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -245,9 +153,6 @@ HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId,
|
|||
HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId,
|
||||
int iPropId, INTLIST *pIntList)
|
||||
{
|
||||
LPCWSTR lpCur;
|
||||
LPCWSTR lpEnd;
|
||||
int i;
|
||||
PTHEME_PROPERTY tp;
|
||||
|
||||
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
||||
|
@ -256,15 +161,7 @@ HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
lpCur = tp->lpValue;
|
||||
lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
for(i=0; i < MAX_INTLIST_COUNT; i++) {
|
||||
if(!UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &pIntList->iValues[i]))
|
||||
break;
|
||||
}
|
||||
pIntList->iValueCount = i;
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyIntList(tp, pIntList);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -273,10 +170,7 @@ HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId,
|
|||
HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId,
|
||||
int iPropId, POINT *pPoint)
|
||||
{
|
||||
LPCWSTR lpEnd;
|
||||
LPCWSTR lpCur;
|
||||
PTHEME_PROPERTY tp;
|
||||
int x,y;
|
||||
|
||||
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
||||
if(!hTheme)
|
||||
|
@ -284,17 +178,7 @@ HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_POSITION, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
lpCur = tp->lpValue;
|
||||
lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &x);
|
||||
if(!UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &y)) {
|
||||
TRACE("Could not parse position property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
pPoint->x = x;
|
||||
pPoint->y = y;
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyPosition(tp, pPoint);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -303,8 +187,6 @@ HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId,
|
|||
HRESULT WINAPI GetThemeRect(HTHEME hTheme, int iPartId, int iStateId,
|
||||
int iPropId, RECT *pRect)
|
||||
{
|
||||
LPCWSTR lpEnd;
|
||||
LPCWSTR lpCur;
|
||||
PTHEME_PROPERTY tp;
|
||||
|
||||
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
||||
|
@ -313,17 +195,7 @@ HRESULT WINAPI GetThemeRect(HTHEME hTheme, int iPartId, int iStateId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_RECT, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
lpCur = tp->lpValue;
|
||||
lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->left);
|
||||
UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->top);
|
||||
UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->right);
|
||||
if(!UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->bottom)) {
|
||||
TRACE("Could not parse rect property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyRect(tp, pRect);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -340,8 +212,7 @@ HRESULT WINAPI GetThemeString(HTHEME hTheme, int iPartId, int iStateId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
lstrcpynW(pszBuff, tp->lpValue, min(tp->dwValueLen+1, cchMaxBuffChars));
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyString(tp, pszBuff, cchMaxBuffChars);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -351,8 +222,6 @@ HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
|
|||
int iStateId, int iPropId, RECT *prc,
|
||||
MARGINS *pMargins)
|
||||
{
|
||||
LPCWSTR lpEnd;
|
||||
LPCWSTR lpCur;
|
||||
PTHEME_PROPERTY tp;
|
||||
|
||||
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
||||
|
@ -361,17 +230,7 @@ HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
|
|||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_MARGINS, iPropId)))
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
lpCur = tp->lpValue;
|
||||
lpEnd = tp->lpValue + tp->dwValueLen;
|
||||
|
||||
UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxLeftWidth);
|
||||
UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxRightWidth);
|
||||
UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyTopHeight);
|
||||
if(!UXTHEME_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyBottomHeight)) {
|
||||
TRACE("Could not parse margins property\n");
|
||||
return E_PROP_ID_UNSUPPORTED;
|
||||
}
|
||||
return S_OK;
|
||||
return MSSTYLES_GetPropertyMargins(tp, prc, pMargins);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -380,10 +239,40 @@ HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
|
|||
HRESULT WINAPI GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId,
|
||||
int iStateId, int iPropId, int *piVal)
|
||||
{
|
||||
FIXME("%d %d %d: stub\n", iPartId, iStateId, iPropId);
|
||||
PTHEME_PROPERTY tp;
|
||||
WCHAR val[60];
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
|
||||
if(!hTheme)
|
||||
return E_HANDLE;
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
|
||||
if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 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;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in New Issue