88 |
{ |
{ |
89 |
Hashtable containers = new Hashtable(); |
Hashtable containers = new Hashtable(); |
90 |
static EventQueue q; |
static EventQueue q; |
|
static Clipboard systemClipboard; |
|
91 |
static boolean useGraphics2dSet; |
static boolean useGraphics2dSet; |
92 |
static boolean useGraphics2d; |
static boolean useGraphics2d; |
93 |
|
static Thread mainThread; |
94 |
|
|
95 |
public static boolean useGraphics2D() |
public static boolean useGraphics2D() |
96 |
{ |
{ |
122 |
|
|
123 |
gtkInit(portableNativeSync); |
gtkInit(portableNativeSync); |
124 |
|
|
125 |
// Register ImageIO SPIs |
mainThread = new Thread ("GTK main thread") |
126 |
GdkPixbufDecoder.registerSpis( IIORegistry.getDefaultInstance() ); |
{ |
127 |
|
public void run () |
128 |
|
{ |
129 |
|
gtkMain (); |
130 |
|
} |
131 |
|
}; |
132 |
|
mainThread.start (); |
133 |
} |
} |
134 |
|
|
135 |
public GtkToolkit () |
public GtkToolkit () |
136 |
{ |
{ |
|
systemClipboard = new GtkClipboard (); |
|
137 |
} |
} |
138 |
|
|
139 |
public native void beep(); |
public native void beep(); |
252 |
|
|
253 |
public Image createImage (String filename) |
public Image createImage (String filename) |
254 |
{ |
{ |
255 |
|
if (filename.length() == 0) |
256 |
|
return new GtkImage (); |
257 |
|
|
258 |
if (useGraphics2D()) |
if (useGraphics2D()) |
259 |
return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (filename)); |
return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (filename)); |
260 |
else |
else |
266 |
if (useGraphics2D()) |
if (useGraphics2D()) |
267 |
return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (url)); |
return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (url)); |
268 |
else |
else |
269 |
{ |
return new GtkImage (url); |
|
GdkPixbufDecoder d = new GdkPixbufDecoder (url); |
|
|
GtkImage image = new GtkImage (d); |
|
|
return image; |
|
|
} |
|
270 |
} |
} |
271 |
|
|
272 |
public Image createImage (ImageProducer producer) |
public Image createImage (ImageProducer producer) |
286 |
imagelength)); |
imagelength)); |
287 |
else |
else |
288 |
{ |
{ |
289 |
GdkPixbufDecoder d = new GdkPixbufDecoder (imagedata, |
byte[] datacopy = new byte[imagelength]; |
290 |
imageoffset, |
System.arraycopy (imagedata, imageoffset, datacopy, 0, imagelength); |
291 |
imagelength); |
return new GtkImage (datacopy); |
|
GtkImage image = new GtkImage (d); |
|
|
return image; |
|
292 |
} |
} |
293 |
} |
} |
294 |
|
|
400 |
|
|
401 |
public Clipboard getSystemClipboard() |
public Clipboard getSystemClipboard() |
402 |
{ |
{ |
403 |
return systemClipboard; |
SecurityManager secman = System.getSecurityManager(); |
404 |
|
if (secman != null) |
405 |
|
secman.checkSystemClipboardAccess(); |
406 |
|
|
407 |
|
return GtkClipboard.getInstance(); |
408 |
} |
} |
409 |
|
|
410 |
/** |
/** |
637 |
|
|
638 |
public GraphicsEnvironment getLocalGraphicsEnvironment() |
public GraphicsEnvironment getLocalGraphicsEnvironment() |
639 |
{ |
{ |
640 |
return new GdkGraphicsEnvironment(this); |
return new GdkGraphicsEnvironment(); |
641 |
} |
} |
642 |
|
|
643 |
public Font createFont(int format, InputStream stream) |
public Font createFont(int format, InputStream stream) |
650 |
return new GdkRobotPeer (screen); |
return new GdkRobotPeer (screen); |
651 |
} |
} |
652 |
|
|
653 |
public native boolean nativeQueueEmpty(); |
public void registerImageIOSpis(IIORegistry reg) |
654 |
public native void wakeNativeQueue(); |
{ |
655 |
public native void iterateNativeQueue(EventQueue locked, boolean block); |
GdkPixbufDecoder.registerSpis(reg); |
656 |
|
} |
657 |
|
|
658 |
|
public static native void gtkMain(); |
659 |
} // class GtkToolkit |
} // class GtkToolkit |