Release 960606
[wine] / include / commdlg.h
1 /* 
2  * COMMDLG - Common Wine Dialog ... :-)
3  */
4
5 #ifndef __WINE_COMMDLG_H
6 #define __WINE_COMMDLG_H
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 #include "wintypes.h"           /* needed for CHOOSEFONT structure */
13
14 #ifndef WINELIB
15 #pragma pack(1)
16 #endif
17
18 #define RT_CURSOR           MAKEINTRESOURCE(1)
19 #define RT_BITMAP           MAKEINTRESOURCE(2)
20 #define RT_ICON             MAKEINTRESOURCE(3)
21 #define RT_MENU             MAKEINTRESOURCE(4)
22 #define RT_DIALOG           MAKEINTRESOURCE(5)
23 #define RT_STRING           MAKEINTRESOURCE(6)
24 #define RT_FONTDIR          MAKEINTRESOURCE(7)
25 #define RT_FONT             MAKEINTRESOURCE(8)
26 #define RT_ACCELERATOR      MAKEINTRESOURCE(9)
27 #define RT_RCDATA           MAKEINTRESOURCE(10)
28
29 #define RT_GROUP_CURSOR     MAKEINTRESOURCE(12)
30 #define RT_GROUP_ICON       MAKEINTRESOURCE(14)
31
32 #ifndef HGLOBAL
33 #define HGLOBAL     HANDLE
34 #endif
35
36 #define OFN_READONLY                 0x00000001
37 #define OFN_OVERWRITEPROMPT          0x00000002
38 #define OFN_HIDEREADONLY             0x00000004
39 #define OFN_NOCHANGEDIR              0x00000008
40 #define OFN_SHOWHELP                 0x00000010
41 #define OFN_ENABLEHOOK               0x00000020
42 #define OFN_ENABLETEMPLATE           0x00000040
43 #define OFN_ENABLETEMPLATEHANDLE     0x00000080
44 #define OFN_NOVALIDATE               0x00000100
45 #define OFN_ALLOWMULTISELECT         0x00000200
46 #define OFN_EXTENSIONDIFFERENT       0x00000400
47 #define OFN_PATHMUSTEXIST            0x00000800
48 #define OFN_FILEMUSTEXIST            0x00001000
49 #define OFN_CREATEPROMPT             0x00002000
50 #define OFN_SHAREAWARE               0x00004000
51 #define OFN_NOREADONLYRETURN         0x00008000
52 #define OFN_NOTESTFILECREATE         0x00010000
53
54 #define OFN_SHAREFALLTHROUGH     2
55 #define OFN_SHARENOWARN          1
56 #define OFN_SHAREWARN            0
57
58
59 typedef struct {
60         DWORD           lStructSize;
61         HWND            hwndOwner;
62         HINSTANCE       hInstance;
63         SEGPTR          lpstrFilter;
64         SEGPTR          lpstrCustomFilter;
65         DWORD           nMaxCustFilter;
66         DWORD           nFilterIndex;
67         SEGPTR          lpstrFile;
68         DWORD           nMaxFile;
69         SEGPTR          lpstrFileTitle;
70         DWORD           nMaxFileTitle;
71         SEGPTR          lpstrInitialDir;
72         SEGPTR          lpstrTitle;
73         DWORD           Flags;
74         UINT            nFileOffset;
75         UINT            nFileExtension;
76         SEGPTR          lpstrDefExt;
77         LPARAM          lCustData;
78 /*      UINT            (CALLBACK *lpfnHook)(HWND, UINT, WPARAM, LPARAM);*/
79         FARPROC         lpfnHook;
80         SEGPTR          lpTemplateName;
81         }   OPENFILENAME;
82 typedef OPENFILENAME * LPOPENFILENAME;
83
84
85 typedef struct {
86         DWORD           lStructSize;
87         HWND            hwndOwner;
88         HWND            hInstance;
89         COLORREF        rgbResult;
90         COLORREF       *lpCustColors;
91         DWORD           Flags;
92         LPARAM          lCustData;
93         UINT            (*lpfnHook)(HWND, UINT, WPARAM, LPARAM);
94         SEGPTR          lpTemplateName;
95         } CHOOSECOLOR;
96 typedef CHOOSECOLOR *LPCHOOSECOLOR;
97
98 #define CC_RGBINIT               0x00000001
99 #define CC_FULLOPEN              0x00000002
100 #define CC_PREVENTFULLOPEN       0x00000004
101 #define CC_SHOWHELP              0x00000008
102 #define CC_ENABLEHOOK            0x00000010
103 #define CC_ENABLETEMPLATE        0x00000020
104 #define CC_ENABLETEMPLATEHANDLE  0x00000040
105
106 typedef struct {
107         DWORD           lStructSize;                    /* size of this struct 0x20 */
108         HWND            hwndOwner;                              /* handle to owner's window */
109         HINSTANCE       hInstance;                              /* instance handle of.EXE that  */
110                                                                                 /*      contains cust. dlg. template */
111         DWORD           Flags;                  /* one or more of the FR_?? */
112         SEGPTR          lpstrFindWhat;          /* ptr. to search string    */
113         SEGPTR          lpstrReplaceWith;       /* ptr. to replace string   */
114         UINT            wFindWhatLen;           /* size of find buffer      */
115         UINT            wReplaceWithLen;        /* size of replace buffer   */
116         LPARAM          lCustData;              /* data passed to hook fn.  */
117 /*      UINT            (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM); */
118         FARPROC         lpfnHook;
119         SEGPTR          lpTemplateName;         /* custom template name     */
120         } FINDREPLACE;
121 typedef FINDREPLACE *LPFINDREPLACE;
122
123 #define FR_DOWN                         0x00000001
124 #define FR_WHOLEWORD                    0x00000002
125 #define FR_MATCHCASE                    0x00000004
126 #define FR_FINDNEXT                     0x00000008
127 #define FR_REPLACE                      0x00000010
128 #define FR_REPLACEALL                   0x00000020
129 #define FR_DIALOGTERM                   0x00000040
130 #define FR_SHOWHELP                     0x00000080
131 #define FR_ENABLEHOOK                   0x00000100
132 #define FR_ENABLETEMPLATE               0x00000200
133 #define FR_NOUPDOWN                     0x00000400
134 #define FR_NOMATCHCASE                  0x00000800
135 #define FR_NOWHOLEWORD                  0x00001000
136 #define FR_ENABLETEMPLATEHANDLE         0x00002000
137 #define FR_HIDEUPDOWN                   0x00004000
138 #define FR_HIDEMATCHCASE                0x00008000
139 #define FR_HIDEWHOLEWORD                0x00010000
140
141
142 typedef struct {
143         DWORD                   lStructSize;
144         HWND                    hwndOwner;          /* caller's window handle   */
145         HDC                     hDC;                /* printer DC/IC or NULL    */
146         SEGPTR                  lpLogFont;          /* ptr. to a LOGFONT struct */
147         short                   iPointSize;         /* 10 * size in points of selected font */
148         DWORD                   Flags WINE_PACKED;  /* enum. type flags         */
149         COLORREF                rgbColors;          /* returned text color      */
150         LPARAM                  lCustData;          /* data passed to hook fn.  */
151 /*      UINT (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);*/
152         FARPROC                 lpfnHook;
153         SEGPTR                  lpTemplateName;     /* custom template name     */
154         HINSTANCE               hInstance;          /* instance handle of.EXE that   */
155                                                         /* contains cust. dlg. template  */
156         SEGPTR                  lpszStyle WINE_PACKED;  /* return the style field here   */
157                                                         /* must be LF_FACESIZE or bigger */
158         UINT                    nFontType;              /* same value reported to the    */
159                                                         /* EnumFonts callback with the   */
160                                                         /* extra FONTTYPE_ bits added    */
161         short                   nSizeMin WINE_PACKED;   /* minimum pt size allowed & */
162         short                   nSizeMax WINE_PACKED;   /* max pt size allowed if    */
163                                                         /* CF_LIMITSIZE is used      */
164         } CHOOSEFONT;
165 typedef CHOOSEFONT *LPCHOOSEFONT;
166
167
168 #define CF_SCREENFONTS               0x00000001
169 #define CF_PRINTERFONTS              0x00000002
170 #define CF_BOTH                      (CF_SCREENFONTS | CF_PRINTERFONTS)
171 #define CF_SHOWHELP                  0x00000004L
172 #define CF_ENABLEHOOK                0x00000008L
173 #define CF_ENABLETEMPLATE            0x00000010L
174 #define CF_ENABLETEMPLATEHANDLE      0x00000020L
175 #define CF_INITTOLOGFONTSTRUCT       0x00000040L
176 #define CF_USESTYLE                  0x00000080L
177 #define CF_EFFECTS                   0x00000100L
178 #define CF_APPLY                     0x00000200L
179 #define CF_ANSIONLY                  0x00000400L
180 #define CF_NOVECTORFONTS             0x00000800L
181 #define CF_NOOEMFONTS                CF_NOVECTORFONTS
182 #define CF_NOSIMULATIONS             0x00001000L
183 #define CF_LIMITSIZE                 0x00002000L
184 #define CF_FIXEDPITCHONLY            0x00004000L
185 #define CF_WYSIWYG                   0x00008000L /* use with CF_SCREENFONTS & CF_PRINTERFONTS */
186 #define CF_FORCEFONTEXIST            0x00010000L
187 #define CF_SCALABLEONLY              0x00020000L
188 #define CF_TTONLY                    0x00040000L
189 #define CF_NOFACESEL                 0x00080000L
190 #define CF_NOSTYLESEL                0x00100000L
191 #define CF_NOSIZESEL                 0x00200000L
192
193 #define SIMULATED_FONTTYPE      0x8000
194 #define PRINTER_FONTTYPE        0x4000
195 #define SCREEN_FONTTYPE         0x2000
196 #define BOLD_FONTTYPE           0x0100
197 #define ITALIC_FONTTYPE         0x0200
198 #define REGULAR_FONTTYPE        0x0400
199
200 #define WM_CHOOSEFONT_GETLOGFONT        (WM_USER + 1)
201
202 #define LBSELCHSTRING  "commdlg_LBSelChangedNotify"
203 #define SHAREVISTRING  "commdlg_ShareViolation"
204 #define FILEOKSTRING   "commdlg_FileNameOK"
205 #define COLOROKSTRING  "commdlg_ColorOK"
206 #define SETRGBSTRING   "commdlg_SetRGBColor"
207 #define FINDMSGSTRING  "commdlg_FindReplace"
208 #define HELPMSGSTRING  "commdlg_help"
209
210 #define CD_LBSELNOITEMS -1
211 #define CD_LBSELCHANGE   0
212 #define CD_LBSELSUB      1
213 #define CD_LBSELADD      2
214
215 typedef struct {
216         DWORD           lStructSize;
217         HWND            hwndOwner;
218         HGLOBAL         hDevMode;
219         HGLOBAL         hDevNames;
220         HDC             hDC;
221         DWORD           Flags;
222         UINT            nFromPage;
223         UINT            nToPage;
224         UINT            nMinPage;
225         UINT            nMaxPage;
226         UINT            nCopies;
227         HINSTANCE       hInstance;
228         LPARAM          lCustData;
229 /*      UINT            (CALLBACK* lpfnPrintHook)(HWND, UINT, WPARAM, LPARAM);
230         UINT            (CALLBACK* lpfnSetupHook)(HWND, UINT, WPARAM, LPARAM);*/
231         FARPROC         lpfnPrintHook;
232         FARPROC         lpfnSetupHook;
233         SEGPTR          lpPrintTemplateName;
234         SEGPTR          lpSetupTemplateName;
235         HGLOBAL         hPrintTemplate;
236         HGLOBAL         hSetupTemplate;
237         } PRINTDLG;
238 typedef PRINTDLG * LPPRINTDLG;
239
240
241 #define PD_ALLPAGES                  0x00000000
242 #define PD_SELECTION                 0x00000001
243 #define PD_PAGENUMS                  0x00000002
244 #define PD_NOSELECTION               0x00000004
245 #define PD_NOPAGENUMS                0x00000008
246 #define PD_COLLATE                   0x00000010
247 #define PD_PRINTTOFILE               0x00000020
248 #define PD_PRINTSETUP                0x00000040
249 #define PD_NOWARNING                 0x00000080
250 #define PD_RETURNDC                  0x00000100
251 #define PD_RETURNIC                  0x00000200
252 #define PD_RETURNDEFAULT             0x00000400
253 #define PD_SHOWHELP                  0x00000800
254 #define PD_ENABLEPRINTHOOK           0x00001000
255 #define PD_ENABLESETUPHOOK           0x00002000
256 #define PD_ENABLEPRINTTEMPLATE       0x00004000
257 #define PD_ENABLESETUPTEMPLATE       0x00008000
258 #define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000
259 #define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000
260 #define PD_USEDEVMODECOPIES          0x00040000
261 #define PD_DISABLEPRINTTOFILE        0x00080000
262 #define PD_HIDEPRINTTOFILE           0x00100000
263
264 typedef struct {
265         UINT    wDriverOffset;
266         UINT    wDeviceOffset;
267         UINT    wOutputOffset;
268         UINT    wDefault;
269         } DEVNAMES;
270 typedef DEVNAMES * LPDEVNAMES;
271
272 #define DN_DEFAULTPRN      0x0001
273
274
275 #define CDERR_DIALOGFAILURE   0xFFFF
276 #define CDERR_GENERALCODES     0x0000
277 #define CDERR_STRUCTSIZE       0x0001
278 #define CDERR_INITIALIZATION   0x0002
279 #define CDERR_NOTEMPLATE       0x0003
280 #define CDERR_NOHINSTANCE      0x0004
281 #define CDERR_LOADSTRFAILURE   0x0005
282 #define CDERR_FINDRESFAILURE   0x0006
283 #define CDERR_LOADRESFAILURE   0x0007
284 #define CDERR_LOCKRESFAILURE   0x0008
285 #define CDERR_MEMALLOCFAILURE  0x0009
286 #define CDERR_MEMLOCKFAILURE   0x000A
287 #define CDERR_NOHOOK           0x000B
288 #define CDERR_REGISTERMSGFAIL  0x000C
289
290 BOOL  ChooseColor(LPCHOOSECOLOR lpChCol);
291 DWORD CommDlgExtendedError(void);
292 BOOL  FindText(LPFINDREPLACE lpFind);
293 short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf);
294 BOOL  GetOpenFileName(LPOPENFILENAME lpofn);
295 BOOL  GetSaveFileName(LPOPENFILENAME lpofn);
296 BOOL  PrintDlg(LPPRINTDLG lpPrint);
297 BOOL  ReplaceText(LPFINDREPLACE lpFind);
298 BOOL  ChooseFont(LPCHOOSEFONT lpChFont);
299
300 LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
301 LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
302 LRESULT ColorDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
303 LRESULT FindTextDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
304 LRESULT ReplaceTextDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
305 LRESULT PrintDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
306 LRESULT PrintSetupDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
307 LRESULT FormatCharDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
308
309 #ifndef WINELIB
310 #pragma pack(4)
311 #endif
312
313 #ifdef __cplusplus
314 }
315 #endif
316
317 #endif  /* __WINE_COMMDLG_H */