27 28 import java.awt.*; 29 import java.awt.datatransfer.Clipboard; 30 import java.awt.dnd.*; 31 import java.awt.dnd.peer.DragSourceContextPeer; 32 import java.awt.event.InputEvent; 33 import java.awt.event.InvocationEvent; 34 import java.awt.event.KeyEvent; 35 import java.awt.im.InputMethodHighlight; 36 import java.awt.peer.*; 37 import java.lang.reflect.*; 38 import java.security.*; 39 import java.util.*; 40 import java.util.concurrent.Callable; 41 42 import sun.awt.*; 43 import sun.lwawt.*; 44 import sun.lwawt.LWWindowPeer.PeerType; 45 import sun.security.action.GetBooleanAction; 46 47 48 class NamedCursor extends Cursor { 49 NamedCursor(String name) { 50 super(name); 51 } 52 } 53 54 /** 55 * Mac OS X Cocoa-based AWT Toolkit. 56 */ 57 public final class LWCToolkit extends LWToolkit { 58 // While it is possible to enumerate all mouse devices 59 // and query them for the number of buttons, the code 60 // that does it is rather complex. Instead, we opt for 61 // the easy way and just support up to 5 mouse buttons, 62 // like Windows. 63 private static final int BUTTONS = 5; 64 65 private static native void initIDs(); 66 67 private static CInputMethodDescriptor sInputMethodDescriptor; 68 69 static { 70 System.err.flush(); 71 java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() { 72 public Object run() { 73 System.loadLibrary("awt"); 74 System.loadLibrary("fontmanager"); 75 return null; 76 } 77 }); 78 if (!GraphicsEnvironment.isHeadless()) { 79 initIDs(); 80 } 81 } 82 83 public LWCToolkit() { 84 SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer"); 85 86 areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true")); 87 //set system property if not yet assigned 88 System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled); 89 } 90 91 /* 92 * System colors with default initial values, overwritten by toolkit if system values differ and are available. 93 */ 94 private final static int NUM_APPLE_COLORS = 3; 95 public final static int KEYBOARD_FOCUS_COLOR = 0; 96 public final static int INACTIVE_SELECTION_BACKGROUND_COLOR = 1; 97 public final static int INACTIVE_SELECTION_FOREGROUND_COLOR = 2; | 27 28 import java.awt.*; 29 import java.awt.datatransfer.Clipboard; 30 import java.awt.dnd.*; 31 import java.awt.dnd.peer.DragSourceContextPeer; 32 import java.awt.event.InputEvent; 33 import java.awt.event.InvocationEvent; 34 import java.awt.event.KeyEvent; 35 import java.awt.im.InputMethodHighlight; 36 import java.awt.peer.*; 37 import java.lang.reflect.*; 38 import java.security.*; 39 import java.util.*; 40 import java.util.concurrent.Callable; 41 42 import sun.awt.*; 43 import sun.lwawt.*; 44 import sun.lwawt.LWWindowPeer.PeerType; 45 import sun.security.action.GetBooleanAction; 46 47 import sun.util.CoreResourceBundleControl; 48 49 50 class NamedCursor extends Cursor { 51 NamedCursor(String name) { 52 super(name); 53 } 54 } 55 56 /** 57 * Mac OS X Cocoa-based AWT Toolkit. 58 */ 59 public final class LWCToolkit extends LWToolkit { 60 // While it is possible to enumerate all mouse devices 61 // and query them for the number of buttons, the code 62 // that does it is rather complex. Instead, we opt for 63 // the easy way and just support up to 5 mouse buttons, 64 // like Windows. 65 private static final int BUTTONS = 5; 66 67 private static native void initIDs(); 68 69 private static CInputMethodDescriptor sInputMethodDescriptor; 70 71 static { 72 System.err.flush(); 73 ResourceBundle platformResources = java.security.AccessController.doPrivileged( 74 new java.security.PrivilegedAction<ResourceBundle>() { 75 public ResourceBundle run() { 76 ResourceBundle platformResources = null; 77 try { 78 platformResources = 79 ResourceBundle.getBundle("sun.awt.resources.awtosx", 80 CoreResourceBundleControl.getRBControlInstance()); 81 } catch (MissingResourceException e) { 82 // No resource file; defaults will be used. 83 } 84 85 System.loadLibrary("awt"); 86 System.loadLibrary("fontmanager"); 87 return platformResources; 88 } 89 }); 90 91 AWTAccessor.getToolkitAccessor().setPlatformResources(platformResources); 92 93 if (!GraphicsEnvironment.isHeadless()) { 94 initIDs(); 95 } 96 } 97 98 public LWCToolkit() { 99 SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer"); 100 101 areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true")); 102 //set system property if not yet assigned 103 System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled); 104 } 105 106 /* 107 * System colors with default initial values, overwritten by toolkit if system values differ and are available. 108 */ 109 private final static int NUM_APPLE_COLORS = 3; 110 public final static int KEYBOARD_FOCUS_COLOR = 0; 111 public final static int INACTIVE_SELECTION_BACKGROUND_COLOR = 1; 112 public final static int INACTIVE_SELECTION_FOREGROUND_COLOR = 2; |