Release 1.1.37.
[wine/gsoc-2012-control.git] / dlls / sane.ds / sane_i.h
blob30fde23aecdd5b7421385973a519661f6149b03a
1 /*
2 * Copyright 2000 Corel Corporation
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef _TWAIN32_H
20 #define _TWAIN32_H
22 #ifndef __WINE_CONFIG_H
23 # error You must include config.h first
24 #endif
26 #ifdef SONAME_LIBSANE
27 # include <sane/sane.h>
28 # include <sane/saneopts.h>
30 #define MAKE_FUNCPTR(f) typeof(f) * p##f;
31 MAKE_FUNCPTR(sane_init)
32 MAKE_FUNCPTR(sane_exit)
33 MAKE_FUNCPTR(sane_get_devices)
34 MAKE_FUNCPTR(sane_open)
35 MAKE_FUNCPTR(sane_close)
36 MAKE_FUNCPTR(sane_get_option_descriptor)
37 MAKE_FUNCPTR(sane_control_option)
38 MAKE_FUNCPTR(sane_get_parameters)
39 MAKE_FUNCPTR(sane_start)
40 MAKE_FUNCPTR(sane_read)
41 MAKE_FUNCPTR(sane_cancel)
42 MAKE_FUNCPTR(sane_set_io_mode)
43 MAKE_FUNCPTR(sane_get_select_fd)
44 MAKE_FUNCPTR(sane_strstatus)
45 #undef MAKE_FUNCPTR
47 #endif
48 #include <stdarg.h>
50 #include "windef.h"
51 #include "winbase.h"
52 #include "winuser.h"
53 #include "twain.h"
55 extern HINSTANCE SANE_instance;
57 #define TWCC_CHECKSTATUS (TWCC_CUSTOMBASE + 1)
59 /* internal information about an active data source */
60 struct tagActiveDS
62 struct tagActiveDS *next; /* next active DS */
63 TW_IDENTITY identity; /* identity */
64 TW_UINT16 currentState; /* current state */
65 UINT windowMessage; /* message to use to send status */
66 TW_UINT16 twCC; /* condition code */
67 HWND hwndOwner; /* window handle of the app */
68 HWND progressWnd; /* window handle of the scanning window */
69 #ifdef SONAME_LIBSANE
70 SANE_Handle deviceHandle; /* device handle */
71 SANE_Parameters sane_param; /* parameters about the image
72 transferred */
73 BOOL sane_param_valid; /* true if valid sane_param*/
74 BOOL sane_started; /* If sane_start has been called */
75 INT deviceIndex; /* index of the current device */
76 #endif
77 /* Capabilities */
78 TW_UINT16 capXferMech; /* ICAP_XFERMECH */
79 BOOL PixelTypeSet;
80 TW_UINT16 defaultPixelType; /* ICAP_PIXELTYPE */
81 BOOL XResolutionSet;
82 TW_FIX32 defaultXResolution;
83 BOOL YResolutionSet;
84 TW_FIX32 defaultYResolution;
85 } activeDS;
87 /* Helper functions */
88 extern TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action);
89 extern TW_UINT16 SANE_SaneSetDefaults (void);
91 /* Implementation of operation triplets
92 * From Application to Source (Control Information) */
93 TW_UINT16 SANE_CapabilityGet (pTW_IDENTITY pOrigin, TW_MEMREF pData);
94 TW_UINT16 SANE_CapabilityGetCurrent
95 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
96 TW_UINT16 SANE_CapabilityGetDefault
97 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
98 TW_UINT16 SANE_CapabilityQuerySupport
99 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
100 TW_UINT16 SANE_CapabilityReset
101 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
102 TW_UINT16 SANE_CapabilitySet
103 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
104 TW_UINT16 SANE_CustomDSDataGet
105 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
106 TW_UINT16 SANE_CustomDSDataSet
107 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
108 TW_UINT16 SANE_AutomaticCaptureDirectory
109 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
110 TW_UINT16 SANE_ChangeDirectory
111 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
112 TW_UINT16 SANE_FileSystemCopy
113 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
114 TW_UINT16 SANE_CreateDirectory
115 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
116 TW_UINT16 SANE_FileSystemDelete
117 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
118 TW_UINT16 SANE_FormatMedia
119 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
120 TW_UINT16 SANE_FileSystemGetClose
121 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
122 TW_UINT16 SANE_FileSystemGetFirstFile
123 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
124 TW_UINT16 SANE_FileSystemGetInfo
125 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
126 TW_UINT16 SANE_FileSystemGetNextFile
127 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
128 TW_UINT16 SANE_FileSystemRename
129 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
130 TW_UINT16 SANE_ProcessEvent
131 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
132 TW_UINT16 SANE_PassThrough
133 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
134 TW_UINT16 SANE_PendingXfersEndXfer
135 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
136 TW_UINT16 SANE_PendingXfersGet
137 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
138 TW_UINT16 SANE_PendingXfersReset
139 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
140 TW_UINT16 SANE_PendingXfersStopFeeder
141 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
142 TW_UINT16 SANE_SetupFileXferGet
143 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
144 TW_UINT16 SANE_SetupFileXferGetDefault
145 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
146 TW_UINT16 SANE_SetupFileXferReset
147 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
148 TW_UINT16 SANE_SetupFileXferSet
149 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
150 TW_UINT16 SANE_SetupFileXfer2Get
151 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
152 TW_UINT16 SANE_SetupFileXfer2GetDefault
153 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
154 TW_UINT16 SANE_SetupFileXfer2Reset
155 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
156 TW_UINT16 SANE_SetupFileXfer2Set
157 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
158 TW_UINT16 SANE_SetupMemXferGet
159 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
160 TW_UINT16 SANE_GetDSStatus
161 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
162 TW_UINT16 SANE_DisableDSUserInterface
163 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
164 TW_UINT16 SANE_EnableDSUserInterface
165 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
166 TW_UINT16 SANE_EnableDSUIOnly
167 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
168 TW_UINT16 SANE_XferGroupGet
169 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
170 TW_UINT16 SANE_XferGroupSet
171 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
173 /* Implementation of operation triplets
174 * From Application to Source (Image Information) */
175 TW_UINT16 SANE_CIEColorGet
176 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
177 TW_UINT16 SANE_ExtImageInfoGet
178 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
179 TW_UINT16 SANE_GrayResponseReset
180 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
181 TW_UINT16 SANE_GrayResponseSet
182 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
183 TW_UINT16 SANE_ImageFileXferGet
184 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
185 TW_UINT16 SANE_ImageInfoGet
186 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
187 TW_UINT16 SANE_ImageLayoutGet
188 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
189 TW_UINT16 SANE_ImageLayoutGetDefault
190 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
191 TW_UINT16 SANE_ImageLayoutReset
192 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
193 TW_UINT16 SANE_ImageLayoutSet
194 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
195 TW_UINT16 SANE_ImageMemXferGet
196 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
197 TW_UINT16 SANE_ImageNativeXferGet
198 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
199 TW_UINT16 SANE_JPEGCompressionGet
200 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
201 TW_UINT16 SANE_JPEGCompressionGetDefault
202 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
203 TW_UINT16 SANE_JPEGCompressionReset
204 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
205 TW_UINT16 SANE_JPEGCompressionSet
206 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
207 TW_UINT16 SANE_Palette8Get
208 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
209 TW_UINT16 SANE_Palette8GetDefault
210 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
211 TW_UINT16 SANE_Palette8Reset
212 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
213 TW_UINT16 SANE_Palette8Set
214 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
215 TW_UINT16 SANE_RGBResponseReset
216 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
217 TW_UINT16 SANE_RGBResponseSet
218 (pTW_IDENTITY pOrigin, TW_MEMREF pData);
220 /* UI function */
221 BOOL DoScannerUI(void);
222 HWND ScanningDialogBox(HWND dialog, LONG progress);
224 /* Option functions */
225 #ifdef SONAME_LIBSANE
226 SANE_Status sane_option_get_int(SANE_Handle h, const char *option_name, SANE_Int *val);
227 SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int val, SANE_Int *status);
228 SANE_Status sane_option_get_str(SANE_Handle h, const char *option_name, SANE_String val, size_t len, SANE_Int *status);
229 SANE_Status sane_option_set_str(SANE_Handle h, const char *option_name, SANE_String val, SANE_Int *status);
230 SANE_Status sane_option_probe_resolution(SANE_Handle h, const char *option_name, SANE_Int *minval, SANE_Int *maxval, SANE_Int *quant);
231 SANE_Status sane_option_probe_mode(SANE_Handle h, SANE_String_Const **choices, char *current, int current_size);
232 SANE_Status sane_option_probe_scan_area(SANE_Handle h, const char *option_name, SANE_Fixed *val,
233 SANE_Unit *unit, SANE_Fixed *min, SANE_Fixed *max, SANE_Fixed *quant);
234 SANE_Status sane_option_get_bool(SANE_Handle h, const char *option_name, SANE_Bool *val, SANE_Int *status);
235 SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bool val, SANE_Int *status);
236 SANE_Status sane_option_set_fixed(SANE_Handle h, const char *option_name, SANE_Fixed val, SANE_Int *status);
237 TW_UINT16 sane_status_to_twcc(SANE_Status rc);
238 BOOL convert_sane_res_to_twain(double sane_res, SANE_Unit unit, TW_FIX32 *twain_res, TW_UINT16 twtype);
239 #endif
242 #endif