summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT AWT/emulated
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2009-07-01 14:50:54 +0000
committerSilenio Quarti <silenio>2009-07-01 14:50:54 +0000
commit093c579a4ffd9551acb901bba9617e7aa776989d (patch)
tree71cf23798b651ef92f188390841a8d130908fb11 /bundles/org.eclipse.swt/Eclipse SWT AWT/emulated
parentf664d297f7bb009784868bf3fcf0b3e3bb9a646b (diff)
downloadeclipse.platform.swt-093c579a4ffd9551acb901bba9617e7aa776989d.tar.gz
eclipse.platform.swt-093c579a4ffd9551acb901bba9617e7aa776989d.tar.xz
eclipse.platform.swt-093c579a4ffd9551acb901bba9617e7aa776989d.zip
restore HEAD after accidental deletion by error in automated build script
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT AWT/emulated')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT AWT/emulated/org/eclipse/swt/awt/SWT_AWT.java117
1 files changed, 117 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/emulated/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/emulated/org/eclipse/swt/awt/SWT_AWT.java
new file mode 100644
index 0000000000..718a1160f5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/emulated/org/eclipse/swt/awt/SWT_AWT.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.awt;
+
+import java.awt.Canvas;
+import java.awt.Frame;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * This class provides a bridge between SWT and AWT, so that it
+ * is possible to embed AWT components in SWT and vice versa.
+ *
+ * @see <a href="http://www.eclipse.org/swt/snippets/#awt">Swing/AWT snippets</a>
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
+ *
+ * @since 3.0
+ */
+public class SWT_AWT {
+
+ /**
+ * The name of the embedded Frame class. The default class name
+ * for the platform will be used if <code>null</code>.
+ */
+ public static String embeddedFrameClass;
+
+ /**
+ * Key for looking up the embedded frame for a Composite using
+ * getData().
+ */
+ static String EMBEDDED_FRAME_KEY = "org.eclipse.swt.awt.SWT_AWT.embeddedFrame";
+
+/**
+ * Returns a <code>java.awt.Frame</code> which is the embedded frame
+ * associated with the specified composite.
+ *
+ * @param parent the parent <code>Composite</code> of the <code>java.awt.Frame</code>
+ * @return a <code>java.awt.Frame</code> the embedded frame or <code>null</code>.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ *
+ * @since 3.2
+ */
+public static Frame getFrame (Composite parent) {
+ if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if ((parent.getStyle () & SWT.EMBEDDED) == 0) return null;
+ return (Frame)parent.getData(EMBEDDED_FRAME_KEY);
+}
+
+/**
+ * Creates a new <code>java.awt.Frame</code>. This frame is the root for
+ * the AWT components that will be embedded within the composite. In order
+ * for the embedding to succeed, the composite must have been created
+ * with the SWT.EMBEDDED style.
+ * <p>
+ * IMPORTANT: As of JDK1.5, the embedded frame does not receive mouse events.
+ * When a lightweight component is added as a child of the embedded frame,
+ * the cursor does not change. In order to work around both these problems, it is
+ * strongly recommended that a heavyweight component such as <code>java.awt.Panel</code>
+ * be added to the frame as the root of all components.
+ * </p>
+ *
+ * @param parent the parent <code>Composite</code> of the new <code>java.awt.Frame</code>
+ * @return a <code>java.awt.Frame</code> to be the parent of the embedded AWT components
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the parent Composite does not have the SWT.EMBEDDED style</li>
+ * </ul>
+ *
+ * @since 3.0
+ */
+public static Frame new_Frame (final Composite parent) {
+ if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if ((parent.getStyle () & SWT.EMBEDDED) == 0) {
+ SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ return null;
+}
+
+/**
+ * Creates a new <code>Shell</code>. This Shell is the root for
+ * the SWT widgets that will be embedded within the AWT canvas.
+ *
+ * @param display the display for the new Shell
+ * @param parent the parent <code>java.awt.Canvas</code> of the new Shell
+ * @return a <code>Shell</code> to be the parent of the embedded SWT widgets
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the display is null</li>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the parent's peer is not created</li>
+ * </ul>
+ *
+ * @since 3.0
+ */
+public static Shell new_Shell (final Display display, final Canvas parent) {
+ if (display == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ return null;
+}
+}