Commit 92002d92 authored by Kevin Koltzau's avatar Kevin Koltzau Committed by Alexandre Julliard

Implemented system metric functions.

parent a21cf075
......@@ -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);
return 0;
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;
}
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment