bb76232aca2625fa78432803469ae5db8e171c6a
2 * Win32 5.1 Theme properties
4 * Copyright (C) 2003 Kevin Koltzau
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 /***********************************************************************
24 * GetThemeBool (UXTHEME.@)
26 HRESULT WINAPI
GetThemeBool(HTHEME hTheme
, int iPartId
, int iStateId
,
27 int iPropId
, BOOL
*pfVal
)
31 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
35 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_BOOL
, iPropId
)))
36 return E_PROP_ID_UNSUPPORTED
;
37 return MSSTYLES_GetPropertyBool(tp
, pfVal
);
40 /***********************************************************************
41 * GetThemeColor (UXTHEME.@)
43 HRESULT WINAPI
GetThemeColor(HTHEME hTheme
, int iPartId
, int iStateId
,
44 int iPropId
, COLORREF
*pColor
)
48 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
52 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_COLOR
, iPropId
)))
53 return E_PROP_ID_UNSUPPORTED
;
54 return MSSTYLES_GetPropertyColor(tp
, pColor
);
57 /***********************************************************************
58 * GetThemeEnumValue (UXTHEME.@)
60 HRESULT WINAPI
GetThemeEnumValue(HTHEME hTheme
, int iPartId
, int iStateId
,
61 int iPropId
, int *piVal
)
67 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
71 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_ENUM
, iPropId
)))
72 return E_PROP_ID_UNSUPPORTED
;
74 hr
= MSSTYLES_GetPropertyString(tp
, val
, sizeof(val
)/sizeof(val
[0]));
77 if(!MSSTYLES_LookupEnum(val
, iPropId
, piVal
))
78 return E_PROP_ID_UNSUPPORTED
;
82 /***********************************************************************
83 * GetThemeFilename (UXTHEME.@)
85 HRESULT WINAPI
GetThemeFilename(HTHEME hTheme
, int iPartId
, int iStateId
,
86 int iPropId
, LPWSTR pszThemeFilename
,
91 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
95 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_FILENAME
, iPropId
)))
96 return E_PROP_ID_UNSUPPORTED
;
97 return MSSTYLES_GetPropertyString(tp
, pszThemeFilename
, cchMaxBuffChars
);
100 /***********************************************************************
101 * GetThemeFont (UXTHEME.@)
103 HRESULT WINAPI
GetThemeFont(HTHEME hTheme
, HDC hdc
, int iPartId
,
104 int iStateId
, int iPropId
, LOGFONTW
*pFont
)
108 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
112 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_FONT
, iPropId
)))
113 return E_PROP_ID_UNSUPPORTED
;
114 return MSSTYLES_GetPropertyFont(tp
, hdc
, pFont
);
117 /***********************************************************************
118 * GetThemeInt (UXTHEME.@)
120 HRESULT WINAPI
GetThemeInt(HTHEME hTheme
, int iPartId
, int iStateId
,
121 int iPropId
, int *piVal
)
125 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
129 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_INT
, iPropId
)))
130 return E_PROP_ID_UNSUPPORTED
;
131 return MSSTYLES_GetPropertyInt(tp
, piVal
);
134 /***********************************************************************
135 * GetThemeIntList (UXTHEME.@)
137 HRESULT WINAPI
GetThemeIntList(HTHEME hTheme
, int iPartId
, int iStateId
,
138 int iPropId
, INTLIST
*pIntList
)
142 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
146 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_INTLIST
, iPropId
)))
147 return E_PROP_ID_UNSUPPORTED
;
148 return MSSTYLES_GetPropertyIntList(tp
, pIntList
);
151 /***********************************************************************
152 * GetThemePosition (UXTHEME.@)
154 HRESULT WINAPI
GetThemePosition(HTHEME hTheme
, int iPartId
, int iStateId
,
155 int iPropId
, POINT
*pPoint
)
159 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
163 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_POSITION
, iPropId
)))
164 return E_PROP_ID_UNSUPPORTED
;
165 return MSSTYLES_GetPropertyPosition(tp
, pPoint
);
168 /***********************************************************************
169 * GetThemeRect (UXTHEME.@)
171 HRESULT WINAPI
GetThemeRect(HTHEME hTheme
, int iPartId
, int iStateId
,
172 int iPropId
, RECT
*pRect
)
176 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
180 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_RECT
, iPropId
)))
181 return E_PROP_ID_UNSUPPORTED
;
182 return MSSTYLES_GetPropertyRect(tp
, pRect
);
185 /***********************************************************************
186 * GetThemeString (UXTHEME.@)
188 HRESULT WINAPI
GetThemeString(HTHEME hTheme
, int iPartId
, int iStateId
,
189 int iPropId
, LPWSTR pszBuff
, int cchMaxBuffChars
)
193 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
197 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_STRING
, iPropId
)))
198 return E_PROP_ID_UNSUPPORTED
;
199 return MSSTYLES_GetPropertyString(tp
, pszBuff
, cchMaxBuffChars
);
202 /***********************************************************************
203 * GetThemeMargins (UXTHEME.@)
205 HRESULT WINAPI
GetThemeMargins(HTHEME hTheme
, HDC hdc
, int iPartId
,
206 int iStateId
, int iPropId
, RECT
*prc
,
211 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
212 memset (pMargins
, 0, sizeof (MARGINS
));
216 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_MARGINS
, iPropId
)))
217 return E_PROP_ID_UNSUPPORTED
;
218 return MSSTYLES_GetPropertyMargins(tp
, prc
, pMargins
);
221 /***********************************************************************
222 * GetThemeMetric (UXTHEME.@)
224 HRESULT WINAPI
GetThemeMetric(HTHEME hTheme
, HDC hdc
, int iPartId
,
225 int iStateId
, int iPropId
, int *piVal
)
231 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
235 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, 0, iPropId
)))
236 return E_PROP_ID_UNSUPPORTED
;
237 switch(tp
->iPrimitiveType
) {
238 case TMT_POSITION
: /* Only the X coord is retrieved */
239 case TMT_MARGINS
: /* Only the cxLeftWidth member is retrieved */
240 case TMT_INTLIST
: /* Only the first int is retrieved */
243 return MSSTYLES_GetPropertyInt(tp
, piVal
);
245 return MSSTYLES_GetPropertyBool(tp
, piVal
);
247 return MSSTYLES_GetPropertyColor(tp
, (COLORREF
*)piVal
);
249 hr
= MSSTYLES_GetPropertyString(tp
, val
, sizeof(val
)/sizeof(val
[0]));
252 if(!MSSTYLES_LookupEnum(val
, iPropId
, piVal
))
253 return E_PROP_ID_UNSUPPORTED
;
256 /* Windows does return a value for this, but its value doesn't make sense */
260 return E_PROP_ID_UNSUPPORTED
;
263 /***********************************************************************
264 * GetThemePropertyOrigin (UXTHEME.@)
266 HRESULT WINAPI
GetThemePropertyOrigin(HTHEME hTheme
, int iPartId
, int iStateId
,
267 int iPropId
, PROPERTYORIGIN
*pOrigin
)
271 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
275 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, 0, iPropId
))) {
276 *pOrigin
= PO_NOTFOUND
;
279 *pOrigin
= tp
->origin
;