Commit c31cae0f authored by Kevin Koltzau's avatar Kevin Koltzau Committed by Alexandre Julliard

Load properties from the theme ini.

Implemented most of the GetTheme* functions.
parent 0c7f4493
......@@ -27,7 +27,9 @@
#include "winuser.h"
#include "wingdi.h"
#include "uxtheme.h"
#include "tmschema.h"
#include "msstyles.h"
#include "uxthemedll.h"
#include "wine/debug.h"
......@@ -133,10 +135,26 @@ HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId
const RECT *pBoundingRect,
RECT *pContentRect)
{
FIXME("%d %d: stub\n", iPartId, iStateId);
MARGINS margin;
HRESULT hr;
TRACE("(%d,%d)\n", iPartId, iStateId);
if(!hTheme)
return E_HANDLE;
return ERROR_CALL_NOT_IMPLEMENTED;
hr = GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_CONTENTMARGINS, NULL, &margin);
if(FAILED(hr)) {
TRACE("Margins not found\n");
return hr;
}
pContentRect->left = pBoundingRect->left + margin.cxLeftWidth;
pContentRect->top = pBoundingRect->top + margin.cyTopHeight;
pContentRect->right = pBoundingRect->right - margin.cxRightWidth;
pContentRect->bottom = pBoundingRect->bottom - margin.cyBottomHeight;
TRACE("left:%ld,top:%ld,right:%ld,bottom:%ld\n", pContentRect->left, pContentRect->top, pContentRect->right, pContentRect->bottom);
return S_OK;
}
/***********************************************************************
......
......@@ -28,6 +28,7 @@
#include "wingdi.h"
#include "uxtheme.h"
#include "msstyles.h"
#include "uxthemedll.h"
#include "wine/debug.h"
......
......@@ -25,16 +25,29 @@
#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;
/* TODO: define part/state properties */
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;
......@@ -55,25 +68,22 @@ typedef struct _THEME_FILE {
PTHEME_CLASS classes;
} THEME_FILE, *PTHEME_FILE;
typedef struct _UXINI_FILE {
LPCWSTR lpIni;
LPCWSTR lpCurLoc;
LPCWSTR lpEnd;
} UXINI_FILE, *PUXINI_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, DWORD *dwPrimitive, DWORD *dwId);
BOOL MSSTYLES_LookupEnum(LPCWSTR pszValueName, DWORD dwEnum, DWORD *dwValue);
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_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);
PUXINI_FILE UXINI_LoadINI(PTHEME_FILE tf, LPCWSTR lpName);
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);
......
......@@ -27,7 +27,7 @@
#include "winuser.h"
#include "tmschema.h"
#include "msstyles.h"
#define TMT_ENUM 200
#include "wine/debug.h"
......@@ -1111,7 +1111,7 @@ BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszStat
* RETURNS
* FALSE if value is not found, TRUE otherwise
*/
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, DWORD *dwPrimitive, DWORD *dwId)
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId)
{
DWORD item = 0;
do {
......@@ -1137,7 +1137,7 @@ BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, DWORD *dwPrimitive, DWORD
* RETURNS
* FALSE if value is not found, TRUE otherwise
*/
BOOL MSSTYLES_LookupEnum(LPCWSTR pszValueName, DWORD dwEnum, DWORD *dwValue)
BOOL MSSTYLES_LookupEnum(LPCWSTR pszValueName, int dwEnum, int *dwValue)
{
DWORD item = 0;
/* Locate the enum block */
......
......@@ -398,7 +398,7 @@ HRESULT WINAPI HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId,
BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
{
TRACE("(%p,%d,%d)\n", hTheme, iPartId, iStateId);
if(MSSTYLES_FindPartState(hTheme, iPartId, iStateId))
if(MSSTYLES_FindPartState(hTheme, iPartId, iStateId, NULL))
return TRUE;
return FALSE;
}
......@@ -428,7 +428,7 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
PTHEME_FILE pt;
HRESULT hr;
int i;
DWORD dwDocId;
int iDocId;
TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName),
pszValueBuff, cchMaxValChars);
......@@ -437,9 +437,9 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
/* Try to load from string resources */
hr = E_PROP_ID_UNSUPPORTED;
if(MSSTYLES_LookupProperty(pszPropertyName, NULL, &dwDocId)) {
if(MSSTYLES_LookupProperty(pszPropertyName, NULL, &iDocId)) {
for(i=0; i<sizeof(wDocToRes)/sizeof(wDocToRes[0]); i+=2) {
if(wDocToRes[i] == dwDocId) {
if(wDocToRes[i] == iDocId) {
if(LoadStringW(pt->hTheme, wDocToRes[i+1], pszValueBuff, cchMaxValChars)) {
hr = S_OK;
break;
......
......@@ -26,8 +26,6 @@
#include "winbase.h"
#include "winnls.h"
#include "msstyles.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
......@@ -40,6 +38,12 @@ 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;
/***********************************************************************/
/**********************************************************************
......@@ -55,7 +59,7 @@ static const WCHAR szTextFileResource[] = {
* RETURNS
* INI file, or NULL if not found
*/
PUXINI_FILE UXINI_LoadINI(PTHEME_FILE tf, LPCWSTR lpName) {
PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName) {
HRSRC hrsc;
LPCWSTR lpThemesIni = NULL;
PUXINI_FILE uf;
......@@ -63,14 +67,14 @@ PUXINI_FILE UXINI_LoadINI(PTHEME_FILE tf, LPCWSTR lpName) {
TRACE("Loading resource INI %s\n", debugstr_w(lpName));
if((hrsc = FindResourceW(tf->hTheme, lpName, szTextFileResource))) {
if(!(lpThemesIni = (LPCWSTR)LoadResource(tf->hTheme, hrsc))) {
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(tf->hTheme, hrsc) / sizeof(WCHAR);
dwIniSize = SizeofResource(hTheme, hrsc) / sizeof(WCHAR);
uf = HeapAlloc(GetProcessHeap(), 0, sizeof(UXINI_FILE));
uf->lpIni = lpThemesIni;
uf->lpCurLoc = lpThemesIni;
......@@ -156,8 +160,7 @@ LPCWSTR UXINI_GetNextLine(PUXINI_FILE uf, DWORD *dwLen)
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(*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++;
......
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