ReactOS 0.4.15-dev-8127-g6338913
msstyles.c File Reference
#include "uxthemep.h"
#include <wine/unicode.h>
Include dependency graph for msstyles.c:

Go to the source code of this file.

Macros

#define MSSTYLES_VERSION   0x0003
 

Functions

HRESULT MSSTYLES_OpenThemeFile (LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
 
void MSSTYLES_CloseThemeFile (PTHEME_FILE tf)
 
HRESULT MSSTYLES_ReferenceTheme (PTHEME_FILE tf)
 
PUXINI_FILE MSSTYLES_GetThemeIni (PTHEME_FILE tf)
 
static PUXINI_FILE MSSTYLES_GetActiveThemeIni (PTHEME_FILE tf)
 
static BOOL MSSTYLES_ParseIniSectionName (LPCWSTR lpSection, DWORD dwLen, LPWSTR szAppName, LPWSTR szClassName, int *iPartId, int *iStateId)
 
static PTHEME_CLASS MSSTYLES_FindClass (PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName)
 
static PTHEME_CLASS MSSTYLES_AddClass (PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName)
 
PTHEME_PARTSTATE MSSTYLES_FindPartState (PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext)
 
static PTHEME_PARTSTATE MSSTYLES_AddPartState (PTHEME_CLASS tc, int iPartId, int iStateId)
 
static PTHEME_PROPERTY MSSTYLES_LFindProperty (PTHEME_PROPERTY tp, int iPropertyPrimitive, int iPropertyId)
 
static PTHEME_PROPERTY MSSTYLES_PSFindProperty (PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId)
 
PTHEME_PROPERTY MSSTYLES_FindMetric (PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
 
static PTHEME_PROPERTY MSSTYLES_AddProperty (PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen, BOOL isGlobal)
 
static PTHEME_PROPERTY MSSTYLES_AddMetric (PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen)
 
void MSSTYLES_ParseThemeIni (PTHEME_FILE tf)
 
PTHEME_CLASS MSSTYLES_OpenThemeClass (PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassList)
 
HRESULT MSSTYLES_CloseThemeClass (PTHEME_CLASS tc)
 
PTHEME_PROPERTY MSSTYLES_FindProperty (PTHEME_CLASS tc, int iPartId, int iStateId, int iPropertyPrimitive, int iPropertyId)
 
static BOOL prepare_alpha (HBITMAP bmp, BOOL *hasAlpha)
 
HBITMAP MSSTYLES_LoadBitmap (PTHEME_CLASS tc, LPCWSTR lpFilename, BOOL *hasAlpha)
 
static BOOL MSSTYLES_GetNextInteger (LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value)
 
static BOOL MSSTYLES_GetNextToken (LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize)
 
HRESULT MSSTYLES_GetPropertyBool (PTHEME_PROPERTY tp, BOOL *pfVal)
 
HRESULT MSSTYLES_GetPropertyColor (PTHEME_PROPERTY tp, COLORREF *pColor)
 
static HRESULT MSSTYLES_GetFont (LPCWSTR lpCur, LPCWSTR lpEnd, LPCWSTR *lpValEnd, LOGFONTW *pFont)
 
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)
 

Variables

int alphaBlendMode
 
static const WCHAR szThemesIniResource []
 

Macro Definition Documentation

◆ MSSTYLES_VERSION

#define MSSTYLES_VERSION   0x0003

Definition at line 31 of file msstyles.c.

Function Documentation

◆ MSSTYLES_AddClass()

static PTHEME_CLASS MSSTYLES_AddClass ( PTHEME_FILE  tf,
LPCWSTR  pszAppName,
LPCWSTR  pszClassName 
)
static

Definition at line 422 of file msstyles.c.

423{
424 PTHEME_CLASS cur = MSSTYLES_FindClass(tf, pszAppName, pszClassName);
425 if(cur) return cur;
426
427 cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_CLASS));
428 cur->hTheme = tf->hTheme;
429 lstrcpyW(cur->szAppName, pszAppName);
430 lstrcpyW(cur->szClassName, pszClassName);
431 cur->next = tf->classes;
432 cur->partstate = NULL;
433 cur->overrides = NULL;
434 tf->classes = cur;
435 return cur;
436}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define lstrcpyW
Definition: compat.h:749
FxCollectionEntry * cur
HFONT tf
Definition: icontest.c:17
static PTHEME_CLASS MSSTYLES_FindClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName)
Definition: msstyles.c:392

Referenced by MSSTYLES_ParseThemeIni().

◆ MSSTYLES_AddMetric()

static PTHEME_PROPERTY MSSTYLES_AddMetric ( PTHEME_FILE  tf,
int  iPropertyPrimitive,
int  iPropertyId,
LPCWSTR  lpValue,
DWORD  dwValueLen 
)
static

Definition at line 617 of file msstyles.c.

618{
619 PTHEME_PROPERTY cur = MSSTYLES_FindMetric(tf, iPropertyPrimitive, iPropertyId);
620 /* Should duplicate properties overwrite the original, or be ignored? */
621 if(cur) return cur;
622
624 cur->iPrimitiveType = iPropertyPrimitive;
625 cur->iPropertyId = iPropertyId;
626 cur->lpValue = lpValue;
627 cur->dwValueLen = dwValueLen;
628
629 cur->origin = PO_GLOBAL;
630
631 cur->next = tf->metrics;
632 tf->metrics = cur;
633 return cur;
634}
PTHEME_PROPERTY MSSTYLES_FindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:556

Referenced by MSSTYLES_ParseThemeIni().

◆ MSSTYLES_AddPartState()

static PTHEME_PARTSTATE MSSTYLES_AddPartState ( PTHEME_CLASS  tc,
int  iPartId,
int  iStateId 
)
static

Definition at line 479 of file msstyles.c.

480{
481 PTHEME_PARTSTATE cur = MSSTYLES_FindPartState(tc, iPartId, iStateId, NULL);
482 if(cur) return cur;
483
485 cur->iPartId = iPartId;
486 cur->iStateId = iStateId;
487 cur->properties = NULL;
488 cur->next = tc->partstate;
489 tc->partstate = cur;
490 return cur;
491}
const GLfloat * tc
Definition: glext.h:8925
PTHEME_PARTSTATE MSSTYLES_FindPartState(PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext)
Definition: msstyles.c:452

Referenced by MSSTYLES_ParseThemeIni().

◆ MSSTYLES_AddProperty()

static PTHEME_PROPERTY MSSTYLES_AddProperty ( PTHEME_PARTSTATE  ps,
int  iPropertyPrimitive,
int  iPropertyId,
LPCWSTR  lpValue,
DWORD  dwValueLen,
BOOL  isGlobal 
)
static

Definition at line 576 of file msstyles.c.

577{
578 PTHEME_PROPERTY cur = MSSTYLES_PSFindProperty(ps, iPropertyPrimitive, iPropertyId);
579 /* Should duplicate properties overwrite the original, or be ignored? */
580 if(cur) return cur;
581
583 cur->iPrimitiveType = iPropertyPrimitive;
584 cur->iPropertyId = iPropertyId;
585 cur->lpValue = lpValue;
586 cur->dwValueLen = dwValueLen;
587
588 if(ps->iStateId)
589 cur->origin = PO_STATE;
590 else if(ps->iPartId)
591 cur->origin = PO_PART;
592 else if(isGlobal)
593 cur->origin = PO_GLOBAL;
594 else
595 cur->origin = PO_CLASS;
596
597 cur->next = ps->properties;
598 ps->properties = cur;
599 return cur;
600}
static PTHEME_PROPERTY MSSTYLES_PSFindProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:538
PTHEME_PROPERTY properties
Definition: uxthemep.h:52

Referenced by MSSTYLES_ParseThemeIni().

◆ MSSTYLES_CloseThemeClass()

HRESULT MSSTYLES_CloseThemeClass ( PTHEME_CLASS  tc)

Definition at line 822 of file msstyles.c.

823{
825 return S_OK;
826}
#define S_OK
Definition: intsafe.h:52
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179

Referenced by CloseThemeData(), and OpenThemeDataInternal().

◆ MSSTYLES_CloseThemeFile()

void MSSTYLES_CloseThemeFile ( PTHEME_FILE  tf)

Definition at line 179 of file msstyles.c.

180{
181 if(tf) {
182
183 tf->dwRefCount--;
184 TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
185
186 if(!tf->dwRefCount) {
187 if(tf->hTheme) FreeLibrary(tf->hTheme);
188 if(tf->classes) {
189 while(tf->classes) {
190 PTHEME_CLASS pcls = tf->classes;
191 tf->classes = pcls->next;
192 while(pcls->partstate) {
193 PTHEME_PARTSTATE ps = pcls->partstate;
194
195 while(ps->properties) {
196 PTHEME_PROPERTY prop = ps->properties;
197 ps->properties = prop->next;
198 HeapFree(GetProcessHeap(), 0, prop);
199 }
200
201 pcls->partstate = ps->next;
202 HeapFree(GetProcessHeap(), 0, ps);
203 }
204 HeapFree(GetProcessHeap(), 0, pcls);
205 }
206 }
207 while (tf->images)
208 {
209 PTHEME_IMAGE img = tf->images;
210 tf->images = img->next;
211 DeleteObject (img->image);
213 }
215 }
216 }
217}
#define FreeLibrary(x)
Definition: compat.h:748
#define HeapFree(x, y, z)
Definition: compat.h:735
pKey DeleteObject()
GLint GLvoid * img
Definition: gl.h:1956
#define TRACE(s)
Definition: solgame.cpp:4
PTHEME_PARTSTATE partstate
Definition: uxthemep.h:64
struct _THEME_CLASS * next
Definition: uxthemep.h:67
struct _THEME_PARTSTATE * next
Definition: uxthemep.h:54
struct _THEME_PROPERTY * next
Definition: uxthemep.h:46

Referenced by CheckThemeSignature(), CloseThemeFile(), EnumThemeColors(), EnumThemeSizes(), GetThemeDefaults(), GetThemeDocumentationProperty(), MSSTYLES_CloseThemeClass(), UXTHEME_LoadTheme(), and UXTHEME_SetActiveTheme().

◆ MSSTYLES_FindClass()

static PTHEME_CLASS MSSTYLES_FindClass ( PTHEME_FILE  tf,
LPCWSTR  pszAppName,
LPCWSTR  pszClassName 
)
static

Definition at line 392 of file msstyles.c.

393{
394 PTHEME_CLASS cur = tf->classes;
395 while(cur) {
396 if(!pszAppName) {
397 if(!*cur->szAppName && !lstrcmpiW(pszClassName, cur->szClassName))
398 return cur;
399 }
400 else {
401 if(!lstrcmpiW(pszAppName, cur->szAppName) && !lstrcmpiW(pszClassName, cur->szClassName))
402 return cur;
403 }
404 cur = cur->next;
405 }
406 return NULL;
407}
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261

Referenced by MSSTYLES_AddClass(), MSSTYLES_OpenThemeClass(), and MSSTYLES_ParseThemeIni().

◆ MSSTYLES_FindMetric()

PTHEME_PROPERTY MSSTYLES_FindMetric ( PTHEME_FILE  tf,
int  iPropertyPrimitive,
int  iPropertyId 
)

Definition at line 556 of file msstyles.c.

557{
558 return MSSTYLES_LFindProperty(tf->metrics, iPropertyPrimitive, iPropertyId);
559}
static PTHEME_PROPERTY MSSTYLES_LFindProperty(PTHEME_PROPERTY tp, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:506

Referenced by GetThemeSysBool(), GetThemeSysColor(), GetThemeSysFont(), GetThemeSysInt(), GetThemeSysSize(), GetThemeSysString(), and MSSTYLES_AddMetric().

◆ MSSTYLES_FindPartState()

PTHEME_PARTSTATE MSSTYLES_FindPartState ( PTHEME_CLASS  tc,
int  iPartId,
int  iStateId,
PTHEME_CLASS tcNext 
)

Definition at line 452 of file msstyles.c.

453{
454 PTHEME_PARTSTATE cur = tc->partstate;
455 while(cur) {
456 if(cur->iPartId == iPartId && cur->iStateId == iStateId) {
457 if(tcNext) *tcNext = tc->overrides;
458 return cur;
459 }
460 cur = cur->next;
461 }
462 if(tc->overrides) return MSSTYLES_FindPartState(tc->overrides, iPartId, iStateId, tcNext);
463 return NULL;
464}
struct _THEME_CLASS * overrides
Definition: uxthemep.h:65

Referenced by IsThemePartDefined(), MSSTYLES_AddPartState(), MSSTYLES_FindPartState(), and MSSTYLES_FindProperty().

◆ MSSTYLES_FindProperty()

PTHEME_PROPERTY MSSTYLES_FindProperty ( PTHEME_CLASS  tc,
int  iPartId,
int  iStateId,
int  iPropertyPrimitive,
int  iPropertyId 
)

Definition at line 835 of file msstyles.c.

836{
840
841 TRACE("(%p, %d, %d, %d)\n", tc, iPartId, iStateId, iPropertyId);
842 /* Try and find an exact match on part & state */
843 while(next && (ps = MSSTYLES_FindPartState(next, iPartId, iStateId, &next))) {
844 if((tp = MSSTYLES_PSFindProperty(ps, iPropertyPrimitive, iPropertyId))) {
845 return tp;
846 }
847 }
848 /* If that fails, and we didn't already try it, search for just part */
849 if(iStateId != 0)
850 iStateId = 0;
851 /* As a last ditch attempt..go for just class */
852 else if(iPartId != 0)
853 iPartId = 0;
854 else
855 return NULL;
856
857 if((tp = MSSTYLES_FindProperty(tc, iPartId, iStateId, iPropertyPrimitive, iPropertyId)))
858 return tp;
859 return NULL;
860}
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
PTHEME_PROPERTY MSSTYLES_FindProperty(PTHEME_CLASS tc, int iPartId, int iStateId, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:835
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by GetThemeBool(), GetThemeColor(), GetThemeEnumValue(), GetThemeFilename(), GetThemeFont(), GetThemeInt(), GetThemeIntList(), GetThemeMargins(), GetThemeMetric(), GetThemePosition(), GetThemePropertyOrigin(), GetThemeRect(), GetThemeString(), MSSTYLES_FindProperty(), and UXTHEME_SelectImage().

◆ MSSTYLES_GetActiveThemeIni()

static PUXINI_FILE MSSTYLES_GetActiveThemeIni ( PTHEME_FILE  tf)
static

Definition at line 246 of file msstyles.c.

247{
248 static const WCHAR szFileResNamesResource[] = {
249 'F','I','L','E','R','E','S','N','A','M','E','S','\0'
250 };
251 DWORD dwColorCount = 0;
252 DWORD dwSizeCount = 0;
253 DWORD dwColorNum = 0;
254 DWORD dwSizeNum = 0;
255 DWORD i;
256 DWORD dwResourceIndex;
257 LPWSTR tmp;
258 HRSRC hrsc;
259
260 /* Count the number of available colors & styles, and determine the index number
261 of the color/style we are interested in
262 */
263 tmp = tf->pszAvailColors;
264 while(*tmp) {
265 if(!lstrcmpiW(tf->pszSelectedColor, tmp))
266 dwColorNum = dwColorCount;
267 tmp += lstrlenW(tmp)+1;
268 dwColorCount++;
269 }
270 tmp = tf->pszAvailSizes;
271 while(*tmp) {
272 if(!lstrcmpiW(tf->pszSelectedSize, tmp))
273 dwSizeNum = dwSizeCount;
274 tmp += lstrlenW(tmp)+1;
275 dwSizeCount++;
276 }
277
278 if(!(hrsc = FindResourceW(tf->hTheme, MAKEINTRESOURCEW(1), szFileResNamesResource))) {
279 TRACE("FILERESNAMES map not found\n");
280 return NULL;
281 }
282 tmp = LoadResource(tf->hTheme, hrsc);
283 dwResourceIndex = (dwSizeCount * dwColorNum) + dwSizeNum;
284 for(i=0; i < dwResourceIndex; i++) {
285 tmp += lstrlenW(tmp)+1;
286 }
287 return UXINI_LoadINI(tf->hTheme, tmp);
288}
#define lstrlenW
Definition: compat.h:750
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName)
Definition: uxini.c:52
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by MSSTYLES_ParseThemeIni().

◆ MSSTYLES_GetFont()

static HRESULT MSSTYLES_GetFont ( LPCWSTR  lpCur,
LPCWSTR  lpEnd,
LPCWSTR lpValEnd,
LOGFONTW pFont 
)
static

Definition at line 1037 of file msstyles.c.

1039{
1040 static const WCHAR szBold[] = {'b','o','l','d','\0'};
1041 static const WCHAR szItalic[] = {'i','t','a','l','i','c','\0'};
1042 static const WCHAR szUnderline[] = {'u','n','d','e','r','l','i','n','e','\0'};
1043 static const WCHAR szStrikeOut[] = {'s','t','r','i','k','e','o','u','t','\0'};
1044 int pointSize;
1045 WCHAR attr[32];
1046
1047 if(!MSSTYLES_GetNextToken(lpCur, lpEnd, &lpCur, pFont->lfFaceName, LF_FACESIZE)) {
1048 TRACE("Property is there, but failed to get face name\n");
1049 *lpValEnd = lpCur;
1050 return E_PROP_ID_UNSUPPORTED;
1051 }
1052 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pointSize)) {
1053 TRACE("Property is there, but failed to get point size\n");
1054 *lpValEnd = lpCur;
1055 return E_PROP_ID_UNSUPPORTED;
1056 }
1057 if(pointSize > 0)
1058 {
1059 HDC hdc = GetDC(0);
1060 pointSize = -MulDiv(pointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
1061 ReleaseDC(0, hdc);
1062 }
1063
1064 pFont->lfHeight = pointSize;
1065 pFont->lfWeight = FW_REGULAR;
1066 pFont->lfCharSet = DEFAULT_CHARSET;
1067 while(MSSTYLES_GetNextToken(lpCur, lpEnd, &lpCur, attr, sizeof(attr)/sizeof(attr[0]))) {
1068 if(!lstrcmpiW(szBold, attr)) pFont->lfWeight = FW_BOLD;
1069 else if(!lstrcmpiW(szItalic, attr)) pFont->lfItalic = TRUE;
1070 else if(!lstrcmpiW(szUnderline, attr)) pFont->lfUnderline = TRUE;
1071 else if(!lstrcmpiW(szStrikeOut, attr)) pFont->lfStrikeOut = TRUE;
1072 }
1073 *lpValEnd = lpCur;
1074 return S_OK;
1075}
#define LF_FACESIZE
Definition: dimm.idl:39
#define TRUE
Definition: types.h:120
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value)
Definition: msstyles.c:945
static BOOL MSSTYLES_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize)
Definition: msstyles.c:969
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfCharSet
Definition: dimm.idl:67
Definition: cookie.c:202
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
#define FW_REGULAR
Definition: wingdi.h:374
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_BOLD
Definition: wingdi.h:378
#define LOGPIXELSY
Definition: wingdi.h:719
#define DEFAULT_CHARSET
Definition: wingdi.h:384
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by MSSTYLES_GetPropertyFont().

