[PROGMAN]
[reactos.git] / reactos / 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 #define MAX_STRING_LEN 255
51 #define MAX_PATHNAME_LEN 1024
52 #define MAX_LANGUAGE_NUMBER (PM_LAST_LANGUAGE - PM_FIRST_LANGUAGE)
53
54 #include "resource.h"
55
56 /* Fallback icon */
57 #define DEFAULTICON OIC_WINLOGO
58
59 #define DEF_GROUP_WIN_XPOS 100
60 #define DEF_GROUP_WIN_YPOS 100
61 #define DEF_GROUP_WIN_WIDTH 300
62 #define DEF_GROUP_WIN_HEIGHT 200
63
64
65 /*
66 * windowsx.h extensions
67 */
68 #define EnableDlgItem(hDlg, nID, bEnable) \
69 EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
70
71
72
73
74
75 typedef struct _PROGRAM PROGRAM, *PPROGRAM;
76 typedef struct _PROGGROUP PROGGROUP, *PPROGGROUP;
77
78 struct _PROGRAM
79 {
80 PROGGROUP* hGroup;
81 PROGRAM* hPrior;
82 PROGRAM* hNext;
83 HWND hWnd;
84
85 INT iItem;
86 INT x;
87 INT y;
88 INT nIconIndex;
89 HICON hIcon;
90 LPWSTR hName;
91 LPWSTR hCmdLine;
92 LPWSTR hIconFile;
93 LPWSTR hWorkDir; /* Extension 0x8101 */
94 INT nHotKey; /* Extension 0x8102 */
95 INT nCmdShow; /* Extension 0x8103 */
96 BOOL bNewVDM; /* Extension 0x8104 */
97
98 SIZE_T TagsSize;
99 PVOID Tags;
100 }; // PROGRAM, *PPROGRAM;
101
102 typedef enum _GROUPFORMAT
103 {
104 Win_311 = 0x0,
105 NT_Ansi = 0x1, // 0x02
106 NT_Unicode = 0x2, // 0x03
107 } GROUPFORMAT;
108
109 struct _PROGGROUP
110 {
111 PROGGROUP* hPrior;
112 PROGGROUP* hNext;
113 HWND hWnd;
114
115 HWND hListView;
116 HIMAGELIST hListLarge;
117 HIMAGELIST hDragImageList;
118 HICON hOldCursor;
119 POINT ptStart;
120 BOOL bDragging;
121
122 GROUPFORMAT format;
123 BOOL bIsCommonGroup;
124 // BOOL bFileNameModified;
125 BOOL bOverwriteFileOk;
126 LPWSTR hGrpFile;
127 INT seqnum;
128 INT nCmdShow;
129 INT x;
130 INT y;
131 INT width;
132 INT height;
133 INT iconx;
134 INT icony;
135 LPWSTR hName;
136 PROGRAM* hPrograms;
137 PROGRAM* hActiveProgram;
138
139 SIZE_T TagsSize;
140 PVOID Tags;
141 }; // PROGGROUP, *PPROGGROUP;
142
143
144 typedef struct _GLOBALS
145 {
146 HINSTANCE hInstance;
147 HACCEL hAccel;
148 HWND hMainWnd;
149 HWND hMDIWnd;
150 HICON hDefaultIcon;
151 HICON hMainIcon;
152 // HICON hGroupIcon;
153 HICON hPersonalGroupIcon;
154 HICON hCommonGroupIcon;
155 HMENU hMainMenu;
156 HMENU hFileMenu;
157 HMENU hOptionMenu;
158 HMENU hWindowsMenu;
159 HMENU hLanguageMenu;
160
161 HKEY hKeyProgMan;
162 HKEY hKeyPMSettings;
163 HKEY hKeyPMCommonGroups;
164 HKEY hKeyPMAnsiGroups;
165 HKEY hKeyPMUnicodeGroups;
166 HKEY hKeyAnsiGroups;
167 HKEY hKeyUnicodeGroups;
168 HKEY hKeyCommonGroups;
169
170 BOOL bAutoArrange;
171 BOOL bSaveSettings;
172 BOOL bMinOnRun;
173 PROGGROUP* hGroups;
174 PROGGROUP* hActiveGroup;
175 // int field_74;
176 // int field_78;
177 // PROGGROUP* field_79;
178 } GLOBALS, *PGLOBALS;
179
180 extern GLOBALS Globals;
181 extern WCHAR szTitle[256];
182
183
184 /*
185 * Memory management functions
186 */
187 PVOID
188 Alloc(IN DWORD dwFlags,
189 IN SIZE_T dwBytes);
190
191 BOOL
192 Free(IN PVOID lpMem);
193
194 PVOID
195 ReAlloc(IN DWORD dwFlags,
196 IN PVOID lpMem,
197 IN SIZE_T dwBytes);
198
199 PVOID
200 AppendToBuffer(IN PVOID pBuffer,
201 IN PSIZE_T pdwBufferSize,
202 IN PVOID pData,
203 IN SIZE_T dwDataSize);
204
205
206 INT MAIN_MessageBoxIDS(UINT ids_text, UINT ids_title, WORD type);
207 INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCWSTR str, UINT ids_title, WORD type);
208 VOID MAIN_ReplaceString(LPWSTR* string, LPWSTR replace);
209
210 DWORD GRPFILE_ReadGroupFile(LPCWSTR lpszPath, BOOL bIsCommonGroup);
211 BOOL GRPFILE_WriteGroupFile(PROGGROUP* hGroup);
212
213 ATOM GROUP_RegisterGroupWinClass(VOID);
214 PROGGROUP* GROUP_AddGroup(GROUPFORMAT format, BOOL bIsCommonGroup, LPCWSTR lpszName, LPCWSTR lpszGrpFile,
215 INT left, INT top, INT right, INT bottom, INT xMin, INT yMin, INT nCmdShow,
216 WORD cxIcon, WORD cyIcon, BOOL bOverwriteFileOk,
217 /* FIXME shouldn't be necessary */
218 BOOL bSuppressShowWindow);
219 VOID GROUP_NewGroup(GROUPFORMAT format, BOOL bIsCommonGroup);
220 VOID GROUP_ModifyGroup(PROGGROUP* hGroup);
221 VOID GROUP_DeleteGroup(PROGGROUP* hGroup);
222 /* FIXME shouldn't be necessary */
223 VOID GROUP_ShowGroupWindow(PROGGROUP* hGroup);
224 PROGGROUP* GROUP_ActiveGroup(VOID);
225
226 PROGRAM* PROGRAM_AddProgram(PROGGROUP* hGroup, HICON hIcon, LPCWSTR lpszName,
227 INT x, INT y, LPCWSTR lpszCmdLine, LPCWSTR lpszIconFile, INT nIconIndex,
228 LPCWSTR lpszWorkDir, INT nHotKey, INT nCmdShow, BOOL bNewVDM);
229 VOID PROGRAM_NewProgram(PROGGROUP* hGroup);
230 VOID PROGRAM_ModifyProgram(PROGRAM* hProgram);
231 VOID PROGRAM_CopyMoveProgram(PROGRAM* hProgram, BOOL bMove);
232 VOID PROGRAM_DeleteProgram(PROGRAM* hProgram, BOOL bUpdateGrpFile);
233 VOID PROGRAM_ExecuteProgram(PROGRAM* hProgram);
234 PROGRAM* PROGRAM_ActiveProgram(PROGGROUP* hGroup);
235
236 BOOL DIALOG_New(INT nDefault, PINT pnResult);
237 PROGGROUP* DIALOG_CopyMove(PROGRAM* hProgram, BOOL bMove);
238 BOOL DIALOG_Delete(UINT ids_text_s, LPCWSTR lpszName);
239 BOOL DIALOG_GroupAttributes(GROUPFORMAT format, LPWSTR lpszTitle, LPWSTR lpszGrpFile, INT nSize);
240 BOOL DIALOG_ProgramAttributes(LPWSTR lpszTitle, LPWSTR lpszCmdLine, LPWSTR lpszWorkDir, LPWSTR lpszIconFile,
241 HICON* lphIcon, INT* lpnIconIndex, INT* lpnHotKey, INT* lpnCmdShow, BOOL* lpbNewVDM, INT nSize);
242 VOID DIALOG_Execute(VOID);
243
244 VOID STRING_LoadStrings(VOID);
245 VOID STRING_LoadMenus(VOID);
246
247 /* Class names */
248 #define STRING_MAIN_WIN_CLASS_NAME L"PMMain"
249 #define STRING_GROUP_WIN_CLASS_NAME L"PMGroup"
250
251 #endif /* PROGMAN_H */