1 /*
2 * Win32 5.1 Theme properties
3 *
4 * Copyright (C) 2003 Kevin Koltzau
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #include "config.h"
22
23 #include <stdarg.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "wingdi.h"
29 #include "vfwmsgs.h"
30 #include "uxtheme.h"
31 #include "tmschema.h"
32
33 #include "msstyles.h"
34
35 #include "wine/debug.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
38
39 /***********************************************************************
40 * GetThemeBool (UXTHEME.@)
41 */
42 HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId,
43 int iPropId, BOOL *pfVal)
44 {
45 PTHEME_PROPERTY tp;
46
47 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
48 if(!hTheme)
49 return E_HANDLE;
50
51 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_BOOL, iPropId)))
52 return E_PROP_ID_UNSUPPORTED;
53 return MSSTYLES_GetPropertyBool(tp, pfVal);
54 }
55
56 /***********************************************************************
57 * GetThemeColor (UXTHEME.@)
58 */
59 HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId,
60 int iPropId, COLORREF *pColor)
61 {
62 PTHEME_PROPERTY tp;
63
64 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
65 if(!hTheme)
66 return E_HANDLE;
67
68 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_COLOR, iPropId)))
69 return E_PROP_ID_UNSUPPORTED;
70 return MSSTYLES_GetPropertyColor(tp, pColor);
71 }
72
73 /***********************************************************************
74 * GetThemeEnumValue (UXTHEME.@)
75 */
76 HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId,
77 int iPropId, int *piVal)
78 {
79 HRESULT hr;
80 WCHAR val[60];
81 PTHEME_PROPERTY tp;
82
83 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
84 if(!hTheme)
85 return E_HANDLE;
86
87 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_ENUM, iPropId)))
88 return E_PROP_ID_UNSUPPORTED;
89
90 hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0]));
91 if(FAILED(hr))
92 return hr;
93 if(!MSSTYLES_LookupEnum(val, iPropId, piVal))
94 return E_PROP_ID_UNSUPPORTED;
95 return S_OK;
96 }
97
98 /***********************************************************************
99 * GetThemeFilename (UXTHEME.@)
100 */
101 HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId,
102 int iPropId, LPWSTR pszThemeFilename,
103 int cchMaxBuffChars)
104 {
105 PTHEME_PROPERTY tp;
106
107 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
108 if(!hTheme)
109 return E_HANDLE;
110
111 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
112 return E_PROP_ID_UNSUPPORTED;
113 return MSSTYLES_GetPropertyString(tp, pszThemeFilename, cchMaxBuffChars);
114 }
115
116 /***********************************************************************
117 * GetThemeFont (UXTHEME.@)
118 */
119 HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
120 int iStateId, int iPropId, LOGFONTW *pFont)
121 {
122 PTHEME_PROPERTY tp;
123
124 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
125 if(!hTheme)
126 return E_HANDLE;
127
128 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId)))
129 return E_PROP_ID_UNSUPPORTED;
130 return MSSTYLES_GetPropertyFont(tp, hdc, pFont);
131 }
132
133 /***********************************************************************
134 * GetThemeInt (UXTHEME.@)
135 */
136 HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId,
137 int iPropId, int *piVal)
138 {
139 PTHEME_PROPERTY tp;
140
141 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
142 if(!hTheme)
143 return E_HANDLE;
144
145 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INT, iPropId)))
146 return E_PROP_ID_UNSUPPORTED;
147 return MSSTYLES_GetPropertyInt(tp, piVal);
148 }
149
150 /***********************************************************************
151 * GetThemeIntList (UXTHEME.@)
152 */
153 HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId,
154 int iPropId, INTLIST *pIntList)
155 {
156 PTHEME_PROPERTY tp;
157
158 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
159 if(!hTheme)
160 return E_HANDLE;
161
162 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId)))
163 return E_PROP_ID_UNSUPPORTED;
164 return MSSTYLES_GetPropertyIntList(tp, pIntList);
165 }
166
167 /***********************************************************************
168 * GetThemePosition (UXTHEME.@)
169 */
170 HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId,
171 int iPropId, POINT *pPoint)
172 {
173 PTHEME_PROPERTY tp;
174
175 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
176 if(!hTheme)
177 return E_HANDLE;
178
179 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_POSITION, iPropId)))
180 return E_PROP_ID_UNSUPPORTED;
181 return MSSTYLES_GetPropertyPosition(tp, pPoint);
182 }
183
184 /***********************************************************************
185 * GetThemeRect (UXTHEME.@)
186 */
187 HRESULT WINAPI GetThemeRect(HTHEME hTheme, int iPartId, int iStateId,
188 int iPropId, RECT *pRect)
189 {
190 PTHEME_PROPERTY tp;
191
192 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
193 if(!hTheme)
194 return E_HANDLE;
195
196 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_RECT, iPropId)))
197 return E_PROP_ID_UNSUPPORTED;
198 return MSSTYLES_GetPropertyRect(tp, pRect);
199 }
200
201 /***********************************************************************
202 * GetThemeString (UXTHEME.@)
203 */
204 HRESULT WINAPI GetThemeString(HTHEME hTheme, int iPartId, int iStateId,
205 int iPropId, LPWSTR pszBuff, int cchMaxBuffChars)
206 {
207 PTHEME_PROPERTY tp;
208
209 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
210 if(!hTheme)
211 return E_HANDLE;
212
213 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId)))
214 return E_PROP_ID_UNSUPPORTED;
215 return MSSTYLES_GetPropertyString(tp, pszBuff, cchMaxBuffChars);
216 }
217
218 /***********************************************************************
219 * GetThemeMargins (UXTHEME.@)
220 */
221 HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
222 int iStateId, int iPropId, RECT *prc,
223 MARGINS *pMargins)
224 {
225 PTHEME_PROPERTY tp;
226
227 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
228 memset (pMargins, 0, sizeof (MARGINS));
229 if(!hTheme)
230 return E_HANDLE;
231
232 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_MARGINS, iPropId)))
233 return E_PROP_ID_UNSUPPORTED;
234 return MSSTYLES_GetPropertyMargins(tp, prc, pMargins);
235 }
236
237 /***********************************************************************
238 * GetThemeMetric (UXTHEME.@)
239 */
240 HRESULT WINAPI GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId,
241 int iStateId, int iPropId, int *piVal)
242 {
243 PTHEME_PROPERTY tp;
244 WCHAR val[60];
245 HRESULT hr;
246
247 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
248 if(!hTheme)
249 return E_HANDLE;
250
251 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId)))
252 return E_PROP_ID_UNSUPPORTED;
253 switch(tp->iPrimitiveType) {
254 case TMT_POSITION: /* Only the X coord is retrieved */
255 case TMT_MARGINS: /* Only the cxLeftWidth member is retrieved */
256 case TMT_INTLIST: /* Only the first int is retrieved */
257 case TMT_SIZE:
258 case TMT_INT:
259 return MSSTYLES_GetPropertyInt(tp, piVal);
260 case TMT_BOOL:
261 return MSSTYLES_GetPropertyBool(tp, piVal);
262 case TMT_COLOR:
263 return MSSTYLES_GetPropertyColor(tp, (COLORREF*)piVal);
264 case TMT_ENUM:
265 hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0]));
266 if(FAILED(hr))
267 return hr;
268 if(!MSSTYLES_LookupEnum(val, iPropId, piVal))
269 return E_PROP_ID_UNSUPPORTED;
270 return S_OK;
271 case TMT_FILENAME:
272 /* Windows does return a value for this, but its value doesn't make sense */
273 FIXME("Filename\n");
274 break;
275 }
276 return E_PROP_ID_UNSUPPORTED;
277 }
278
279 /***********************************************************************
280 * GetThemePropertyOrigin (UXTHEME.@)
281 */
282 HRESULT WINAPI GetThemePropertyOrigin(HTHEME hTheme, int iPartId, int iStateId,
283 int iPropId, PROPERTYORIGIN *pOrigin)
284 {
285 PTHEME_PROPERTY tp;
286
287 TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId);
288 if(!hTheme)
289 return E_HANDLE;
290
291 if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) {
292 *pOrigin = PO_NOTFOUND;
293 return S_OK;
294 }
295 *pOrigin = tp->origin;
296 return S_OK;
297 }
298
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.