◆ MSSTYLES_GetNextInteger()

static BOOL MSSTYLES_GetNextInteger ( LPCWSTR  lpStringStart,
LPCWSTR  lpStringEnd,
LPCWSTR lpValEnd,
int value 
)
static

Definition at line 945 of file msstyles.c.

946{
947 LPCWSTR cur = lpStringStart;
948 int total = 0;
949 BOOL gotNeg = FALSE;
950
951 while(cur < lpStringEnd && ((*cur < '0' || *cur > '9') && *cur != '-')) cur++;
952 if(cur >= lpStringEnd) {
953 return FALSE;
954 }
955 if(*cur == '-') {
956 cur++;
957 gotNeg = TRUE;
958 }
959 while(cur < lpStringEnd && (*cur >= '0' && *cur <= '9')) {
960 total = total * 10 + (*cur - '0');
961 cur++;
962 }
963 if(gotNeg) total = -total;
964 *value = total;
965 if(lpValEnd) *lpValEnd = cur;
966 return TRUE;
967}
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
size_t total
Definition: pdh_main.c:94
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by MSSTYLES_GetFont(), MSSTYLES_GetPropertyColor(), MSSTYLES_GetPropertyInt(), MSSTYLES_GetPropertyIntList(), MSSTYLES_GetPropertyMargins(), MSSTYLES_GetPropertyPosition(), and MSSTYLES_GetPropertyRect().

◆ MSSTYLES_GetNextToken()

static BOOL MSSTYLES_GetNextToken ( LPCWSTR  lpStringStart,
LPCWSTR  lpStringEnd,
LPCWSTR lpValEnd,
LPWSTR  lpBuff,
DWORD  buffSize 
)
static

Definition at line 969 of file msstyles.c.

969 {
970 LPCWSTR cur = lpStringStart;
972 LPCWSTR end;
973
974 while(cur < lpStringEnd && (isspace(*cur) || *cur == ',')) cur++;
975 if(cur >= lpStringEnd) {
976 return FALSE;
977 }
978 start = cur;
979 while(cur < lpStringEnd && *cur != '\n'&& *cur != ',') cur++;
980 end = cur;
981 while(isspace(*(end-1))) end--;
982
983 lstrcpynW(lpBuff, start, min(buffSize, end-start+1));
984
985 if(lpValEnd) *lpValEnd = cur;
986 return TRUE;
987}
#define isspace(c)
Definition: acclib.h:69
#define lstrcpynW
Definition: compat.h:738
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
#define min(a, b)
Definition: monoChain.cc:55

Referenced by MSSTYLES_GetFont().

◆ MSSTYLES_GetPropertyBool()

HRESULT MSSTYLES_GetPropertyBool ( PTHEME_PROPERTY  tp,
BOOL pfVal 
)

Definition at line 994 of file msstyles.c.

995{
996 *pfVal = FALSE;
997 if(*tp->lpValue == 't' || *tp->lpValue == 'T')
998 *pfVal = TRUE;
999 return S_OK;
1000}

Referenced by GetThemeBool(), GetThemeMetric(), and GetThemeSysBool().

◆ MSSTYLES_GetPropertyColor()

HRESULT MSSTYLES_GetPropertyColor ( PTHEME_PROPERTY  tp,
COLORREF pColor 
)

Definition at line 1007 of file msstyles.c.

1008{
1009 LPCWSTR lpEnd;
1010 LPCWSTR lpCur;
1011 int red, green, blue;
1012
1013 lpCur = tp->lpValue;
1014 lpEnd = tp->lpValue + tp->dwValueLen;
1015
1016 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &red)) {
1017 TRACE("Could not parse color property\n");
1018 return E_PROP_ID_UNSUPPORTED;
1019 }
1020 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &green)) {
1021 TRACE("Could not parse color property\n");
1022 return E_PROP_ID_UNSUPPORTED;
1023 }
1024 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &blue)) {
1025 TRACE("Could not parse color property\n");
1026 return E_PROP_ID_UNSUPPORTED;
1027 }
1028 *pColor = RGB(red,green,blue);
1029 return S_OK;
1030}
#define RGB(r, g, b)
Definition: precomp.h:71
GLclampf green
Definition: gl.h:1740
GLclampf GLclampf blue
Definition: gl.h:1740
#define red
Definition: linetest.c:67

Referenced by GetThemeColor(), GetThemeMetric(), and GetThemeSysColor().

◆ MSSTYLES_GetPropertyFont()

HRESULT MSSTYLES_GetPropertyFont ( PTHEME_PROPERTY  tp,
HDC  hdc,
LOGFONTW pFont 
)

Definition at line 1077 of file msstyles.c.

1078{
1079 LPCWSTR lpCur = tp->lpValue;
1080 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1081 HRESULT hr;
1082
1083 ZeroMemory(pFont, sizeof(LOGFONTW));
1084 hr = MSSTYLES_GetFont (lpCur, lpEnd, &lpCur, pFont);
1085
1086 return hr;
1087}
static HRESULT MSSTYLES_GetFont(LPCWSTR lpCur, LPCWSTR lpEnd, LPCWSTR *lpValEnd, LOGFONTW *pFont)
Definition: msstyles.c:1037
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1712

Referenced by GetThemeFont(), and GetThemeSysFont().

◆ MSSTYLES_GetPropertyInt()

HRESULT MSSTYLES_GetPropertyInt ( PTHEME_PROPERTY  tp,
int piVal 
)

Definition at line 1094 of file msstyles.c.

1095{
1096 if(!MSSTYLES_GetNextInteger(tp->lpValue, (tp->lpValue + tp->dwValueLen), NULL, piVal)) {
1097 TRACE("Could not parse int property\n");
1098 return E_PROP_ID_UNSUPPORTED;
1099 }
1100 return S_OK;
1101}

Referenced by GetThemeInt(), GetThemeMetric(), GetThemeSysInt(), and GetThemeSysSize().

◆ MSSTYLES_GetPropertyIntList()

