xref: /reactos/dll/cpl/desk/appearance.h (revision 8a978a17)
1 #pragma once
2 
3 /* Some definitions for theme */
4 #define SIZE_BORDER_WIDTH       0
5 #define SIZE_SCROLL_WIDTH       1
6 #define SIZE_SCROLL_HEIGHT      2
7 #define SIZE_CAPTION_WIDTH      3
8 #define SIZE_CAPTION_HEIGHT     4
9 #define SIZE_SM_CAPTION_WIDTH   5
10 #define SIZE_SM_CAPTION_HEIGHT  6
11 #define SIZE_MENU_WIDTH         7
12 #define SIZE_MENU_HEIGHT        8
13 
14 #define SIZE_ICON_SPACE_X       9
15 #define SIZE_ICON_SPACE_Y       10
16 #define SIZE_ICON               11
17 
18 #define FONT_CAPTION            0
19 #define FONT_SMCAPTION          1
20 #define FONT_MENU               2
21 #define FONT_STATUS             3
22 #define FONT_MESSAGE            4
23 #define FONT_ICON               5
24 
25 #define NUM_ELEMENTS            18
26 #define NUM_FONTS               6
27 #define NUM_SIZES               9
28 #define NUM_COLORS              31
29 #define MAX_TEMPLATES           50
30 #define MAX_TEMPLATENAMELENTGH  80
31 
32 /* Some typedefs for theme */
33 
34 /* Most (but not all) fields below correspond to HKCU\Control Panel\Desktop\UserPreferencesMask */
35 typedef struct
36 {
37     BOOL bActiveWindowTracking;
38     BOOL bMenuAnimation;
39     BOOL bComboBoxAnimation;
40     BOOL bListBoxSmoothScrolling;
41     BOOL bGradientCaptions;
42     BOOL bKeyboardCues;
43     BOOL bActiveWndTrkZorder;
44     BOOL bHotTracking;
45     BOOL bMenuFade;
46     BOOL bSelectionFade;
47     BOOL bTooltipAnimation;
48     BOOL bTooltipFade;
49     BOOL bCursorShadow;
50     BOOL bDropShadow;
51     BOOL bUiEffects;
52     BOOL bFontSmoothing;
53     UINT uiFontSmoothingType;
54     BOOL bDragFullWindows;
55 } EFFECTS;
56 
57 typedef struct
58 {
59     NONCLIENTMETRICSW ncMetrics;
60     ICONMETRICSW icMetrics;
61     COLORREF crColor[NUM_COLORS];
62     INT iIconSize;
63     BOOL bFlatMenus;
64     EFFECTS Effects;
65 } COLOR_SCHEME, *PCOLOR_SCHEME;
66 
67 /*
68  * The classic theme has several different 'colours' and every colour has
69  * several sizes. On visual styles however a theme has different colours
70  * and different sizes. In other words the user can select a combination
71  * of colour and size.
72  * That means that for the classic theme THEME.SizesList is unused and
73  * every color has some child styles that correspond its sizes.
74  * The themes for visual styles however will use both ColoursList and SizesList
75  * and ChildStyle will not be used.
76  */
77 
78 /* struct for holding theme colors and sizes */
79 typedef struct _THEME_STYLE
80 {
81     struct _THEME_STYLE *NextStyle;
82     struct _THEME_STYLE *ChildStyle;
83     PWSTR StyleName;
84     PWSTR DisplayName;
85 } THEME_STYLE, *PTHEME_STYLE;
86 
87 typedef struct _THEME
88 {
89     struct _THEME *NextTheme;
90     PWSTR ThemeFileName;
91     PWSTR DisplayName;
92     THEME_STYLE *ColoursList;
93     THEME_STYLE *SizesList;
94 } THEME, *PTHEME;
95 
96 typedef struct _THEME_SELECTION
97 {
98     BOOL ThemeActive;
99     PTHEME Theme;
100     PTHEME_STYLE Color;
101     PTHEME_STYLE Size;
102 } THEME_SELECTION, *PTHEME_SELECTION;
103 
104 /*
105  * This is the global structure used to store the current values.
106  * A pointer of this get's passed to the functions either directly
107  * or by passing hwnd and getting the pointer by GetWindowLongPtr.
108  */
109 typedef struct tagGLOBALS
110 {
111     PTHEME pThemes;
112 
113     /*
114      * Keep a copy of the selected classic theme in order to select this
115      * when user selects the classic theme (and not a horrible random theme )
116      */
117     THEME_SELECTION ClassicTheme;
118     THEME_SELECTION ActiveTheme;
119 
120     COLOR_SCHEME Scheme;
121     COLOR_SCHEME SchemeAdv;
122     BOOL bThemeChanged;
123     BOOL bSchemeChanged;
124     HBITMAP hbmpColor[3];
125     INT CurrentElement;
126     HFONT hBoldFont;
127     HFONT hItalicFont;
128     BOOL bInitializing;
129 
130     HBITMAP hbmpThemePreview;
131     HDC hdcThemePreview;
132 } GLOBALS;
133 
134 /* prototypes for theme.c */
135 VOID SchemeSetMetric(COLOR_SCHEME *scheme, int id, int value);
136 int SchemeGetMetric(COLOR_SCHEME *scheme, int id);
137 PLOGFONTW SchemeGetFont(COLOR_SCHEME *scheme, int id);
138 PTHEME LoadTheme(IN LPCWSTR pszThemeFileName,IN LPCWSTR pszThemeName);
139 PTHEME LoadThemes(VOID);
140 BOOL FindOrAppendTheme(IN PTHEME pThemeList, IN LPCWSTR pwszThemeFileName, IN LPCWSTR pwszColorBuff, IN LPCWSTR pwszSizeBuff, OUT PTHEME_SELECTION pSelectedTheme);
141 BOOL GetActiveTheme(PTHEME pThemeList, PTHEME_SELECTION pSelectedTheme);
142 BOOL GetActiveClassicTheme(PTHEME pThemeList, PTHEME_SELECTION pSelectedTheme);
143 BOOL LoadCurrentScheme(PCOLOR_SCHEME scheme);
144 BOOL LoadSchemeFromReg(PCOLOR_SCHEME scheme, PTHEME_SELECTION pSelectedTheme);
145 BOOL LoadSchemeFromTheme(PCOLOR_SCHEME scheme, PTHEME_SELECTION pSelectedTheme);
146 VOID ApplyScheme(PCOLOR_SCHEME scheme, PTHEME_SELECTION pSelectedTheme);
147 BOOL ActivateTheme(PTHEME_SELECTION pSelectedTheme);
148 void CleanupThemes(IN PTHEME pThemeList);
149 BOOL DrawThemePreview(HDC hdcMem, PCOLOR_SCHEME scheme, PTHEME_SELECTION pSelectedTheme, PRECT prcWindow);
150 BOOL ActivateThemeFile(LPCWSTR pwszFile);
151 
152 /* prototypes for appearance.c */
153 INT_PTR CALLBACK AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
154 
155 /* prototypes for advappdlg.c */
156 INT_PTR CALLBACK AdvAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
157 
158 /* prototypes for effappdlg.c */
159 INT_PTR CALLBACK EffAppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
160