ReactOS 0.4.16-dev-306-g647d351
metric.c File Reference
#include "uxthemep.h"
Include dependency graph for metric.c:

Go to the source code of this file.

Functions

BOOL WINAPI GetThemeSysBool (HTHEME hTheme, int iBoolID)
 
COLORREF WINAPI GetThemeSysColor (HTHEME hTheme, int iColorID)
 
HBRUSH WINAPI GetThemeSysColorBrush (HTHEME hTheme, int iColorID)
 
HRESULT WINAPI GetThemeSysFont (HTHEME hTheme, int iFontID, LOGFONTW *plf)
 
HRESULT WINAPI GetThemeSysInt (HTHEME hTheme, int iIntID, int *piValue)
 
int WINAPI GetThemeSysSize (HTHEME hTheme, int iSizeID)
 
HRESULT WINAPI GetThemeSysString (HTHEME hTheme, int iStringID, LPWSTR pszStringBuff, int cchMaxStringChars)
 
HRESULT WINAPI GetThemeTransitionDuration (HTHEME hTheme, int iPartId, int iStateIdFrom, int iStateIdTo, int iPropId, DWORD *pdwDuration)
 

Function Documentation

◆ GetThemeSysBool()

BOOL WINAPI GetThemeSysBool ( HTHEME  hTheme,
int  iBoolID 
)

Definition at line 26 of file metric.c.

27{
28 HRESULT hr;
30 BOOL ret;
31 PTHEME_CLASS ptc = ValidateHandle(hTheme);
32
33 TRACE("(%p, %d)\n", hTheme, iBoolID);
34 SetLastError(0);
35 if(ptc) {
36 if((tp = MSSTYLES_FindMetric(ptc->tf, TMT_BOOL, iBoolID))) {
38 if(SUCCEEDED(hr))
39 return ret;
40 else
42 }
43 }
44 if(iBoolID == TMT_FLATMENUS) {
45 if(SystemParametersInfoW(SPI_GETFLATMENU, 0, &ret, 0))
46 return ret;
47 }
48 else {
49 FIXME("Unknown bool id: %d\n", iBoolID);
51 }
52 return FALSE;
53}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
LPVOID FASTCALL ValidateHandle(HANDLE hObject, UINT uType)
Definition: utils.c:377
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT MSSTYLES_GetPropertyBool(PTHEME_PROPERTY tp, BOOL *pfVal)
Definition: msstyles.c:994
PTHEME_PROPERTY MSSTYLES_FindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:556
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
struct _THEME_FILE * tf
Definition: uxthemep.h:61
#define TMT_FLATMENUS
Definition: vssym32.h:175
#define TMT_BOOL
Definition: vssym32.h:137
int ret
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)

Referenced by LoadSchemeFromTheme().

◆ GetThemeSysColor()

COLORREF WINAPI GetThemeSysColor ( HTHEME  hTheme,
int  iColorID 
)

Definition at line 58 of file metric.c.

59{
60 HRESULT hr;
62 PTHEME_CLASS ptc = ValidateHandle(hTheme);
63
64 TRACE("(%p, %d)\n", hTheme, iColorID);
65 SetLastError(0);
66 if(ptc) {
67 if((tp = MSSTYLES_FindMetric(ptc->tf, TMT_COLOR, iColorID + TMT_FIRSTCOLOR))) {
70 if(SUCCEEDED(hr))
71 return color;
72 else
74 }
75 }
76 return GetSysColor(iColorID);
77}
GLuint color
Definition: glext.h:6243
HRESULT MSSTYLES_GetPropertyColor(PTHEME_PROPERTY tp, COLORREF *pColor)
Definition: msstyles.c:1007
#define TMT_FIRSTCOLOR
Definition: tmschema.h:236
#define TMT_COLOR
Definition: vssym32.h:138
DWORD COLORREF
Definition: windef.h:300
DWORD WINAPI GetSysColor(_In_ int)

Referenced by DrawNCPreview(), GetThemeSysColorBrush(), LoadSchemeFromTheme(), and ThemeDrawCaptionText().

◆ GetThemeSysColorBrush()

HBRUSH WINAPI GetThemeSysColorBrush ( HTHEME  hTheme,
int  iColorID 
)

Definition at line 82 of file metric.c.