HRESULT MSSTYLES_GetPropertyIntList ( PTHEME_PROPERTY  tp,
INTLIST *  pIntList 
)

Definition at line 1108 of file msstyles.c.

1109{
1110 int i;
1111 LPCWSTR lpCur = tp->lpValue;
1112 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1113
1114 for(i=0; i < MAX_INTLIST_COUNT; i++) {
1115 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pIntList->iValues[i]))
1116 break;
1117 }
1118 pIntList->iValueCount = i;
1119 return S_OK;
1120}

Referenced by GetThemeIntList().

◆ MSSTYLES_GetPropertyMargins()

HRESULT MSSTYLES_GetPropertyMargins ( PTHEME_PROPERTY  tp,
RECT prc,
MARGINS pMargins 
)

Definition at line 1182 of file msstyles.c.

1183{
1184 LPCWSTR lpCur = tp->lpValue;
1185 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1186
1187 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxLeftWidth);
1188 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxRightWidth);
1189 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyTopHeight);
1190 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyBottomHeight)) {
1191 TRACE("Could not parse margins property\n");
1192 return E_PROP_ID_UNSUPPORTED;
1193 }
1194 return S_OK;
1195}
int cyBottomHeight
Definition: misc.c:283
int cyTopHeight
Definition: misc.c:282
int cxRightWidth
Definition: misc.c:281
int cxLeftWidth
Definition: misc.c:280

Referenced by GetThemeMargins().

◆ MSSTYLES_GetPropertyPosition()

HRESULT MSSTYLES_GetPropertyPosition ( PTHEME_PROPERTY  tp,
POINT pPoint 
)

Definition at line 1127 of file msstyles.c.

1128{
1129 int x,y;
1130 LPCWSTR lpCur = tp->lpValue;
1131 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1132
1133 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &x)) {
1134 TRACE("Could not parse position property\n");
1135 return E_PROP_ID_UNSUPPORTED;
1136 }
1137 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &y)) {
1138 TRACE("Could not parse position property\n");
1139 return E_PROP_ID_UNSUPPORTED;
1140 }
1141 pPoint->x = x;
1142 pPoint->y = y;
1143 return S_OK;
1144}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by GetThemePosition().

◆ MSSTYLES_GetPropertyRect()

HRESULT MSSTYLES_GetPropertyRect ( PTHEME_PROPERTY  tp,
RECT pRect 
)

Definition at line 1162 of file msstyles.c.

1163{
1164 LPCWSTR lpCur = tp->lpValue;
1165 LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen;
1166
1167 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pRect->left);
1168 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pRect->top);
1169 MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pRect->right);
1170 if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pRect->bottom)) {
1171 TRACE("Could not parse rect property\n");
1172 return E_PROP_ID_UNSUPPORTED;
1173 }
1174 return S_OK;
1175}
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306

Referenced by GetThemeRect().

◆ MSSTYLES_GetPropertyString()

HRESULT MSSTYLES_GetPropertyString ( PTHEME_PROPERTY  tp,
LPWSTR  pszBuff,
int  cchMaxBuffChars 
)

Definition at line 1151 of file msstyles.c.

1152{
1153 lstrcpynW(pszBuff, tp->lpValue, min(tp->dwValueLen+1, cchMaxBuffChars));
1154 return S_OK;
1155}

Referenced by GetThemeEnumValue(), GetThemeFilename(), GetThemeMetric(), GetThemeString(), and GetThemeSysString().

◆ MSSTYLES_GetThemeIni()

PUXINI_FILE MSSTYLES_GetThemeIni ( PTHEME_FILE  tf)

Definition at line 236 of file msstyles.c.

237{
238 return UXINI_LoadINI(tf->hTheme, szThemesIniResource);
239}
static const WCHAR szThemesIniResource[]
Definition: msstyles.c:33

Referenced by GetThemeDocumentationProperty().

◆ MSSTYLES_LFindProperty()

static PTHEME_PROPERTY MSSTYLES_LFindProperty ( PTHEME_PROPERTY  tp,
int  iPropertyPrimitive,
int  iPropertyId 
)
static

Definition at line 506 of file msstyles.c.

507{
509 while(cur) {
510 if(cur->iPropertyId == iPropertyId) {
511 if(cur->iPrimitiveType == iPropertyPrimitive) {
512 return cur;
513 }
514 else {
515 if(!iPropertyPrimitive)
516 return cur;
517 return NULL;
518 }
519 }
520 cur = cur->next;
521 }
522 return NULL;
523}

Referenced by MSSTYLES_FindMetric(), and MSSTYLES_PSFindProperty().

◆ MSSTYLES_LoadBitmap()

HBITMAP MSSTYLES_LoadBitmap ( PTHEME_CLASS  tc,
LPCWSTR  lpFilename,
BOOL hasAlpha 
)

Definition at line 896 of file msstyles.c.

