001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Michael Danilov
019: * @version $Revision$
020: */package org.apache.harmony.awt.wtk.linux;
021:
022: import java.awt.GraphicsDevice;
023: import java.util.HashMap;
024:
025: import org.apache.harmony.awt.gl.linux.XGraphicsDevice;
026: import org.apache.harmony.awt.wtk.*;
027:
028: public final class LinuxWTK extends WTK {
029:
030: static {
031: System.loadLibrary("gl");
032: }
033:
034: /**
035: * @see org.apache.harmony.awt.wtk.WTK#getGraphicsFactory()
036: */
037: public GraphicsFactory getGraphicsFactory() {
038: return graphicsFactory;
039: }
040:
041: /**
042: * @see org.apache.harmony.awt.wtk.WTK#getNativeEventQueue()
043: */
044: public NativeEventQueue getNativeEventQueue() {
045: return eventQueue;
046: }
047:
048: /**
049: * @see org.apache.harmony.awt.wtk.WTK#getWindowFactory()
050: */
051: public WindowFactory getWindowFactory() {
052: return windowFactory;
053: }
054:
055: /**
056: * @see org.apache.harmony.awt.wtk.WTK#getCursorFactory()
057: */
058: public CursorFactory getCursorFactory() {
059: return cursorFactory;
060: }
061:
062: /**
063: * @see org.apache.harmony.awt.wtk.WTK#getNativeMouseInfo()
064: */
065: public NativeMouseInfo getNativeMouseInfo() {
066: return mouseInfo;
067: }
068:
069: /**
070: * @see org.apache.harmony.awt.wtk.WTK#getSystemProperties()
071: */
072: public SystemProperties getSystemProperties() {
073: return systemProperties;
074: }
075:
076: /**
077: * @see org.apache.harmony.awt.wtk.WTK#getNativeRobot(java.awt.GraphicsDevice)
078: */
079: public NativeRobot getNativeRobot(GraphicsDevice screen) {
080: XTestRobot robot = (XTestRobot) robots.get(screen);
081: if (robot == null) {
082: robot = new XTestRobot(windowFactory.getDisplay(),
083: (XGraphicsDevice) screen);
084: robots.put(screen, robot);
085: }
086: return robot;
087: }
088:
089: public NativeIM getNativeIM() {
090: // TODO implement
091: return null;
092: }
093:
094: public native boolean getLockingState(int keyCode);
095:
096: public native void setLockingState(int keyCode, boolean on);
097:
098: private final LinuxWindowFactory windowFactory = new LinuxWindowFactory();
099: private final LinuxEventQueue eventQueue = new LinuxEventQueue(
100: windowFactory);
101: private final GraphicsFactory graphicsFactory = new org.apache.harmony.awt.gl.linux.LinuxGraphics2DFactory();
102: private final LinuxCursorFactory cursorFactory = new LinuxCursorFactory(
103: windowFactory);
104: private final NativeMouseInfo mouseInfo = new LinuxMouseInfo(
105: windowFactory);
106: private final LinuxSystemProperties systemProperties = new LinuxSystemProperties(
107: windowFactory);
108: private HashMap robots = new HashMap(); //HashMap<GraphicsDevice, XTestRobot>
109: }
|