83{
84 TRACE("(%p, %d)\n", hTheme, iColorID);
85 return CreateSolidBrush(GetThemeSysColor(hTheme, iColorID));
86}
COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
Definition: metric.c:58
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

Referenced by DrawWindowForNCPreview().

◆ GetThemeSysFont()

HRESULT WINAPI GetThemeSysFont ( HTHEME  hTheme,
int  iFontID,
LOGFONTW plf 
)

Definition at line 91 of file metric.c.

92{
93 HRESULT hr = S_OK;
95 PTHEME_CLASS ptc = ValidateHandle(hTheme);
96
97 TRACE("(%p, %d)\n", hTheme, iFontID);
98 if(ptc) {
99 if((tp = MSSTYLES_FindMetric(ptc->tf, TMT_FONT, iFontID))) {
100 HDC hdc = GetDC(NULL);
103 if(SUCCEEDED(hr))
104 return S_OK;
105 }
106 }
107 if(iFontID == TMT_ICONTITLEFONT) {
110 }
111 else {
112 NONCLIENTMETRICSW ncm;
113 LOGFONTW *font = NULL;
114 ncm.cbSize = sizeof(NONCLIENTMETRICSW);
115 if(!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0))
117 switch(iFontID) {
118 case TMT_CAPTIONFONT: font = &ncm.lfCaptionFont; break;
119 case TMT_SMALLCAPTIONFONT: font = &ncm.lfSmCaptionFont; break;
120 case TMT_MENUFONT: font = &ncm.lfMenuFont; break;
121 case TMT_STATUSFONT: font = &ncm.lfStatusFont; break;
122 case TMT_MSGBOXFONT: font = &ncm.lfMessageFont; break;
123 default: FIXME("Unknown FontID: %d\n", iFontID); break;
124 }
125 if(font) *plf = *font;
127 }
128 return hr;
129}
#define NULL
Definition: types.h:112
#define S_OK
Definition: intsafe.h:52
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
HRESULT MSSTYLES_GetPropertyFont(PTHEME_PROPERTY tp, HDC hdc, LOGFONTW *pFont)
Definition: msstyles.c:1077
Definition: mk_font.cpp:20
#define TMT_SMALLCAPTIONFONT
Definition: vssym32.h:165
#define TMT_CAPTIONFONT
Definition: vssym32.h:164
#define TMT_MENUFONT
Definition: vssym32.h:166
#define TMT_FONT
Definition: vssym32.h:144
#define TMT_MSGBOXFONT
Definition: vssym32.h:168
#define TMT_ICONTITLEFONT
Definition: vssym32.h:169
#define TMT_STATUSFONT
Definition: vssym32.h:167
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1383
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by DrawNCPreview(), LoadSchemeFromTheme(), and ThemeDrawCaptionText().

◆ GetThemeSysInt()

HRESULT WINAPI GetThemeSysInt ( HTHEME  hTheme,
int  iIntID,
int piValue 
)

Definition at line 134 of file metric.c.

135{
137 PTHEME_CLASS ptc = ValidateHandle(hTheme);
138
139 TRACE("(%p, %d)\n", hTheme, iIntID);
140 if(!ptc)
141 return E_HANDLE;
142 if(iIntID < TMT_FIRSTINT || iIntID > TMT_LASTINT) {
143 WARN("Unknown IntID: %d\n", iIntID);
145 }
146 if((tp = MSSTYLES_FindMetric(ptc->tf , TMT_INT, iIntID)))
147 return MSSTYLES_GetPropertyInt(tp, piValue);
149}
#define WARN(fmt,...)
Definition: precomp.h:61
HRESULT MSSTYLES_GetPropertyInt(PTHEME_PROPERTY tp, int *piVal)
Definition: msstyles.c:1094
#define TMT_LASTINT
Definition: tmschema.h:196
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
#define TMT_INT
Definition: vssym32.h:136
#define E_HANDLE
Definition: winerror.h:2850

◆ GetThemeSysSize()

int WINAPI GetThemeSysSize ( HTHEME  hTheme,
int  iSizeID 
)

Definition at line 154 of file metric.c.

