c753c1fb6014eda6726c8a1ffab02f97a21f35ec
[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 #ifndef PROGMAN_H
23 #define PROGMAN_H
24
25 #include <stdio.h>
26 #include <string.h>
27
28 #define WIN32_LEAN_AND_MEAN
29
30 #include <windows.h>
31 #include <windef.h>
32 #include <commdlg.h>
33 #include <shellapi.h>
34
35
36 #define MAX_STRING_LEN 255
37 #define MAX_PATHNAME_LEN 1024
38 #define MAX_LANGUAGE_NUMBER (PM_LAST_LANGUAGE - PM_FIRST_LANGUAGE)
39
40
41 #include "resource.h"
42
43 /* Fallback icon */
44 #define DEFAULTICON OIC_WINLOGO
45
46 /* Icon index in MS Windows' progman.exe */
47 #define PROGMAN_ICON_INDEX 0
48 #define GROUP_ICON_INDEX 6
49 #define DEFAULT_ICON_INDEX 7
50
51 #define DEF_GROUP_WIN_XPOS 100
52 #define DEF_GROUP_WIN_YPOS 100
53 #define DEF_GROUP_WIN_WIDTH 300
54 #define DEF_GROUP_WIN_HEIGHT 200
55
56 typedef struct
57 {
58 HLOCAL hGroup;
59 HLOCAL hPrior;
60 HLOCAL hNext;
61 HWND hWnd;
62 /**/ /* Numbers are byte indexes in *.grp */
63
64 /**/ /* Program entry */
65 INT x, y; /* 0 - 3 */
66 INT nIconIndex; /* 4 - 5 */
67 HICON hIcon;
68 /* icon flags ??? */ /* 6 - 7 */
69 /* iconANDsize */ /* 8 - 9 */
70 /* iconXORsize */ /* 10 - 11 */
71 /* pointer to IconInfo */ /* 12 - 13 */
72 /* pointer to iconXORbits */ /* 14 - 15 */ /* sometimes iconANDbits ?! */
73 /* pointer to iconANDbits */ /* 16 - 17 */ /* sometimes iconXORbits ?! */
74 HLOCAL hName; /* 18 - 19 */
75 HLOCAL hCmdLine; /* 20 - 21 */
76 HLOCAL hIconFile; /* 22 - 23 */
77 HLOCAL hWorkDir; /* Extension 0x8101 */
78 INT nHotKey; /* Extension 0x8102 */
79 /* Modifier: bit 8... */
80 INT nCmdShow; /* Extension 0x8103 */
81
82 /**/ /* IconInfo */
83 /* HotSpot x ??? */ /* 0 - 1 */
84 /* HotSpot y ??? */ /* 2 - 3 */
85 /* Width */ /* 4 - 5 */
86 /* Height */ /* 6 - 7 */
87 /* WidthBytes ??? */ /* 8 - 9 */
88 /* Planes */ /* 10 - 10 */
89 /* BitsPerPixel */ /* 11 - 11 */
90 } PROGRAM;
91
92 typedef struct
93 {
94 HLOCAL hPrior;
95 HLOCAL hNext;
96 HWND hWnd;
97 HLOCAL hGrpFile;
98 HLOCAL hActiveProgram;
99 BOOL bFileNameModified;
100 BOOL bOverwriteFileOk;
101 INT seqnum;
102
103 /**/ /* Absolute */
104 /* magic `PMCC' */ /* 0 - 3 */
105 /* checksum */ /* 4 - 5 */
106 /* Extension ptr */ /* 6 - 7 */
107 INT nCmdShow; /* 8 - 9 */
108 INT x, y; /* 10 - 13 */
109 INT width, height; /* 14 - 17 */
110 INT iconx, icony; /* 18 - 21 */
111 HLOCAL hName; /* 22 - 23 */
112 /* unknown */ /* 24 - 31 */
113 /* number of programs */ /* 32 - 33 */
114 HLOCAL hPrograms; /* 34 ... */
115
116 /**/ /* Extensions */
117 /* Extension type */ /* 0 - 1 */
118 /* Program number */ /* 2 - 3 */
119 /* Size of entry */ /* 4 - 5 */
120 /* Data */ /* 6 ... */
121
122 /* magic `PMCC' */ /* Extension 0x8000 */
123 /* End of Extensions */ /* Extension 0xffff */
124 } PROGGROUP;
125
126 typedef struct
127 {
128 HANDLE hInstance;
129 HANDLE hAccel;
130 HWND hMainWnd;
131 HWND hMDIWnd;
132 HICON hMainIcon;
133 HICON hGroupIcon;
134 HICON hDefaultIcon;
135 HMENU hMainMenu;
136 HMENU hFileMenu;
137 HMENU hOptionMenu;
138 HMENU hWindowsMenu;
139 HMENU hLanguageMenu;
140 LPCSTR lpszIniFile;
141 BOOL bAutoArrange;
142 BOOL bSaveSettings;
143 BOOL bMinOnRun;
144 HLOCAL hGroups;
145 HLOCAL hActiveGroup;
146 } GLOBALS;
147
148 extern GLOBALS Globals;
149
150 INT MAIN_MessageBoxIDS(UINT ids_text, UINT ids_title, WORD type);
151 INT MAIN_MessageBoxIDS_s(UINT ids_text_s, LPCSTR str, UINT ids_title, WORD type);
152 VOID MAIN_ReplaceString(HLOCAL *handle, LPSTR replacestring);
153
154 HLOCAL GRPFILE_ReadGroupFile(const char* path);
155 BOOL GRPFILE_WriteGroupFile(HLOCAL hGroup);
156
157 ATOM GROUP_RegisterGroupWinClass(void);
158 HLOCAL GROUP_AddGroup(LPCSTR lpszName, LPCSTR lpszGrpFile, INT nCmdShow,
159 INT x, INT y, INT width, INT height,
160 INT iconx, INT icony,
161 BOOL bFileNameModified, BOOL bOverwriteFileOk,
162 /* FIXME shouldn't be necessary */
163 BOOL bSuppressShowWindow);
164 VOID GROUP_NewGroup(void);
165 VOID GROUP_ModifyGroup(HLOCAL hGroup);
166 VOID GROUP_DeleteGroup(HLOCAL hGroup);
167 /* FIXME shouldn't be necessary */
168 VOID GROUP_ShowGroupWindow(HLOCAL hGroup);
169 HLOCAL GROUP_FirstGroup(void);
170 HLOCAL GROUP_NextGroup(HLOCAL hGroup);
171 HLOCAL GROUP_ActiveGroup(void);
172 HWND GROUP_GroupWnd(HLOCAL hGroup);
173 LPCSTR GROUP_GroupName(HLOCAL hGroup);
174
175 ATOM PROGRAM_RegisterProgramWinClass(void);
176 HLOCAL PROGRAM_AddProgram(HLOCAL hGroup, HICON hIcon, LPCSTR lpszName,
177 INT x, INT y, LPCSTR lpszCmdLine,
178 LPCSTR lpszIconFile, INT nIconIndex,
179 LPCSTR lpszWorkDir, INT nHotKey, INT nCmdShow);
180 VOID PROGRAM_NewProgram(HLOCAL hGroup);
181 VOID PROGRAM_ModifyProgram(HLOCAL hProgram);
182 VOID PROGRAM_CopyMoveProgram(HLOCAL hProgram, BOOL bMove);
183 VOID PROGRAM_DeleteProgram(HLOCAL hProgram, BOOL BUpdateGrpFile);
184 HLOCAL PROGRAM_FirstProgram(HLOCAL hGroup);
185 HLOCAL PROGRAM_NextProgram(HLOCAL hProgram);
186 HLOCAL PROGRAM_ActiveProgram(HLOCAL hGroup);
187 LPCSTR PROGRAM_ProgramName(HLOCAL hProgram);
188 VOID PROGRAM_ExecuteProgram(HLOCAL hLocal);
189
190 INT DIALOG_New(INT nDefault);
191 HLOCAL DIALOG_CopyMove(LPCSTR lpszProgramName, LPCSTR lpszGroupName, BOOL bMove);
192 BOOL DIALOG_Delete(UINT ids_format_s, LPCSTR lpszName);
193 BOOL DIALOG_GroupAttributes(LPSTR lpszTitle, LPSTR lpszPath, INT nSize);
194 BOOL DIALOG_ProgramAttributes(LPSTR lpszTitle, LPSTR lpszCmdLine,
195 LPSTR lpszWorkDir, LPSTR lpszIconFile,
196 HICON *lphIcon, INT *nIconIndex,
197 INT *lpnHotKey, INT *lpnCmdShow, INT nSize);
198 VOID DIALOG_Execute(void);
199
200 VOID STRING_LoadMenus(VOID);
201
202 /* Class names */
203 extern WCHAR STRING_MAIN_WIN_CLASS_NAME[];
204 extern WCHAR STRING_MDI_WIN_CLASS_NAME[];
205 extern WCHAR STRING_GROUP_WIN_CLASS_NAME[];
206 extern WCHAR STRING_PROGRAM_WIN_CLASS_NAME[];
207
208 #endif /* PROGMAN_H */