/** creates and returns a picture */
public static Picture createPicture(int[] data, int w, int h) { return platform._createPicture(data, w, h); }
+ public static Picture createAlphaOnlyPicture(byte[] data, int w, int h) { return platform._createAlphaOnlyPicture(data, w, h); }
+
protected Picture _createPicture(int[] b, int w, int h) { return null; }
+ protected Picture _createAlphaOnlyPicture(byte[] b, int w, int h) {
+ int[] b2 = new int[b.length];
+ for(int i=0;i<b.length;i++) b2[i] = (b[i]&0xff) << 24;
+ return _createPicture(b2,w,h);
+ }
/** creates a socket object */
public static Socket getSocket(String host, int port, boolean ssl, boolean negotiate) throws IOException {
}
}
+ /** default implementation is Eric Albert's BrowserLauncher.java */
+ protected void _newBrowserWindow(String url) {
+ try {
+ Class c = Class.forName("edu.stanford.ejalbert.BrowserLauncher");
+ Method m = c.getMethod("openURL", new Class[] { String.class });
+ m.invoke(null, new String[] { url });
+ } catch (Exception e) {
+ Log.log(this, e);
+ }
+ }
+
/** opens a new browser window */
public static void newBrowserWindow(String url) {
if (!(url.startsWith("https://") || url.startsWith("http://") || url.startsWith("ftp://") || url.startsWith("mailto:"))) {
if (Log.on) Log.log(Platform.class, "newBrowserWindow, url = " + url);
platform._newBrowserWindow(url);
}
- protected void _newBrowserWindow(String url) {
- if (Log.on) Log.log(this, "Platform " + platform.getClass().getName() + " cannot open browser windows");
- }
/** used to notify the user of very serious failures; usually used when logging is not working or unavailable */
public static void criticalAbort(String message) {
Object titlebar = b.get("titlebar", true);
if (titlebar != null) ret.setTitleBarText(titlebar.toString());
- /* FIXME
Object icon = b.get("icon", true);
- if (icon != null && !"".equals(icon)) {
- Picture pic = ImageDecoder.getPicture(icon.toString());
+ if (icon != null && icon instanceof Res) {
+ Picture pic = Picture.fromRes((Res)icon);
if (pic != null) ret.setIcon(pic);
else if (Log.on) Log.log(Platform.class, "unable to load icon " + icon);
}
- */
ret.setLimits(b.minwidth, b.minheight, b.maxwidth, b.maxheight);
return cachedProxyInfo;
}
-
+
+ public static void running() { platform._running(); }
+ public void _running() { new Semaphore().block(); }
}