1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.ximtec.igesture.io.win32;
28
29 import java.util.HashMap;
30 import java.util.Map;
31
32 import org.ximtec.igesture.io.wacom.Wintab32;
33
34 import com.sun.jna.Native;
35 import com.sun.jna.win32.StdCallLibrary;
36 import com.sun.jna.win32.W32APIFunctionMapper;
37 import com.sun.jna.win32.W32APITypeMapper;
38
39
40
41
42
43
44
45 public class Win32 {
46
47
48 private static Map<String, Object> UNICODE_OPTIONS = new HashMap<String, Object>() {
49
50 {
51 put(StdCallLibrary.OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
52 put(StdCallLibrary.OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
53 }
54 };
55
56
57 private static Map<String, Object> ASCII_OPTIONS = new HashMap<String, Object>() {
58
59 {
60 put(StdCallLibrary.OPTION_TYPE_MAPPER, W32APITypeMapper.ASCII);
61 put(StdCallLibrary.OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.ASCII);
62 }
63 };
64
65 private static Map<String, Object> DEFAULT_OPTIONS = Boolean
66 .getBoolean("w32.ascii") ? ASCII_OPTIONS : UNICODE_OPTIONS;
67
68
69
70 public static final GDI32 GDI32_INSTANCE = (GDI32)Native.loadLibrary("gdi32",
71 GDI32.class, DEFAULT_OPTIONS);
72
73 public static final User32 USER32_INSTANCE = (User32)Native.loadLibrary(
74 "user32", User32.class, DEFAULT_OPTIONS);
75
76 public static final Kernel32 KERNEL32_INSTANCE = (Kernel32)Native.loadLibrary("kernel32", Kernel32.class,
77 DEFAULT_OPTIONS);
78
79 public static final Wintab32 WINTAB32_INSTANCE = (Wintab32)Native.loadLibrary("wintab32", Wintab32.class, DEFAULT_OPTIONS);
80
81 }