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
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(uxtheme
);
37 /***********************************************************************
38 * GetThemeBool (UXTHEME.@)
40 HRESULT WINAPI
GetThemeBool(HTHEME hTheme
, int iPartId
, int iStateId
,
41 int iPropId
, BOOL
*pfVal
)
45 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
49 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_BOOL
, iPropId
)))
50 return E_PROP_ID_UNSUPPORTED
;
51 return MSSTYLES_GetPropertyBool(tp
, pfVal
);
54 /***********************************************************************
55 * GetThemeColor (UXTHEME.@)
57 HRESULT WINAPI
GetThemeColor(HTHEME hTheme
, int iPartId
, int iStateId
,
58 int iPropId
, COLORREF
*pColor
)
62 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
66 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_COLOR
, iPropId
)))
67 return E_PROP_ID_UNSUPPORTED
;
68 return MSSTYLES_GetPropertyColor(tp
, pColor
);
71 /***********************************************************************
72 * GetThemeEnumValue (UXTHEME.@)
74 HRESULT WINAPI
GetThemeEnumValue(HTHEME hTheme
, int iPartId
, int iStateId
,
75 int iPropId
, int *piVal
)
81 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
85 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_ENUM
, iPropId
)))
86 return E_PROP_ID_UNSUPPORTED
;
88 hr
= MSSTYLES_GetPropertyString(tp
, val
, ARRAY_SIZE(val
));
91 if(!MSSTYLES_LookupEnum(val
, iPropId
, piVal
))
92 return E_PROP_ID_UNSUPPORTED
;
96 /***********************************************************************
97 * GetThemeFilename (UXTHEME.@)
99 HRESULT WINAPI
GetThemeFilename(HTHEME hTheme
, int iPartId
, int iStateId
,
100 int iPropId
, LPWSTR pszThemeFilename
,
105 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
109 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_FILENAME
, iPropId
)))
110 return E_PROP_ID_UNSUPPORTED
;
111 return MSSTYLES_GetPropertyString(tp
, pszThemeFilename
, cchMaxBuffChars
);
114 /***********************************************************************
115 * GetThemeFont (UXTHEME.@)
117 HRESULT WINAPI
GetThemeFont(HTHEME hTheme
, HDC hdc
, int iPartId
,
118 int iStateId
, int iPropId
, LOGFONTW
*pFont
)
122 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
126 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_FONT
, iPropId
)))
127 return E_PROP_ID_UNSUPPORTED
;
128 return MSSTYLES_GetPropertyFont(tp
, hdc
, pFont
);
131 /***********************************************************************
132 * GetThemeInt (UXTHEME.@)
134 HRESULT WINAPI
GetThemeInt(HTHEME hTheme
, int iPartId
, int iStateId
,
135 int iPropId
, int *piVal
)
139 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
143 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_INT
, iPropId
)))
144 return E_PROP_ID_UNSUPPORTED
;
145 return MSSTYLES_GetPropertyInt(tp
, piVal
);
148 /***********************************************************************
149 * GetThemeIntList (UXTHEME.@)
151 HRESULT WINAPI
GetThemeIntList(HTHEME hTheme
, int iPartId
, int iStateId
,
152 int iPropId
, INTLIST
*pIntList
)
156 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
160 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_INTLIST
, iPropId
)))
161 return E_PROP_ID_UNSUPPORTED
;
162 return MSSTYLES_GetPropertyIntList(tp
, pIntList
);
165 /***********************************************************************
166 * GetThemePosition (UXTHEME.@)
168 HRESULT WINAPI
GetThemePosition(HTHEME hTheme
, int iPartId
, int iStateId
,
169 int iPropId
, POINT
*pPoint
)
173 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
177 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_POSITION
, iPropId
)))
178 return E_PROP_ID_UNSUPPORTED
;
179 return MSSTYLES_GetPropertyPosition(tp
, pPoint
);
182 /***********************************************************************
183 * GetThemeRect (UXTHEME.@)
185 HRESULT WINAPI
GetThemeRect(HTHEME hTheme
, int iPartId
, int iStateId
,
186 int iPropId
, RECT
*pRect
)
190 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
194 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_RECT
, iPropId
)))
195 return E_PROP_ID_UNSUPPORTED
;
196 return MSSTYLES_GetPropertyRect(tp
, pRect
);
199 /***********************************************************************
200 * GetThemeString (UXTHEME.@)
202 HRESULT WINAPI
GetThemeString(HTHEME hTheme
, int iPartId
, int iStateId
,
203 int iPropId
, LPWSTR pszBuff
, int cchMaxBuffChars
)
207 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
211 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_STRING
, iPropId
)))
212 return E_PROP_ID_UNSUPPORTED
;
213 return MSSTYLES_GetPropertyString(tp
, pszBuff
, cchMaxBuffChars
);
216 /***********************************************************************
217 * GetThemeMargins (UXTHEME.@)
219 HRESULT WINAPI
GetThemeMargins(HTHEME hTheme
, HDC hdc
, int iPartId
,
220 int iStateId
, int iPropId
, RECT
*prc
,
225 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
226 memset (pMargins
, 0, sizeof (MARGINS
));
230 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, TMT_MARGINS
, iPropId
)))
231 return E_PROP_ID_UNSUPPORTED
;
232 return MSSTYLES_GetPropertyMargins(tp
, prc
, pMargins
);
235 /***********************************************************************
236 * GetThemeMetric (UXTHEME.@)
238 HRESULT WINAPI
GetThemeMetric(HTHEME hTheme
, HDC hdc
, int iPartId
,
239 int iStateId
, int iPropId
, int *piVal
)
245 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
249 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, 0, iPropId
)))
250 return E_PROP_ID_UNSUPPORTED
;
251 switch(tp
->iPrimitiveType
) {
252 case TMT_POSITION
: /* Only the X coord is retrieved */
253 case TMT_MARGINS
: /* Only the cxLeftWidth member is retrieved */
254 case TMT_INTLIST
: /* Only the first int is retrieved */
257 return MSSTYLES_GetPropertyInt(tp
, piVal
);
259 return MSSTYLES_GetPropertyBool(tp
, piVal
);
261 return MSSTYLES_GetPropertyColor(tp
, (COLORREF
*)piVal
);
263 hr
= MSSTYLES_GetPropertyString(tp
, val
, ARRAY_SIZE(val
));
266 if(!MSSTYLES_LookupEnum(val
, iPropId
, piVal
))
267 return E_PROP_ID_UNSUPPORTED
;
270 /* Windows does return a value for this, but its value doesn't make sense */
274 return E_PROP_ID_UNSUPPORTED
;
277 /***********************************************************************
278 * GetThemePropertyOrigin (UXTHEME.@)
280 HRESULT WINAPI
GetThemePropertyOrigin(HTHEME hTheme
, int iPartId
, int iStateId
,
281 int iPropId
, PROPERTYORIGIN
*pOrigin
)
285 TRACE("(%d, %d, %d)\n", iPartId
, iStateId
, iPropId
);
289 if(!(tp
= MSSTYLES_FindProperty(hTheme
, iPartId
, iStateId
, 0, iPropId
))) {
290 *pOrigin
= PO_NOTFOUND
;
293 *pOrigin
= tp
->origin
;