3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS Display Control Panel
5 * FILE: lib/cpl/desk/appearance.c
6 * PURPOSE: Appearance property page
8 * PROGRAMMERS: Trevor McCort (lycan359@gmail.com)
9 * Timo Kreuzer (timo[dot]kreuzer[at]web[dot]de
13 #include "appearance.h"
15 /******************************************************************************/
17 /* This const assigns the color and metric numbers to the elements from the elements list */
19 /* Size 1 (width) Size 2 (height) Color 1 Color 2 Font Fontcolor */
20 const ASSIGNMENT g_Assignment
[NUM_ELEMENTS
] =
21 { {-1, -1, COLOR_DESKTOP
, -1, -1, -1}, /* -Desktop */
22 {SIZE_CAPTION_Y
, -1, COLOR_INACTIVECAPTION
, COLOR_GRADIENTINACTIVECAPTION
, FONT_CAPTION
, -1}, /* inactive window caption */
23 {SIZE_BORDER_X
, SIZE_BORDER_Y
, COLOR_INACTIVEBORDER
, -1, -1, -1}, /* inactive window border */
24 {SIZE_CAPTION_Y
, -1, COLOR_ACTIVECAPTION
, COLOR_GRADIENTACTIVECAPTION
, FONT_CAPTION
, COLOR_CAPTIONTEXT
}, /* -active window caption */
25 {SIZE_BORDER_X
, SIZE_BORDER_Y
, COLOR_ACTIVEBORDER
, -1, -1, -1}, /* active window border */
26 {SIZE_MENU_X
, SIZE_MENU_Y
, COLOR_MENU
, -1, FONT_MENU
, COLOR_MENUTEXT
}, /* menu */
27 {SIZE_MENU_X
, SIZE_MENU_Y
, COLOR_HIGHLIGHT
, -1, FONT_HILIGHT
, COLOR_HIGHLIGHTTEXT
},/* marked element */
28 {-1, -1, COLOR_WINDOW
, -1 /*COLOR_WINDOWFRAME*/, -1, COLOR_WINDOWTEXT
}, /* window */
29 {SIZE_SCROLL_X
, SIZE_SCROLL_Y
, COLOR_SCROLLBAR
, -1, -1, -1}, /* scroll bar */
30 {-1, -1, COLOR_3DFACE
, -1, -1, COLOR_BTNTEXT
}, /* 3d objects */
31 {SIZE_SMCAPTION_Y
,-1, -1, -1, FONT_SMCAPTION
, -1}, /* palette window caption */
32 {-1, -1, -1, -1, -1, -1}, /* symbol caption FIXME: Access? */
33 {SIZE_CAPTION_Y
, -1, -1, -1, -1, -1}, /* caption bar */
34 {-1, -1, -1, -1, -1, COLOR_GRAYTEXT
}, /* inactive menu item FIXME: Access? */
35 {-1, -1, -1, -1, FONT_DIALOG
, COLOR_WINDOWTEXT
}, /* dialog */
36 {-1, -1, -1, -1, -1, -1}, /* scrollbar controls FIXME: Access? */
37 {-1, -1, COLOR_APPWORKSPACE
, -1, -1, -1}, /* application background */
38 {-1, -1, -1, -1, -1, -1}, /* small caption bar FIXME: Access? */
39 {SIZE_ICON_SPC_X
, -1, -1, -1, -1, -1}, /* symbol distance horiz. */
40 {SIZE_ICON_SPC_Y
, -1, -1, -1, -1, -1}, /* symbol distance vert. */
41 {-1, -1, COLOR_INFOBK
, -1, FONT_INFO
, COLOR_INFOTEXT
}, /* quickinfo */
42 {SIZE_ICON_X
, SIZE_ICON_Y
, -1, -1, FONT_ICON
, -1}}; /* symbol */
44 /* This is the list of names for the colors stored in the registry */
45 const TCHAR g_RegColorNames
[NUM_COLORS
][MAX_COLORNAMELENGTH
] =
46 {TEXT("Scrollbar"), /* 00 = COLOR_SCROLLBAR */
47 TEXT("Background"), /* 01 = COLOR_DESKTOP */
48 TEXT("ActiveTitle"), /* 02 = COLOR_ACTIVECAPTION */
49 TEXT("InactiveTitle"), /* 03 = COLOR_INACTIVECAPTION */
50 TEXT("Menu"), /* 04 = COLOR_MENU */
51 TEXT("Window"), /* 05 = COLOR_WINDOW */
52 TEXT("WindowFrame"), /* 06 = COLOR_WINDOWFRAME */
53 TEXT("MenuText"), /* 07 = COLOR_MENUTEXT */
54 TEXT("WindowText"), /* 08 = COLOR_WINDOWTEXT */
55 TEXT("TitleText"), /* 09 = COLOR_CAPTIONTEXT */
56 TEXT("ActiveBorder"), /* 10 = COLOR_ACTIVEBORDER */
57 TEXT("InactiveBorder"), /* 11 = COLOR_INACTIVEBORDER */
58 TEXT("AppWorkSpace"), /* 12 = COLOR_APPWORKSPACE */
59 TEXT("Hilight"), /* 13 = COLOR_HIGHLIGHT */
60 TEXT("HilightText"), /* 14 = COLOR_HIGHLIGHTTEXT */
61 TEXT("ButtonFace"), /* 15 = COLOR_BTNFACE */
62 TEXT("ButtonShadow"), /* 16 = COLOR_BTNSHADOW */
63 TEXT("GrayText"), /* 17 = COLOR_GRAYTEXT */
64 TEXT("ButtonText"), /* 18 = COLOR_BTNTEXT */
65 TEXT("InactiveTitleText"), /* 19 = COLOR_INACTIVECAPTIONTEXT */
66 TEXT("ButtonHilight"), /* 20 = COLOR_BTNHIGHLIGHT */
67 TEXT("ButtonDkShadow"), /* 21 = COLOR_3DDKSHADOW */
68 TEXT("ButtonLight"), /* 22 = COLOR_3DLIGHT */
69 TEXT("InfoText"), /* 23 = COLOR_INFOTEXT */
70 TEXT("InfoWindow"), /* 24 = COLOR_INFOBK */
71 TEXT("ButtonAlternateFace"), /* 25 = COLOR_ALTERNATEBTNFACE */
72 TEXT("HotTrackingColor"), /* 26 = COLOR_HOTLIGHT */
73 TEXT("GradientActiveTitle"), /* 27 = COLOR_GRADIENTACTIVECAPTION */
74 TEXT("GradientInactiveTitle"), /* 28 = COLOR_GRADIENTINACTIVECAPTION */
75 TEXT("MenuHilight"), /* 29 = COLOR_MENUHILIGHT */
76 TEXT("MenuBar"), /* 30 = COLOR_MENUBAR */
79 /* This is the list of used metrics and their numbers */
80 const int g_SizeMetric
[NUM_SIZES
] =
96 /******************************************************************************/
99 LoadCurrentTheme(GLOBALS
* g
)
102 NONCLIENTMETRICS NonClientMetrics
;
104 g
->Theme
.bHasChanged
= FALSE
;
105 /* FIXME: it may be custom! */
106 g
->Theme
.bIsCustom
= FALSE
;
109 for (i
= 0; i
<= 30; i
++)
112 g
->Theme
.crColor
[i
] = (COLORREF
)GetSysColor(i
);
116 for (i
= 0; i
<= 11; i
++)
118 g
->Theme
.Size
[i
] = GetSystemMetrics(g_SizeMetric
[i
]);
122 NonClientMetrics
.cbSize
= sizeof(NONCLIENTMETRICS
);
123 SystemParametersInfo(SPI_GETNONCLIENTMETRICS
, sizeof(NONCLIENTMETRICS
), &NonClientMetrics
, 0);
124 g
->Theme
.lfFont
[FONT_CAPTION
] = NonClientMetrics
.lfCaptionFont
;
125 g
->Theme
.lfFont
[FONT_SMCAPTION
] = NonClientMetrics
.lfSmCaptionFont
;
126 g
->Theme
.lfFont
[FONT_MENU
] = NonClientMetrics
.lfMenuFont
;
127 g
->Theme
.lfFont
[FONT_INFO
] = NonClientMetrics
.lfStatusFont
;
128 g
->Theme
.lfFont
[FONT_DIALOG
] = NonClientMetrics
.lfMessageFont
;
129 SystemParametersInfo(SPI_GETICONTITLELOGFONT
, sizeof(LOGFONT
), &g
->Theme
.lfFont
[FONT_ICON
], 0);
134 LoadThemeFromReg(GLOBALS
* g
, INT iPreset
)
137 TCHAR strSizeName
[20] = {TEXT("Sizes\\0")};
138 TCHAR strValueName
[10];
139 HKEY hkNewSchemes
, hkScheme
, hkSize
;
140 DWORD dwType
, dwLength
;
143 if(RegOpenKeyEx(HKEY_CURRENT_USER
, TEXT("Control Panel\\Appearance\\New Schemes"),
144 0, KEY_READ
, &hkNewSchemes
) == ERROR_SUCCESS
)
146 if(RegOpenKeyEx(hkNewSchemes
, g
->ThemeTemplates
[iPreset
].strKeyName
, 0, KEY_READ
, &hkScheme
) == ERROR_SUCCESS
)
148 lstrcpyn(&strSizeName
[6],g
->ThemeTemplates
[iPreset
].strSizeName
, 3);
149 if(RegOpenKeyEx(hkScheme
, strSizeName
, 0, KEY_READ
, &hkSize
) == ERROR_SUCCESS
)
153 dwLength
= sizeof(DWORD
);
154 if (RegQueryValueEx(hkSize
, TEXT("FlatMenus"), NULL
, &dwType
, (LPBYTE
)&g
->Theme
.bFlatMenus
, &dwLength
) != ERROR_SUCCESS
||
155 dwType
!= REG_DWORD
|| dwLength
!= sizeof(DWORD
))
157 /* Failed to read registry value */
158 g
->Theme
.bFlatMenus
= FALSE
;
162 for (i
= 0; i
<= 30; i
++)
164 wsprintf(strValueName
, TEXT("Color #%d"), i
);
165 dwLength
= sizeof(COLORREF
);
166 if (RegQueryValueEx(hkSize
, strValueName
, NULL
, &dwType
, (LPBYTE
)&g
->Theme
.crColor
[i
], &dwLength
) != ERROR_SUCCESS
||
167 dwType
!= REG_DWORD
|| dwLength
!= sizeof(COLORREF
))
169 /* Failed to read registry value, initialize with current setting for now */
170 g
->Theme
.crColor
[i
] = GetSysColor(i
);
174 for (i
= 0; i
<= 5; i
++)
176 wsprintf(strValueName
, TEXT("Font #%d"), i
);
177 dwLength
= sizeof(LOGFONT
);
178 g
->Theme
.lfFont
[i
].lfFaceName
[0] = 'x';
179 if (RegQueryValueEx(hkSize
, strValueName
, NULL
, &dwType
, (LPBYTE
)&g
->Theme
.lfFont
[i
], &dwLength
) != ERROR_SUCCESS
||
180 dwType
!= REG_BINARY
|| dwLength
!= sizeof(LOGFONT
))
182 /* Failed to read registry value */
186 for (i
= 0; i
<= 8; i
++)
188 wsprintf(strValueName
, TEXT("Size #%d"), i
);
189 dwLength
= sizeof(UINT64
);
190 if (RegQueryValueEx(hkSize
, strValueName
, NULL
, &dwType
, (LPBYTE
)&g
->Theme
.Size
[i
], &dwLength
) != ERROR_SUCCESS
||
191 dwType
!= REG_QWORD
|| dwLength
!= sizeof(UINT64
))
193 /* Failed to read registry value, initialize with current setting for now */
194 g
->Theme
.Size
[i
] = GetSystemMetrics(g_SizeMetric
[i
]);
198 RegCloseKey(hkScheme
);
200 RegCloseKey(hkScheme
);
202 RegCloseKey(hkNewSchemes
);
210 ApplyTheme(GLOBALS
* g
)
214 DWORD dwDisposition
= 0;
215 TCHAR clText
[16] = {0};
216 NONCLIENTMETRICS NonClientMetrics
;
218 LOGFONT lfButtonFont
;
220 if (!g
->Theme
.bHasChanged
)
223 g
->Theme
.bHasChanged
= FALSE
;
225 /* Update some globals */
226 g
->crCOLOR_BTNFACE
= g
->Theme
.crColor
[COLOR_BTNFACE
];
227 g
->crCOLOR_BTNTEXT
= g
->Theme
.crColor
[COLOR_BTNTEXT
];
228 g
->crCOLOR_BTNSHADOW
= g
->Theme
.crColor
[COLOR_BTNSHADOW
];
229 g
->crCOLOR_BTNHIGHLIGHT
= g
->Theme
.crColor
[COLOR_BTNHIGHLIGHT
];
230 lfButtonFont
= g
->Theme
.lfFont
[FONT_DIALOG
];
232 /* Create new font for bold button */
233 lfButtonFont
.lfWeight
= FW_BOLD
;
234 lfButtonFont
.lfItalic
= FALSE
;
235 hMyFont
= CreateFontIndirect(&lfButtonFont
);
239 DeleteObject(g
->hBoldFont
);
240 g
->hBoldFont
= hMyFont
;
243 /* Create new font for italic button */
244 lfButtonFont
.lfWeight
= FW_REGULAR
;
245 lfButtonFont
.lfItalic
= TRUE
;
246 hMyFont
= CreateFontIndirect(&lfButtonFont
);
250 DeleteObject(g
->hItalicFont
);
251 g
->hItalicFont
= hMyFont
;
254 /* Apply Colors from global variable */
255 SetSysColors(30, &g
->ColorList
[0], &g
->Theme
.crColor
[0]);
257 /* Save colors to registry */
258 Result
= RegOpenKeyEx(HKEY_CURRENT_USER
, TEXT("Control Panel\\Colors"), 0, KEY_ALL_ACCESS
, &hKey
);
259 if (Result
!= ERROR_SUCCESS
)
261 /* Could not open the key, try to create it */
262 Result
= RegCreateKeyEx(HKEY_CURRENT_USER
, TEXT("Control Panel\\Colors"), 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
,&hKey
, &dwDisposition
);
265 if (Result
== ERROR_SUCCESS
)
267 for (i
= 0; i
<= 30; i
++)
269 DWORD red
= GetRValue(g
->Theme
.crColor
[i
]);
270 DWORD green
= GetGValue(g
->Theme
.crColor
[i
]);
271 DWORD blue
= GetBValue(g
->Theme
.crColor
[i
]);
272 wsprintf(clText
, TEXT("%d %d %d"), red
, green
, blue
);
273 RegSetValueEx(hKey
, g_RegColorNames
[i
], 0, REG_SZ
, (BYTE
*)clText
, lstrlen( clText
)*sizeof(TCHAR
) + sizeof(TCHAR
));
279 /* Apply the fonts */
280 NonClientMetrics
.cbSize
= sizeof(NONCLIENTMETRICS
);
281 SystemParametersInfo(SPI_GETNONCLIENTMETRICS
, sizeof(NONCLIENTMETRICS
), &NonClientMetrics
, 0);
282 NonClientMetrics
.lfCaptionFont
= g
->Theme
.lfFont
[FONT_CAPTION
];
283 NonClientMetrics
.lfSmCaptionFont
= g
->Theme
.lfFont
[FONT_SMCAPTION
];
284 NonClientMetrics
.lfMenuFont
= g
->Theme
.lfFont
[FONT_MENU
];
285 NonClientMetrics
.lfStatusFont
= g
->Theme
.lfFont
[FONT_INFO
];
286 NonClientMetrics
.lfMessageFont
= g
->Theme
.lfFont
[FONT_DIALOG
];
287 SystemParametersInfo(SPI_SETNONCLIENTMETRICS
, sizeof(NONCLIENTMETRICS
), &NonClientMetrics
, 0);
288 SystemParametersInfo(SPI_SETICONTITLELOGFONT
, sizeof(LOGFONT
), &g
->Theme
.lfFont
[FONT_ICON
], 0);
290 /* FIXME: Apply size metrics */
292 /* Save fonts and size metrics to registry */
293 Result
= RegOpenKeyEx(HKEY_CURRENT_USER
, TEXT("Control Panel\\Desktop\\WindowMetrics"), 0, KEY_ALL_ACCESS
, &hKey
);
294 if (Result
!= ERROR_SUCCESS
)
296 /* Could not open the key, try to create it */
297 Result
= RegCreateKeyEx(HKEY_CURRENT_USER
, TEXT("Control Panel\\Desktop\\WindowMetrics"), 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
,&hKey
, &dwDisposition
);
300 if (Result
== ERROR_SUCCESS
)
302 RegSetValueEx(hKey
, TEXT("CaptionFont"), 0, REG_BINARY
, (BYTE
*)&g
->Theme
.lfFont
[FONT_CAPTION
], sizeof(LOGFONT
));
303 RegSetValueEx(hKey
, TEXT("SmCaptionFont"), 0, REG_BINARY
, (BYTE
*)&g
->Theme
.lfFont
[FONT_SMCAPTION
], sizeof(LOGFONT
));
304 RegSetValueEx(hKey
, TEXT("IconFont"), 0, REG_BINARY
, (BYTE
*)&g
->Theme
.lfFont
[FONT_ICON
], sizeof(LOGFONT
));
305 RegSetValueEx(hKey
, TEXT("MenuFont"), 0, REG_BINARY
, (BYTE
*)&g
->Theme
.lfFont
[FONT_MENU
], sizeof(LOGFONT
));
306 RegSetValueEx(hKey
, TEXT("StatusFont"), 0, REG_BINARY
, (BYTE
*)&g
->Theme
.lfFont
[FONT_INFO
], sizeof(LOGFONT
));
307 RegSetValueEx(hKey
, TEXT("MessageFont"), 0, REG_BINARY
, (BYTE
*)&g
->Theme
.lfFont
[FONT_DIALOG
], sizeof(LOGFONT
));
309 /* Save size metrics to registry */
310 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_BORDER_X
]);
311 RegSetValueEx(hKey
, TEXT("BorderWidth"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
312 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_CAPTION_Y
]);
313 RegSetValueEx(hKey
, TEXT("CaptionWidth"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
314 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_CAPTION_Y
]);
315 RegSetValueEx(hKey
, TEXT("CaptionHeight"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
316 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_SMCAPTION_Y
]);
317 RegSetValueEx(hKey
, TEXT("SmCaptionWidth"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
318 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_SMCAPTION_Y
]);
319 RegSetValueEx(hKey
, TEXT("SmCaptionHeight"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
320 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_ICON_SPC_X
]);
321 RegSetValueEx(hKey
, TEXT("IconSpacing"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
322 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_ICON_SPC_Y
]);
323 RegSetValueEx(hKey
, TEXT("IconVerticalSpacing"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
324 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_MENU_X
]);
325 RegSetValueEx(hKey
, TEXT("MenuWidth"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
326 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_MENU_Y
]);
327 RegSetValueEx(hKey
, TEXT("MenuHeight"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
328 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_SCROLL_X
]);
329 RegSetValueEx(hKey
, TEXT("ScrollWidth"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
330 wsprintf(clText
, TEXT("%d"), -15 * g
->Theme
.Size
[SIZE_SCROLL_Y
]);
331 RegSetValueEx(hKey
, TEXT("ScrollHeight"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
332 wsprintf(clText
, TEXT("%d"), g
->Theme
.Size
[SIZE_ICON_X
]);
333 RegSetValueEx(hKey
, TEXT("Shell Icon Sizet"), 0, REG_SZ
, (BYTE
*)clText
, sizeof(clText
));
341 AppearancePage_OnInit(HWND hwndDlg
, GLOBALS
*g
)
343 HKEY hkNewSchemes
, hkScheme
, hkSizes
, hkSize
;
344 FILETIME ftLastWriteTime
;
345 TCHAR strSelectedStyle
[4];
346 DWORD dwLength
, dwType
;
347 DWORD dwDisposition
= 0;
348 INT iStyle
, iSize
, iTemplateIndex
, iListIndex
= 0;
351 g
= (GLOBALS
*)malloc(sizeof(GLOBALS
));
357 SetWindowLongPtr(hwndDlg
, DWLP_USER
, (LONG_PTR
)g
);
361 /* Fill color schemes combo */
362 Result
= RegOpenKeyEx(HKEY_CURRENT_USER
, TEXT("Control Panel\\Appearance\\New Schemes"),
363 0, KEY_READ
, &hkNewSchemes
);
364 if (Result
!= ERROR_SUCCESS
)
366 /* Could not open the key, try to create it */
367 Result
= RegCreateKeyEx(HKEY_CURRENT_USER
, TEXT("Control Panel\\Appearance\\New Schemes"), 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
,&hkNewSchemes
, &dwDisposition
);
368 if (Result
== ERROR_SUCCESS
)
370 /* FIXME: We have created it new, so let's put somethig there */
373 if (Result
== ERROR_SUCCESS
)
375 /* First find out the currently selected template */
377 RegQueryValueEx(hkNewSchemes
, TEXT("SelectedStyle"), NULL
, &dwType
, (LPBYTE
)&strSelectedStyle
, &dwLength
);
380 dwLength
= MAX_TEMPLATENAMELENTGH
;
381 while((RegEnumKeyEx(hkNewSchemes
, iStyle
, g
->ThemeTemplates
[iTemplateIndex
].strKeyName
, &dwLength
,
382 NULL
, NULL
, NULL
, &ftLastWriteTime
) == ERROR_SUCCESS
) && (iTemplateIndex
< MAX_TEMPLATES
))
384 /* is it really a template or one of the other entries */
387 if (RegOpenKeyEx(hkNewSchemes
, g
->ThemeTemplates
[iTemplateIndex
].strKeyName
, 0, KEY_READ
, &hkScheme
) == ERROR_SUCCESS
)
389 if(RegOpenKeyEx(hkScheme
, TEXT("Sizes"), 0, KEY_READ
, &hkSizes
) == ERROR_SUCCESS
)
393 while((RegEnumKeyEx(hkSizes
, iSize
, g
->ThemeTemplates
[iTemplateIndex
].strSizeName
, &dwLength
,
394 NULL
, NULL
, NULL
, &ftLastWriteTime
) == ERROR_SUCCESS
) && (iSize
<= 4))
396 if(RegOpenKeyEx(hkSizes
, g
->ThemeTemplates
[iTemplateIndex
].strSizeName
, 0, KEY_READ
, &hkSize
) == ERROR_SUCCESS
)
398 dwLength
= MAX_TEMPLATENAMELENTGH
;
399 RegQueryValueEx(hkSize
, TEXT("DisplayName"), NULL
, &dwType
, (LPBYTE
)&g
->ThemeTemplates
[iTemplateIndex
].strDisplayName
, &dwLength
);
400 dwLength
= MAX_TEMPLATENAMELENTGH
;
401 RegQueryValueEx(hkSize
, TEXT("LegacyName"), NULL
, &dwType
, (LPBYTE
)&g
->ThemeTemplates
[iTemplateIndex
].strLegacyName
, &dwLength
);
404 iListIndex
= SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_COLORSCHEME
, CB_ADDSTRING
, 0, (LPARAM
)g
->ThemeTemplates
[iTemplateIndex
].strLegacyName
);
405 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_COLORSCHEME
, CB_SETITEMDATA
, iListIndex
, iTemplateIndex
);
406 if (lstrcmp(g
->ThemeTemplates
[iTemplateIndex
].strKeyName
, strSelectedStyle
) == 0)
408 SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_COLORSCHEME
, CB_SETCURSEL
, (WPARAM
)iListIndex
, 0);
414 RegCloseKey(hkSizes
);
416 RegCloseKey(hkScheme
);
420 dwLength
= MAX_TEMPLATENAMELENTGH
;
422 RegCloseKey(hkNewSchemes
);
424 SendMessage(GetDlgItem(hwndDlg
, IDC_APPEARANCE_COLORSCHEME
), LB_SETCURSEL
, 0, 0);
431 AppearancePage_OnDestroy(HWND hwndDlg
, GLOBALS
*g
)
439 AppearancePageProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
445 g
= (GLOBALS
*)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
450 return AppearancePage_OnInit(hwndDlg
, g
);
453 return AppearancePage_OnDestroy(hwndDlg
, g
);
456 switch (LOWORD(wParam
))
458 case IDC_APPEARANCE_ADVANCED
:
459 DialogBoxParam(hApplet
, (LPCTSTR
)IDD_ADVAPPEARANCE
,
460 hwndDlg
, AdvAppearanceDlgProc
, (LPARAM
)g
);
462 /* Was anything changed in the advanced appearance dialog? */
463 if (memcmp(&g
->Theme
, &g
->ThemeAdv
, sizeof(THEME
)) != 0)
465 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
466 g
->Theme
= g
->ThemeAdv
;
467 g
->Theme
.bHasChanged
= TRUE
;
471 case IDC_APPEARANCE_COLORSCHEME
:
472 if(HIWORD(wParam
) == CBN_SELCHANGE
)
474 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
475 g
->Theme
.bHasChanged
= TRUE
;
476 i
= SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_COLORSCHEME
, CB_GETCURSEL
, 0, 0);
477 index
= SendDlgItemMessage(hwndDlg
, IDC_APPEARANCE_COLORSCHEME
, CB_GETITEMDATA
, (WPARAM
)i
, 0);
478 LoadThemeFromReg(g
, index
);
488 lpnm
= (LPNMHDR
)lParam
;
492 if (g
->Theme
.bHasChanged
)