155{
157 int i, id = -1;
158 int metricMap[] = {
164 SM_CYFRAME, TMT_SIZINGBORDERWIDTH, /* There is no TMT_SIZINGBORDERHEIGHT, but this works in windows.. */
169 };
170 PTHEME_CLASS ptc = ValidateHandle(hTheme);
171
172 if(ptc) {
173 for(i=0; i<sizeof(metricMap)/sizeof(metricMap[0]); i+=2) {
174 if(metricMap[i] == iSizeID) {
175 id = metricMap[i+1];
176 break;
177 }
178 }
179 SetLastError(0);
180 if(id != -1) {
181 if((tp = MSSTYLES_FindMetric(ptc->tf, TMT_SIZE, id))) {
183 return i;
184 }
185 }
186 TRACE("Size %d not found in theme, using system metric\n", iSizeID);
187 }
188 else {
190 return 0;
191 }
192 }
193
194
195 // TODO: Check if this is correct
196 // In windows for SM_CXFRAME this function returns what seems to be the non client metric iBorderWidth
197 if (iSizeID == SM_CXFRAME)
199 return GetSystemMetrics(iSizeID);
200}
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
#define TMT_SMCAPTIONBARHEIGHT
Definition: vssym32.h:184
#define TMT_SMCAPTIONBARWIDTH
Definition: vssym32.h:183
#define TMT_MENUBARWIDTH
Definition: vssym32.h:185
#define TMT_CAPTIONBARHEIGHT
Definition: vssym32.h:182
#define TMT_SCROLLBARHEIGHT
Definition: vssym32.h:180
#define TMT_SIZINGBORDERWIDTH
Definition: vssym32.h:178
#define TMT_MENUBARHEIGHT
Definition: vssym32.h:186
#define TMT_CAPTIONBARWIDTH
Definition: vssym32.h:181
#define TMT_SCROLLBARWIDTH
Definition: vssym32.h:179
#define TMT_SIZE
Definition: vssym32.h:141
#define SM_CYSIZE
Definition: winuser.h:995
#define SM_CXVSCROLL
Definition: winuser.h:964
#define SM_CXFRAME
Definition: winuser.h:997
#define SM_CXSIZE
Definition: winuser.h:994
#define SM_CYFRAME
Definition: winuser.h:999
#define SM_CYHSCROLL
Definition: winuser.h:965
#define SM_CXSMSIZE
Definition: winuser.h:1018
#define SM_CXDLGFRAME
Definition: winuser.h:969
#define SM_CXMENUSIZE
Definition: winuser.h:1020
#define SM_CYSMSIZE
Definition: winuser.h:1019
#define SM_CYMENUSIZE
Definition: winuser.h:1021
int WINAPI GetSystemMetrics(_In_ int)

Referenced by DrawWindowForNCPreview(), CTipbarWnd::InitThemeMargins(), and LoadSchemeFromTheme().

◆ GetThemeSysString()

HRESULT WINAPI GetThemeSysString ( HTHEME  hTheme,
int  iStringID,
LPWSTR  pszStringBuff,
int  cchMaxStringChars 
)

Definition at line 205 of file metric.c.

207{
209 PTHEME_CLASS ptc = ValidateHandle(hTheme);
210
211 TRACE("(%p, %d)\n", hTheme, iStringID);
212 if(!ptc)
213 return E_HANDLE;
214 if(iStringID < TMT_FIRSTSTRING || iStringID > TMT_LASTSTRING) {
215 WARN("Unknown StringID: %d\n", iStringID);
217 }
218 if((tp = MSSTYLES_FindMetric(ptc->tf, TMT_STRING, iStringID)))
219 return MSSTYLES_GetPropertyString(tp, pszStringBuff, cchMaxStringChars);
221}
HRESULT MSSTYLES_GetPropertyString(PTHEME_PROPERTY tp, LPWSTR pszBuff, int cchMaxBuffChars)
Definition: msstyles.c:1151
#define TMT_LASTSTRING
Definition: tmschema.h:202
#define TMT_STRING
Definition: vssym32.h:135

◆ GetThemeTransitionDuration()

HRESULT WINAPI GetThemeTransitionDuration ( HTHEME  hTheme,
int  iPartId,
int  iStateIdFrom,
int  iStateIdTo,
int  iPropId,
DWORD pdwDuration 
)

Definition at line 227 of file metric.c.

229{
230 FIXME("(%p, %u, %u, %u, %u, %p) stub\n", hTheme, iPartId, iStateIdFrom, iStateIdTo,
231 iPropId, pdwDuration);
232
233 return E_NOTIMPL;
234}
#define E_NOTIMPL
Definition: ddrawi.h:99