ReactOS 0.4.15-dev-5666-gc548b97
theme.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Display Control Panel
4 * FILE: dll/cpl/desk/theme.c
5 * PURPOSE: Handling themes and visual effects
6 *
7 * PROGRAMMERS: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
8 * Ismael Ferreras Morezuelas (swyterzone+reactos@gmail.com)
9 */
10
11#include "desk.h"
12
13#include <shlwapi.h>
14#include <uxtheme.h>
15#include <uxundoc.h>
16#include <vssym32.h>
17
18static const WCHAR g_CPColors[] = L"Control Panel\\Colors";
19static const WCHAR g_CPANewSchemes[] = L"Control Panel\\Appearance\\New Schemes";
20static const WCHAR g_CPMetrics[] = L"Control Panel\\Desktop\\WindowMetrics";
21static const WCHAR g_SelectedStyle[] = L"SelectedStyle";
22
23/******************************************************************************/
24
25/* This is the list of names for the colors stored in the registry */
27 L"Scrollbar", /* 00 = COLOR_SCROLLBAR */
28 L"Background", /* 01 = COLOR_DESKTOP */
29 L"ActiveTitle", /* 02 = COLOR_ACTIVECAPTION */
30 L"InactiveTitle", /* 03 = COLOR_INACTIVECAPTION */
31 L"Menu", /* 04 = COLOR_MENU */
32 L"Window", /* 05 = COLOR_WINDOW */
33 L"WindowFrame", /* 06 = COLOR_WINDOWFRAME */
34 L"MenuText", /* 07 = COLOR_MENUTEXT */
35 L"WindowText", /* 08 = COLOR_WINDOWTEXT */
36 L"TitleText", /* 09 = COLOR_CAPTIONTEXT */
37 L"ActiveBorder", /* 10 = COLOR_ACTIVEBORDER */
38 L"InactiveBorder", /* 11 = COLOR_INACTIVEBORDER */
39 L"AppWorkSpace", /* 12 = COLOR_APPWORKSPACE */
40 L"Hilight", /* 13 = COLOR_HIGHLIGHT */
41 L"HilightText", /* 14 = COLOR_HIGHLIGHTTEXT */
42 L"ButtonFace", /* 15 = COLOR_BTNFACE */
43 L"ButtonShadow", /* 16 = COLOR_BTNSHADOW */
44 L"GrayText", /* 17 = COLOR_GRAYTEXT */
45 L"ButtonText", /* 18 = COLOR_BTNTEXT */
46 L"InactiveTitleText", /* 19 = COLOR_INACTIVECAPTIONTEXT */
47 L"ButtonHilight", /* 20 = COLOR_BTNHIGHLIGHT */
48 L"ButtonDkShadow", /* 21 = COLOR_3DDKSHADOW */
49 L"ButtonLight", /* 22 = COLOR_3DLIGHT */
50 L"InfoText", /* 23 = COLOR_INFOTEXT */
51 L"InfoWindow", /* 24 = COLOR_INFOBK */
52 L"ButtonAlternateFace", /* 25 = COLOR_ALTERNATEBTNFACE */
53 L"HotTrackingColor", /* 26 = COLOR_HOTLIGHT */
54 L"GradientActiveTitle", /* 27 = COLOR_GRADIENTACTIVECAPTION */
55 L"GradientInactiveTitle", /* 28 = COLOR_GRADIENTINACTIVECAPTION */
56 L"MenuHilight", /* 29 = COLOR_MENUHILIGHT */
57 L"MenuBar", /* 30 = COLOR_MENUBAR */
58};
59
60/******************************************************************************/
61
62VOID
64{
65 switch (id)
66 {
67 case SIZE_BORDER_WIDTH: scheme->ncMetrics.iBorderWidth = value; break;
68 case SIZE_SCROLL_WIDTH: scheme->ncMetrics.iScrollWidth = value; break;
69 case SIZE_SCROLL_HEIGHT: scheme->ncMetrics.iScrollHeight = value; break;
70 case SIZE_CAPTION_WIDTH: scheme->ncMetrics.iCaptionWidth = value; break;
71 case SIZE_CAPTION_HEIGHT: scheme->ncMetrics.iCaptionHeight = value; break;
72 case SIZE_SM_CAPTION_WIDTH: scheme->ncMetrics.iSmCaptionWidth = value; break;
73 case SIZE_SM_CAPTION_HEIGHT: scheme->ncMetrics.iSmCaptionHeight = value; break;
74 case SIZE_MENU_WIDTH: scheme->ncMetrics.iMenuWidth = value; break;
75 case SIZE_MENU_HEIGHT: scheme->ncMetrics.iMenuHeight = value; break;
76 case SIZE_ICON: scheme->iIconSize = value; break;
77 case SIZE_ICON_SPACE_X: scheme->icMetrics.iHorzSpacing = value; break;
78 case SIZE_ICON_SPACE_Y: scheme->icMetrics.iVertSpacing = value; break;
79 }
80}
81
82int
84{
85 switch (id)
86 {
87 case SIZE_BORDER_WIDTH: return scheme->ncMetrics.iBorderWidth;
88 case SIZE_SCROLL_WIDTH: return scheme->ncMetrics.iScrollWidth;
89 case SIZE_SCROLL_HEIGHT: return scheme->ncMetrics.iScrollHeight;
90 case SIZE_CAPTION_WIDTH: return scheme->ncMetrics.iCaptionWidth;
91 case SIZE_CAPTION_HEIGHT: return scheme->ncMetrics.iCaptionHeight;
92 case SIZE_SM_CAPTION_WIDTH: return scheme->ncMetrics.iSmCaptionWidth;
93 case SIZE_SM_CAPTION_HEIGHT: return scheme->ncMetrics.iSmCaptionHeight;
94 case SIZE_MENU_WIDTH: return scheme->ncMetrics.iMenuWidth;
95 case SIZE_MENU_HEIGHT: return scheme->ncMetrics.iMenuHeight;
96 case SIZE_ICON: return scheme->iIconSize;
97 case SIZE_ICON_SPACE_X: return scheme->icMetrics.iHorzSpacing;
98 case SIZE_ICON_SPACE_Y: return scheme->icMetrics.iVertSpacing;
99 }
100 return 0;
101}
102
105{
106 switch (id)
107 {
108 case FONT_CAPTION: return &scheme->ncMetrics.lfCaptionFont;
109 case FONT_SMCAPTION: return &scheme->ncMetrics.lfSmCaptionFont;
110 case FONT_MENU: return &scheme->ncMetrics.lfMenuFont;
111 case FONT_STATUS: return &scheme->ncMetrics.lfStatusFont;
112 case FONT_MESSAGE: return &scheme->ncMetrics.lfMessageFont;
113 case FONT_ICON: return &scheme->icMetrics.lfFont;
114 }
115 return NULL;
116}
117
118/*
119 * LoadCurrentScheme: Populates the passed scheme based on the current system settings
120 */
121BOOL
123{
124 INT i, Result;
125 HKEY hKey;
126 BOOL ret;
127#if (WINVER >= 0x0600)
129#endif
130
131 /* Load colors */
132 for (i = 0; i < NUM_COLORS; i++)
133 {
134 scheme->crColor[i] = (COLORREF)GetSysColor(i);
135 }
136
137 /* Load non client metrics */
138 scheme->ncMetrics.cbSize = sizeof(NONCLIENTMETRICSW);
139
140#if (WINVER >= 0x0600)
141 /* Size of NONCLIENTMETRICSA/W depends on current version of the OS.
142 * see:
143 * https://msdn.microsoft.com/en-us/library/windows/desktop/ff729175%28v=vs.85%29.aspx
144 */
145 if (GetVersionEx(&osvi))
146 {
147 /* Windows XP and earlier */
148 if (osvi.dwMajorVersion <= 5)
149 scheme->ncMetrics.cbSize -= sizeof(scheme->ncMetrics.iPaddedBorderWidth);
150 }
151#endif
152
153 ret = SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
154 sizeof(NONCLIENTMETRICSW),
155 &scheme->ncMetrics,
156 0);
157 if (!ret) return FALSE;
158
159 /* Load icon metrics */
160 scheme->icMetrics.cbSize = sizeof(ICONMETRICSW);
161 ret = SystemParametersInfoW(SPI_GETICONMETRICS,
162 sizeof(ICONMETRICSW),
163 &scheme->icMetrics,
164 0);
165 if (!ret) return FALSE;
166
167 /* Load flat menu style */
168 ret = SystemParametersInfoW(SPI_GETFLATMENU,
169 0,
170 &scheme->bFlatMenus,
171 0);
172 if (!ret) return FALSE;
173
174 /* Effects */
175 /* Use the following transition effect for menus and tooltips */
176 ret = SystemParametersInfoW(SPI_GETMENUANIMATION,
177 0,
178 &scheme->Effects.bMenuAnimation,
179 0);
180 if (!ret) return FALSE;
181
182 ret = SystemParametersInfoW(SPI_GETMENUFADE,
183 0,
184 &scheme->Effects.bMenuFade,
185 0);
186 if (!ret) return FALSE;
187
188 /* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings
189 * Just keep them in sync for now:
190 */
191 scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation;
192 scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade;
193
194 /* Use the following transition effect for menus and tooltips */
195 ret = SystemParametersInfoW(SPI_GETFONTSMOOTHING,
196 0,
197 &scheme->Effects.bFontSmoothing,
198 0);
199 if (!ret) return FALSE;
200
201 ret = SystemParametersInfoW(SPI_GETFONTSMOOTHINGTYPE,
202 0,
203 &scheme->Effects.uiFontSmoothingType,
204 0);
205 if (!ret) return FALSE;
206
207 /* Show shadows under menus */
208 ret = SystemParametersInfoW(SPI_GETDROPSHADOW,
209 0,
210 &scheme->Effects.bDropShadow,
211 0);
212 if (!ret) return FALSE;
213
214 /* Show content of windows during dragging */
215 ret = SystemParametersInfoW(SPI_GETDRAGFULLWINDOWS,
216 0,
217 &scheme->Effects.bDragFullWindows,
218 0);
219 if (!ret) return FALSE;
220
221 /* Hide underlined letters for keyboard navigation until the Alt key is pressed */
222 ret = SystemParametersInfoW(SPI_GETKEYBOARDCUES,
223 0,
224 &scheme->Effects.bKeyboardCues,
225 0);
226 if (!ret) return FALSE;
227
228 /* Read the icon size from registry */
230 if(Result == ERROR_SUCCESS)
231 {
232 scheme->iIconSize = SHRegGetIntW(hKey, L"Shell Icon Size", 32);
234 }
235
236 return TRUE;
237}
238
239/*
240 * LoadSchemeFromReg: Populates the passed scheme with values retrieved from registry
241 */
242BOOL
244{
245 INT i;
246 WCHAR strValueName[10], strSchemeKey[MAX_PATH];
247 HKEY hkScheme = NULL;
248 DWORD dwType, dwLength;
249 UINT64 iSize;
250 BOOL Ret = TRUE;
251 LONG result;
252
253 wsprintf(strSchemeKey, L"%s\\%s\\Sizes\\%s",
255 pSelectedTheme->Color->StyleName,
256 pSelectedTheme->Size->StyleName);
257
258 result = RegOpenKeyW(HKEY_CURRENT_USER, strSchemeKey, &hkScheme);
259 if (result != ERROR_SUCCESS) return FALSE;
260
261 scheme->bFlatMenus = SHRegGetIntW(hkScheme, L"FlatMenus", 0);
262
263 for (i = 0; i < NUM_COLORS; i++)
264 {
265 wsprintf(strValueName, L"Color #%d", i);
266 dwLength = sizeof(COLORREF);
267 result = RegQueryValueExW(hkScheme,
268 strValueName,
269 NULL,
270 &dwType,
271 (LPBYTE)&scheme->crColor[i],
272 &dwLength);
273 if (result != ERROR_SUCCESS || dwType != REG_DWORD)
274 {
275 /* Failed to read registry value, initialize with current setting for now */
276 scheme->crColor[i] = GetSysColor(i);
277 }
278 }
279
280 for (i = 0; i < NUM_FONTS; i++)
281 {
282 PLOGFONTW lpfFont = SchemeGetFont(scheme, i);
283
284 wsprintf(strValueName, L"Font #%d", i);
285 dwLength = sizeof(LOGFONT);
286 result = RegQueryValueExW(hkScheme,
287 strValueName,
288 NULL,
289 &dwType,
290 (LPBYTE)lpfFont,
291 &dwLength);
292 if (result != ERROR_SUCCESS || dwType != REG_BINARY ||
293 dwLength != sizeof(LOGFONT))
294 {
295 /* Failed to read registry value */
296 Ret = FALSE;
297 }
298 }
299
300 for (i = 0; i < NUM_SIZES; i++)
301 {
302 wsprintf(strValueName, L"Size #%d", i);
303 dwLength = sizeof(UINT64);
304 result = RegQueryValueExW(hkScheme,
305 strValueName,
306 NULL,
307 &dwType,
308 (LPBYTE)&iSize,
309 &dwLength);
310 if (result != ERROR_SUCCESS || dwType != REG_QWORD ||
311 dwLength != sizeof(UINT64))
312 {
313 /* Failed to read registry value, initialize with current setting for now */
314 }
315 else
316 {
317 SchemeSetMetric(scheme, i, (int)iSize);
318 }
319 }
320
321 RegCloseKey(hkScheme);
322
323 return Ret;
324}
325
326/*
327 * ApplyScheme: Applies the selected scheme and stores its id in the registry if needed
328 */
329VOID
331{
332 INT i, Result;
333 HKEY hKey;
334 WCHAR clText[16], *StyleName;
335 INT ColorList[NUM_COLORS];
336
337 /* Apply system colors */
338 for (i = 0; i < NUM_COLORS; i++)
339 ColorList[i] = i;
340 SetSysColors(NUM_COLORS, ColorList, scheme->crColor);
341
342 /* Save colors to registry */
344 if (Result == ERROR_SUCCESS)
345 {
346 for (i = 0; i < NUM_COLORS; i++)
347 {
348 wsprintf(clText,
349 L"%d %d %d",
350 GetRValue(scheme->crColor[i]),
351 GetGValue(scheme->crColor[i]),
352 GetBValue(scheme->crColor[i]));
353
356 0,
357 REG_SZ,
358 (BYTE *)clText,
359 (lstrlen(clText) + 1) * sizeof(WCHAR));
360 }
362 }
363
364 /* Apply non client metrics */
365 SystemParametersInfoW(SPI_SETNONCLIENTMETRICS,
366 sizeof(NONCLIENTMETRICS),
367 &scheme->ncMetrics,
369
370 /* Apply icon metrics */
371 SystemParametersInfoW(SPI_SETICONMETRICS,
372 sizeof(ICONMETRICS),
373 &scheme->icMetrics,
375
376 /* Effects, save only when needed: */
377 /* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings
378 * Just keep them in sync for now.
379 */
380
381#define SYS_CONFIG(__uiAction, __uiParam, __pvParam) \
382 SystemParametersInfoW(__uiAction, __uiParam, __pvParam, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE)
383
384 scheme->Effects.bTooltipAnimation = scheme->Effects.bMenuAnimation;
385 scheme->Effects.bTooltipFade = scheme->Effects.bMenuFade;
386
387 /* Use the following transition effect for menus and tooltips */
388 SYS_CONFIG(SPI_SETMENUANIMATION, 0, IntToPtr(scheme->Effects.bMenuAnimation));
389 SYS_CONFIG(SPI_SETMENUFADE, 0, IntToPtr(scheme->Effects.bMenuFade));
390
391 /* Use the following method to smooth edges of screen fonts */
392 SYS_CONFIG(SPI_SETFONTSMOOTHING, scheme->Effects.bFontSmoothing, 0);
393 SYS_CONFIG(SPI_SETFONTSMOOTHINGTYPE, 0, IntToPtr(scheme->Effects.uiFontSmoothingType));
394
395 /*
396 * Refresh and redraw all the windows, otherwise the font smoothing changes
397 * only appear after any future partial region invalidation.
398 * Not everyone listens for this WM_SETTINGCHANGE, including the shell and most third party programs.
399 */
401
402 /* Use large icons */
403 //SYS_CONFIG(SPI_GETDRAGFULLWINDOWS, (PVOID) g->SchemeAdv.Effects.bMenuFade);
404
405 /* Show shadows under menus */
406 SYS_CONFIG(SPI_SETDROPSHADOW, 0, IntToPtr(scheme->Effects.bDropShadow));
407
408 /* Show window contents while dragging */
409 SYS_CONFIG(SPI_SETDRAGFULLWINDOWS, scheme->Effects.bDragFullWindows, 0);
410
411 /* Hide underlined letters for keyboard navigation until I press the Alt key */
412 SYS_CONFIG(SPI_SETKEYBOARDCUES, 0, IntToPtr(scheme->Effects.bKeyboardCues));
413
414 SYS_CONFIG(SPI_SETFLATMENU, 0, IntToPtr(scheme->bFlatMenus));
415
416 // SYS_CONFIG(SPI_SETACTIVEWINDOWTRACKING, 0, IntToPtr(scheme->Effects.bActiveWindowTracking));
417 // SYS_CONFIG(SPI_SETCOMBOBOXANIMATION, 0, IntToPtr(scheme->Effects.bComboBoxAnimation));
418 // SYS_CONFIG(SPI_SETLISTBOXSMOOTHSCROLLING, 0, IntToPtr(scheme->Effects.bListBoxSmoothScrolling));
419 // SYS_CONFIG(SPI_SETGRADIENTCAPTIONS, 0, IntToPtr(scheme->Effects.bGradientCaptions));
420 // SYS_CONFIG(SPI_SETACTIVEWNDTRKZORDER, 0, IntToPtr(scheme->Effects.bActiveWndTrkZorder));
421 // SYS_CONFIG(SPI_SETHOTTRACKING, 0, IntToPtr(scheme->Effects.bHotTracking));
422 // SYS_CONFIG(SPI_SETSELECTIONFADE, 0, IntToPtr(scheme->Effects.bSelectionFade));
423 SYS_CONFIG(SPI_SETTOOLTIPANIMATION, 0, IntToPtr(scheme->Effects.bTooltipAnimation));
424 SYS_CONFIG(SPI_SETTOOLTIPFADE, 0, IntToPtr(scheme->Effects.bTooltipFade));
425 // SYS_CONFIG(SPI_SETCURSORSHADOW, 0, IntToPtr(scheme->Effects.bCursorShadow));
426 // SYS_CONFIG(SPI_SETUIEFFECTS, 0, IntToPtr(scheme->Effects.bUiEffects));
427
428#undef SYS_CONFIG
429
430 /* Save SchemeId in the registry */
431 if (pSelectedTheme->Theme != NULL && pSelectedTheme->ThemeActive == FALSE)
432 {
433 StyleName = pSelectedTheme->Color->StyleName;
437 REG_SZ,
438 StyleName,
439 (lstrlenW(StyleName) + 1) * sizeof(WCHAR));
440 }
441}
442
443static THEME*
444CreateTheme(LPCWSTR pszName, LPCWSTR pszDisplayName)
445{
446 PTHEME pTheme;
447
448 pTheme = (PTHEME) malloc(sizeof(THEME));
449 if (pTheme == NULL) return NULL;
450
451 pTheme->DisplayName = _wcsdup(pszDisplayName);
452 if (pTheme->DisplayName == NULL)
453 {
454 free(pTheme);
455 return NULL;
456 }
457
458 pTheme->ColoursList = NULL;
459 pTheme->NextTheme = NULL;
460 pTheme->SizesList = NULL;
461
462 if (pszName == NULL)
463 {
464 pTheme->ThemeFileName = NULL;
465 return pTheme;
466 }
467
468 pTheme->ThemeFileName = _wcsdup(pszName);
469 if (pTheme->ThemeFileName == NULL)
470 {
471 free(pTheme->DisplayName);
472 free(pTheme);
473 return NULL;
474 }
475
476 return pTheme;
477}
478
479static PTHEME_STYLE
480CreateStyle(LPCWSTR pszName, LPCWSTR pszDisplayName)
481{
482 PTHEME_STYLE pStyle;
483
484 pStyle = (PTHEME_STYLE) malloc(sizeof(THEME_STYLE));
485 if (pStyle == NULL) return NULL;
486
487 pStyle->StyleName = _wcsdup(pszName);
488 if (pStyle->StyleName == NULL)
489 {
490 free(pStyle);
491 return NULL;
492 }
493
494 pStyle->DisplayName = _wcsdup(pszDisplayName);
495 if (pStyle->DisplayName == NULL)
496 {
497 free(pStyle->StyleName);
498 free(pStyle);
499 return NULL;
500 }
501
502 pStyle->ChildStyle = NULL;
503 pStyle->NextStyle = NULL;
504
505 return pStyle;
506}
507
508static void
510{
511 PTHEME_STYLE pStyle, pStyleOld;
512
513 pStyle = pStylesList;
514 while (pStyle)
515 {
516 if (pStyle->ChildStyle) CleanupStyles(pStyle->ChildStyle);
517 if (pStyle->DisplayName) free(pStyle->DisplayName);
518 if (pStyle->StyleName) free(pStyle->StyleName);
519
520 pStyleOld = pStyle;
521 pStyle = pStyle->NextStyle;
522 free(pStyleOld);
523 }
524}
525
526void
528{
529 PTHEME pTheme, pThemeOld;
530
531 pTheme = pThemeList;
532 while (pTheme)
533 {
534 CleanupStyles(pTheme->ColoursList);
535 if (pTheme->SizesList) CleanupStyles(pTheme->SizesList);
536 if (pTheme->DisplayName) free(pTheme->DisplayName);
537 if (pTheme->ThemeFileName) free(pTheme->ThemeFileName);
538
539 pThemeOld = pTheme;
540 pTheme = pTheme->NextTheme;
541 free(pThemeOld);
542 }
543}
544
545static PTHEME_STYLE
546FindStyle(IN PTHEME_STYLE pStylesList, IN PCWSTR StyleName)
547{
548 PTHEME_STYLE pStyle;
549
550 for (pStyle = pStylesList; pStyle; pStyle = pStyle->NextStyle)
551 {
552 if (_wcsicmp(pStyle->StyleName, StyleName) == 0)
553 {
554 return pStyle;
555 }
556 }
557
558 /* If we can't find the style requested, return the first one */
559 return pStylesList;
560}
561
562/*
563 * LoadSchemeSizes: Returns a list of sizes from the registry key of a scheme
564 */
565static PTHEME_STYLE
567{
568 HKEY hkSizes, hkSize;
569 INT Result;
570 INT iStyle;
571 WCHAR wstrSizeName[5], wstrDisplayName[50];
572 THEME_STYLE *List = NULL, *pCurrentStyle;
573
574 Result = RegOpenKeyW(hkScheme, L"Sizes", &hkSizes);
575 if (Result != ERROR_SUCCESS) return NULL;
576
577 iStyle = 0;
578 while ((RegEnumKeyW(hkSizes, iStyle, wstrSizeName, 5) == ERROR_SUCCESS))
579 {
580 iStyle++;
581
582 Result = RegOpenKeyW(hkSizes, wstrSizeName, &hkSize);
583 if (Result != ERROR_SUCCESS) continue;
584
585 Result = RegLoadMUIStringW(hkSize,
586 L"DisplayName",
587 wstrDisplayName,
588 sizeof(wstrDisplayName),
589 NULL,
590 0,
591 NULL);
592 if (Result != ERROR_SUCCESS)
593 {
594 Result = RegLoadMUIStringW(hkSize,
595 L"LegacyName",
596 wstrDisplayName,
597 sizeof(wstrDisplayName),
598 NULL,
599 0,
600 NULL);
601 }
602
603 if (Result == ERROR_SUCCESS)
604 pCurrentStyle = CreateStyle(wstrSizeName, wstrDisplayName);
605 else
606 pCurrentStyle = CreateStyle(wstrSizeName, wstrSizeName);
607
608 if (pCurrentStyle != NULL)
609 {
610 pCurrentStyle->NextStyle = List;
611 List = pCurrentStyle;
612 }
613
614 RegCloseKey(hkSize);
615 }
616
617 RegCloseKey(hkSizes);
618 return List;
619}
620
621/*
622 * LoadClassicColorSchemes: Returns a list of classic theme colours from the registry key of a scheme
623 */
624static THEME_STYLE*
626{
627 INT Result;
628 HKEY hkNewSchemes, hkScheme;
629 INT iStyle;
630 WCHAR wstrStyleName[5], wstrDisplayName[50];
631 THEME_STYLE *List = NULL, *pCurrentStyle;
632
634 if (Result != ERROR_SUCCESS) return NULL;
635
636 iStyle = 0;
637 while ((RegEnumKeyW(hkNewSchemes, iStyle, wstrStyleName, 5) == ERROR_SUCCESS))
638 {
639 iStyle++;
640
641 Result = RegOpenKeyW(hkNewSchemes, wstrStyleName, &hkScheme);
642 if (Result != ERROR_SUCCESS) continue;
643
644 Result = RegLoadMUIStringW(hkScheme,
645 L"DisplayName",
646 wstrDisplayName,
647 sizeof(wstrDisplayName),
648 NULL,
649 0,
650 NULL);
651 if (Result != ERROR_SUCCESS)
652 {
653 Result = RegLoadMUIStringW(hkScheme,
654 L"LegacyName",
655 wstrDisplayName,
656 sizeof(wstrDisplayName),
657 NULL,
658 0,
659 NULL);
660 }
661
662 if (Result == ERROR_SUCCESS)
663 pCurrentStyle = CreateStyle(wstrStyleName, wstrDisplayName);
664 else
665 pCurrentStyle = CreateStyle(wstrStyleName, wstrStyleName);
666
667 if (pCurrentStyle != NULL)
668 {
669 pCurrentStyle->NextStyle = List;
670 pCurrentStyle->ChildStyle = LoadSchemeSizes(hkScheme);
671 if(pCurrentStyle->ChildStyle == NULL)
672 CleanupStyles(pCurrentStyle);
673 else
674 List = pCurrentStyle;
675 }
676
677 RegCloseKey(hkScheme);
678 }
679
680 RegCloseKey(hkNewSchemes);
681 return List;
682}
683
685
686static THEME_STYLE*
687EnumThemeStyles(IN LPCWSTR pszThemeFileName, IN ENUMTHEMESTYLE pfnEnumTheme)
688{
689 DWORD index = 0;
691 THEME_STYLE *List = NULL, **ppPrevStyle, *pCurrentStyle;
692
693 ppPrevStyle = &List;
694
695 while (SUCCEEDED(pfnEnumTheme (pszThemeFileName, NULL, index++, &names)))
696 {
697 pCurrentStyle = CreateStyle(names.szName, names.szDisplayName);
698 if(pCurrentStyle == NULL) break;
699
700 *ppPrevStyle = pCurrentStyle;
701 ppPrevStyle = &pCurrentStyle->NextStyle;
702 }
703
704 return List;
705}
706
707PTHEME LoadTheme(IN LPCWSTR pszThemeFileName,IN LPCWSTR pszThemeName)
708{
709 PTHEME pTheme = CreateTheme(pszThemeFileName, pszThemeName);
710 if (pTheme == NULL)
711 return NULL;
712
713 pTheme->SizesList = EnumThemeStyles( pszThemeFileName, (ENUMTHEMESTYLE)EnumThemeSizes);
714 pTheme->ColoursList = EnumThemeStyles( pszThemeFileName, (ENUMTHEMESTYLE)EnumThemeColors);
715 if(pTheme->SizesList == NULL || pTheme->ColoursList == NULL)
716 {
717 CleanupThemes(pTheme);
718 return NULL;
719 }
720
721 return pTheme;
722}
723
726 IN LPCWSTR pszThemeFileName,
727 IN LPCWSTR pszThemeName,
728 IN LPCWSTR pszToolTip,
729 IN LPVOID lpReserved2,
730 IN OUT LPVOID lpData)
731{
732 PTHEME *List, pTheme;
733
734 List = (PTHEME*)lpData;
735 pTheme = LoadTheme(pszThemeFileName, pszThemeName);
736 if (pTheme == NULL) return FALSE;
737
738 pTheme->NextTheme = *List;
739 *List = pTheme;
740
741 return TRUE;
742}
743
744/*
745 * LoadThemes: Returns a list that contains tha classic theme and
746 * the visual styles of the system
747 */
748PTHEME
750{
751 HRESULT hret;
752 PTHEME pClassicTheme;
753 WCHAR strClassicTheme[40];
754 WCHAR szThemesPath[MAX_PATH], *pszClassicTheme;
755 int res;
756
757 /* Insert the classic theme */
758 res = LoadString(hApplet, IDS_CLASSIC_THEME, strClassicTheme, 40);
759 pszClassicTheme = (res > 0 ? strClassicTheme : L"Classic Theme");
760 pClassicTheme = CreateTheme(NULL, pszClassicTheme);
761 if (pClassicTheme == NULL) return NULL;
762 pClassicTheme->ColoursList = LoadClassicColorSchemes();
763
764 /* Get path to themes folder */
765 ZeroMemory(szThemesPath, sizeof(szThemesPath));
767 if (FAILED(hret)) return pClassicTheme;
768 lstrcatW (szThemesPath, L"\\Themes");
769
770 /* Enumerate themes */
771 hret = EnumThemes( szThemesPath, EnumThemeProc, &pClassicTheme->NextTheme);
772 if (FAILED(hret))
773 {
774 pClassicTheme->NextTheme = NULL;
775 if (pClassicTheme->ColoursList == NULL)
776 {
777 free(pClassicTheme->DisplayName);
778 free(pClassicTheme);
779 return NULL;
780 }
781 }
782
783 return pClassicTheme;
784}
785
786/*
787 * FindSelectedTheme: Finds the specified theme in the list of themes
788 * or loads it if it was not loaded already.
789 */
790BOOL
792 IN LPCWSTR pwszThemeFileName,
793 IN LPCWSTR pwszColorBuff,
794 IN LPCWSTR pwszSizeBuff,
795 OUT PTHEME_SELECTION pSelectedTheme)
796{
797 PTHEME pTheme;
798 PTHEME pFoundTheme = NULL;
799
800 ZeroMemory(pSelectedTheme, sizeof(THEME_SELECTION));
801
802 for (pTheme = pThemeList; pTheme; pTheme = pTheme->NextTheme)
803 {
804 if (pTheme->ThemeFileName &&
805 _wcsicmp(pTheme->ThemeFileName, pwszThemeFileName) == 0)
806 {
807 pFoundTheme = pTheme;
808 break;
809 }
810
811 if (pTheme->NextTheme == NULL)
812 break;
813 }
814
815 if (!pFoundTheme)
816 {
817 pFoundTheme = LoadTheme(pwszThemeFileName, pwszThemeFileName);
818 if (!pFoundTheme)
819 return FALSE;
820
821 pTheme->NextTheme = pFoundTheme;
822 }
823
824 pSelectedTheme->ThemeActive = TRUE;
825 pSelectedTheme->Theme = pFoundTheme;
826 if (pwszColorBuff)
827 pSelectedTheme->Color = FindStyle(pFoundTheme->ColoursList, pwszColorBuff);
828 else
829 pSelectedTheme->Color = pFoundTheme->ColoursList;
830
831 if (pwszSizeBuff)
832 pSelectedTheme->Size = FindStyle(pFoundTheme->SizesList, pwszSizeBuff);
833 else
834 pSelectedTheme->Size = pFoundTheme->SizesList;
835
836 return TRUE;
837}
838
839/*
840 * GetActiveTheme: Gets the active theme and populates pSelectedTheme
841 * with entries from the list of loaded themes.
842 */
843BOOL
844GetActiveTheme(IN PTHEME pThemeList, OUT PTHEME_SELECTION pSelectedTheme)
845{
846 WCHAR szThemeFileName[MAX_PATH];
847 WCHAR szColorBuff[MAX_PATH];
848 WCHAR szSizeBuff[MAX_PATH];
849 HRESULT hret;
850
851 /* Retrieve the name of the current theme */
852 hret = GetCurrentThemeName(szThemeFileName,
853 MAX_PATH,
854 szColorBuff,
855 MAX_PATH,
856 szSizeBuff,
857 MAX_PATH);
858 if (FAILED(hret))
859 return FALSE;
860
861 return FindOrAppendTheme(pThemeList, szThemeFileName, szColorBuff, szSizeBuff, pSelectedTheme);
862}
863
864/*
865 * GetActiveTheme: Gets the active classic theme and populates pSelectedTheme
866 * with entries from the list of loaded themes
867 */
868BOOL
870{
871 INT Result;
872 WCHAR szSelectedClassicScheme[5], szSelectedClassicSize[5];
873 HKEY hkNewSchemes;
874 DWORD dwType, dwDisplayNameLength;
875 PTHEME_STYLE pCurrentStyle, pCurrentSize;
876
877 ZeroMemory(pSelectedTheme, sizeof(THEME_SELECTION));
878
879 /* Assume failure */
880 szSelectedClassicScheme[0] = 0;
881 szSelectedClassicSize[0] = 0;
882
884 if (Result != ERROR_SUCCESS) return FALSE;
885
886 dwType = REG_SZ;
887 dwDisplayNameLength = sizeof(szSelectedClassicScheme);
888 Result = RegQueryValueEx(hkNewSchemes, L"SelectedStyle", NULL, &dwType,
889 (LPBYTE)&szSelectedClassicScheme, &dwDisplayNameLength);
890 if (Result == ERROR_SUCCESS)
891 {
892 dwType = REG_SZ;
893 dwDisplayNameLength = sizeof(szSelectedClassicSize);
894 Result = SHGetValue(hkNewSchemes, szSelectedClassicScheme, L"SelectedSize",
895 &dwType, szSelectedClassicSize, &dwDisplayNameLength);
896 }
897
898 RegCloseKey(hkNewSchemes);
899
900 pCurrentStyle = FindStyle(pThemeList->ColoursList, szSelectedClassicScheme);
901 pCurrentSize = FindStyle(pCurrentStyle->ChildStyle, szSelectedClassicSize);
902
903 pSelectedTheme->Theme = pThemeList;
904 pSelectedTheme->Color = pCurrentStyle;
905 pSelectedTheme->Size = pCurrentSize;
906
907 return TRUE;
908}
909
910BOOL
912{
913 HTHEMEFILE hThemeFile = 0;
914 HRESULT hret;
915
916 if (pSelectedTheme->ThemeActive)
917 {
918 hret = OpenThemeFile(pSelectedTheme->Theme->ThemeFileName,
919 pSelectedTheme->Color->StyleName,
920 pSelectedTheme->Size->StyleName,
921 &hThemeFile,
922 0);
923
924 if (!SUCCEEDED(hret)) return FALSE;
925 }
926
927 hret = ApplyTheme(hThemeFile, 0, 0);
928
929 if (pSelectedTheme->ThemeActive)
930 {
931 CloseThemeFile(hThemeFile);
932 }
933
934 return SUCCEEDED(hret);
935}
936
937BOOL
939{
940 HTHEMEFILE hThemeFile = 0;
941 HRESULT hret;
942 HTHEME hTheme;
943 int i;
944
945 hret = OpenThemeFile(pSelectedTheme->Theme->ThemeFileName,
946 pSelectedTheme->Color->StyleName,
947 pSelectedTheme->Size->StyleName,
948 &hThemeFile,
949 0);
950
951 if (!SUCCEEDED(hret)) return FALSE;
952
953 hTheme = OpenThemeDataFromFile(hThemeFile, hCPLWindow, L"WINDOW", 0);
954 if (hTheme == NULL) return FALSE;
955
956 /* Load colors */
957 for (i = 0; i < NUM_COLORS; i++)
958 {
959 scheme->crColor[i] = GetThemeSysColor(hTheme,i);
960 }
961
962 /* Load sizes */
963 /* I wonder why GetThemeSysInt doesn't work here */
964 scheme->ncMetrics.iBorderWidth = GetThemeSysSize(hTheme, SM_CXFRAME);
965 scheme->ncMetrics.iScrollWidth = GetThemeSysSize(hTheme, SM_CXVSCROLL);
966 scheme->ncMetrics.iScrollHeight = GetThemeSysSize(hTheme, SM_CYHSCROLL);
967 scheme->ncMetrics.iCaptionWidth = GetThemeSysSize(hTheme, SM_CXSIZE);
968 scheme->ncMetrics.iCaptionHeight = GetThemeSysSize(hTheme, SM_CYSIZE);
969 scheme->ncMetrics.iSmCaptionWidth = GetThemeSysSize(hTheme, SM_CXSMSIZE);
970 scheme->ncMetrics.iSmCaptionHeight = GetThemeSysSize(hTheme, SM_CYSMSIZE);
971 scheme->ncMetrics.iMenuWidth = GetThemeSysSize(hTheme, SM_CXMENUSIZE);
972 scheme->ncMetrics.iMenuHeight = GetThemeSysSize(hTheme, SM_CYMENUSIZE);
973
974 /* Load fonts */
975 GetThemeSysFont(hTheme, TMT_CAPTIONFONT, &scheme->ncMetrics.lfCaptionFont);
976 GetThemeSysFont(hTheme, TMT_SMALLCAPTIONFONT, &scheme->ncMetrics.lfSmCaptionFont);
977 GetThemeSysFont(hTheme, TMT_MENUFONT, &scheme->ncMetrics.lfMenuFont );
978 GetThemeSysFont(hTheme, TMT_STATUSFONT, &scheme->ncMetrics.lfStatusFont);
979 GetThemeSysFont(hTheme, TMT_MSGBOXFONT, &scheme->ncMetrics.lfMessageFont);
980 GetThemeSysFont(hTheme, TMT_ICONTITLEFONT, &scheme->icMetrics.lfFont);
981
982 scheme->bFlatMenus = GetThemeSysBool(hTheme, TMT_FLATMENUS);
983
984 CloseThemeData(hTheme);
985
986 return TRUE;
987}
988
989BOOL
991{
992 HBRUSH hbrBack;
994
995 hbrBack = CreateSolidBrush(scheme->crColor[COLOR_DESKTOP]);
996
997 FillRect(hdcMem, prcWindow, hbrBack);
998 DeleteObject(hbrBack);
999
1000 InflateRect(prcWindow, -10, -10);
1001
1004 prcWindow,
1005 pSelectedTheme->Theme->ThemeFileName,
1006 pSelectedTheme->Color->StyleName,
1007 pSelectedTheme->Size->StyleName,
1008 &scheme->ncMetrics,
1009 scheme->crColor);
1010
1011 return SUCCEEDED(hres);
1012}
1013
1015{
1016 PTHEME pThemes;
1019 BOOL ret = FALSE;
1020
1021 pThemes = LoadThemes();
1022 if (!pThemes)
1023 return FALSE;
1024
1026
1027 if (pwszFile)
1028 {
1029 ret = FindOrAppendTheme(pThemes, pwszFile, NULL, NULL, &selection);
1030 if (!ret)
1031 goto cleanup;
1032
1034 if (!ret)
1035 goto cleanup;
1036 }
1037 else
1038 {
1039 ret = GetActiveClassicTheme(pThemes, &selection);
1040 if (!ret)
1041 goto cleanup;
1042
1044 if (!ret)
1045 goto cleanup;
1046 }
1047
1049 if (!ret)
1050 goto cleanup;
1051
1053
1054 ret = TRUE;
1055
1056cleanup:
1057 CleanupThemes(pThemes);
1058
1059 return ret;
1060}
1061
1062/* TODO: */
1065{
1066 LPNMHDR lpnm;
1067
1068 switch (uMsg)
1069 {
1070 case WM_INITDIALOG:
1071 break;
1072
1073 case WM_COMMAND:
1074 break;
1075
1076 case WM_NOTIFY:
1077 lpnm = (LPNMHDR)lParam;
1078 switch (lpnm->code)
1079 {
1080 case PSN_APPLY:
1082 return TRUE;
1083 }
1084 break;
1085
1086 case WM_DESTROY:
1087 break;
1088 }
1089
1090 return FALSE;
1091}
unsigned long long UINT64
#define SIZE_MENU_WIDTH
Definition: appearance.h:11
#define SIZE_CAPTION_WIDTH
Definition: appearance.h:7
struct _THEME_STYLE * PTHEME_STYLE
#define FONT_MESSAGE
Definition: appearance.h:22
#define NUM_FONTS
Definition: appearance.h:26
#define FONT_CAPTION
Definition: appearance.h:18
#define SIZE_ICON_SPACE_X
Definition: appearance.h:14
#define FONT_SMCAPTION
Definition: appearance.h:19
#define FONT_STATUS
Definition: appearance.h:21
#define SIZE_SCROLL_HEIGHT
Definition: appearance.h:6
#define NUM_SIZES
Definition: appearance.h:27
#define SIZE_SM_CAPTION_WIDTH
Definition: appearance.h:9
struct _THEME * PTHEME
#define SIZE_ICON_SPACE_Y
Definition: appearance.h:15
#define SIZE_SCROLL_WIDTH
Definition: appearance.h:5
#define FONT_ICON
Definition: appearance.h:23
#define SIZE_MENU_HEIGHT
Definition: appearance.h:12
#define SIZE_BORDER_WIDTH
Definition: appearance.h:4
#define SIZE_ICON
Definition: appearance.h:16
#define FONT_MENU
Definition: appearance.h:20
#define SIZE_CAPTION_HEIGHT
Definition: appearance.h:8
#define SIZE_SM_CAPTION_HEIGHT
Definition: appearance.h:10
#define IntToPtr(i)
Definition: basetsd.h:89
#define RegCloseKey(hKey)
Definition: registry.h:47
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
int selection
Definition: ctm.c:92
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hCPLWindow
Definition: desk.c:27
LONG RegLoadMUIStringW(IN HKEY hKey, IN LPCWSTR pszValue OPTIONAL, OUT LPWSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCWSTR pszDirectory OPTIONAL)
Definition: muireg.c:53
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define IDS_CLASSIC_THEME
Definition: resource.h:111
static PTHEME_STYLE LoadSchemeSizes(IN HKEY hkScheme)
Definition: theme.c:566
static void CleanupStyles(IN PTHEME_STYLE pStylesList)
Definition: theme.c:509
static PTHEME_STYLE FindStyle(IN PTHEME_STYLE pStylesList, IN PCWSTR StyleName)
Definition: theme.c:546
static const WCHAR g_CPMetrics[]
Definition: theme.c:20
PTHEME LoadTheme(IN LPCWSTR pszThemeFileName, IN LPCWSTR pszThemeName)
Definition: theme.c:707
BOOL CALLBACK EnumThemeProc(IN LPVOID lpReserved, IN LPCWSTR pszThemeFileName, IN LPCWSTR pszThemeName, IN LPCWSTR pszToolTip, IN LPVOID lpReserved2, IN OUT LPVOID lpData)
Definition: theme.c:725
void CleanupThemes(IN PTHEME pThemeList)
Definition: theme.c:527
static THEME_STYLE * EnumThemeStyles(IN LPCWSTR pszThemeFileName, IN ENUMTHEMESTYLE pfnEnumTheme)
Definition: theme.c:687
VOID SchemeSetMetric(IN COLOR_SCHEME *scheme, int id, int value)
Definition: theme.c:63
static PTHEME_STYLE CreateStyle(LPCWSTR pszName, LPCWSTR pszDisplayName)
Definition: theme.c:480
static const WCHAR g_CPColors[]
Definition: theme.c:18
BOOL FindOrAppendTheme(IN PTHEME pThemeList, IN LPCWSTR pwszThemeFileName, IN LPCWSTR pwszColorBuff, IN LPCWSTR pwszSizeBuff, OUT PTHEME_SELECTION pSelectedTheme)
Definition: theme.c:791
HRESULT(WINAPI * ENUMTHEMESTYLE)(LPCWSTR, LPWSTR, DWORD, PTHEMENAMES)
Definition: theme.c:684
static const WCHAR * g_RegColorNames[NUM_COLORS]
Definition: theme.c:26
PLOGFONTW SchemeGetFont(IN COLOR_SCHEME *scheme, int id)
Definition: theme.c:104
BOOL GetActiveTheme(IN PTHEME pThemeList, OUT PTHEME_SELECTION pSelectedTheme)
Definition: theme.c:844
static const WCHAR g_SelectedStyle[]
Definition: theme.c:21
BOOL DrawThemePreview(IN HDC hdcMem, IN PCOLOR_SCHEME scheme, IN PTHEME_SELECTION pSelectedTheme, IN PRECT prcWindow)
Definition: theme.c:990
int SchemeGetMetric(IN COLOR_SCHEME *scheme, int id)
Definition: theme.c:83
BOOL ActivateThemeFile(LPCWSTR pwszFile)
Definition: theme.c:1014
BOOL LoadSchemeFromTheme(OUT PCOLOR_SCHEME scheme, IN PTHEME_SELECTION pSelectedTheme)
Definition: theme.c:938
BOOL GetActiveClassicTheme(IN PTHEME pThemeList, OUT PTHEME_SELECTION pSelectedTheme)
Definition: theme.c:869
BOOL ActivateTheme(IN PTHEME_SELECTION pSelectedTheme)
Definition: theme.c:911
VOID ApplyScheme(IN COLOR_SCHEME *scheme, IN PTHEME_SELECTION pSelectedTheme)
Definition: theme.c:330
static THEME * CreateTheme(LPCWSTR pszName, LPCWSTR pszDisplayName)
Definition: theme.c:444
PTHEME LoadThemes(VOID)
Definition: theme.c:749
BOOL LoadSchemeFromReg(OUT COLOR_SCHEME *scheme, IN PTHEME_SELECTION pSelectedTheme)
Definition: theme.c:243
INT_PTR CALLBACK ThemesPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: theme.c:1064
BOOL LoadCurrentScheme(OUT COLOR_SCHEME *scheme)
Definition: theme.c:122
static const WCHAR g_CPANewSchemes[]
Definition: theme.c:19
static THEME_STYLE * LoadClassicColorSchemes(VOID)
Definition: theme.c:625
#define SYS_CONFIG(__uiAction, __uiParam, __pvParam)
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4900
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define lstrlenW
Definition: compat.h:750
static DWORD DWORD * dwLength
Definition: fusion.c:86
static void cleanup(void)
Definition: main.c:1335
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2558
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
int WINAPI SHRegGetIntW(HKEY hKey, LPCWSTR lpszValue, int iDefault)
Definition: reg.c:2374
COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
Definition: metric.c:58
HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf)
Definition: metric.c:91
int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID)
Definition: metric.c:154
BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID)
Definition: metric.c:26
HRESULT WINAPI DrawNCPreview(HDC hDC, DWORD DNCP_Flag, LPRECT prcPreview, LPCWSTR pszThemeFileName, LPCWSTR pszColorName, LPCWSTR pszSizeName, PNONCLIENTMETRICSW pncMetrics, COLORREF *lpaRgbValues)
Definition: nonclient.c:1078
HTHEME WINAPI OpenThemeDataFromFile(HTHEMEFILE hThemeFile, HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:827
HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars, LPWSTR pszColorBuff, int cchMaxColorChars, LPWSTR pszSizeBuff, int cchMaxSizeChars)
Definition: system.c:894
HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd)
Definition: system.c:1158
HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName, LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile, DWORD unknown)
Definition: system.c:1101
HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName, DWORD dwColorNum, PTHEMENAMES pszColorNames)
Definition: system.c:1310
HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName, DWORD dwSizeNum, PTHEMENAMES pszSizeNames)
Definition: system.c:1373
HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, ENUMTHEMEPROC callback, LPVOID lpData)
Definition: system.c:1221
HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile)
Definition: system.c:1127
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
#define GetBValue(quad)
Definition: precomp.h:66
#define GetGValue(quad)
Definition: precomp.h:65
#define GetRValue(quad)
Definition: precomp.h:64
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
pKey DeleteObject()
GLuint res
Definition: glext.h:9613
GLuint GLuint * names
Definition: glext.h:11545
GLuint index
Definition: glext.h:6031
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define TEXT(s)
Definition: k32.h:26
#define REG_SZ
Definition: layer.c:22
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static HDC
Definition: imagelist.c:92
HRESULT hres
Definition: protocol.c:465
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
unsigned int UINT
Definition: ndis.h:50
#define REG_BINARY
Definition: nt_native.h:1496
#define DWORD
Definition: nt_native.h:44
#define L(x)
Definition: ntvdm.h:50
#define NUM_COLORS
Definition: palettemodel.h:11
long LONG
Definition: pedump.c:60
#define PSN_APPLY
Definition: prsht.h:117
#define WM_NOTIFY
Definition: richedit.h:61
DWORD scheme
#define REG_QWORD
Definition: sdbapi.c:597
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2002
#define CSIDL_RESOURCES
Definition: shlobj.h:2077
#define SHGetValue
Definition: shlwapi.h:70
ULONG dwMajorVersion
Definition: rtltypes.h:238
struct _THEME_STYLE * ChildStyle
Definition: appearance.h:82
PWSTR StyleName
Definition: appearance.h:83
struct _THEME_STYLE * NextStyle
Definition: appearance.h:81
PWSTR DisplayName
Definition: appearance.h:84
THEME_STYLE * SizesList
Definition: appearance.h:93
THEME_STYLE * ColoursList
Definition: appearance.h:92
PWSTR ThemeFileName
Definition: appearance.h:90
struct _THEME * NextTheme
Definition: appearance.h:89
PWSTR DisplayName
Definition: appearance.h:91
UINT code
Definition: winuser.h:3149
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
Definition: pdh_main.c:94
#define DNCP_DRAW_ALL
Definition: uxundoc.h:106
struct tagTHEMENAMES * PTHEMENAMES
OSVERSIONINFO osvi
Definition: ver.c:28
#define TMT_SMALLCAPTIONFONT
Definition: vssym32.h:165
#define TMT_FLATMENUS
Definition: vssym32.h:175
#define TMT_CAPTIONFONT
Definition: vssym32.h:164
#define TMT_MENUFONT
Definition: vssym32.h:166
#define TMT_MSGBOXFONT
Definition: vssym32.h:168
#define TMT_ICONTITLEFONT
Definition: vssym32.h:169
#define TMT_STATUSFONT
Definition: vssym32.h:167
int ret
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
HDC hdcMem
Definition: welcome.c:104
#define ZeroMemory
Definition: winbase.h:1670
#define GetVersionEx
Definition: winbase.h:3723
#define lstrlen
Definition: winbase.h:3747
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
LOGFONTA LOGFONT
Definition: wingdi.h:4415
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegQueryValueEx
Definition: winreg.h:524
DWORD WINAPI GetSysColor(_In_ int)
#define SM_CYSIZE
Definition: winuser.h:986
BOOL WINAPI SetSysColors(_In_ int cElements, _In_reads_(cElements) CONST INT *lpaElements, _In_reads_(cElements) CONST COLORREF *lpaRgbValues)
#define SM_CXVSCROLL
Definition: winuser.h:955
#define HWND_BROADCAST
Definition: winuser.h:1194
#define SM_CXFRAME
Definition: winuser.h:988
#define WM_COMMAND
Definition: winuser.h:1730
#define WM_INITDIALOG
Definition: winuser.h:1729
#define SM_CXSIZE
Definition: winuser.h:985
#define SM_CYHSCROLL
Definition: winuser.h:956
#define SPIF_SENDCHANGE
Definition: winuser.h:1562
#define WM_SETTINGCHANGE
Definition: winuser.h:1619
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1561
#define SM_CXSMSIZE
Definition: winuser.h:1009
#define COLOR_DESKTOP
Definition: winuser.h:908
struct tagNMHDR * LPNMHDR
#define SendMessage
Definition: winuser.h:5833
#define wsprintf
Definition: winuser.h:5855
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define LoadString
Definition: winuser.h:5809
#define SM_CXMENUSIZE
Definition: winuser.h:1011
#define SM_CYSMSIZE
Definition: winuser.h:1010
#define WM_DESTROY
Definition: winuser.h:1599
#define SM_CYMENUSIZE
Definition: winuser.h:1012
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193