ReactOS  0.4.13-dev-563-g0561610
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 }
PTHEME_PROPERTY MSSTYLES_FindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:556
#define TMT_BOOL
Definition: vssym32.h:137
HRESULT hr
Definition: shlfolder.c:183
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2694
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
HRESULT MSSTYLES_GetPropertyBool(PTHEME_PROPERTY tp, BOOL *pfVal)
Definition: msstyles.c:983
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define SetLastError(x)
Definition: compat.h:409
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
int ret
PTHEME_CLASS ValidateHandle(HTHEME hTheme)
Definition: system.c:717
#define TMT_FLATMENUS
Definition: vssym32.h:175
struct _THEME_FILE * tf
Definition: uxthemep.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by LoadSchemeFromTheme(), and main().

◆ 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 }
PTHEME_PROPERTY MSSTYLES_FindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:556
HRESULT hr
Definition: shlfolder.c:183
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2694
DWORD WINAPI GetSysColor(_In_ int)
#define TMT_FIRSTCOLOR
Definition: tmschema.h:236
GLuint color
Definition: glext.h:6243
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
DWORD COLORREF
Definition: windef.h:285
#define SetLastError(x)
Definition: compat.h:409
PTHEME_CLASS ValidateHandle(HTHEME hTheme)
Definition: system.c:717
HRESULT MSSTYLES_GetPropertyColor(PTHEME_PROPERTY tp, COLORREF *pColor)
Definition: msstyles.c:996
#define TMT_COLOR
Definition: vssym32.h:138
struct _THEME_FILE * tf
Definition: uxthemep.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by GetThemeSysColorBrush(), LoadSchemeFromTheme(), and main().

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4
COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
Definition: metric.c:58
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

◆ 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);
102  ReleaseDC(NULL, hdc);
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;
126  else hr = STG_E_INVALIDPARAMETER;
127  }
128  return hr;
129 }
PTHEME_PROPERTY MSSTYLES_FindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:556
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
HDC WINAPI GetDC(_In_opt_ HWND)
Definition: mk_font.cpp:20
static HDC
Definition: imagelist.c:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define TMT_MENUFONT
Definition: vssym32.h:166
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2694
#define TMT_MSGBOXFONT
Definition: vssym32.h:168
#define TMT_CAPTIONFONT
Definition: vssym32.h:164
#define TMT_ICONTITLEFONT
Definition: vssym32.h:169
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TMT_FONT
Definition: vssym32.h:144
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
PTHEME_CLASS ValidateHandle(HTHEME hTheme)
Definition: system.c:717
HDC hdc
Definition: main.c:9
#define S_OK
Definition: intsafe.h:59
HRESULT MSSTYLES_GetPropertyFont(PTHEME_PROPERTY tp, HDC hdc, LOGFONTW *pFont)
Definition: msstyles.c:1066
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
#define TMT_SMALLCAPTIONFONT
Definition: vssym32.h:165
struct _THEME_FILE * tf
Definition: uxthemep.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define TMT_STATUSFONT
Definition: vssym32.h:167

Referenced by LoadSchemeFromTheme(), main(), 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);
144  return STG_E_INVALIDPARAMETER;
145  }
146  if((tp = MSSTYLES_FindMetric(ptc->tf , TMT_INT, iIntID)))
147  return MSSTYLES_GetPropertyInt(tp, piValue);
148  return E_PROP_ID_UNSUPPORTED;
149 }
PTHEME_PROPERTY MSSTYLES_FindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:556
#define E_HANDLE
Definition: winerror.h:2850
#define WARN(fmt,...)
Definition: debug.h:111
#define TMT_LASTINT
Definition: tmschema.h:196
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2694
#define TRACE(s)
Definition: solgame.cpp:4
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
PTHEME_CLASS ValidateHandle(HTHEME hTheme)
Definition: system.c:717
#define TMT_INT
Definition: vssym32.h:136
HRESULT MSSTYLES_GetPropertyInt(PTHEME_PROPERTY tp, int *piVal)
Definition: msstyles.c:1083
struct _THEME_FILE * tf
Definition: uxthemep.h:59

Referenced by main().

◆ 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 }
PTHEME_PROPERTY MSSTYLES_FindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:556
#define SM_CYHSCROLL
Definition: winuser.h:952
#define SM_CYSIZE
Definition: winuser.h:982
#define SM_CYMENUSIZE
Definition: winuser.h:1008
#define TMT_SCROLLBARWIDTH
Definition: vssym32.h:179
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2694
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
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_MENUBARHEIGHT
Definition: vssym32.h:186
#define TMT_CAPTIONBARHEIGHT
Definition: vssym32.h:182
#define SM_CYSMSIZE
Definition: winuser.h:1006
#define TRACE(s)
Definition: solgame.cpp:4
#define SM_CXDLGFRAME
Definition: winuser.h:956
#define SM_CXSMSIZE
Definition: winuser.h:1005
int WINAPI GetSystemMetrics(_In_ int)
#define SetLastError(x)
Definition: compat.h:409
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
PTHEME_CLASS ValidateHandle(HTHEME hTheme)
Definition: system.c:717
#define TMT_SCROLLBARHEIGHT
Definition: vssym32.h:180
HRESULT MSSTYLES_GetPropertyInt(PTHEME_PROPERTY tp, int *piVal)
Definition: msstyles.c:1083
#define SM_CXVSCROLL
Definition: winuser.h:951
#define TMT_MENUBARWIDTH
Definition: vssym32.h:185
#define TMT_CAPTIONBARWIDTH
Definition: vssym32.h:181
#define SM_CXSIZE
Definition: winuser.h:981
#define TMT_SMCAPTIONBARWIDTH
Definition: vssym32.h:183
#define TMT_SIZINGBORDERWIDTH
Definition: vssym32.h:178
struct _THEME_FILE * tf
Definition: uxthemep.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define TMT_SIZE
Definition: vssym32.h:141
#define SM_CXMENUSIZE
Definition: winuser.h:1007

Referenced by LoadSchemeFromTheme(), and main().

◆ 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);
216  return STG_E_INVALIDPARAMETER;
217  }
218  if((tp = MSSTYLES_FindMetric(ptc->tf, TMT_STRING, iStringID)))
219  return MSSTYLES_GetPropertyString(tp, pszStringBuff, cchMaxStringChars);
220  return E_PROP_ID_UNSUPPORTED;
221 }
PTHEME_PROPERTY MSSTYLES_FindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:556
#define E_HANDLE
Definition: winerror.h:2850
#define WARN(fmt,...)
Definition: debug.h:111
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2694
#define TMT_STRING
Definition: vssym32.h:135
#define TRACE(s)
Definition: solgame.cpp:4
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
PTHEME_CLASS ValidateHandle(HTHEME hTheme)
Definition: system.c:717
HRESULT MSSTYLES_GetPropertyString(PTHEME_PROPERTY tp, LPWSTR pszBuff, int cchMaxBuffChars)
Definition: msstyles.c:1140
#define TMT_LASTSTRING
Definition: tmschema.h:202
struct _THEME_FILE * tf
Definition: uxthemep.h:59

Referenced by main().

◆ 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 FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99