2 * Win32 5.1 Theme system
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
31 #include "uxthemedll.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
37 /***********************************************************************
38 * Defines and global variables
41 DWORD dwThemeAppProperties = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS;
46 /***********************************************************************/
48 /***********************************************************************
51 void UXTHEME_InitSystem()
53 const WCHAR szWindowTheme[] = {
54 'u','x','_','t','h','e','m','e','\0'
56 const WCHAR szSubAppName[] = {
57 'u','x','_','s','u','b','a','p','p','\0'
59 const WCHAR szSubIdList[] = {
60 'u','x','_','s','u','b','i','d','l','s','t','\0'
63 atWindowTheme = GlobalAddAtomW(szWindowTheme);
64 atSubAppName = GlobalAddAtomW(szSubAppName);
65 atSubIdList = GlobalAddAtomW(szSubIdList);
68 /***********************************************************************
69 * IsAppThemed (UXTHEME.@)
71 BOOL WINAPI IsAppThemed(void)
77 /***********************************************************************
78 * IsThemeActive (UXTHEME.@)
80 BOOL WINAPI IsThemeActive(void)
86 /***********************************************************************
87 * EnableTheming (UXTHEME.@)
90 * This is a global and persistant change
92 HRESULT WINAPI EnableTheming(BOOL fEnable)
94 FIXME("%d: stub\n", fEnable);
95 return ERROR_CALL_NOT_IMPLEMENTED;
98 /***********************************************************************
99 * OpenThemeData (UXTHEME.@)
101 HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
103 FIXME("%p %s: stub\n", hwnd, debugstr_w(pszClassList));
107 /***********************************************************************
108 * GetWindowTheme (UXTHEME.@)
110 * Retrieve the last theme opened for a window
112 HTHEME WINAPI GetWindowTheme(HWND hwnd)
114 TRACE("(%p)\n", hwnd);
115 return GetPropW(hwnd, MAKEINTATOMW(atWindowTheme));
118 /***********************************************************************
119 * UXTHEME_SetWindowProperty
121 * I'm using atoms as there may be large numbers of duplicated strings
122 * and they do the work of keeping memory down as a cause of that quite nicely
124 HRESULT UXTHEME_SetWindowProperty(HWND hwnd, ATOM aProp, LPCWSTR pszValue)
126 ATOM oldValue = (ATOM)(size_t)RemovePropW(hwnd, MAKEINTATOMW(aProp));
128 DeleteAtom(oldValue);
130 ATOM atValue = AddAtomW(pszValue);
132 || !SetPropW(hwnd, MAKEINTATOMW(aProp), (LPWSTR)MAKEINTATOMW(atValue))) {
133 HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
134 if(atValue) DeleteAtom(atValue);
141 /***********************************************************************
142 * SetWindowTheme (UXTHEME.@)
144 * Persistant through the life of the window, even after themes change
146 HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName,
147 LPCWSTR pszSubIdList)
150 TRACE("(%p,%s,%s)\n", hwnd, debugstr_w(pszSubAppName),
151 debugstr_w(pszSubIdList));
152 hr = UXTHEME_SetWindowProperty(hwnd, atSubAppName, pszSubAppName);
154 hr = UXTHEME_SetWindowProperty(hwnd, atSubIdList, pszSubIdList);
158 /***********************************************************************
159 * GetCurrentThemeName (UXTHEME.@)
161 HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars,
162 LPWSTR pszColorBuff, int cchMaxColorChars,
163 LPWSTR pszSizeBuff, int cchMaxSizeChars)
166 return ERROR_CALL_NOT_IMPLEMENTED;
169 /***********************************************************************
170 * GetThemeAppProperties (UXTHEME.@)
172 DWORD WINAPI GetThemeAppProperties(void)
174 return dwThemeAppProperties;
177 /***********************************************************************
178 * SetThemeAppProperties (UXTHEME.@)
180 void WINAPI SetThemeAppProperties(DWORD dwFlags)
182 TRACE("(0x%08lx)\n", dwFlags);
183 dwThemeAppProperties = dwFlags;
186 /***********************************************************************
187 * CloseThemeData (UXTHEME.@)
189 HRESULT WINAPI CloseThemeData(HTHEME hTheme)
197 /***********************************************************************
198 * HitTestThemeBackground (UXTHEME.@)
200 HRESULT WINAPI HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId,
201 int iStateId, DWORD dwOptions,
202 const RECT *pRect, HRGN hrgn,
203 POINT ptTest, WORD *pwHitTestCode)
205 FIXME("%d %d 0x%08lx: stub\n", iPartId, iStateId, dwOptions);
208 return ERROR_CALL_NOT_IMPLEMENTED;
211 /***********************************************************************
212 * IsThemePartDefined (UXTHEME.@)
214 BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
216 FIXME("%d %d: stub\n", iPartId, iStateId);
220 /**********************************************************************
221 * Undocumented functions
224 /**********************************************************************
225 * QueryThemeServices (UXTHEME.1)
228 * some kind of status flag
230 DWORD WINAPI QueryThemeServices()
233 return 3; /* This is what is returned under XP in most cases */
237 /**********************************************************************
238 * OpenThemeFile (UXTHEME.2)
240 * Opens a theme file, which can be used to change the current theme, etc
243 * pszThemeFileName Path to a msstyles theme file
244 * pszColorName Color defined in the theme, eg. NormalColor
245 * pszSizeName Size defined in the theme, eg. NormalSize
246 * hThemeFile Handle to theme file
248 HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName,
249 LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile,
252 FIXME("%s,%s,%s,%ld: stub\n", debugstr_w(pszThemeFileName),
253 debugstr_w(pszColorName),
254 debugstr_w(pszSizeName), unknown);
255 return ERROR_CALL_NOT_IMPLEMENTED;
258 /**********************************************************************
259 * CloseThemeFile (UXTHEME.3)
261 * Releases theme file handle returned by OpenThemeFile
264 * hThemeFile Handle to theme file
266 HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile)
272 /**********************************************************************
273 * ApplyTheme (UXTHEME.4)
275 * Set a theme file to be the currently active theme
278 * hThemeFile Handle to theme file
280 * hWnd Window requesting the theme change
283 * I'm not sure what the second parameter is (the datatype is likely wrong), other then this:
286 * the theme is applied with the screen redrawing really badly (flickers)
287 * char b[] = "\0"; where \0 can be one or more of any character, makes no difference
288 * the theme is applied smoothly (screen does not flicker)
289 * char *b = "\0" or NULL; where \0 can be zero or more of any character, makes no difference
290 * the function fails returning invalid parameter...very strange
292 HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd)
294 FIXME("%s: stub\n", unknown);
295 return ERROR_CALL_NOT_IMPLEMENTED;
298 /**********************************************************************
299 * GetThemeDefaults (UXTHEME.7)
301 * Get the default color & size for a theme
304 * pszThemeFileName Path to a msstyles theme file
305 * pszColorName Buffer to recieve the default color name
306 * dwColorNameLen Length, in characters, of color name buffer
307 * pszSizeName Buffer to recieve the default size name
308 * dwSizeNameLen Length, in characters, of size name buffer
310 HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName,
311 DWORD dwColorNameLen, LPWSTR pszSizeName,
314 FIXME("%s: stub\n", debugstr_w(pszThemeFileName));
315 return ERROR_CALL_NOT_IMPLEMENTED;
318 /**********************************************************************
319 * EnumThemes (UXTHEME.8)
321 * Enumerate available themes, calls specified EnumThemeProc for each
322 * theme found. Passes lpData through to callback function.
325 * pszThemePath Path containing themes
326 * callback Called for each theme found in path
327 * lpData Passed through to callback
329 HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
332 FIXME("%s: stub\n", debugstr_w(pszThemePath));
333 return ERROR_CALL_NOT_IMPLEMENTED;
337 /**********************************************************************
338 * EnumThemeColors (UXTHEME.9)
340 * Enumerate theme colors available with a particular size
343 * pszThemeFileName Path to a msstyles theme file
344 * pszSizeName Theme size to enumerate available colors
345 * If NULL the default theme size is used
346 * dwColorNum Color index to retrieve, increment from 0
347 * pszColorName Output color name
351 * E_PROP_ID_UNSUPPORTED when dwColorName does not refer to a color
352 * or when pszSizeName does not refer to a valid size
355 * XP fails with E_POINTER when pszColorName points to a buffer smaller then 605
358 HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
359 DWORD dwColorNum, LPWSTR pszColorName)
361 FIXME("%s %s %ld: stub\n", debugstr_w(pszThemeFileName),
362 debugstr_w(pszSizeName), dwColorNum);
363 return ERROR_CALL_NOT_IMPLEMENTED;
366 /**********************************************************************
367 * EnumThemeSizes (UXTHEME.10)
369 * Enumerate theme colors available with a particular size
372 * pszThemeFileName Path to a msstyles theme file
373 * pszColorName Theme color to enumerate available sizes
374 * If NULL the default theme color is used
375 * dwSizeNum Size index to retrieve, increment from 0
376 * pszSizeName Output size name
380 * E_PROP_ID_UNSUPPORTED when dwSizeName does not refer to a size
381 * or when pszColorName does not refer to a valid color
384 * XP fails with E_POINTER when pszSizeName points to a buffer smaller then 605
387 HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
388 DWORD dwSizeNum, LPWSTR pszSizeName)
390 FIXME("%s %s %ld: stub\n", debugstr_w(pszThemeFileName), debugstr_w(pszColorName), dwSizeNum);
391 return ERROR_CALL_NOT_IMPLEMENTED;
394 /**********************************************************************
395 * ParseThemeIniFile (UXTHEME.11)
397 * Enumerate data in a theme INI file.
400 * pszIniFileName Path to a theme ini file
401 * pszUnknown Cannot be NULL, L"" is valid
402 * callback Called for each found entry
403 * lpData Passed through to callback
407 * 0x800706488 (Unknown property) when enumeration is canceled from callback
410 * When pszUnknown is NULL the callback is never called, the value does not seem to surve
413 HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown,
414 ParseThemeIniFileProc callback, LPVOID lpData)
416 FIXME("%s %s: stub\n", debugstr_w(pszIniFileName), debugstr_w(pszUnknown));
417 return ERROR_CALL_NOT_IMPLEMENTED;