blob: 7bbf8f5da6c9e1d5f68634a032639d6514c07d8f [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-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 embedded AWT components in SWT and vice versa.
*
* @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;
/**
* 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.
*
* @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>
* </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;
}
}