40 |
import java.awt.*; |
import java.awt.*; |
41 |
import java.awt.event.*; |
import java.awt.event.*; |
42 |
|
|
|
/* This class will go away with Japhar integration. For use with Sun's JDK |
|
|
this may be required, unless another method of associating Java objects |
|
|
with GTK objects is used. */ |
|
|
|
|
43 |
public class GtkGenericPeer |
public class GtkGenericPeer |
44 |
{ |
{ |
45 |
// FIXME: this isn't guaranteed to give unique numbers. |
final int native_state = getUniqueInteger (); |
46 |
final int native_state = java.lang.System.identityHashCode(this); |
|
47 |
|
// Next native state value we will assign. |
48 |
|
private static int next_native_state = 0; |
49 |
|
|
50 |
|
// The widget or other java-side object we wrap. |
51 |
protected Object awtWidget; |
protected Object awtWidget; |
52 |
|
|
53 |
|
// Global event queue. |
54 |
protected static EventQueue q = null; |
protected static EventQueue q = null; |
55 |
|
|
56 |
|
// Dispose of our native state. |
57 |
|
public native void dispose (); |
58 |
|
|
59 |
protected GtkGenericPeer (Object awtWidget) |
protected GtkGenericPeer (Object awtWidget) |
60 |
{ |
{ |
61 |
this.awtWidget = awtWidget; |
this.awtWidget = awtWidget; |
72 |
q.postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, |
q.postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, |
73 |
command, mods)); |
command, mods)); |
74 |
} |
} |
75 |
|
|
76 |
|
// Return a unique integer for use in the native state mapping |
77 |
|
// code. We can't use a hash code since that is not guaranteed to |
78 |
|
// be unique. |
79 |
|
private static synchronized int getUniqueInteger () |
80 |
|
{ |
81 |
|
// Let's assume this will never wrap. |
82 |
|
return next_native_state++; |
83 |
|
} |
84 |
} |
} |