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