Release 980301
[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 #define OFN_READONLY                 0x00000001
15 #define OFN_OVERWRITEPROMPT          0x00000002
16 #define OFN_HIDEREADONLY             0x00000004
17 #define OFN_NOCHANGEDIR              0x00000008
18 #define OFN_SHOWHELP                 0x00000010
19 #define OFN_ENABLEHOOK               0x00000020
20 #define OFN_ENABLETEMPLATE           0x00000040
21 #define OFN_ENABLETEMPLATEHANDLE     0x00000080
22 #define OFN_NOVALIDATE               0x00000100
23 #define OFN_ALLOWMULTISELECT         0x00000200
24 #define OFN_EXTENSIONDIFFERENT       0x00000400
25 #define OFN_PATHMUSTEXIST            0x00000800
26 #define OFN_FILEMUSTEXIST            0x00001000
27 #define OFN_CREATEPROMPT             0x00002000
28 #define OFN_SHAREAWARE               0x00004000
29 #define OFN_NOREADONLYRETURN         0x00008000
30 #define OFN_NOTESTFILECREATE         0x00010000
31
32 /*      OFN_?                        0x00020000 */
33
34 #define OFN_NOLONGNAMES              0x00040000
35 #define OFN_EXPLORER                 0x00080000
36 #define OFN_NODEREFERENCELINKS       0x00100000
37 #define OFN_LONGNAMES                0x00200000
38
39 /* WINE internal flags */
40 #define OFN_UNICODE                  0x40000000 /*to differ between 32W/A hook*/
41 #define OFN_WINE32                   0x80000000 /* comdlg32 */
42
43 #define OFN_SHAREFALLTHROUGH     2
44 #define OFN_SHARENOWARN          1
45 #define OFN_SHAREWARN            0
46
47 typedef struct {
48         DWORD           lStructSize;
49         HWND16          hwndOwner;
50         HINSTANCE16     hInstance;
51         SEGPTR          lpstrFilter;
52         SEGPTR          lpstrCustomFilter;
53         DWORD           nMaxCustFilter;
54         DWORD           nFilterIndex;
55         SEGPTR          lpstrFile;
56         DWORD           nMaxFile;
57         SEGPTR          lpstrFileTitle;
58         DWORD           nMaxFileTitle;
59         SEGPTR          lpstrInitialDir;
60         SEGPTR          lpstrTitle;
61         DWORD           Flags;
62         UINT16          nFileOffset;
63         UINT16          nFileExtension;
64         SEGPTR          lpstrDefExt;
65         LPARAM          lCustData;
66         WNDPROC16       lpfnHook;
67         SEGPTR          lpTemplateName;
68 }   OPENFILENAME16,*LPOPENFILENAME16;
69
70 typedef struct {
71         DWORD           lStructSize;
72         HWND32          hwndOwner;
73         HINSTANCE32     hInstance;
74         LPCSTR          lpstrFilter;
75         LPSTR           lpstrCustomFilter;
76         DWORD           nMaxCustFilter;
77         DWORD           nFilterIndex;
78         LPSTR           lpstrFile;
79         DWORD           nMaxFile;
80         LPSTR           lpstrFileTitle;
81         DWORD           nMaxFileTitle;
82         LPCSTR          lpstrInitialDir;
83         LPCSTR          lpstrTitle;
84         DWORD           Flags;
85         WORD            nFileOffset;
86         WORD            nFileExtension;
87         LPCSTR          lpstrDefExt;
88         LPARAM          lCustData;
89         WNDPROC32       lpfnHook;
90         LPCSTR          lpTemplateName;
91 } OPENFILENAME32A,*LPOPENFILENAME32A;
92
93 typedef struct {
94         DWORD           lStructSize;
95         HWND32          hwndOwner;
96         HINSTANCE32     hInstance;
97         LPCWSTR         lpstrFilter;
98         LPWSTR          lpstrCustomFilter;
99         DWORD           nMaxCustFilter;
100         DWORD           nFilterIndex;
101         LPWSTR          lpstrFile;
102         DWORD           nMaxFile;
103         LPWSTR          lpstrFileTitle;
104         DWORD           nMaxFileTitle;
105         LPCWSTR         lpstrInitialDir;
106         LPCWSTR         lpstrTitle;
107         DWORD           Flags;
108         WORD            nFileOffset;
109         WORD            nFileExtension;
110         LPCWSTR         lpstrDefExt;
111         LPARAM          lCustData;
112         WNDPROC32       lpfnHook;
113         LPCWSTR         lpTemplateName;
114 } OPENFILENAME32W,*LPOPENFILENAME32W;
115
116 DECL_WINELIB_TYPE_AW(OPENFILENAME);
117 DECL_WINELIB_TYPE_AW(LPOPENFILENAME);
118
119 typedef struct {
120         DWORD           lStructSize;
121         HWND16          hwndOwner;
122         HWND16          hInstance;
123         COLORREF        rgbResult;
124         COLORREF       *lpCustColors;
125         DWORD           Flags;
126         LPARAM          lCustData;
127         WNDPROC16       lpfnHook;
128         SEGPTR          lpTemplateName;
129 } CHOOSECOLOR;
130 typedef CHOOSECOLOR *LPCHOOSECOLOR;
131
132 #define CC_RGBINIT               0x00000001
133 #define CC_FULLOPEN              0x00000002
134 #define CC_PREVENTFULLOPEN       0x00000004
135 #define CC_SHOWHELP              0x00000008
136 #define CC_ENABLEHOOK            0x00000010
137 #define CC_ENABLETEMPLATE        0x00000020
138 #define CC_ENABLETEMPLATEHANDLE  0x00000040
139
140 typedef struct {
141         DWORD           lStructSize;                    /* size of this struct 0x20 */
142         HWND16          hwndOwner;                              /* handle to owner's window */
143         HINSTANCE16     hInstance;                              /* instance handle of.EXE that  */
144                                                                                 /*      contains cust. dlg. template */
145         DWORD           Flags;                  /* one or more of the FR_?? */
146         SEGPTR          lpstrFindWhat;          /* ptr. to search string    */
147         SEGPTR          lpstrReplaceWith;       /* ptr. to replace string   */
148         UINT16          wFindWhatLen;           /* size of find buffer      */
149         UINT16          wReplaceWithLen;        /* size of replace buffer   */
150         LPARAM          lCustData;              /* data passed to hook fn.  */
151         WNDPROC16       lpfnHook;
152         SEGPTR          lpTemplateName;         /* custom template name     */
153         } FINDREPLACE;
154 typedef FINDREPLACE *LPFINDREPLACE;
155
156 #define FR_DOWN                         0x00000001
157 #define FR_WHOLEWORD                    0x00000002
158 #define FR_MATCHCASE                    0x00000004
159 #define FR_FINDNEXT                     0x00000008
160 #define FR_REPLACE                      0x00000010
161 #define FR_REPLACEALL                   0x00000020
162 #define FR_DIALOGTERM                   0x00000040
163 #define FR_SHOWHELP                     0x00000080
164 #define FR_ENABLEHOOK                   0x00000100
165 #define FR_ENABLETEMPLATE               0x00000200
166 #define FR_NOUPDOWN                     0x00000400
167 #define FR_NOMATCHCASE                  0x00000800
168 #define FR_NOWHOLEWORD                  0x00001000
169 #define FR_ENABLETEMPLATEHANDLE         0x00002000
170 #define FR_HIDEUPDOWN                   0x00004000
171 #define FR_HIDEMATCHCASE                0x00008000
172 #define FR_HIDEWHOLEWORD                0x00010000
173
174
175 #pragma pack(1)
176
177 typedef struct {
178         DWORD                   lStructSize;
179         HWND16                  hwndOwner;          /* caller's window handle   */
180         HDC16                   hDC;                /* printer DC/IC or NULL    */
181         SEGPTR                  lpLogFont;          /* ptr. to a LOGFONT struct */
182         short                   iPointSize;         /* 10 * size in points of selected font */
183         DWORD                   Flags WINE_PACKED;  /* enum. type flags         */
184         COLORREF                rgbColors;          /* returned text color      */
185         LPARAM                  lCustData;          /* data passed to hook fn.  */
186         WNDPROC16               lpfnHook;
187         SEGPTR                  lpTemplateName;     /* custom template name     */
188         HINSTANCE16             hInstance;          /* instance handle of.EXE that   */
189                                                         /* contains cust. dlg. template  */
190         SEGPTR                  lpszStyle WINE_PACKED;  /* return the style field here   */
191                                                         /* must be LF_FACESIZE or bigger */
192         UINT16                  nFontType;              /* same value reported to the    */
193                                                         /* EnumFonts callback with the   */
194                                                         /* extra FONTTYPE_ bits added    */
195         short                   nSizeMin WINE_PACKED;   /* minimum pt size allowed & */
196         short                   nSizeMax WINE_PACKED;   /* max pt size allowed if    */
197                                                         /* CF_LIMITSIZE is used      */
198         } CHOOSEFONT;
199 typedef CHOOSEFONT *LPCHOOSEFONT;
200
201 #pragma pack(4)
202
203 #define CF_SCREENFONTS               0x00000001
204 #define CF_PRINTERFONTS              0x00000002
205 #define CF_BOTH                      (CF_SCREENFONTS | CF_PRINTERFONTS)
206 #define CF_SHOWHELP                  0x00000004L
207 #define CF_ENABLEHOOK                0x00000008L
208 #define CF_ENABLETEMPLATE            0x00000010L
209 #define CF_ENABLETEMPLATEHANDLE      0x00000020L
210 #define CF_INITTOLOGFONTSTRUCT       0x00000040L
211 #define CF_USESTYLE                  0x00000080L
212 #define CF_EFFECTS                   0x00000100L
213 #define CF_APPLY                     0x00000200L
214 #define CF_ANSIONLY                  0x00000400L
215 #define CF_NOVECTORFONTS             0x00000800L
216 #define CF_NOOEMFONTS                CF_NOVECTORFONTS
217 #define CF_NOSIMULATIONS             0x00001000L
218 #define CF_LIMITSIZE                 0x00002000L
219 #define CF_FIXEDPITCHONLY            0x00004000L
220 #define CF_WYSIWYG                   0x00008000L /* use with CF_SCREENFONTS & CF_PRINTERFONTS */
221 #define CF_FORCEFONTEXIST            0x00010000L
222 #define CF_SCALABLEONLY              0x00020000L
223 #define CF_TTONLY                    0x00040000L
224 #define CF_NOFACESEL                 0x00080000L
225 #define CF_NOSTYLESEL                0x00100000L
226 #define CF_NOSIZESEL                 0x00200000L
227
228 #define SIMULATED_FONTTYPE      0x8000
229 #define PRINTER_FONTTYPE        0x4000
230 #define SCREEN_FONTTYPE         0x2000
231 #define BOLD_FONTTYPE           0x0100
232 #define ITALIC_FONTTYPE         0x0200
233 #define REGULAR_FONTTYPE        0x0400
234
235 #define WM_CHOOSEFONT_GETLOGFONT        (WM_USER + 1)
236
237 #define LBSELCHSTRING  "commdlg_LBSelChangedNotify"
238 #define SHAREVISTRING  "commdlg_ShareViolation"
239 #define FILEOKSTRING   "commdlg_FileNameOK"
240 #define COLOROKSTRING  "commdlg_ColorOK"
241 #define SETRGBSTRING   "commdlg_SetRGBColor"
242 #define FINDMSGSTRING  "commdlg_FindReplace"
243 #define HELPMSGSTRING  "commdlg_help"
244
245 #define CD_LBSELNOITEMS -1
246 #define CD_LBSELCHANGE   0
247 #define CD_LBSELSUB      1
248 #define CD_LBSELADD      2
249
250 typedef struct
251 {
252     DWORD            lStructSize;
253     HWND16           hwndOwner;
254     HGLOBAL16        hDevMode;
255     HGLOBAL16        hDevNames;
256     HDC16            hDC;
257     DWORD            Flags;
258     WORD             nFromPage;
259     WORD             nToPage;
260     WORD             nMinPage;
261     WORD             nMaxPage;
262     WORD             nCopies;
263     HINSTANCE16      hInstance;
264     LPARAM           lCustData;
265     WNDPROC16        lpfnPrintHook;
266     WNDPROC16        lpfnSetupHook;
267     SEGPTR           lpPrintTemplateName;
268     SEGPTR           lpSetupTemplateName;
269     HGLOBAL16        hPrintTemplate;
270     HGLOBAL16        hSetupTemplate;
271 } PRINTDLG16, *LPPRINTDLG16;
272
273 typedef UINT32 (CALLBACK *LPPRINTHOOKPROC) (HWND32, UINT32, WPARAM32, LPARAM);
274 typedef UINT32 (CALLBACK *LPSETUPHOOKPROC) (HWND32, UINT32, WPARAM32, LPARAM);
275
276 typedef struct
277 {
278     DWORD            lStructSize;
279     HWND32           hwndOwner;
280     HGLOBAL32        hDevMode;
281     HGLOBAL32        hDevNames;
282     HDC32            hDC;
283     DWORD            Flags;
284     WORD             nFromPage;
285     WORD             nToPage;
286     WORD             nMinPage;
287     WORD             nMaxPage;
288     WORD             nCopies;
289     HINSTANCE32      hInstance;
290     LPARAM           lCustData;
291     LPPRINTHOOKPROC  lpfnPrintHook;
292     LPSETUPHOOKPROC  lpfnSetupHook;
293     LPCSTR           lpPrintTemplateName;
294     LPCSTR           lpSetupTemplateName;
295     HGLOBAL32        hPrintTemplate;
296     HGLOBAL32        hSetupTemplate;
297 } PRINTDLG32A, *LPPRINTDLG32A;
298
299 typedef struct
300 {
301     DWORD            lStructSize;
302     HWND32           hwndOwner;
303     HGLOBAL32        hDevMode;
304     HGLOBAL32        hDevNames;
305     HDC32            hDC;
306     DWORD            Flags;
307     WORD             nFromPage;
308     WORD             nToPage;
309     WORD             nMinPage;
310     WORD             nMaxPage;
311     WORD             nCopies;
312     HINSTANCE32      hInstance;
313     LPARAM           lCustData;
314     LPPRINTHOOKPROC  lpfnPrintHook;
315     LPSETUPHOOKPROC  lpfnSetupHook;
316     LPCWSTR          lpPrintTemplateName;
317     LPCWSTR          lpSetupTemplateName;
318     HGLOBAL32        hPrintTemplate;
319     HGLOBAL32        hSetupTemplate;
320 } PRINTDLG32W, *LPPRINTDLG32W;
321
322 DECL_WINELIB_TYPE_AW(PRINTDLG);
323 DECL_WINELIB_TYPE_AW(LPPRINTDLG);
324
325 #define PD_ALLPAGES                  0x00000000
326 #define PD_SELECTION                 0x00000001
327 #define PD_PAGENUMS                  0x00000002
328 #define PD_NOSELECTION               0x00000004
329 #define PD_NOPAGENUMS                0x00000008
330 #define PD_COLLATE                   0x00000010
331 #define PD_PRINTTOFILE               0x00000020
332 #define PD_PRINTSETUP                0x00000040
333 #define PD_NOWARNING                 0x00000080
334 #define PD_RETURNDC                  0x00000100
335 #define PD_RETURNIC                  0x00000200
336 #define PD_RETURNDEFAULT             0x00000400
337 #define PD_SHOWHELP                  0x00000800
338 #define PD_ENABLEPRINTHOOK           0x00001000
339 #define PD_ENABLESETUPHOOK           0x00002000
340 #define PD_ENABLEPRINTTEMPLATE       0x00004000
341 #define PD_ENABLESETUPTEMPLATE       0x00008000
342 #define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000
343 #define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000
344 #define PD_USEDEVMODECOPIES          0x00040000
345 #define PD_DISABLEPRINTTOFILE        0x00080000
346 #define PD_HIDEPRINTTOFILE           0x00100000
347
348 typedef struct {
349         UINT16  wDriverOffset;
350         UINT16  wDeviceOffset;
351         UINT16  wOutputOffset;
352         UINT16  wDefault;
353         } DEVNAMES;
354 typedef DEVNAMES * LPDEVNAMES;
355
356 #define DN_DEFAULTPRN      0x0001
357
358
359 #define CDERR_DIALOGFAILURE   0xFFFF
360 #define CDERR_GENERALCODES     0x0000
361 #define CDERR_STRUCTSIZE       0x0001
362 #define CDERR_INITIALIZATION   0x0002
363 #define CDERR_NOTEMPLATE       0x0003
364 #define CDERR_NOHINSTANCE      0x0004
365 #define CDERR_LOADSTRFAILURE   0x0005
366 #define CDERR_FINDRESFAILURE   0x0006
367 #define CDERR_LOADRESFAILURE   0x0007
368 #define CDERR_LOCKRESFAILURE   0x0008
369 #define CDERR_MEMALLOCFAILURE  0x0009
370 #define CDERR_MEMLOCKFAILURE   0x000A
371 #define CDERR_NOHOOK           0x000B
372 #define CDERR_REGISTERMSGFAIL  0x000C
373
374 BOOL16  WINAPI ChooseColor(LPCHOOSECOLOR lpChCol);
375 DWORD   WINAPI CommDlgExtendedError(void);
376 HWND16  WINAPI FindText( SEGPTR find);
377 INT16   WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf);
378 INT16   WINAPI GetFileTitle32A(LPCSTR lpFile, LPSTR lpTitle, UINT32 cbBuf);
379 INT16   WINAPI GetFileTitle32W(LPCWSTR lpFile, LPWSTR lpTitle, UINT32 cbBuf);
380 #define GetFileTitle WINELIB_NAME_AW(GetFileTitle)
381 BOOL16  WINAPI GetOpenFileName16(SEGPTR ofn);
382 BOOL32  WINAPI GetOpenFileName32A(LPOPENFILENAME32A ofn);
383 BOOL32  WINAPI GetOpenFileName32W(LPOPENFILENAME32W ofn);
384 #define GetOpenFileName WINELIB_NAME_AW(GetOpenFileName)
385 BOOL16  WINAPI GetSaveFileName16(SEGPTR ofn);
386 BOOL32  WINAPI GetSaveFileName32A(LPOPENFILENAME32A ofn);
387 BOOL32  WINAPI GetSaveFileName32W(LPOPENFILENAME32W ofn);
388 #define GetSaveFileName WINELIB_NAME_AW(GetSaveFileName)
389 BOOL16  WINAPI PrintDlg( SEGPTR print);
390 HWND16  WINAPI ReplaceText( SEGPTR find);
391 BOOL16  WINAPI ChooseFont(LPCHOOSEFONT lpChFont);
392 LRESULT WINAPI FileOpenDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam);
393 LRESULT WINAPI FileSaveDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam);
394 LRESULT WINAPI ColorDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam);
395 LRESULT WINAPI FindTextDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam);
396 LRESULT WINAPI ReplaceTextDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam);
397 LRESULT WINAPI PrintDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam);
398 LRESULT WINAPI PrintSetupDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam);
399 LRESULT WINAPI FormatCharDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam);
400
401 #ifdef __cplusplus
402 }
403 #endif
404
405 #endif  /* __WINE_COMMDLG_H */