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