xref: /reactos/dll/cpl/desk/desk.h (revision 769fcd89)
1 #ifndef _DESK_H
2 #define _DESK_H
3 
4 #include <stdarg.h>
5 
6 #define WIN32_NO_STATUS
7 #define _INC_WINDOWS
8 #define COM_NO_WINDOWS_H
9 
10 #define COBJMACROS
11 
12 #include <windef.h>
13 #include <winbase.h>
14 #include <winreg.h>
15 #include <wingdi.h>
16 #include <winuser.h>
17 #include <wincon.h>
18 #include <commdlg.h>
19 #include <cpl.h>
20 #include <tchar.h>
21 #include <setupapi.h>
22 #include <shlobj.h>
23 #include <regstr.h>
24 #include <dll/desk/deskcplx.h>
25 #include <strsafe.h>
26 #include <gdiplus.h>
27 
28 #include "appearance.h"
29 #include "preview.h"
30 #include "draw.h"
31 #include "monslctl.h"
32 
33 #include "resource.h"
34 
35 typedef struct _APPLET
36 {
37     int idIcon;
38     int idName;
39     int idDescription;
40     APPLET_PROC AppletProc;
41 } APPLET, *PAPPLET;
42 
43 typedef struct _DIBITMAP
44 {
45     BITMAPINFO       *info;
46     BYTE             *bits;
47     UINT              width;
48     UINT              height;
49 } DIBITMAP, *PDIBITMAP;
50 
51 extern HINSTANCE hApplet;
52 
53 HMENU
54 LoadPopupMenu(IN HINSTANCE hInstance,
55               IN LPCTSTR lpMenuName);
56 
57 PDIBITMAP DibLoadImage(LPTSTR lpFilename);
58 VOID DibFreeImage(PDIBITMAP lpBitmap);
59 
60 INT AllocAndLoadString(LPTSTR *lpTarget,
61                        HINSTANCE hInst,
62                        UINT uID);
63 
64 ULONG __cdecl DbgPrint(PCCH Format,...);
65 
66 /*
67  * The values in these macros are dependent on the
68  * layout of the monitor image and they must be adjusted
69  * if that image is changed.
70  */
71 #define MONITOR_LEFT        20
72 #define MONITOR_TOP         8
73 #define MONITOR_RIGHT       140
74 #define MONITOR_BOTTOM      92
75 
76 #define MONITOR_WIDTH       (MONITOR_RIGHT-MONITOR_LEFT)
77 #define MONITOR_HEIGHT      (MONITOR_BOTTOM-MONITOR_TOP)
78 
79 #define MONITOR_ALPHA       0xFF00FF
80 
81 #define MAX_DESK_PAGES        32
82 #define NUM_SPECTRUM_BITMAPS  3
83 
84 #define NUM_DESKTOP_ICONS  4  /* DesktopIcons array size */
85 #define NUM_CHANGE_ICONS   5  /* IconChange array size */
86 
87 typedef struct
88 {
89     BOOL bHideClassic;  /* Hide icon in Classic mode */
90     BOOL bHideNewStart; /* Hide icon in Modern Start menu mode */
91 } HIDE_ICON;
92 
93 typedef struct _ICON_PATH
94 {
95     TCHAR szPath[MAX_PATH];
96 } ICON_PATH;
97 
98 typedef struct _ICON_DATA
99 {
100     TCHAR szPath[MAX_PATH];
101     TCHAR szTitle[40];
102 } ICON_DATA;
103 
104 typedef struct _DESKTOP_DATA
105 {
106     BOOL bSettingsChanged;
107     HIDE_ICON optIcons[NUM_DESKTOP_ICONS];
108     BOOL bHideChanged[NUM_DESKTOP_ICONS];
109     BOOL bIconChanged[NUM_CHANGE_ICONS];
110     ICON_PATH Icon[NUM_CHANGE_ICONS];
111     ICON_PATH DefIcon[NUM_CHANGE_ICONS];
112 
113     BOOL bLocalSettingsChanged;
114     BOOL bLocalHideIcon[NUM_DESKTOP_ICONS];
115     BOOL bLocalHideChanged[NUM_DESKTOP_ICONS];
116     BOOL bLocalIconChanged[NUM_CHANGE_ICONS];
117     ICON_DATA LocalIcon[NUM_CHANGE_ICONS];
118     HIMAGELIST hLocalImageList;
119     INT iLocalCurIcon;
120 } DESKTOP_DATA, *PDESKTOP_DATA;
121 
122 /* As slider control can't contain user data, we have to keep an
123  * array of RESOLUTION_INFO to have our own associated data.
124  */
125 typedef struct _RESOLUTION_INFO
126 {
127     DWORD dmPelsWidth;
128     DWORD dmPelsHeight;
129 } RESOLUTION_INFO, *PRESOLUTION_INFO;
130 
131 typedef struct _SETTINGS_ENTRY
132 {
133     struct _SETTINGS_ENTRY *Blink;
134     struct _SETTINGS_ENTRY *Flink;
135     DWORD dmBitsPerPel;
136     DWORD dmPelsWidth;
137     DWORD dmPelsHeight;
138     DWORD dmDisplayFrequency;
139 } SETTINGS_ENTRY, *PSETTINGS_ENTRY;
140 
141 typedef struct _DISPLAY_DEVICE_ENTRY
142 {
143     struct _DISPLAY_DEVICE_ENTRY *Flink;
144     LPTSTR DeviceDescription;
145     LPTSTR DeviceName;
146     LPTSTR DeviceKey;
147     LPTSTR DeviceID;
148     DWORD DeviceStateFlags;
149     PSETTINGS_ENTRY Settings; /* Sorted by increasing dmPelsHeight, BPP */
150     DWORD SettingsCount;
151     PRESOLUTION_INFO Resolutions;
152     DWORD ResolutionsCount;
153     PSETTINGS_ENTRY CurrentSettings; /* Points into Settings list */
154     SETTINGS_ENTRY InitialSettings;
155 } DISPLAY_DEVICE_ENTRY, *PDISPLAY_DEVICE_ENTRY;
156 
157 typedef struct _GLOBAL_DATA
158 {
159     COLORREF desktop_color;
160     LPCWSTR pwszFile;
161     LPCWSTR pwszAction;
162     HBITMAP hMonitorBitmap;
163     LONG bmMonWidth;
164     LONG bmMonHeight;
165 } GLOBAL_DATA, *PGLOBAL_DATA;
166 
167 extern GLOBAL_DATA g_GlobalData;
168 extern HWND hCPLWindow;
169 
170 BOOL
171 DisplayAdvancedSettings(HWND hWndParent, PDISPLAY_DEVICE_ENTRY DisplayDevice);
172 
173 IDataObject *
174 CreateDevSettings(PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo);
175 
176 HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY,LPCWSTR,UINT,IDataObject*);
177 
178 INT_PTR CALLBACK
179 AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
180 
181 BOOL
182 SwitchDisplayMode(HWND hwndDlg, PWSTR DeviceName, PSETTINGS_ENTRY seInit, PSETTINGS_ENTRY seNew, OUT PLONG rc);
183 
184 INT_PTR CALLBACK
185 DesktopPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
186 
187 VOID
188 InitDesktopSettings(PDESKTOP_DATA pData);
189 
190 BOOL
191 SaveDesktopSettings(PDESKTOP_DATA pData);
192 
193 VOID
194 SetDesktopSettings(PDESKTOP_DATA pData);
195 
196 LONG
197 RegLoadMUIStringW(IN HKEY hKey,
198                   IN LPCWSTR pszValue  OPTIONAL,
199                   OUT LPWSTR pszOutBuf,
200                   IN DWORD cbOutBuf,
201                   OUT LPDWORD pcbData OPTIONAL,
202                   IN DWORD Flags,
203                   IN LPCWSTR pszDirectory  OPTIONAL);
204 
205 #endif /* _DESK_H */
206