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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include "uxthemedll.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
39 /***********************************************************************
40 * GetThemeBool (UXTHEME.@)
42 HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId,
43 int iPropId, BOOL *pfVal)
47 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
51 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_BOOL, iPropId)))
52 return E_PROP_ID_UNSUPPORTED;
53 return MSSTYLES_GetPropertyBool(tp, pfVal);
56 /***********************************************************************
57 * GetThemeColor (UXTHEME.@)
59 HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId,
60 int iPropId, COLORREF *pColor)
64 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
68 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_COLOR, iPropId)))
69 return E_PROP_ID_UNSUPPORTED;
70 return MSSTYLES_GetPropertyColor(tp, pColor);
73 /***********************************************************************
74 * GetThemeEnumValue (UXTHEME.@)
76 HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId,
77 int iPropId, int *piVal)
83 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
87 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_ENUM, iPropId)))
88 return E_PROP_ID_UNSUPPORTED;
90 hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0]));
93 if(!MSSTYLES_LookupEnum(val, iPropId, piVal))
94 return E_PROP_ID_UNSUPPORTED;
98 /***********************************************************************
99 * GetThemeFilename (UXTHEME.@)
101 HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId,
102 int iPropId, LPWSTR pszThemeFilename,
107 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
111 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
112 return E_PROP_ID_UNSUPPORTED;
113 return MSSTYLES_GetPropertyString(tp, pszThemeFilename, cchMaxBuffChars);
116 /***********************************************************************
117 * GetThemeFont (UXTHEME.@)
119 HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
120 int iStateId, int iPropId, LOGFONTW *pFont)
124 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
128 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId)))
129 return E_PROP_ID_UNSUPPORTED;
130 return MSSTYLES_GetPropertyFont(tp, hdc, pFont);
133 /***********************************************************************
134 * GetThemeInt (UXTHEME.@)
136 HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId,
137 int iPropId, int *piVal)
141 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
145 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INT, iPropId)))
146 return E_PROP_ID_UNSUPPORTED;
147 return MSSTYLES_GetPropertyInt(tp, piVal);
150 /***********************************************************************
151 * GetThemeIntList (UXTHEME.@)
153 HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId,
154 int iPropId, INTLIST *pIntList)
158 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
162 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId)))
163 return E_PROP_ID_UNSUPPORTED;
164 return MSSTYLES_GetPropertyIntList(tp, pIntList);
167 /***********************************************************************
168 * GetThemePosition (UXTHEME.@)
170 HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId,
171 int iPropId, POINT *pPoint)
175 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
179 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_POSITION, iPropId)))
180 return E_PROP_ID_UNSUPPORTED;
181 return MSSTYLES_GetPropertyPosition(tp, pPoint);
184 /***********************************************************************
185 * GetThemeRect (UXTHEME.@)
187 HRESULT WINAPI GetThemeRect(HTHEME hTheme, int iPartId, int iStateId,
188 int iPropId, RECT *pRect)
192 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
196 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_RECT, iPropId)))
197 return E_PROP_ID_UNSUPPORTED;
198 return MSSTYLES_GetPropertyRect(tp, pRect);
201 /***********************************************************************
202 * GetThemeString (UXTHEME.@)
204 HRESULT WINAPI GetThemeString(HTHEME hTheme, int iPartId, int iStateId,
205 int iPropId, LPWSTR pszBuff, int cchMaxBuffChars)
209 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
213 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
214 return E_PROP_ID_UNSUPPORTED;
215 return MSSTYLES_GetPropertyString(tp, pszBuff, cchMaxBuffChars);
218 /***********************************************************************
219 * GetThemeMargins (UXTHEME.@)
221 HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
222 int iStateId, int iPropId, RECT *prc,
227 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
231 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_MARGINS, iPropId)))
232 return E_PROP_ID_UNSUPPORTED;
233 return MSSTYLES_GetPropertyMargins(tp, prc, pMargins);
236 /***********************************************************************
237 * GetThemeMetric (UXTHEME.@)
239 HRESULT WINAPI GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId,
240 int iStateId, int iPropId, int *piVal)
246 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
250 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId)))
251 return E_PROP_ID_UNSUPPORTED;
252 switch(tp->iPrimitiveType) {
253 case TMT_POSITION: /* Only the X coord is retrieved */
254 case TMT_MARGINS: /* Only the cxLeftWidth member is retrieved */
255 case TMT_INTLIST: /* Only the first int is retrieved */
258 return MSSTYLES_GetPropertyInt(tp, piVal);
260 return MSSTYLES_GetPropertyBool(tp, piVal);
262 return MSSTYLES_GetPropertyColor(tp, (COLORREF*)piVal);
264 hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0]));
267 if(!MSSTYLES_LookupEnum(val, iPropId, piVal))
268 return E_PROP_ID_UNSUPPORTED;
271 /* Windows does return a value for this, but its value doesn't make sense */
275 return E_PROP_ID_UNSUPPORTED;
278 /***********************************************************************
279 * GetThemePropertyOrigin (UXTHEME.@)
281 HRESULT WINAPI GetThemePropertyOrigin(HTHEME hTheme, int iPartId, int iStateId,
282 int iPropId, PROPERTYORIGIN *pOrigin)
286 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
290 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) {
291 *pOrigin = PO_NOTFOUND;
294 *pOrigin = tp->origin;