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 @@ ...@@ -27,7 +27,9 @@
#include "winuser.h" #include "winuser.h"
#include "wingdi.h" #include "wingdi.h"
#include "uxtheme.h" #include "uxtheme.h"
#include "tmschema.h"
#include "msstyles.h"
#include "uxthemedll.h" #include "uxthemedll.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -133,10 +135,26 @@ HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId ...@@ -133,10 +135,26 @@ HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId
const RECT *pBoundingRect, const RECT *pBoundingRect,
RECT *pContentRect) RECT *pContentRect)
{ {
FIXME("%d %d: stub\n", iPartId, iStateId); MARGINS margin;
HRESULT hr;
TRACE("(%d,%d)\n", iPartId, iStateId);
if(!hTheme) if(!hTheme)
return E_HANDLE; 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 @@ ...@@ -28,6 +28,7 @@
#include "wingdi.h" #include "wingdi.h"
#include "uxtheme.h" #include "uxtheme.h"
#include "msstyles.h"
#include "uxthemedll.h" #include "uxthemedll.h"
#include "wine/debug.h" #include "wine/debug.h"
......
...@@ -25,16 +25,29 @@ ...@@ -25,16 +25,29 @@
#define MAX_THEME_APP_NAME 60 #define MAX_THEME_APP_NAME 60
#define MAX_THEME_CLASS_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 { typedef struct _THEME_PARTSTATE {
int iPartId; int iPartId;
int iStateId; int iStateId;
/* TODO: define part/state properties */ PTHEME_PROPERTY properties;
struct _THEME_PARTSTATE *next; struct _THEME_PARTSTATE *next;
} THEME_PARTSTATE, *PTHEME_PARTSTATE; } THEME_PARTSTATE, *PTHEME_PARTSTATE;
typedef struct _THEME_CLASS { typedef struct _THEME_CLASS {
HMODULE hTheme;
WCHAR szAppName[MAX_THEME_APP_NAME]; WCHAR szAppName[MAX_THEME_APP_NAME];
WCHAR szClassName[MAX_THEME_CLASS_NAME]; WCHAR szClassName[MAX_THEME_CLASS_NAME];
PTHEME_PARTSTATE partstate; PTHEME_PARTSTATE partstate;
...@@ -55,25 +68,22 @@ typedef struct _THEME_FILE { ...@@ -55,25 +68,22 @@ typedef struct _THEME_FILE {
PTHEME_CLASS classes; PTHEME_CLASS classes;
} THEME_FILE, *PTHEME_FILE; } THEME_FILE, *PTHEME_FILE;
typedef struct _UXINI_FILE { typedef void* PUXINI_FILE;
LPCWSTR lpIni;
LPCWSTR lpCurLoc;
LPCWSTR lpEnd;
} UXINI_FILE, *PUXINI_FILE;
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf); HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf);
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf); void MSSTYLES_CloseThemeFile(PTHEME_FILE tf);
HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf); HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf);
PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList); PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList);
HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc); HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc);
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, DWORD *dwPrimitive, DWORD *dwId); BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId);
BOOL MSSTYLES_LookupEnum(LPCWSTR pszValueName, DWORD dwEnum, DWORD *dwValue); BOOL MSSTYLES_LookupEnum(LPCWSTR pszValueName, int dwEnum, int *dwValue);
BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszState, int *iPartId, int *iStateId); BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszState, int *iPartId, int *iStateId);
PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf); 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_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_CloseINI(PUXINI_FILE uf);
void UXINI_ResetINI(PUXINI_FILE uf); void UXINI_ResetINI(PUXINI_FILE uf);
LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen); LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "winuser.h" #include "winuser.h"
#include "tmschema.h" #include "tmschema.h"
#include "msstyles.h" #define TMT_ENUM 200
#include "wine/debug.h" #include "wine/debug.h"
...@@ -1111,7 +1111,7 @@ BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszStat ...@@ -1111,7 +1111,7 @@ BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszStat
* RETURNS * RETURNS
* FALSE if value is not found, TRUE otherwise * 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; DWORD item = 0;
do { do {
...@@ -1137,7 +1137,7 @@ BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, DWORD *dwPrimitive, DWORD ...@@ -1137,7 +1137,7 @@ BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, DWORD *dwPrimitive, DWORD
* RETURNS * RETURNS
* FALSE if value is not found, TRUE otherwise * 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; DWORD item = 0;
/* Locate the enum block */ /* Locate the enum block */
......
...@@ -398,7 +398,7 @@ HRESULT WINAPI HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, ...@@ -398,7 +398,7 @@ HRESULT WINAPI HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId,
BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId) BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
{ {
TRACE("(%p,%d,%d)\n", hTheme, iPartId, 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 TRUE;
return FALSE; return FALSE;
} }
...@@ -428,7 +428,7 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName, ...@@ -428,7 +428,7 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
PTHEME_FILE pt; PTHEME_FILE pt;
HRESULT hr; HRESULT hr;
int i; int i;
DWORD dwDocId; int iDocId;
TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName), TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName),
pszValueBuff, cchMaxValChars); pszValueBuff, cchMaxValChars);
...@@ -437,9 +437,9 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName, ...@@ -437,9 +437,9 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
/* Try to load from string resources */ /* Try to load from string resources */
hr = E_PROP_ID_UNSUPPORTED; 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) { 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)) { if(LoadStringW(pt->hTheme, wDocToRes[i+1], pszValueBuff, cchMaxValChars)) {
hr = S_OK; hr = S_OK;
break; break;
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
#include "msstyles.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
...@@ -40,6 +38,12 @@ static const WCHAR szTextFileResource[] = { ...@@ -40,6 +38,12 @@ static const WCHAR szTextFileResource[] = {
'T','E','X','T','F','I','L','E','\0' '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[] = { ...@@ -55,7 +59,7 @@ static const WCHAR szTextFileResource[] = {
* RETURNS * RETURNS
* INI file, or NULL if not found * 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; HRSRC hrsc;
LPCWSTR lpThemesIni = NULL; LPCWSTR lpThemesIni = NULL;
PUXINI_FILE uf; PUXINI_FILE uf;
...@@ -63,14 +67,14 @@ PUXINI_FILE UXINI_LoadINI(PTHEME_FILE tf, LPCWSTR lpName) { ...@@ -63,14 +67,14 @@ PUXINI_FILE UXINI_LoadINI(PTHEME_FILE tf, LPCWSTR lpName) {
TRACE("Loading resource INI %s\n", debugstr_w(lpName)); TRACE("Loading resource INI %s\n", debugstr_w(lpName));
if((hrsc = FindResourceW(tf->hTheme, lpName, szTextFileResource))) { if((hrsc = FindResourceW(hTheme, lpName, szTextFileResource))) {
if(!(lpThemesIni = (LPCWSTR)LoadResource(tf->hTheme, hrsc))) { if(!(lpThemesIni = (LPCWSTR)LoadResource(hTheme, hrsc))) {
TRACE("%s resource not found\n", debugstr_w(lpName)); TRACE("%s resource not found\n", debugstr_w(lpName));
return NULL; return NULL;
} }
} }
dwIniSize = SizeofResource(tf->hTheme, hrsc) / sizeof(WCHAR); dwIniSize = SizeofResource(hTheme, hrsc) / sizeof(WCHAR);
uf = HeapAlloc(GetProcessHeap(), 0, sizeof(UXINI_FILE)); uf = HeapAlloc(GetProcessHeap(), 0, sizeof(UXINI_FILE));
uf->lpIni = lpThemesIni; uf->lpIni = lpThemesIni;
uf->lpCurLoc = lpThemesIni; uf->lpCurLoc = lpThemesIni;
...@@ -156,8 +160,7 @@ LPCWSTR UXINI_GetNextLine(PUXINI_FILE uf, DWORD *dwLen) ...@@ -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++; while(!UXINI_eof(uf) && (UXINI_isspace(*uf->lpCurLoc) || *uf->lpCurLoc == '\n')) uf->lpCurLoc++;
lpLineStart = uf->lpCurLoc; lpLineStart = uf->lpCurLoc;
lpLineEnd = uf->lpCurLoc; lpLineEnd = uf->lpCurLoc;
while(!UXINI_eof(uf) && *uf->lpCurLoc != '\n' && *uf->lpCurLoc != ';') lpLineEnd = uf->lpCurLoc++; while(!UXINI_eof(uf) && *uf->lpCurLoc != '\n' && *uf->lpCurLoc != ';') lpLineEnd = ++uf->lpCurLoc;
if(*uf->lpCurLoc == ';') lpLineEnd = uf->lpCurLoc++;
/* If comment was found, skip the rest of the line */ /* If comment was found, skip the rest of the line */
if(*uf->lpCurLoc == ';') if(*uf->lpCurLoc == ';')
while(!UXINI_eof(uf) && *uf->lpCurLoc != '\n') 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