View Javadoc

1   /*
2    * @(#)$Id:$
3    *
4    * Author		:	Ueli Kurmann, igesture@uelikurmann.ch
5    *                  
6    *
7    * Purpose		: 
8    *
9    * -----------------------------------------------------------------------
10   *
11   * Revision Information:
12   *
13   * Date				Who			Reason
14   *
15   * 27.11.2008			ukurmann	Initial Release
16   *
17   * -----------------------------------------------------------------------
18   *
19   * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20   *
21   * This software is the proprietary information of ETH Zurich.
22   * Use is subject to license terms.
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   * Comment
42   * @version 1.0 27.11.2008
43   * @author Ueli Kurmann
44   */
45  public class Win32 {
46  
47     /** Standard options to use the unicode version of a w32 API. */
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     /** Standard options to use the ASCII/MBCS version of a w32 API. */
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  }