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
34 #include "uxthemedll.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
40 /***********************************************************************
41 * GetThemeBool (UXTHEME.@)
43 HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId,
44 int iPropId, BOOL *pfVal)
48 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
52 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_BOOL, iPropId)))
53 return E_PROP_ID_UNSUPPORTED;
54 return MSSTYLES_GetPropertyBool(tp, pfVal);
57 /***********************************************************************
58 * GetThemeColor (UXTHEME.@)
60 HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId,
61 int iPropId, COLORREF *pColor)
65 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
69 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_COLOR, iPropId)))
70 return E_PROP_ID_UNSUPPORTED;
71 return MSSTYLES_GetPropertyColor(tp, pColor);
74 /***********************************************************************
75 * GetThemeEnumValue (UXTHEME.@)
77 HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId,
78 int iPropId, int *piVal)
84 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
88 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_ENUM, iPropId)))
89 return E_PROP_ID_UNSUPPORTED;
91 hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0]));
94 if(!MSSTYLES_LookupEnum(val, iPropId, piVal))
95 return E_PROP_ID_UNSUPPORTED;
99 /***********************************************************************
100 * GetThemeFilename (UXTHEME.@)
102 HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId,
103 int iPropId, LPWSTR pszThemeFilename,
108 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
112 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
113 return E_PROP_ID_UNSUPPORTED;
114 return MSSTYLES_GetPropertyString(tp, pszThemeFilename, cchMaxBuffChars);
117 /***********************************************************************
118 * GetThemeFont (UXTHEME.@)
120 HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
121 int iStateId, int iPropId, LOGFONTW *pFont)
125 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
129 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId)))
130 return E_PROP_ID_UNSUPPORTED;
131 return MSSTYLES_GetPropertyFont(tp, hdc, pFont);
134 /***********************************************************************
135 * GetThemeInt (UXTHEME.@)
137 HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId,
138 int iPropId, int *piVal)
142 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
146 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INT, iPropId)))
147 return E_PROP_ID_UNSUPPORTED;
148 return MSSTYLES_GetPropertyInt(tp, piVal);
151 /***********************************************************************
152 * GetThemeIntList (UXTHEME.@)
154 HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId,
155 int iPropId, INTLIST *pIntList)
159 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
163 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId)))
164 return E_PROP_ID_UNSUPPORTED;
165 return MSSTYLES_GetPropertyIntList(tp, pIntList);
168 /***********************************************************************
169 * GetThemePosition (UXTHEME.@)
171 HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId,
172 int iPropId, POINT *pPoint)
176 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
180 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_POSITION, iPropId)))
181 return E_PROP_ID_UNSUPPORTED;
182 return MSSTYLES_GetPropertyPosition(tp, pPoint);
185 /***********************************************************************
186 * GetThemeRect (UXTHEME.@)
188 HRESULT WINAPI GetThemeRect(HTHEME hTheme, int iPartId, int iStateId,
189 int iPropId, RECT *pRect)
193 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
197 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_RECT, iPropId)))
198 return E_PROP_ID_UNSUPPORTED;
199 return MSSTYLES_GetPropertyRect(tp, pRect);
202 /***********************************************************************
203 * GetThemeString (UXTHEME.@)
205 HRESULT WINAPI GetThemeString(HTHEME hTheme, int iPartId, int iStateId,
206 int iPropId, LPWSTR pszBuff, int cchMaxBuffChars)
210 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
214 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
215 return E_PROP_ID_UNSUPPORTED;
216 return MSSTYLES_GetPropertyString(tp, pszBuff, cchMaxBuffChars);
219 /***********************************************************************
220 * GetThemeMargins (UXTHEME.@)
222 HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
223 int iStateId, int iPropId, RECT *prc,
228 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
229 memset (pMargins, 0, sizeof (MARGINS));
233 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_MARGINS, iPropId)))
234 return E_PROP_ID_UNSUPPORTED;
235 return MSSTYLES_GetPropertyMargins(tp, prc, pMargins);
238 /***********************************************************************
239 * GetThemeMetric (UXTHEME.@)
241 HRESULT WINAPI GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId,
242 int iStateId, int iPropId, int *piVal)
248 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
252 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId)))
253 return E_PROP_ID_UNSUPPORTED;
254 switch(tp->iPrimitiveType) {
255 case TMT_POSITION: /* Only the X coord is retrieved */
256 case TMT_MARGINS: /* Only the cxLeftWidth member is retrieved */
257 case TMT_INTLIST: /* Only the first int is retrieved */
260 return MSSTYLES_GetPropertyInt(tp, piVal);
262 return MSSTYLES_GetPropertyBool(tp, piVal);
264 return MSSTYLES_GetPropertyColor(tp, (COLORREF*)piVal);
266 hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0]));
269 if(!MSSTYLES_LookupEnum(val, iPropId, piVal))
270 return E_PROP_ID_UNSUPPORTED;
273 /* Windows does return a value for this, but its value doesn't make sense */
277 return E_PROP_ID_UNSUPPORTED;
280 /***********************************************************************
281 * GetThemePropertyOrigin (UXTHEME.@)
283 HRESULT WINAPI GetThemePropertyOrigin(HTHEME hTheme, int iPartId, int iStateId,
284 int iPropId, PROPERTYORIGIN *pOrigin)
288 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
292 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) {
293 *pOrigin = PO_NOTFOUND;
296 *pOrigin = tp->origin;