897{
898 WCHAR szFile[MAX_PATH];
899 LPWSTR tmp;
901 lstrcpynW(szFile, lpFilename, sizeof(szFile)/sizeof(szFile[0]));
902 tmp = szFile;
903 do {
904 if(*tmp == '\\') *tmp = '_';
905 if(*tmp == '/') *tmp = '_';
906 if(*tmp == '.') *tmp = '_';
907 } while(*tmp++);
908
909 /* Try to locate in list of loaded images */
910 img = tc->tf->images;
911 while (img)
912 {
913 if (lstrcmpiW (szFile, img->name) == 0)
914 {
915 TRACE ("found %p %s: %p\n", img, debugstr_w (img->name), img->image);
916 *hasAlpha = img->hasAlpha;
917 return img->image;
918 }
919 img = img->next;
920 }
921 /* Not found? Load from resources */
922 img = HeapAlloc (GetProcessHeap(), 0, sizeof (THEME_IMAGE));
923#ifdef ENABLE_PNG_SUPPORT
924 if (MSSTYLES_TryLoadPng(tc->hTheme, szFile, TEXT(L"IMAGE"), &img->image)) // ...as PNG...
925 {
926 prepare_png_alpha(img->image, hasAlpha);
927 }
928 else // ...or, failing that, as BMP
929 {
930#endif /* ENABLE_PNG_SUPPORT */
931 img->image = LoadImageW(tc->hTheme, szFile, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
932 prepare_alpha (img->image, hasAlpha);
933#ifdef ENABLE_PNG_SUPPORT
934 }
935#endif /* ENABLE_PNG_SUPPORT */
936 img->hasAlpha = *hasAlpha;
937 /* ...and stow away for later reuse. */
938 lstrcpyW (img->name, szFile);
939 img->next = tc->tf->images;
940 tc->tf->images = img;
941 TRACE ("new %p %s: %p\n", img, debugstr_w (img->name), img->image);
942 return img->image;
943}
#define MAX_PATH
Definition: compat.h:34
#define TEXT(s)
Definition: k32.h:26
#define debugstr_w
Definition: kernel32.h:32
static BOOL prepare_alpha(HBITMAP bmp, BOOL *hasAlpha)
Definition: msstyles.c:863
#define L(x)
Definition: ntvdm.h:50
BOOL MSSTYLES_TryLoadPng(_In_ HINSTANCE hTheme, _In_ LPCWSTR szFile, _In_ LPCWSTR type, _Out_ HBITMAP *phBitmap)
Definition: pngsup.cpp:18
BOOL prepare_png_alpha(_In_ HBITMAP png, _Out_ BOOL *hasAlpha)
Definition: pngsup.cpp:60
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_CREATEDIBSECTION
Definition: winuser.h:1098
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2234

Referenced by UXTHEME_LoadImage(), and UXTHEME_SelectImage().

◆ MSSTYLES_OpenThemeClass()

PTHEME_CLASS MSSTYLES_OpenThemeClass ( PTHEME_FILE  tf,
LPCWSTR  pszAppName,
LPCWSTR  pszClassList 
)

Definition at line 756 of file msstyles.c.

757{
758 PTHEME_CLASS cls = NULL;
759#ifdef __REACTOS__
760 PTHEME_CLASS defaultCls = NULL;
761#endif
764 LPCWSTR end;
765 DWORD len;
766
767 if(!tf->classes) {
768 return NULL;
769 }
770
771 start = pszClassList;
772 while((end = strchrW(start, ';'))) {
773 len = end-start;
774 lstrcpynW(szClassName, start, min(len+1, sizeof(szClassName)/sizeof(szClassName[0])));
775 start = end+1;
776 cls = MSSTYLES_FindClass(tf, pszAppName, szClassName);
777 if(cls) break;
778#ifdef __REACTOS__
779 if (!defaultCls)
780 defaultCls = MSSTYLES_FindClass(tf, NULL, szClassName);
781#endif
782 }
783 if(!cls && *start) {
784 lstrcpynW(szClassName, start, sizeof(szClassName)/sizeof(szClassName[0]));
785 cls = MSSTYLES_FindClass(tf, pszAppName, szClassName);
786#ifdef __REACTOS__
787 if (!defaultCls)
788 defaultCls = MSSTYLES_FindClass(tf, NULL, szClassName);
789#endif
790 }
791 if(cls) {
792 TRACE("Opened app %s, class %s from list %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName), debugstr_w(pszClassList));
793 cls->tf = tf;
794 cls->tf->dwRefCount++;
795 TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
796 }
797#ifdef __REACTOS__
798 else if (defaultCls)
799 {
800 cls = defaultCls;
801 TRACE("Opened default class %s from list %s\n", debugstr_w(cls->szClassName), debugstr_w(pszClassList));
802 cls->tf = tf;
803 cls->tf->dwRefCount++;
804 TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
805 }
806#endif
807 return cls;
808}
static const WCHAR szClassName[]
Definition: clipbrd.c:11
GLenum GLsizei len
Definition: glext.h:6722
#define strchrW(s, c)
Definition: unicode.h:40
struct _THEME_FILE * tf
Definition: uxthemep.h:61
WCHAR szAppName[MAX_THEME_APP_NAME]
Definition: uxthemep.h:62
WCHAR szClassName[MAX_THEME_CLASS_NAME]
Definition: uxthemep.h:63
#define MAX_THEME_CLASS_NAME
Definition: uxthemep.h:35

Referenced by OpenThemeDataInternal().

◆ MSSTYLES_OpenThemeFile()

HRESULT MSSTYLES_OpenThemeFile ( LPCWSTR  lpThemeFile,
LPCWSTR  pszColorName,
LPCWSTR  pszSizeName,
PTHEME_FILE tf 
)

Definition at line 54 of file msstyles.c.

55{
56 HMODULE hTheme;
57 HRSRC hrsc;
58 HRESULT hr = S_OK;
59 static const WCHAR szPackThemVersionResource[] = {
60 'P','A','C','K','T','H','E','M','_','V','E','R','S','I','O','N', '\0'
61 };
62 static const WCHAR szColorNamesResource[] = {
63 'C','O','L','O','R','N','A','M','E','S','\0'
64 };
65 static const WCHAR szSizeNamesResource[] = {
66 'S','I','Z','E','N','A','M','E','S','\0'
67 };
68
70 DWORD versize;
71 LPWSTR pszColors;
72 LPWSTR pszSelectedColor = NULL;
73 LPWSTR pszSizes;
74 LPWSTR pszSelectedSize = NULL;
75 LPWSTR tmp;
76
77 TRACE("Opening %s\n", debugstr_w(lpThemeFile));
78
79 hTheme = LoadLibraryExW(lpThemeFile, NULL, LOAD_LIBRARY_AS_DATAFILE);
80
81 /* Validate that this is really a theme */
82 if(!hTheme) {
84 goto invalid_theme;
85 }
86 if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szPackThemVersionResource))) {
87 TRACE("No version resource found\n");
89 goto invalid_theme;
90 }
91 if((versize = SizeofResource(hTheme, hrsc)) != 2)
92 {
93 TRACE("Version resource found, but wrong size: %d\n", versize);
95 goto invalid_theme;
96 }
97 version = *(WORD*)LoadResource(hTheme, hrsc);
99 {
100 TRACE("Version of theme file is unsupported: 0x%04x\n", version);
102 goto invalid_theme;
103 }
104
105 if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szColorNamesResource))) {
106 TRACE("Color names resource not found\n");
108 goto invalid_theme;
109 }
110 pszColors = LoadResource(hTheme, hrsc);
111
112 if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szSizeNamesResource))) {
113 TRACE("Size names resource not found\n");
115 goto invalid_theme;
116 }
117 pszSizes = LoadResource(hTheme, hrsc);
118
119 /* Validate requested color against what's available from the theme */
120 if(pszColorName) {
121 tmp = pszColors;
122 while(*tmp) {
123 if(!lstrcmpiW(pszColorName, tmp)) {
124 pszSelectedColor = tmp;
125 break;
126 }
127 tmp += lstrlenW(tmp)+1;
128 }
129 }
130 else
131 pszSelectedColor = pszColors; /* Use the default color */
132
133 /* Validate requested size against what's available from the theme */
134 if(pszSizeName) {
135 tmp = pszSizes;
136 while(*tmp) {
137 if(!lstrcmpiW(pszSizeName, tmp)) {
138 pszSelectedSize = tmp;
139 break;
140 }
141 tmp += lstrlenW(tmp)+1;
142 }
143 }
144 else
145 pszSelectedSize = pszSizes; /* Use the default size */
146
147 if(!pszSelectedColor || !pszSelectedSize) {
148 TRACE("Requested color/size (%s/%s) not found in theme\n",
149 debugstr_w(pszColorName), debugstr_w(pszSizeName));
151 goto invalid_theme;
152 }
153
155 (*tf)->hTheme = hTheme;
156
157 GetFullPathNameW(lpThemeFile, MAX_PATH, (*tf)->szThemeFile, NULL);
158
159 (*tf)->pszAvailColors = pszColors;
160 (*tf)->pszAvailSizes = pszSizes;
161 (*tf)->pszSelectedColor = pszSelectedColor;
162 (*tf)->pszSelectedSize = pszSelectedSize;
163 (*tf)->dwRefCount = 1;
164
165 TRACE("Theme %p refcount: %d\n", *tf, (*tf)->dwRefCount);
166
167 return S_OK;
168
169invalid_theme:
170 if(hTheme) FreeLibrary(hTheme);
171 return hr;
172}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static const WCHAR version[]
Definition: asmname.c:66
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
unsigned short WORD
Definition: ntddk_ex.h:93
#define MSSTYLES_VERSION
Definition: msstyles.c:31
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:342
#define ERROR_BAD_FORMAT
Definition: winerror.h:114
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by CheckThemeSignature(), EnumThemeColors(), EnumThemeSizes(), GetThemeDefaults(), GetThemeDocumentationProperty(), OpenThemeFile(), and UXTHEME_LoadTheme().

