2003/04/24 10:22:31
[org.ibex.core.git] / src / org / xwt / plat / Carbon.java
1 // Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL]
2 package org.xwt.plat;
3
4 import java.awt.*;
5 import java.awt.image.*;
6 import gnu.gcj.RawData;
7 import java.net.*;
8 import java.lang.reflect.*;
9 import java.io.*;
10 import java.util.*;
11 import java.awt.peer.*;
12 import org.xwt.util.*;
13 import org.xwt.*;
14
15 /** Platform implementation for Carbon UI on a POSIX-compliant OS (ie Mac OS X) */
16 public class Carbon extends POSIX {
17
18     // General Methods ///////////////////////////////////////////////////////
19
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"); }
34
35     public Carbon() { }
36     public void init() { throw new Error("FIXME"); }
37
38
39     // CarbonSurface /////////////////////////////////////////////////////
40
41     /** Implements a Surface as an Carbon Window */
42     public static class CarbonSurface extends Surface {
43         
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);
58
59         public CarbonSurface(Box root, boolean framed) { super(root); throw new Error("FIXME"); }
60
61     }
62
63
64     // Our Subclass of Picture ///////////////////////////////////////////////
65
66     /** Implements a Picture */
67     public static class CarbonPicture extends Picture {
68         
69         int width;
70         int height;
71         int[] data = null;
72         public int getWidth() { return width; }
73         public int getHeight() { return height; }
74
75         public CarbonPicture(int[] data, int w, int h) {
76             this.data = data;
77             this.width = w;
78             this.height = h;
79             throw new Error("FIXME");
80         }
81
82     }
83
84     /** A Carbon DoubleBuffer */
85     public static class CarbonDoubleBuffer extends DoubleBuffer {
86
87         int width;
88         int height;
89         public int getWidth() { return width; }
90         public int getHeight() { return height; }
91
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();
99     }
100
101 }