1 /* -------------------------------- wintab.h -------------------------------- */
2 /* Combined 16 & 32-bit version. */
3 
4 /*------------------------------------------------------------------------------
5 The text and information contained in this file may be freely used,
6 copied, or distributed without compensation or licensing restrictions.
7 
8 This file is copyright 1998-2008 by Wacom Technology
9 with portions copyright 1991-1998 by LCS/Telegraphics.
10 ------------------------------------------------------------------------------*/
11 #include "windows.h"
12 
13 #ifndef _INC_WINTAB	/* prevent multiple includes */
14 #define _INC_WINTAB
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif	/* __cplusplus */
19 
20 /* -------------------------------------------------------------------------- */
21 /* Messages */
22 #ifndef NOWTMESSAGES
23 
24 	#define WT_DEFBASE			0x7FF0
25 	#define WT_MAXOFFSET			0xF
26 
27 	#define _WT_PACKET(b)		((b)+0)
28 	#define _WT_CTXOPEN(b)		((b)+1)
29 	#define _WT_CTXCLOSE(b)		((b)+2)
30 	#define _WT_CTXUPDATE(b)	((b)+3)
31 	#define _WT_CTXOVERLAP(b)	((b)+4)
32 	#define _WT_PROXIMITY(b)	((b)+5)
33 	#define _WT_INFOCHANGE(b)	((b)+6)
34 	#define _WT_CSRCHANGE(b)	((b)+7) /* 1.1 */
35 	#define _WT_PACKETEXT(b)	((b)+8) /* 1.4 */
36 	#define _WT_MAX(b)			((b)+WT_MAXOFFSET)
37 
38 	#define WT_PACKET				_WT_PACKET(WT_DEFBASE)
39 	#define WT_CTXOPEN			_WT_CTXOPEN(WT_DEFBASE)
40 	#define WT_CTXCLOSE			_WT_CTXCLOSE(WT_DEFBASE)
41 	#define WT_CTXUPDATE			_WT_CTXUPDATE(WT_DEFBASE)
42 	#define WT_CTXOVERLAP		_WT_CTXOVERLAP(WT_DEFBASE)
43 	#define WT_PROXIMITY			_WT_PROXIMITY(WT_DEFBASE)
44 	#define WT_INFOCHANGE		_WT_INFOCHANGE(WT_DEFBASE)
45 	#define WT_CSRCHANGE			_WT_CSRCHANGE(WT_DEFBASE) /* 1.1 */
46 	#define WT_PACKETEXT			_WT_PACKETEXT(WT_DEFBASE) /* 1.4 */
47 	#define WT_MAX					_WT_MAX(WT_DEFBASE)
48 
49 #endif
50 
51 /* -------------------------------------------------------------------------- */
52 /* -------------------------------------------------------------------------- */
53 /* Data Types */
54 
55 /* -------------------------------------------------------------------------- */
56 /* COMMON DATA DEFS */
57 
58 DECLARE_HANDLE(HMGR);		/* manager handle */
59 DECLARE_HANDLE(HCTX);		/* context handle */
60 DECLARE_HANDLE(HWTHOOK);	/* hook handle */
61 
62 typedef DWORD WTPKT;			/* packet mask */
63 
64 
65 #ifndef NOWTPKT
66 
67 	/* WTPKT bits */
68 	#define PK_CONTEXT				0x0001	/* reporting context */
69 	#define PK_STATUS					0x0002	/* status bits */
70 	#define PK_TIME					0x0004	/* time stamp */
71 	#define PK_CHANGED				0x0008	/* change bit vector */
72 	#define PK_SERIAL_NUMBER		0x0010	/* packet serial number */
73 	#define PK_CURSOR					0x0020	/* reporting cursor */
74 	#define PK_BUTTONS				0x0040	/* button information */
75 	#define PK_X						0x0080	/* x axis */
76 	#define PK_Y						0x0100	/* y axis */
77 	#define PK_Z						0x0200	/* z axis */
78 	#define PK_NORMAL_PRESSURE		0x0400	/* normal or tip pressure */
79 	#define PK_TANGENT_PRESSURE	0x0800	/* tangential or barrel pressure */
80 	#define PK_ORIENTATION			0x1000	/* orientation info: tilts */
81 	#define PK_ROTATION				0x2000	/* rotation info; 1.1 */
82 
83 #endif
84 
85 typedef DWORD FIX32;				/* fixed-point arithmetic type */
86 
87 #ifndef NOFIX32
88 	#define INT(x)			HIWORD(x)
89 	#define FRAC(x)		LOWORD(x)
90 
91 	#define CASTFIX32(x)	((FIX32)((x)*65536L))
92 
93 	#define ROUND(x)		(INT(x) + (FRAC(x) > (WORD)0x8000))
94 
95 	#define FIX_MUL(c, a, b)							\
96 		(c = (((DWORD)FRAC(a) * FRAC(b)) >> 16) +	\
97 			(DWORD)INT(a) * FRAC(b) +					\
98 			(DWORD)INT(b) * FRAC(a) +					\
99 			((DWORD)INT(a) * INT(b) << 16))
100 
101 	#ifdef _WINDLL
102 		#define FIX_DIV_SC static
103 	#else
104 		#define FIX_DIV_SC
105 	#endif
106 
107 	#define FIX_DIV(c, a, b)						\
108 		{													\
109 			FIX_DIV_SC DWORD temp, rem, btemp;	\
110 															\
111 			/* fraction done bytewise */			\
112 			temp = ((a / b) << 16);					\
113 			rem = a % b;								\
114 			btemp = b;									\
115 			if (INT(btemp) < 256) {					\
116 				rem <<= 8;								\
117 			}												\
118 			else {										\
119 				btemp >>= 8;							\
120 			}												\
121 			temp += ((rem / btemp) << 8);			\
122 			rem %= btemp;								\
123 			rem <<= 8;									\
124 			temp += rem / btemp;						\
125 			c = temp;									\
126 		}
127 #endif
128 
129 /* -------------------------------------------------------------------------- */
130 /* INFO DATA DEFS */
131 
132 #ifndef NOWTINFO
133 
134 #ifndef NOWTAXIS
135 
136 typedef struct tagAXIS {
137 	LONG	axMin;
138 	LONG	axMax;
139 	UINT	axUnits;
140 	FIX32	axResolution;
141 } AXIS, *PAXIS, NEAR *NPAXIS, FAR *LPAXIS;
142 
143 	/* unit specifiers */
144 	#define TU_NONE			0
145 	#define TU_INCHES		1
146 	#define TU_CENTIMETERS	2
147 	#define TU_CIRCLE		3
148 
149 #endif
150 
151 #ifndef NOWTSYSBUTTONS
152 
153 /* system button assignment values */
154 #define SBN_NONE			0x00
155 #define SBN_LCLICK		0x01
156 #define SBN_LDBLCLICK	0x02
157 #define SBN_LDRAG			0x03
158 #define SBN_RCLICK		0x04
159 #define SBN_RDBLCLICK	0x05
160 #define SBN_RDRAG			0x06
161 #define SBN_MCLICK		0x07
162 #define SBN_MDBLCLICK	0x08
163 #define SBN_MDRAG			0x09
164 /* for Pen Windows */
165 #define SBN_PTCLICK		0x10
166 #define SBN_PTDBLCLICK	0x20
167 #define SBN_PTDRAG		0x30
168 #define SBN_PNCLICK		0x40
169 #define SBN_PNDBLCLICK	0x50
170 #define SBN_PNDRAG		0x60
171 #define SBN_P1CLICK		0x70
172 #define SBN_P1DBLCLICK	0x80
173 #define SBN_P1DRAG		0x90
174 #define SBN_P2CLICK		0xA0
175 #define SBN_P2DBLCLICK	0xB0
176 #define SBN_P2DRAG		0xC0
177 #define SBN_P3CLICK		0xD0
178 #define SBN_P3DBLCLICK	0xE0
179 #define SBN_P3DRAG		0xF0
180 
181 #endif
182 
183 #ifndef NOWTCAPABILITIES
184 
185 /* hardware capabilities */
186 #define HWC_INTEGRATED		0x0001
187 #define HWC_TOUCH				0x0002
188 #define HWC_HARDPROX			0x0004
189 #define HWC_PHYSID_CURSORS	0x0008 /* 1.1 */
190 #endif
191 
192 #ifndef NOWTIFC
193 
194 #ifndef NOWTCURSORS
195 
196 /* cursor capabilities */
197 #define CRC_MULTIMODE	0x0001 /* 1.1 */
198 #define CRC_AGGREGATE	0x0002 /* 1.1 */
199 #define CRC_INVERT		0x0004 /* 1.1 */
200 
201 #endif
202 
203 /* info categories */
204 #define WTI_INTERFACE		1
205 	#define IFC_WINTABID			1
206 	#define IFC_SPECVERSION		2
207 	#define IFC_IMPLVERSION		3
208 	#define IFC_NDEVICES			4
209 	#define IFC_NCURSORS			5
210 	#define IFC_NCONTEXTS		6
211 	#define IFC_CTXOPTIONS		7
212 	#define IFC_CTXSAVESIZE		8
213 	#define IFC_NEXTENSIONS		9
214 	#define IFC_NMANAGERS		10
215 	#define IFC_MAX				10
216 
217 
218 #endif
219 
220 #ifndef NOWTSTATUS
221 
222 #define WTI_STATUS			2
223 	#define STA_CONTEXTS			1
224 	#define STA_SYSCTXS			2
225 	#define STA_PKTRATE			3
226 	#define STA_PKTDATA			4
227 	#define STA_MANAGERS			5
228 	#define STA_SYSTEM			6
229 	#define STA_BUTTONUSE		7
230 	#define STA_SYSBTNUSE		8
231 	#define STA_MAX				8
232 
233 #endif
234 
235 #ifndef NOWTDEFCONTEXT
236 
237 #define WTI_DEFCONTEXT	3
238 #define WTI_DEFSYSCTX	4
239 #define WTI_DDCTXS		400 /* 1.1 */
240 #define WTI_DSCTXS		500 /* 1.1 */
241 	#define CTX_NAME			1
242 	#define CTX_OPTIONS		2
243 	#define CTX_STATUS		3
244 	#define CTX_LOCKS			4
245 	#define CTX_MSGBASE		5
246 	#define CTX_DEVICE		6
247 	#define CTX_PKTRATE		7
248 	#define CTX_PKTDATA		8
249 	#define CTX_PKTMODE		9
250 	#define CTX_MOVEMASK		10
251 	#define CTX_BTNDNMASK	11
252 	#define CTX_BTNUPMASK	12
253 	#define CTX_INORGX		13
254 	#define CTX_INORGY		14
255 	#define CTX_INORGZ		15
256 	#define CTX_INEXTX		16
257 	#define CTX_INEXTY		17
258 	#define CTX_INEXTZ		18
259 	#define CTX_OUTORGX		19
260 	#define CTX_OUTORGY		20
261 	#define CTX_OUTORGZ		21
262 	#define CTX_OUTEXTX		22
263 	#define CTX_OUTEXTY		23
264 	#define CTX_OUTEXTZ		24
265 	#define CTX_SENSX			25
266 	#define CTX_SENSY			26
267 	#define CTX_SENSZ			27
268 	#define CTX_SYSMODE		28
269 	#define CTX_SYSORGX		29
270 	#define CTX_SYSORGY		30
271 	#define CTX_SYSEXTX		31
272 	#define CTX_SYSEXTY		32
273 	#define CTX_SYSSENSX		33
274 	#define CTX_SYSSENSY		34
275 	#define CTX_MAX			34
276 
277 #endif
278 
279 #ifndef NOWTDEVICES
280 
281 #define WTI_DEVICES		100
282 	#define DVC_NAME			1
283 	#define DVC_HARDWARE		2
284 	#define DVC_NCSRTYPES	3
285 	#define DVC_FIRSTCSR		4
286 	#define DVC_PKTRATE		5
287 	#define DVC_PKTDATA		6
288 	#define DVC_PKTMODE		7
289 	#define DVC_CSRDATA		8
290 	#define DVC_XMARGIN		9
291 	#define DVC_YMARGIN		10
292 	#define DVC_ZMARGIN		11
293 	#define DVC_X				12
294 	#define DVC_Y				13
295 	#define DVC_Z				14
296 	#define DVC_NPRESSURE	15
297 	#define DVC_TPRESSURE	16
298 	#define DVC_ORIENTATION	17
299 	#define DVC_ROTATION		18 /* 1.1 */
300 	#define DVC_PNPID			19 /* 1.1 */
301 	#define DVC_MAX			19
302 
303 #endif
304 
305 #ifndef NOWTCURSORS
306 
307 #define WTI_CURSORS			200
308 	#define CSR_NAME				1
309 	#define CSR_ACTIVE			2
310 	#define CSR_PKTDATA			3
311 	#define CSR_BUTTONS			4
312 	#define CSR_BUTTONBITS		5
313 	#define CSR_BTNNAMES			6
314 	#define CSR_BUTTONMAP		7
315 	#define CSR_SYSBTNMAP		8
316 	#define CSR_NPBUTTON			9
317 	#define CSR_NPBTNMARKS		10
318 	#define CSR_NPRESPONSE		11
319 	#define CSR_TPBUTTON			12
320 	#define CSR_TPBTNMARKS		13
321 	#define CSR_TPRESPONSE		14
322 	#define CSR_PHYSID			15 /* 1.1 */
323 	#define CSR_MODE				16 /* 1.1 */
324 	#define CSR_MINPKTDATA		17 /* 1.1 */
325 	#define CSR_MINBUTTONS		18 /* 1.1 */
326 	#define CSR_CAPABILITIES	19 /* 1.1 */
327 	#define CSR_TYPE				20 /* 1.2 */
328 	#define CSR_MAX				20
329 
330 #endif
331 
332 #ifndef NOWTEXTENSIONS
333 
334 #define WTI_EXTENSIONS	300
335 	#define EXT_NAME			1
336 	#define EXT_TAG			2
337 	#define EXT_MASK			3
338 	#define EXT_SIZE			4
339 	#define EXT_AXES			5
340 	#define EXT_DEFAULT		6
341 	#define EXT_DEFCONTEXT	7
342 	#define EXT_DEFSYSCTX	8
343 	#define EXT_CURSORS		9
344 	#define EXT_DEVICES     110 /* Allow 100 cursors */
345 	#define EXT_MAX			210 /* Allow 100 devices */
346 
347 #endif
348 
349 #endif
350 
351 /* -------------------------------------------------------------------------- */
352 /* CONTEXT DATA DEFS */
353 
354 #define LCNAMELEN		40
355 #define LC_NAMELEN	40
356 #ifdef WIN32
357 typedef struct tagLOGCONTEXTA {
358 	char	lcName[LCNAMELEN];
359 	UINT	lcOptions;
360 	UINT	lcStatus;
361 	UINT	lcLocks;
362 	UINT	lcMsgBase;
363 	UINT	lcDevice;
364 	UINT	lcPktRate;
365 	WTPKT	lcPktData;
366 	WTPKT	lcPktMode;
367 	WTPKT	lcMoveMask;
368 	DWORD	lcBtnDnMask;
369 	DWORD	lcBtnUpMask;
370 	LONG	lcInOrgX;
371 	LONG	lcInOrgY;
372 	LONG	lcInOrgZ;
373 	LONG	lcInExtX;
374 	LONG	lcInExtY;
375 	LONG	lcInExtZ;
376 	LONG	lcOutOrgX;
377 	LONG	lcOutOrgY;
378 	LONG	lcOutOrgZ;
379 	LONG	lcOutExtX;
380 	LONG	lcOutExtY;
381 	LONG	lcOutExtZ;
382 	FIX32	lcSensX;
383 	FIX32	lcSensY;
384 	FIX32	lcSensZ;
385 	BOOL	lcSysMode;
386 	int	lcSysOrgX;
387 	int	lcSysOrgY;
388 	int	lcSysExtX;
389 	int	lcSysExtY;
390 	FIX32	lcSysSensX;
391 	FIX32	lcSysSensY;
392 } LOGCONTEXTA, *PLOGCONTEXTA, NEAR *NPLOGCONTEXTA, FAR *LPLOGCONTEXTA;
393 typedef struct tagLOGCONTEXTW {
394 	WCHAR	lcName[LCNAMELEN];
395 	UINT	lcOptions;
396 	UINT	lcStatus;
397 	UINT	lcLocks;
398 	UINT	lcMsgBase;
399 	UINT	lcDevice;
400 	UINT	lcPktRate;
401 	WTPKT	lcPktData;
402 	WTPKT	lcPktMode;
403 	WTPKT	lcMoveMask;
404 	DWORD	lcBtnDnMask;
405 	DWORD	lcBtnUpMask;
406 	LONG	lcInOrgX;
407 	LONG	lcInOrgY;
408 	LONG	lcInOrgZ;
409 	LONG	lcInExtX;
410 	LONG	lcInExtY;
411 	LONG	lcInExtZ;
412 	LONG	lcOutOrgX;
413 	LONG	lcOutOrgY;
414 	LONG	lcOutOrgZ;
415 	LONG	lcOutExtX;
416 	LONG	lcOutExtY;
417 	LONG	lcOutExtZ;
418 	FIX32	lcSensX;
419 	FIX32	lcSensY;
420 	FIX32	lcSensZ;
421 	BOOL	lcSysMode;
422 	int	lcSysOrgX;
423 	int	lcSysOrgY;
424 	int	lcSysExtX;
425 	int	lcSysExtY;
426 	FIX32	lcSysSensX;
427 	FIX32	lcSysSensY;
428 } LOGCONTEXTW, *PLOGCONTEXTW, NEAR *NPLOGCONTEXTW, FAR *LPLOGCONTEXTW;
429 #ifdef UNICODE
430 typedef LOGCONTEXTW LOGCONTEXT;
431 typedef PLOGCONTEXTW PLOGCONTEXT;
432 typedef NPLOGCONTEXTW NPLOGCONTEXT;
433 typedef LPLOGCONTEXTW LPLOGCONTEXT;
434 #else
435 typedef LOGCONTEXTA LOGCONTEXT;
436 typedef PLOGCONTEXTA PLOGCONTEXT;
437 typedef NPLOGCONTEXTA NPLOGCONTEXT;
438 typedef LPLOGCONTEXTA LPLOGCONTEXT;
439 #endif /* UNICODE */
440 #else /* WIN32 */
441 typedef struct tagLOGCONTEXT {
442 	char	lcName[LCNAMELEN];
443 	UINT	lcOptions;
444 	UINT	lcStatus;
445 	UINT	lcLocks;
446 	UINT	lcMsgBase;
447 	UINT	lcDevice;
448 	UINT	lcPktRate;
449 	WTPKT	lcPktData;
450 	WTPKT	lcPktMode;
451 	WTPKT	lcMoveMask;
452 	DWORD	lcBtnDnMask;
453 	DWORD	lcBtnUpMask;
454 	LONG	lcInOrgX;
455 	LONG	lcInOrgY;
456 	LONG	lcInOrgZ;
457 	LONG	lcInExtX;
458 	LONG	lcInExtY;
459 	LONG	lcInExtZ;
460 	LONG	lcOutOrgX;
461 	LONG	lcOutOrgY;
462 	LONG	lcOutOrgZ;
463 	LONG	lcOutExtX;
464 	LONG	lcOutExtY;
465 	LONG	lcOutExtZ;
466 	FIX32	lcSensX;
467 	FIX32	lcSensY;
468 	FIX32	lcSensZ;
469 	BOOL	lcSysMode;
470 	int	lcSysOrgX;
471 	int	lcSysOrgY;
472 	int	lcSysExtX;
473 	int	lcSysExtY;
474 	FIX32	lcSysSensX;
475 	FIX32	lcSysSensY;
476 } LOGCONTEXT, *PLOGCONTEXT, NEAR *NPLOGCONTEXT, FAR *LPLOGCONTEXT;
477 #endif /* WIN32 */
478 
479 	/* context option values */
480 	#define CXO_SYSTEM		0x0001
481 	#define CXO_PEN			0x0002
482 	#define CXO_MESSAGES		0x0004
483 	#define CXO_MARGIN		0x8000
484 	#define CXO_MGNINSIDE	0x4000
485 	#define CXO_CSRMESSAGES	0x0008 /* 1.1 */
486 
487 	/* context status values */
488 	#define CXS_DISABLED		0x0001
489 	#define CXS_OBSCURED		0x0002
490 	#define CXS_ONTOP			0x0004
491 
492 	/* context lock values */
493 	#define CXL_INSIZE		0x0001
494 	#define CXL_INASPECT		0x0002
495 	#define CXL_SENSITIVITY	0x0004
496 	#define CXL_MARGIN		0x0008
497 	#define CXL_SYSOUT		0x0010
498 
499 /* -------------------------------------------------------------------------- */
500 /* EVENT DATA DEFS */
501 
502 /* For packet structure definition, see pktdef.h */
503 
504 /* packet status values */
505 #define TPS_PROXIMITY		0x0001
506 #define TPS_QUEUE_ERR		0x0002
507 #define TPS_MARGIN			0x0004
508 #define TPS_GRAB				0x0008
509 #define TPS_INVERT			0x0010 /* 1.1 */
510 
511 typedef struct tagORIENTATION {
512 	int orAzimuth;
513 	int orAltitude;
514 	int orTwist;
515 } ORIENTATION, *PORIENTATION, NEAR *NPORIENTATION, FAR *LPORIENTATION;
516 
517 typedef struct tagROTATION { /* 1.1 */
518 	int roPitch;
519 	int roRoll;
520 	int roYaw;
521 } ROTATION, *PROTATION, NEAR *NPROTATION, FAR *LPROTATION;
522 // grandfather in obsolete member names.
523 #define rotPitch	roPitch
524 #define rotRoll	roRoll
525 #define rotYaw		roYaw
526 
527 
528 /* relative buttons */
529 #define TBN_NONE	0
530 #define TBN_UP		1
531 #define TBN_DOWN	2
532 
533 /* -------------------------------------------------------------------------- */
534 /* DEVICE CONFIG CONSTANTS */
535 
536 #ifndef NOWTDEVCFG
537 
538 #define WTDC_NONE		0
539 #define WTDC_CANCEL		1
540 #define WTDC_OK			2
541 #define WTDC_RESTART	3
542 
543 #endif
544 
545 /* -------------------------------------------------------------------------- */
546 /* HOOK CONSTANTS */
547 
548 #ifndef NOWTHOOKS
549 
550 #define WTH_PLAYBACK			1
551 #define WTH_RECORD			2
552 
553 #define WTHC_GETLPLPFN		(-3)
554 #define WTHC_LPLPFNNEXT		(-2)
555 #define WTHC_LPFNNEXT		(-1)
556 #define WTHC_ACTION			0
557 #define WTHC_GETNEXT			1
558 #define WTHC_SKIP				2
559 
560 #endif
561 
562 /* -------------------------------------------------------------------------- */
563 /* PREFERENCE FUNCTION CONSTANTS */
564 
565 #ifndef NOWTPREF
566 
567 #define WTP_LPDEFAULT	((LPVOID)-1L)
568 #define WTP_DWDEFAULT	((DWORD)-1L)
569 
570 #endif
571 
572 /* -------------------------------------------------------------------------- */
573 /* EXTENSION TAGS AND CONSTANTS */
574 
575 #ifndef NOWTEXTENSIONS
576 
577 /* constants for use with pktdef.h */
578 #define PKEXT_ABSOLUTE	1
579 #define PKEXT_RELATIVE	2
580 
581 /* Extension tags. */
582 #define WTX_OBT				0	/* Out of bounds tracking */
583 #define WTX_FKEYS				1	/* Function keys */
584 #define WTX_TILT				2	/* Raw Cartesian tilt; 1.1 */
585 #define WTX_CSRMASK			3	/* select input by cursor type; 1.1 */
586 #define WTX_XBTNMASK			4	/* Extended button mask; 1.1 */
587 #define WTX_EXPKEYS			5	/* ExpressKeys; 1.3 - DEPRECATED: see WTX_EXPKEYS2 */
588 #define WTX_TOUCHSTRIP		6	/* TouchStrips; 1.4 */
589 #define WTX_TOUCHRING		7	/* TouchRings; 1.4 */
590 #define WTX_EXPKEYS2			8	/* ExpressKeys; 1.4 */
591 
592 typedef struct tagXBTNMASK {
593 	BYTE xBtnDnMask[32];
594 	BYTE xBtnUpMask[32];
595 } XBTNMASK;
596 
597 typedef struct tagTILT { /* 1.1 */
598 	int tiltX;
599 	int tiltY;
600 } TILT;
601 
602 typedef struct tagEXTENSIONBASE { /* 1.4 */
603 	HCTX		nContext;
604 	UINT		nStatus;
605 	DWORD		nTime;
606 	UINT		nSerialNumber;
607 } EXTENSIONBASE;
608 
609 typedef struct tagEXPKEYSDATA { /* 1.4 */
610 	BYTE		nTablet;
611 	BYTE		nControl;
612 	BYTE		nLocation;
613 	BYTE		nReserved;
614 	DWORD		nState;
615 } EXPKEYSDATA;
616 
617 typedef struct tagSLIDERDATA { /* 1.4 */
618 	BYTE		nTablet;
619 	BYTE		nControl;
620 	BYTE		nMode;
621 	BYTE		nReserved;
622 	DWORD		nPosition;
623 } SLIDERDATA;
624 
625 typedef struct tagEXTPROPERTY { /* 1.4 */
626 	BYTE		version;				// Structure version, 0 for now
627 	BYTE		tabletIndex;		// 0-based index for tablet
628 	BYTE		controlIndex;		// 0-based index for control
629 	BYTE		functionIndex;		// 0-based index for control's sub-function
630 	WORD		propertyID;			// property ID
631 	WORD		reserved;			// DWORD-alignment filler
632 	DWORD		dataSize;			// number of bytes in data[] buffer
633 	BYTE		data[1];				// raw data
634 } EXTPROPERTY;
635 
636 #define TABLET_PROPERTY_CONTROLCOUNT	 0			// UINT32: number of physical controls on tablet
637 #define TABLET_PROPERTY_FUNCCOUNT		 1			// UINT32: number of functions of control
638 #define TABLET_PROPERTY_AVAILABLE		 2			// BOOL: control/mode is available for override
639 #define TABLET_PROPERTY_MIN				 3			// UINT32: minimum value
640 #define TABLET_PROPERTY_MAX				 4			// UINT32: maximum value
641 #define TABLET_PROPERTY_OVERRIDE			 5			// BOOL: control is overridden
642 #define TABLET_PROPERTY_OVERRIDE_NAME	 6			// UTF-8: Displayable name when control is overridden
643 #define TABLET_PROPERTY_OVERRIDE_ICON	 7			// Image: Icon to show when control is overridden
644 #define TABLET_PROPERTY_ICON_WIDTH		 8			// UINT32: Pixel width of icon display
645 #define TABLET_PROPERTY_ICON_HEIGHT		 9			// UINT32: Pixel height of icon display
646 #define TABLET_PROPERTY_ICON_FORMAT		 10		// UINT32: UINT32: Pixel format of icon display (see TABLET_ICON_FMT_*)
647 #define TABLET_PROPERTY_LOCATION			 11		// UINT32: Physical location of control (see TABLET_LOC_*)
648 
649 #define TABLET_ICON_FMT_NONE				 0			// No display
650 #define TABLET_ICON_FMT_4BPP_GRAY		 1			// 4bpp grayscale
651 
652 #define TABLET_LOC_LEFT				0
653 #define TABLET_LOC_RIGHT			1
654 #define TABLET_LOC_TOP				2
655 #define TABLET_LOC_BOTTOM			3
656 #define TABLET_LOC_TRANSDUCER		4
657 
658 #endif
659 
660 /* -------------------------------------------------------------------------- */
661 /* -------------------------------------------------------------------------- */
662 /* Functions */
663 
664 	#ifndef API
665 		#ifndef WINAPI
666 			#define API			FAR PASCAL
667 		#else
668 			#define API			WINAPI
669 		#endif
670 	#endif
671 
672 #ifndef NOWTCALLBACKS
673 
674 	#ifndef CALLBACK
675 	#define CALLBACK	FAR PASCAL
676 	#endif
677 
678 	#ifndef NOWTMANAGERFXNS
679 	/* callback function types */
680 	typedef BOOL (WINAPI * WTENUMPROC)(HCTX, LPARAM); /* changed CALLBACK->WINAPI, 1.1 */
681 	typedef BOOL (WINAPI * WTCONFIGPROC)(HCTX, HWND);
682 	typedef LRESULT (WINAPI * WTHOOKPROC)(int, WPARAM, LPARAM);
683 	typedef WTHOOKPROC FAR *LPWTHOOKPROC;
684 	#endif
685 
686 #endif
687 
688 
689 #ifndef NOWTFUNCTIONS
690 
691 	#ifndef NOWTBASICFXNS
692 	/* BASIC FUNCTIONS */
693 #ifdef WIN32
694 	UINT API WTInfoA(UINT, UINT, LPVOID);
695 	#define ORD_WTInfoA						20
696 	UINT API WTInfoW(UINT, UINT, LPVOID);
697 	#define ORD_WTInfoW						1020
698 	#ifdef UNICODE
699 	#define WTInfo			WTInfoW
700 	#define ORD_WTInfo	ORD_WTInfoW
701 	#else
702 	#define WTInfo			WTInfoA
703 	#define ORD_WTInfo	ORD_WTInfoA
704 	#endif /* !UNICODE */
705 #else
706 	UINT API WTInfo(UINT, UINT, LPVOID);
707 	#define ORD_WTInfo							20
708 #endif
709 #ifdef WIN32
710 	HCTX API WTOpenA(HWND, LPLOGCONTEXTA, BOOL);
711 	#define ORD_WTOpenA							21
712 	HCTX API WTOpenW(HWND, LPLOGCONTEXTW, BOOL);
713 	#define ORD_WTOpenW							1021
714 	#ifdef UNICODE
715 	#define WTOpen			WTOpenW
716 	#define ORD_WTOpen	ORD_WTOpenW
717 	#else
718 	#define WTOpen			WTOpenA
719 	#define ORD_WTOpen	ORD_WTOpenA
720 	#endif /* !UNICODE */
721 #else
722 	HCTX API WTOpen(HWND, LPLOGCONTEXT, BOOL);
723 	#define ORD_WTOpen							21
724 #endif
725 	BOOL API WTClose(HCTX);
726 	#define ORD_WTClose							22
727 	int API WTPacketsGet(HCTX, int, LPVOID);
728 	#define ORD_WTPacketsGet					23
729 	BOOL API WTPacket(HCTX, UINT, LPVOID);
730 	#define ORD_WTPacket							24
731 	#endif
732 
733 	#ifndef NOWTVISIBILITYFXNS
734 	/* VISIBILITY FUNCTIONS */
735 	BOOL API WTEnable(HCTX, BOOL);
736 	#define ORD_WTEnable							40
737 	BOOL API WTOverlap(HCTX, BOOL);
738 	#define ORD_WTOverlap						41
739 	#endif
740 
741 	#ifndef NOWTCTXEDITFXNS
742 	/* CONTEXT EDITING FUNCTIONS */
743 	BOOL API WTConfig(HCTX, HWND);
744 	#define ORD_WTConfig							60
745 #ifdef WIN32
746 	BOOL API WTGetA(HCTX, LPLOGCONTEXTA);
747 	#define ORD_WTGetA							61
748 	BOOL API WTGetW(HCTX, LPLOGCONTEXTW);
749 	#define ORD_WTGetW							1061
750 	#ifdef UNICODE
751 	#define WTGet			WTGetW
752 	#define ORD_WTGet		ORD_WTGetW
753 	#else
754 	#define WTGet			WTGetA
755 	#define ORD_WTGet		ORD_WTGetA
756 	#endif /* !UNICODE */
757 #else
758 	BOOL API WTGet(HCTX, LPLOGCONTEXT);
759 	#define ORD_WTGet								61
760 #endif
761 #ifdef WIN32
762 	BOOL API WTSetA(HCTX, LPLOGCONTEXTA);
763 	#define ORD_WTSetA							62
764 	BOOL API WTSetW(HCTX, LPLOGCONTEXTW);
765 	#define ORD_WTSetW							1062
766 	#ifdef UNICODE
767 	#define WTSet			WTSetW
768 	#define ORD_WTSet		ORD_WTSetW
769 	#else
770 	#define WTSet			WTSetA
771 	#define ORD_WTSet		ORD_WTSetA
772 	#endif /* !UNICODE */
773 #else
774 	BOOL API WTSet(HCTX, LPLOGCONTEXT);
775 	#define ORD_WTSet								62
776 #endif
777 	BOOL API WTExtGet(HCTX, UINT, LPVOID);
778 	#define ORD_WTExtGet							63
779 	BOOL API WTExtSet(HCTX, UINT, LPVOID);
780 	#define ORD_WTExtSet							64
781 	BOOL API WTSave(HCTX, LPVOID);
782 	#define ORD_WTSave							65
783 	HCTX API WTRestore(HWND, LPVOID, BOOL);
784 	#define ORD_WTRestore						66
785 	#endif
786 
787 	#ifndef NOWTQUEUEFXNS
788 	/* ADVANCED PACKET AND QUEUE FUNCTIONS */
789 	int API WTPacketsPeek(HCTX, int, LPVOID);
790 	#define ORD_WTPacketsPeek					80
791 	int API WTDataGet(HCTX, UINT, UINT, int, LPVOID, LPINT);
792 	#define ORD_WTDataGet						81
793 	int API WTDataPeek(HCTX, UINT, UINT, int, LPVOID, LPINT);
794 	#define ORD_WTDataPeek						82
795 #ifndef WIN32
796 /* OBSOLETE IN WIN32! */
797 	DWORD API WTQueuePackets(HCTX);
798 	#define ORD_WTQueuePackets					83
799 #endif
800 	int API WTQueueSizeGet(HCTX);
801 	#define ORD_WTQueueSizeGet					84
802 	BOOL API WTQueueSizeSet(HCTX, int);
803 	#define ORD_WTQueueSizeSet					85
804 	#endif
805 
806 	#ifndef NOWTHMGRFXNS
807 	/* MANAGER HANDLE FUNCTIONS */
808 	HMGR API WTMgrOpen(HWND, UINT);
809 	#define ORD_WTMgrOpen						100
810 	BOOL API WTMgrClose(HMGR);
811 	#define ORD_WTMgrClose						101
812 	#endif
813 
814 	#ifndef NOWTMGRCTXFXNS
815 	/* MANAGER CONTEXT FUNCTIONS */
816 	BOOL API WTMgrContextEnum(HMGR, WTENUMPROC, LPARAM);
817 	#define ORD_WTMgrContextEnum				120
818 	HWND API WTMgrContextOwner(HMGR, HCTX);
819 	#define ORD_WTMgrContextOwner				121
820 	HCTX API WTMgrDefContext(HMGR, BOOL);
821 	#define ORD_WTMgrDefContext				122
822 	HCTX API WTMgrDefContextEx(HMGR, UINT, BOOL); /* 1.1 */
823 	#define ORD_WTMgrDefContextEx				206
824 	#endif
825 
826 	#ifndef NOWTMGRCONFIGFXNS
827 	/* MANAGER CONFIG BOX  FUNCTIONS */
828 	UINT API WTMgrDeviceConfig(HMGR, UINT, HWND);
829 	#define ORD_WTMgrDeviceConfig				140
830 #ifndef WIN32
831 /* OBSOLETE IN WIN32! */
832 	BOOL API WTMgrConfigReplace(HMGR, BOOL, WTCONFIGPROC);
833 	#define ORD_WTMgrConfigReplace			141
834 #endif
835 	#endif
836 
837 	#ifndef NOWTMGRHOOKFXNS
838 	/* MANAGER PACKET HOOK FUNCTIONS */
839 #ifndef WIN32
840 /* OBSOLETE IN WIN32! */
841 	WTHOOKPROC API WTMgrPacketHook(HMGR, BOOL, int, WTHOOKPROC);
842 	#define ORD_WTMgrPacketHook				160
843 	LRESULT API WTMgrPacketHookDefProc(int, WPARAM, LPARAM, LPWTHOOKPROC);
844 	#define ORD_WTMgrPacketHookDefProc		161
845 #endif
846 	#endif
847 
848 	#ifndef NOWTMGRPREFFXNS
849 	/* MANAGER PREFERENCE DATA FUNCTIONS */
850 	BOOL API WTMgrExt(HMGR, UINT, LPVOID);
851 	#define ORD_WTMgrExt							180
852 	BOOL API WTMgrCsrEnable(HMGR, UINT, BOOL);
853 	#define ORD_WTMgrCsrEnable					181
854 	BOOL API WTMgrCsrButtonMap(HMGR, UINT, LPBYTE, LPBYTE);
855 	#define ORD_WTMgrCsrButtonMap				182
856 	BOOL API WTMgrCsrPressureBtnMarks(HMGR, UINT, DWORD, DWORD);
857 	#define ORD_WTMgrCsrPressureBtnMarks	183
858 	BOOL API WTMgrCsrPressureResponse(HMGR, UINT, UINT FAR *, UINT FAR *);
859 	#define ORD_WTMgrCsrPressureResponse	184
860 	BOOL API WTMgrCsrExt(HMGR, UINT, UINT, LPVOID);
861 	#define ORD_WTMgrCsrExt						185
862 	#endif
863 
864 /* Win32 replacements for non-portable functions. */
865 	#ifndef NOWTQUEUEFXNS
866 	/* ADVANCED PACKET AND QUEUE FUNCTIONS */
867 	BOOL API WTQueuePacketsEx(HCTX, UINT FAR *, UINT FAR *);
868 	#define ORD_WTQueuePacketsEx				200
869 	#endif
870 
871 	#ifndef NOWTMGRCONFIGFXNS
872 	/* MANAGER CONFIG BOX  FUNCTIONS */
873 #ifdef WIN32
874 	BOOL API WTMgrConfigReplaceExA(HMGR, BOOL, LPSTR, LPSTR);
875 	#define ORD_WTMgrConfigReplaceExA		202
876 	BOOL API WTMgrConfigReplaceExW(HMGR, BOOL, LPWSTR, LPSTR);
877 	#define ORD_WTMgrConfigReplaceExW		1202
878 	#ifdef UNICODE
879 	#define WTMgrConfigReplaceEx			WTMgrConfigReplaceExW
880 	#define ORD_WTMgrConfigReplaceEx		ORD_WTMgrConfigReplaceExW
881 	#else
882 	#define WTMgrConfigReplaceEx			WTMgrConfigReplaceExA
883 	#define ORD_WTMgrConfigReplaceEx		ORD_WTMgrConfigReplaceExA
884 	#endif /* !UNICODE */
885 #else
886 	BOOL API WTMgrConfigReplaceEx(HMGR, BOOL, LPSTR, LPSTR);
887 	#define ORD_WTMgrConfigReplaceEx			202
888 #endif
889 	#endif
890 
891 	#ifndef NOWTMGRHOOKFXNS
892 	/* MANAGER PACKET HOOK FUNCTIONS */
893 #ifdef WIN32
894 	HWTHOOK API WTMgrPacketHookExA(HMGR, int, LPSTR, LPSTR);
895 	#define ORD_WTMgrPacketHookExA			203
896 	HWTHOOK API WTMgrPacketHookExW(HMGR, int, LPWSTR, LPSTR);
897 	#define ORD_WTMgrPacketHookExW			1203
898 	#ifdef UNICODE
899 	#define WTMgrPacketHookEx			WTMgrPacketHookExW
900 	#define ORD_WTMgrPacketHookEx		ORD_WTMgrPacketHookExW
901 	#else
902 	#define WTMgrPacketHookEx			WTMgrPacketHookExA
903 	#define ORD_WTMgrPacketHookEx		ORD_WTMgrPacketHookExA
904 	#endif /* !UNICODE */
905 #else
906 	HWTHOOK API WTMgrPacketHookEx(HMGR, int, LPSTR, LPSTR);
907 	#define ORD_WTMgrPacketHookEx				203
908 #endif
909 	BOOL API WTMgrPacketUnhook(HWTHOOK);
910 	#define ORD_WTMgrPacketUnhook				204
911 	LRESULT API WTMgrPacketHookNext(HWTHOOK, int, WPARAM, LPARAM);
912 	#define ORD_WTMgrPacketHookNext			205
913 	#endif
914 
915 	#ifndef NOWTMGRPREFFXNS
916 	/* MANAGER PREFERENCE DATA FUNCTIONS */
917 	BOOL API WTMgrCsrPressureBtnMarksEx(HMGR, UINT, UINT FAR *, UINT FAR *);
918 	#define ORD_WTMgrCsrPressureBtnMarksEx	201
919 	#endif
920 
921 #endif
922 
923 #ifdef __cplusplus
924 }
925 #endif	/* __cplusplus */
926 
927 #endif /* #define _INC_WINTAB */
928 
929