◆ MSSTYLES_ParseIniSectionName()

static BOOL MSSTYLES_ParseIniSectionName ( LPCWSTR  lpSection,
DWORD  dwLen,
LPWSTR  szAppName,
LPWSTR  szClassName,
int iPartId,
int iStateId 
)
static

Definition at line 313 of file msstyles.c.

314{
315 WCHAR sec[255];
316 WCHAR part[60] = {'\0'};
317 WCHAR state[60] = {'\0'};
318 LPWSTR tmp;
319 LPWSTR comp;
320 lstrcpynW(sec, lpSection, min(dwLen+1, sizeof(sec)/sizeof(sec[0])));
321
322 *szAppName = 0;
323 *szClassName = 0;
324 *iPartId = 0;
325 *iStateId = 0;
326 comp = sec;
327 /* Get the application name */
328 tmp = strchrW(comp, ':');
329 if(tmp) {
330 *tmp++ = 0;
331 tmp++;
333 comp = tmp;
334 }
335
336 tmp = strchrW(comp, '.');
337 if(tmp) {
338 *tmp++ = 0;
340 comp = tmp;
341 /* now get the part & state */
342 tmp = strchrW(comp, '(');
343 if(tmp) {
344 *tmp++ = 0;
345 lstrcpynW(part, comp, sizeof(part)/sizeof(part[0]));
346 comp = tmp;
347 /* now get the state */
348 tmp = strchrW(comp, ')');
349 if (!tmp)
350 return FALSE;
351 *tmp = 0;
352 lstrcpynW(state, comp, sizeof(state)/sizeof(state[0]));
353 }
354 else {
355 lstrcpynW(part, comp, sizeof(part)/sizeof(part[0]));
356 }
357 }
358 else {
359 tmp = strchrW(comp, '(');
360 if(tmp) {
361 *tmp++ = 0;
363 comp = tmp;
364 /* now get the state */
365 tmp = strchrW(comp, ')');
366 if (!tmp)
367 return FALSE;
368 *tmp = 0;
369 lstrcpynW(state, comp, sizeof(state)/sizeof(state[0]));
370 }
371 else {
373 }
374 }
375 if(!*szClassName) return FALSE;
376 return MSSTYLES_LookupPartState(szClassName, part[0]?part:NULL, state[0]?state:NULL, iPartId, iStateId);
377}
static int state
Definition: maze.c:121
TCHAR szAppName[128]
Definition: solitaire.cpp:18
BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszState, int *iPartId, int *iStateId)
Definition: stylemap.c:1038
#define MAX_THEME_APP_NAME
Definition: uxthemep.h:34

Referenced by MSSTYLES_ParseThemeIni().

◆ MSSTYLES_ParseThemeIni()

void MSSTYLES_ParseThemeIni ( PTHEME_FILE  tf)

Definition at line 644 of file msstyles.c.

