2003/04/24 08:00:37
[org.ibex.core.git] / src / org / xwt / plat / Carbon.java
diff --git a/src/org/xwt/plat/Carbon.java b/src/org/xwt/plat/Carbon.java
new file mode 100644 (file)
index 0000000..80a0eef
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL]
+package org.xwt.plat;
+
+import java.awt.*;
+import java.awt.image.*;
+import gnu.gcj.RawData;
+import java.net.*;
+import java.lang.reflect.*;
+import java.io.*;
+import java.util.*;
+import java.awt.peer.*;
+import org.xwt.util.*;
+import org.xwt.*;
+
+/** Platform implementation for Carbon UI on a POSIX-compliant OS (ie Mac OS X) */
+public class Carbon extends POSIX {
+
+    // General Methods ///////////////////////////////////////////////////////
+
+    protected String _getAltKeyName() { return "option"; }
+    protected String[] _listFonts() { throw new Error("FIXME"); }
+    protected Picture _createPicture(int[] data, int w, int h) { return new CarbonPicture(data, w, h); }
+    protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new CarbonDoubleBuffer(w, h); }
+    protected Surface _createSurface(Box b, boolean framed) { return new CarbonSurface(b, framed); }
+    protected boolean _needsAutoClick() { throw new Error("FIXME"); }
+    protected native int _getScreenWidth();
+    protected native int _getScreenHeight();
+    protected native String _getClipBoard();
+    protected native void _setClipBoard(String s);
+    protected native int _stringWidth(String font, String text);
+    protected native int _getMaxAscent(String font);
+    protected native int _getMaxDescent(String font);
+    protected boolean _needsAutoDoubleClick() { throw new Error("FIXME"); }
+
+    public Carbon() { }
+    public void init() { throw new Error("FIXME"); }
+
+
+    // CarbonSurface /////////////////////////////////////////////////////
+
+    /** Implements a Surface as an Carbon Window */
+    public static class CarbonSurface extends Surface {
+        
+        public native void setInvisible(boolean i);
+        public native void _setMaximized(boolean m);
+        public native void setIcon(Picture p);
+        public native void _setMinimized(boolean b);
+        public native void setTitleBarText(String s);
+        public native void setSize(int w, int h);
+        public native void setLocation(int x, int y);
+        public native void natInit();
+        public native void toFront();
+        public native void toBack();
+        public native void syncCursor();
+        public native void _dispose();
+        public native void setLimits(int minw, int minh, int maxw, int maxh);
+        public native void blit(DoubleBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2);
+
+        public CarbonSurface(Box root, boolean framed) { throw new Error("FIXME"); }
+
+    }
+
+
+    // Our Subclass of Picture ///////////////////////////////////////////////
+
+    /** Implements a Picture */
+    public static class CarbonPicture extends Picture {
+        
+        int width;
+        int height;
+        int[] data = null;
+        public int getWidth() { return width; }
+        public int getHeight() { return height; }
+
+        public CarbonPicture(int[] data, int w, int h) {
+            this.data = data;
+            this.width = w;
+            this.height = h;
+           throw new Error("FIXME");
+        }
+
+    }
+
+    /** A Carbon DoubleBuffer */
+    public static class CarbonDoubleBuffer extends DoubleBuffer {
+
+        int width;
+        int height;
+        public int getWidth() { return width; }
+        public int getHeight() { return height; }
+
+        public CarbonDoubleBuffer(int w, int h) { this.width = w; this.height = h; throw new Error("FIXME"); }
+        public void setClip(int x, int y, int x2, int y2) { throw new Error("FIXME"); }
+        public void drawPicture(Picture source, int x, int y) { throw new Error("FIXME"); }
+        public void drawPicture(Picture source, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) { throw new Error("FIXME"); }
+        public native void fillRect(int x, int y, int x2, int y2, int color);
+        public native void drawString(String font, String text, int x, int y, int color);
+        public native void finalize();
+    }
+
+}