34 import java.awt.event.KeyEvent;
35 import java.awt.im.InputMethodHighlight;
36 import java.awt.im.spi.InputMethodDescriptor;
37 import java.awt.peer.*;
38 import java.lang.reflect.*;
39 import java.net.URL;
40 import java.security.*;
41 import java.util.*;
42 import java.util.concurrent.Callable;
43 import java.net.MalformedURLException;
44
45 import sun.awt.*;
46 import sun.awt.datatransfer.DataTransferer;
47 import sun.lwawt.*;
48 import sun.lwawt.LWWindowPeer.PeerType;
49 import sun.security.action.GetBooleanAction;
50 import sun.awt.image.MultiResolutionImage;
51
52 import sun.util.CoreResourceBundleControl;
53
54 final class NamedCursor extends Cursor {
55 NamedCursor(String name) {
56 super(name);
57 }
58 }
59
60 /**
61 * Mac OS X Cocoa-based AWT Toolkit.
62 */
63 public final class LWCToolkit extends LWToolkit {
64 // While it is possible to enumerate all mouse devices
65 // and query them for the number of buttons, the code
66 // that does it is rather complex. Instead, we opt for
67 // the easy way and just support up to 5 mouse buttons,
68 // like Windows.
69 private static final int BUTTONS = 5;
70
71 private static native void initIDs();
72
73 private static CInputMethodDescriptor sInputMethodDescriptor;
124 * System colors with default initial values, overwritten by toolkit if system values differ and are available.
125 */
126 private final static int NUM_APPLE_COLORS = 3;
127 public final static int KEYBOARD_FOCUS_COLOR = 0;
128 public final static int INACTIVE_SELECTION_BACKGROUND_COLOR = 1;
129 public final static int INACTIVE_SELECTION_FOREGROUND_COLOR = 2;
130 private static int[] appleColors = {
131 0xFF808080, // keyboardFocusColor = Color.gray;
132 0xFFC0C0C0, // secondarySelectedControlColor
133 0xFF303030, // controlDarkShadowColor
134 };
135
136 private native void loadNativeColors(final int[] systemColors, final int[] appleColors);
137
138 @Override
139 protected void loadSystemColors(final int[] systemColors) {
140 if (systemColors == null) return;
141 loadNativeColors(systemColors, appleColors);
142 }
143
144 private static class AppleSpecificColor extends Color {
145 private final int index;
146 AppleSpecificColor(int index) {
147 super(appleColors[index]);
148 this.index = index;
149 }
150
151 @Override
152 public int getRGB() {
153 return appleColors[index];
154 }
155 }
156
157 /**
158 * Returns Apple specific colors that we may expose going forward.
159 */
160 public static Color getAppleColor(int color) {
161 return new AppleSpecificColor(color);
162 }
163
|
34 import java.awt.event.KeyEvent;
35 import java.awt.im.InputMethodHighlight;
36 import java.awt.im.spi.InputMethodDescriptor;
37 import java.awt.peer.*;
38 import java.lang.reflect.*;
39 import java.net.URL;
40 import java.security.*;
41 import java.util.*;
42 import java.util.concurrent.Callable;
43 import java.net.MalformedURLException;
44
45 import sun.awt.*;
46 import sun.awt.datatransfer.DataTransferer;
47 import sun.lwawt.*;
48 import sun.lwawt.LWWindowPeer.PeerType;
49 import sun.security.action.GetBooleanAction;
50 import sun.awt.image.MultiResolutionImage;
51
52 import sun.util.CoreResourceBundleControl;
53
54 @SuppressWarnings("serial") // JDK implementation class
55 final class NamedCursor extends Cursor {
56 NamedCursor(String name) {
57 super(name);
58 }
59 }
60
61 /**
62 * Mac OS X Cocoa-based AWT Toolkit.
63 */
64 public final class LWCToolkit extends LWToolkit {
65 // While it is possible to enumerate all mouse devices
66 // and query them for the number of buttons, the code
67 // that does it is rather complex. Instead, we opt for
68 // the easy way and just support up to 5 mouse buttons,
69 // like Windows.
70 private static final int BUTTONS = 5;
71
72 private static native void initIDs();
73
74 private static CInputMethodDescriptor sInputMethodDescriptor;
125 * System colors with default initial values, overwritten by toolkit if system values differ and are available.
126 */
127 private final static int NUM_APPLE_COLORS = 3;
128 public final static int KEYBOARD_FOCUS_COLOR = 0;
129 public final static int INACTIVE_SELECTION_BACKGROUND_COLOR = 1;
130 public final static int INACTIVE_SELECTION_FOREGROUND_COLOR = 2;
131 private static int[] appleColors = {
132 0xFF808080, // keyboardFocusColor = Color.gray;
133 0xFFC0C0C0, // secondarySelectedControlColor
134 0xFF303030, // controlDarkShadowColor
135 };
136
137 private native void loadNativeColors(final int[] systemColors, final int[] appleColors);
138
139 @Override
140 protected void loadSystemColors(final int[] systemColors) {
141 if (systemColors == null) return;
142 loadNativeColors(systemColors, appleColors);
143 }
144
145 b @SuppressWarnings("serial") // JDK implementation class
146 private static class AppleSpecificColor extends Color {
147 private final int index;
148 AppleSpecificColor(int index) {
149 super(appleColors[index]);
150 this.index = index;
151 }
152
153 @Override
154 public int getRGB() {
155 return appleColors[index];
156 }
157 }
158
159 /**
160 * Returns Apple specific colors that we may expose going forward.
161 */
162 public static Color getAppleColor(int color) {
163 return new AppleSpecificColor(color);
164 }
165
|