summaryrefslogtreecommitdiff
path: root/libjava/gnu/java/awt/EmbeddedWindow.java
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@redhat.com>2003-07-27 19:04:42 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-07-27 19:04:42 +0000
commit096380816540c78e63e64f0349af2a0416be8f56 (patch)
treefcc5d69edb5a39dceca0ff7cc2899f14dbba82ab /libjava/gnu/java/awt/EmbeddedWindow.java
parentb7a78333b1d28106f1c1326fb69b97452c98fc49 (diff)
2003-07-27 Thomas Fitzsimmons <fitzsim@redhat.com.h>
Michael Koch <konqueror@gmx.de> * gnu/java/awt/EmbeddedWindow.java (EmbeddedWindow): Extends Frame instead of Window. (window_id): New member variable to store the native window handle. (create): Removed. (EmbeddedWindow): New constructor. (addNotify): New method. (getHandler): Likewise. (setWindowPeer): New native method. * gnu/java/awt/EmbeddedWindowSupport.java (EmbeddedWindowSupport): Fixed documentation. (createEmbeddedWindow): Return EmbeddedWindowPeer instead of WindowPeer, give it an EmbeddedWindow instance instead of the raw window data. * gnu/java/awt/natEmbeddedWindow.cc (create): Removed. (setWindowPeer): New method. * gnu/java/awt/peer/EmbeddedWindowPeer.java, gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c: New files * gnu/java/awt/peer/gtk/GtkToolkit.java (GtkToolkit): Implements EmbeddedWindowSupport. (createEmbeddedWindow): New method. * java/awt/Window.java (Window): Removed. * Makefile.am (java_source_files): Added EmbeddedWindowPeer.java. (gtk_awt_peer_sources): Added GtkEmbeddedWindowPeer.java. (gtk_c_source_files): Added gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c. * Makefile.in: Regenerated. Co-Authored-By: Michael Koch <konqueror@gmx.de> From-SVN: r69859
Diffstat (limited to 'libjava/gnu/java/awt/EmbeddedWindow.java')
-rw-r--r--libjava/gnu/java/awt/EmbeddedWindow.java52
1 files changed, 43 insertions, 9 deletions
diff --git a/libjava/gnu/java/awt/EmbeddedWindow.java b/libjava/gnu/java/awt/EmbeddedWindow.java
index 607cc38518c..fc64e215162 100644
--- a/libjava/gnu/java/awt/EmbeddedWindow.java
+++ b/libjava/gnu/java/awt/EmbeddedWindow.java
@@ -38,25 +38,59 @@ exception statement from your version. */
package gnu.java.awt;
-import java.awt.Window;
+import gnu.java.awt.peer.EmbeddedWindowPeer;
+import java.awt.Frame;
+import java.awt.Toolkit;
/**
- * This class represents an AWT window embedded into another graphical
- * toolkit or anther application.
+ * Represents an AWT window that can be embedded into another
+ * application.
*
* @author Michael Koch <konqueror@gmx.de>
*/
-public class EmbeddedWindow extends Window
+public class EmbeddedWindow extends Frame
{
+ private int window_id;
+
/**
- * Creates an window embedded into another application of graphical toolkit.
+ * Creates an window to be embedded into another application.
*
* @param window_id The native handle to the screen area where the AWT window
* should be embedded.
- * @param width The width of the screen area.
- * @param height The height of the screen area.
*/
+ public EmbeddedWindow (int window_id)
+ {
+ super();
+ this.window_id = window_id;
+ }
+
+ /**
+ * Creates the native peer for this embedded window.
+ */
+ public void addNotify()
+ {
+ Toolkit tk = getToolkit();
+
+ if (! (tk instanceof EmbeddedWindowSupport))
+ throw new UnsupportedOperationException
+ ("Embedded windows are not supported by the current peers: " + tk.getClass());
+
+ setWindowPeer (((EmbeddedWindowSupport) tk).createEmbeddedWindow (this));
+ super.addNotify();
+ }
+
// This method is only made native to circumvent the package-privateness of
- // an internal java.awt.Window constructor.
- public static native Window create (int window_id, int width, int height);
+ // an AWT internal java.awt.Component.peer member variable.
+ native void setWindowPeer (EmbeddedWindowPeer peer);
+
+ /**
+ * Gets the native handle of the screen area where the window will
+ * be embedded.
+ *
+ * @return The native handle that was passed to the constructor.
+ */
+ public int getHandle()
+ {
+ return window_id;
+ }
}