1 // Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL]
5 import java.awt.image.*;
6 import gnu.gcj.RawData;
8 import java.lang.reflect.*;
11 import java.awt.peer.*;
12 import org.xwt.util.*;
15 /** Platform implementation for Carbon UI on a POSIX-compliant OS (ie Mac OS X) */
16 public class Carbon extends POSIX {
18 // General Methods ///////////////////////////////////////////////////////
20 protected String _getAltKeyName() { return "option"; }
21 protected String[] _listFonts() { throw new Error("FIXME"); }
22 protected Picture _createPicture(int[] data, int w, int h) { return new CarbonPicture(data, w, h); }
23 protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new CarbonDoubleBuffer(w, h); }
24 protected Surface _createSurface(Box b, boolean framed) { return new CarbonSurface(b, framed); }
25 protected boolean _needsAutoClick() { throw new Error("FIXME"); }
26 protected native int _getScreenWidth();
27 protected native int _getScreenHeight();
28 protected native String _getClipBoard();
29 protected native void _setClipBoard(String s);
30 protected native int _stringWidth(String font, String text);
31 protected native int _getMaxAscent(String font);
32 protected native int _getMaxDescent(String font);
33 protected boolean _needsAutoDoubleClick() { throw new Error("FIXME"); }
36 public void init() { throw new Error("FIXME"); }
39 // CarbonSurface /////////////////////////////////////////////////////
41 /** Implements a Surface as an Carbon Window */
42 public static class CarbonSurface extends Surface {
44 public native void setInvisible(boolean i);
45 public native void _setMaximized(boolean m);
46 public native void setIcon(Picture p);
47 public native void _setMinimized(boolean b);
48 public native void setTitleBarText(String s);
49 public native void setSize(int w, int h);
50 public native void setLocation(int x, int y);
51 public native void natInit();
52 public native void toFront();
53 public native void toBack();
54 public native void syncCursor();
55 public native void _dispose();
56 public native void setLimits(int minw, int minh, int maxw, int maxh);
57 public native void blit(DoubleBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2);
59 public CarbonSurface(Box root, boolean framed) { throw new Error("FIXME"); }
64 // Our Subclass of Picture ///////////////////////////////////////////////
66 /** Implements a Picture */
67 public static class CarbonPicture extends Picture {
72 public int getWidth() { return width; }
73 public int getHeight() { return height; }
75 public CarbonPicture(int[] data, int w, int h) {
79 throw new Error("FIXME");
84 /** A Carbon DoubleBuffer */
85 public static class CarbonDoubleBuffer extends DoubleBuffer {
89 public int getWidth() { return width; }
90 public int getHeight() { return height; }
92 public CarbonDoubleBuffer(int w, int h) { this.width = w; this.height = h; throw new Error("FIXME"); }
93 public void setClip(int x, int y, int x2, int y2) { throw new Error("FIXME"); }
94 public void drawPicture(Picture source, int x, int y) { throw new Error("FIXME"); }
95 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"); }
96 public native void fillRect(int x, int y, int x2, int y2, int color);
97 public native void drawString(String font, String text, int x, int y, int color);
98 public native void finalize();