Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java
new file mode 100755
index 0000000000..5573ac6a09
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java
@@ -0,0 +1,67 @@
+package org.eclipse.swt.internal.awt.win32;
+
+/* Win32, SUN AWT */
+import sun.awt.DrawingSurface;
+import sun.awt.windows.WDrawingSurfaceInfo;
+import sun.awt.windows.WEmbeddedFrame;
+
+/* SWT Imports */
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.graphics.Rectangle;
+
+/* AWT Imports */
+import java.awt.Canvas;
+import java.awt.Panel;
+import java.awt.Dimension;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+public class SWT_AWT {
+
+public static Panel new_Panel (final Composite parent) {
+ int handle = parent.handle;
+ final WEmbeddedFrame frame = new WEmbeddedFrame (handle);
+ Panel panel = new Panel ();
+ frame.add (panel);
+ parent.addListener (SWT.Resize, new Listener () {
+ public void handleEvent (Event e) {
+ Rectangle rect = parent.getClientArea ();
+ frame.setSize (rect.width, rect.height);
+ frame.validate ();
+ }
+ });
+ return panel;
+}
+
+public static Shell new_Shell (Display display, final Canvas parent) {
+ DrawingSurface ds = (DrawingSurface)parent.getPeer();
+ WDrawingSurfaceInfo wds = (WDrawingSurfaceInfo)ds.getDrawingSurfaceInfo();
+ wds.lock ();
+ int handle = wds.getHWnd ();
+ wds.unlock ();
+ final Shell shell = Shell.win32_new (display, handle);
+ final Display newDisplay = shell.getDisplay ();
+ parent.addComponentListener(new ComponentAdapter () {
+ public void componentResized (ComponentEvent e) {
+ newDisplay.syncExec (new Runnable () {
+ public void run () {
+ Dimension dim = parent.getSize ();
+ shell.setSize (dim.width, dim.height);
+ }
+ });
+ }
+ });
+ shell.setVisible (true);
+ return shell;
+}
+} \ No newline at end of file

Back to the top