[CSCRIPT][WSCRIPT] Sync with Wine Staging 3.17. CORE-15127
[reactos.git] / base / shell / progman / progman.h
1 /*
2 * Program Manager
3 *
4 * Copyright 1996 Ulrich Schmid
5 * Copyright 2002 Sylvain Petreolle
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22 /*
23 * PROJECT: ReactOS Program Manager
24 * COPYRIGHT: GPL - See COPYING in the top level directory
25 * FILE: base/shell/progman/progman.h
26 * PURPOSE: ProgMan header
27 * PROGRAMMERS: Ulrich Schmid
28 * Sylvain Petreolle
29 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
30 */
31
32 #ifndef PROGMAN_H
33 #define PROGMAN_H
34
35 #include <stdio.h>
36 #include <stdlib.h>
37
38 #define WIN32_NO_STATUS
39 #include <windef.h>
40 #include <winbase.h>
41 #include <winreg.h>
42 #include <wingdi.h>
43 #include <winuser.h>
44
45 #include <shellapi.h>
46
47 #include <commctrl.h>
48 #include <richedit.h>
49
50 #include <windowsx.h>
51 #include <strsafe.h>
52
53 #define MAX_STRING_LEN 255
54 #define MAX_PATHNAME_LEN 1024
55 #define MAX_LANGUAGE_NUMBER (PM_LAST_LANGUAGE - PM_FIRST_LANGUAGE)
56
57 #include "resource.h"
58
59 /* Fallback icon */
60 #define DEFAULTICON OIC_WINLOGO
61
62 #define DEF_GROUP_WIN_XPOS 100
63 #define DEF_GROUP_WIN_YPOS 100
64 #define DEF_GROUP_WIN_WIDTH 300
65 #define DEF_GROUP_WIN_HEIGHT 200
66
67
68 /*
69 * windowsx.h extensions
70 */
71 #define EnableDlgItem(hDlg, nID, bEnable) \
72 EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
73
74
75
76
77
78 typedef struct _PROGRAM PROGRAM, *PPROGRAM;
79 typedef struct _PROGGROUP PROGGROUP, *PPROGGROUP;
80
81 struct _PROGRAM
82 {
83 PROGGROUP* hGroup;
84 PROGRAM* hPrior;
85 PROGRAM* hNext;
86 HWND hWnd;
87
88 INT iItem;
89 INT x;
90 INT y;
91 INT nIconIndex;
92 HICON hIcon;
93 LPWSTR hName;
94 LPWSTR hCmdLine;
95 LPWSTR hIconFile;
96 LPWSTR hWorkDir; /* Extension 0x8101 */
97 INT nHotKey; /* Extension 0x8102 */
98 INT nCmdShow; /* Extension 0x8103 */
99 BOOL bNewVDM; /* Extension 0x8104 */
100
101 SIZE_T TagsSize;
102 PVOID Tags;
103 }; // PROGRAM, *PPROGRAM;
104
105 typedef enum _GROUPFORMAT
106 {
107 Win_311 = 0x0,
108 NT_Ansi = 0x1, // 0x02
109 NT_Unicode = 0x2, // 0x03
110 } GROUPFORMAT;
111
112 struct _PROGGROUP
113 {
114 PROGGROUP* hPrior;
115 PROGGROUP* hNext;
116 HWND hWnd;
117
118 HWND hListView;
119 HIMAGELIST hListLarge;
120 HIMAGELIST hDragImageList;
121 HICON hOldCursor;
122 POINT ptStart;
123 BOOL bDragging;
124
125 GROUPFORMAT format;
126 BOOL bIsCommonGroup;
127 // BOOL bFileNameModified;
128 BOOL bOverwriteFileOk;
129 LPWSTR hGrpFile;
130 INT seqnum;
131 INT nCmdShow;
132 INT x;
133 INT y;
134 INT width;
135 INT height;
136 INT iconx;
137 INT icony;
138 LPWSTR hName;
139 PROGRAM* hPrograms;
140 PROGRAM* hActiveProgram;
141
142 SIZE_T TagsSize;
143 PVOID Tags;
144 }; // PROGGROUP, *PPROGGROUP;
145
146
147 typedef struct _GLOBALS
148 {
149 HINSTANCE hInstance;
150 HACCEL hAccel;
151 HWND hMainWnd;
152 HWND hMDIWnd;
153 HICON hDefaultIcon;
154 HICON hMainIcon;
155 // HICON hGroupIcon;
156 HICON hPersonalGroupIcon;
157 HICON hCommonGroupIcon;
158 HMENU hMainMenu;
159 HMENU hFileMenu;
160 HMENU hOptionMenu;
161 HMENU hWindowsMenu;
162 HMENU hLanguageMenu;
163
164 HKEY hKeyProgMan;
165 HKEY hKeyPMSettings;
166 HKEY hKeyPMCommonGroups;
167 HKEY hKeyPMAnsiGroups;
168 HKEY hKeyPMUnicodeGroups;
169 HKEY hKeyAnsiGroups;
170 HKEY hKeyUnicodeGroups;
171 HKEY hKeyCommonGroups;
172
173 BOOL bAutoArrange;
174 BOOL bSaveSettings;
175 BOOL bMinOnRun;
176 PROGGROUP* hGroups;
177 PROGGROUP* hActiveGroup;
178 // int field_74;
179 // int field_78;
180 // PROGGROUP* field_79;
181 } GLOBALS, *PGLOBALS;
182
183 extern GLOBALS Globals;
184 extern WCHAR szTitle[256];
185
186
187 /*
188 * Memory management functions
189 */
190 PVOID
191 Alloc(IN DWORD dwFlags,
192 IN SIZE_T dwBytes);
193
194 BOOL
195 Free(IN PVOID lpMem);
196
197 PVOID
198 ReAlloc(IN DWORD dwFlags,
199 IN PVOID lpMem,
200 IN SIZE_T dwBytes);
201
202 PVOID
203 AppendToBuffer(IN PVOID pBuffer,
204 IN PSIZE_T pdwBufferSize,
205 IN PVOID pData,
206 IN SIZE_T dwDataSize);
207
208
209 INT MAIN_MessageBoxIDS(UINT ids_text, UINT ids_title, WORD type);
210 INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCWSTR str, UINT ids_title, WORD type);
211 VOID MAIN_ReplaceString(LPWSTR* string, LPWSTR replace);
212
213 DWORD GRPFILE_ReadGroupFile(LPCWSTR lpszPath, BOOL bIsCommonGroup);
214 BOOL GRPFILE_WriteGroupFile(PROGGROUP* hGroup);
215
216 ATOM GROUP_RegisterGroupWinClass(VOID);
217 PROGGROUP* GROUP_AddGroup(GROUPFORMAT format, BOOL bIsCommonGroup, LPCWSTR lpszName, LPCWSTR lpszGrpFile,
218 INT left, INT top, INT right, INT bottom, INT xMin, INT yMin, INT nCmdShow,
219 WORD cxIcon, WORD cyIcon, BOOL bOverwriteFileOk,
220 /* FIXME shouldn't be necessary */
221 BOOL bSuppressShowWindow);
222 VOID GROUP_NewGroup(GROUPFORMAT format, BOOL bIsCommonGroup);
223 VOID GROUP_ModifyGroup(PROGGROUP* hGroup);
224 VOID GROUP_DeleteGroup(PROGGROUP* hGroup);
225 /* FIXME shouldn't be necessary */
226 VOID GROUP_ShowGroupWindow(PROGGROUP* hGroup);
227 PROGGROUP* GROUP_ActiveGroup(VOID);
228
229 PROGRAM* PROGRAM_AddProgram(PROGGROUP* hGroup, HICON hIcon, LPCWSTR lpszName,
230 INT x, INT y, LPCWSTR lpszCmdLine, LPCWSTR lpszIconFile, INT nIconIndex,
231 LPCWSTR lpszWorkDir, INT nHotKey, INT nCmdShow, BOOL bNewVDM);
232 VOID PROGRAM_NewProgram(PROGGROUP* hGroup);
233 VOID PROGRAM_ModifyProgram(PROGRAM* hProgram);
234 VOID PROGRAM_CopyMoveProgram(PROGRAM* hProgram, BOOL bMove);
235 VOID PROGRAM_DeleteProgram(PROGRAM* hProgram, BOOL bUpdateGrpFile);
236 VOID PROGRAM_ExecuteProgram(PROGRAM* hProgram);
237 PROGRAM* PROGRAM_ActiveProgram(PROGGROUP* hGroup);
238
239 BOOL DIALOG_New(INT nDefault, PINT pnResult);
240 PROGGROUP* DIALOG_CopyMove(PROGRAM* hProgram, BOOL bMove);
241 BOOL DIALOG_Delete(UINT ids_text_s, LPCWSTR lpszName);
242 BOOL DIALOG_GroupAttributes(GROUPFORMAT format, LPWSTR lpszTitle, LPWSTR lpszGrpFile, INT nSize);
243 BOOL DIALOG_ProgramAttributes(LPWSTR lpszTitle, LPWSTR lpszCmdLine, LPWSTR lpszWorkDir, LPWSTR lpszIconFile,
244 HICON* lphIcon, INT* lpnIconIndex, INT* lpnHotKey, INT* lpnCmdShow, BOOL* lpbNewVDM, INT nSize);
245 VOID DIALOG_Execute(VOID);
246
247 VOID STRING_LoadStrings(VOID);
248 VOID STRING_LoadMenus(VOID);
249
250 /* Class names */
251 #define STRING_MAIN_WIN_CLASS_NAME L"PMMain"
252 #define STRING_GROUP_WIN_CLASS_NAME L"PMGroup"
253
254 #endif /* PROGMAN_H */