645{
646 static const WCHAR szSysMetrics[] = {'S','y','s','M','e','t','r','i','c','s','\0'};
647 static const WCHAR szGlobals[] = {'g','l','o','b','a','l','s','\0'};
648 PTHEME_CLASS cls;
649 PTHEME_CLASS globals;
654 WCHAR szPropertyName[MAX_THEME_VALUE_NAME];
655 int iPartId;
656 int iStateId;
657 int iPropertyPrimitive;
658 int iPropertyId;
659 DWORD dwLen;
661 DWORD dwValueLen;
662 LPCWSTR lpValue;
663
664 if(tf->classes)
665 return;
666
668
669 while((lpName=UXINI_GetNextSection(ini, &dwLen)))
670 {
671 if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, lpName, dwLen, szSysMetrics, -1) == CSTR_EQUAL)
672 {
673 while((lpName=UXINI_GetNextValue(ini, &dwLen, &lpValue, &dwValueLen)))
674 {
675 lstrcpynW(szPropertyName, lpName, min(dwLen+1, sizeof(szPropertyName)/sizeof(szPropertyName[0])));
676 if(MSSTYLES_LookupProperty(szPropertyName, &iPropertyPrimitive, &iPropertyId))
677 {
678 /* Catch all metrics, including colors */
679 MSSTYLES_AddMetric(tf, iPropertyPrimitive, iPropertyId, lpValue, dwValueLen);
680 }
681 else
682 {
683 TRACE("Unknown system metric %s\n", debugstr_w(szPropertyName));
684 }
685 }
686 continue;
687 }
688
689 if(MSSTYLES_ParseIniSectionName(lpName, dwLen, szAppName, szClassName, &iPartId, &iStateId))
690 {
691 BOOL isGlobal = FALSE;
692 if(!lstrcmpiW(szClassName, szGlobals))
693 {
694 isGlobal = TRUE;
695 }
697 ps = MSSTYLES_AddPartState(cls, iPartId, iStateId);
698
699 while((lpName=UXINI_GetNextValue(ini, &dwLen, &lpValue, &dwValueLen)))
700 {
701 lstrcpynW(szPropertyName, lpName, min(dwLen+1, sizeof(szPropertyName)/sizeof(szPropertyName[0])));
702 if(MSSTYLES_LookupProperty(szPropertyName, &iPropertyPrimitive, &iPropertyId))
703 {
704 MSSTYLES_AddProperty(ps, iPropertyPrimitive, iPropertyId, lpValue, dwValueLen, isGlobal);
705 }
706 else
707 {
708 TRACE("Unknown property %s\n", debugstr_w(szPropertyName));
709 }
710 }
711 }
712 }
713
714 /* App/Class combos override values defined by the base class, map these overrides */
715 globals = MSSTYLES_FindClass(tf, NULL, szGlobals);
716 cls = tf->classes;
717 while(cls)
718 {
719 if(*cls->szAppName)
720 {
722 if(!cls->overrides)
723 {
724 TRACE("No overrides found for app %s class %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName));
725 }
726 else
727 {
728 cls->overrides = globals;
729 }
730 }
731 else
732 {
733 /* Everything overrides globals..except globals */
734 if(cls != globals)
735 cls->overrides = globals;
736 }
737 cls = cls->next;
738 }
740
741 if(!tf->classes) {
742 ERR("Failed to parse theme ini\n");
743 }
744}
#define ERR(fmt,...)
Definition: debug.h:113
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: locale.c:4013
static PTHEME_CLASS MSSTYLES_AddClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName)
Definition: msstyles.c:422
static PUXINI_FILE MSSTYLES_GetActiveThemeIni(PTHEME_FILE tf)
Definition: msstyles.c:246
static PTHEME_PARTSTATE MSSTYLES_AddPartState(PTHEME_CLASS tc, int iPartId, int iStateId)
Definition: msstyles.c:479
static BOOL MSSTYLES_ParseIniSectionName(LPCWSTR lpSection, DWORD dwLen, LPWSTR szAppName, LPWSTR szClassName, int *iPartId, int *iStateId)
Definition: msstyles.c:313
static PTHEME_PROPERTY MSSTYLES_AddMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen)
Definition: msstyles.c:617
static PTHEME_PROPERTY MSSTYLES_AddProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen, BOOL isGlobal)
Definition: msstyles.c:576
#define LOCALE_SYSTEM_DEFAULT
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId)
Definition: stylemap.c:1100
TConfig ini
Definition: tnconfig.cpp:45
LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen)
Definition: uxini.c:173
LPCWSTR UXINI_GetNextValue(PUXINI_FILE uf, DWORD *dwNameLen, LPCWSTR *lpValue, DWORD *dwValueLen)
Definition: uxini.c:226
void UXINI_CloseINI(PUXINI_FILE uf)
Definition: uxini.c:83
#define MAX_THEME_VALUE_NAME
Definition: uxthemep.h:36
_In_ LPCSTR lpName
Definition: winbase.h:2789
#define NORM_IGNORECASE
Definition: winnls.h:176
#define CSTR_EQUAL
Definition: winnls.h:456

Referenced by OpenThemeDataInternal(), and UXTHEME_SetActiveTheme().

◆ MSSTYLES_PSFindProperty()

static PTHEME_PROPERTY MSSTYLES_PSFindProperty ( PTHEME_PARTSTATE  ps,
int  iPropertyPrimitive,
int  iPropertyId 
)
inlinestatic

Definition at line 538 of file msstyles.c.

539{
540 return MSSTYLES_LFindProperty(ps->properties, iPropertyPrimitive, iPropertyId);
541}

Referenced by MSSTYLES_AddProperty(), and MSSTYLES_FindProperty().

◆ MSSTYLES_ReferenceTheme()

HRESULT MSSTYLES_ReferenceTheme ( PTHEME_FILE  tf)

Definition at line 224 of file msstyles.c.

225{
226 tf->dwRefCount++;
227 TRACE("Theme %p refcount: %d\n", tf, tf->dwRefCount);
228 return S_OK;
229}

Referenced by UXTHEME_SetActiveTheme().

◆ prepare_alpha()

static BOOL prepare_alpha ( HBITMAP  bmp,
BOOL hasAlpha 
)
static

Definition at line 863 of file msstyles.c.

864{
866 int n;
867 BYTE* p;
868
869 *hasAlpha = FALSE;
870
871 if (!bmp || GetObjectW( bmp, sizeof(dib), &dib ) != sizeof(dib))
872 return FALSE;
873
874 if(dib.dsBm.bmBitsPixel != 32)
875 /* nothing to do */
876 return TRUE;
877
878 p = dib.dsBm.bmBits;
879 n = dib.dsBmih.biHeight * dib.dsBmih.biWidth;
880 /* AlphaBlend() wants premultiplied alpha, so do that now */
881 while (n-- > 0)
882 {
883 int a = p[3]+1;
884 p[0] = (p[0] * a) >> 8;
885 p[1] = (p[1] * a) >> 8;
886 p[2] = (p[2] * a) >> 8;
887 p += 4;
888
889 if (a != 256)
890 *hasAlpha = TRUE;
891 }
892
893 return TRUE;
894}
GLdouble n
Definition: glext.h:7729
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78
BITMAP bmp
Definition: alphablend.c:62
static const BYTE dib[]
Definition: ole2.c:201
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by MSSTYLES_LoadBitmap().

Variable Documentation

◆ alphaBlendMode

int alphaBlendMode
extern

◆ szThemesIniResource

const WCHAR szThemesIniResource[]
static
Initial value:
= {
't','h','e','m','e','s','_','i','n','i','\0'
}

Definition at line 33 of file msstyles.c.

Referenced by MSSTYLES_GetThemeIni().