package com.akuiteo.widget.breadcrumb;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class GlassPaneSnippet {

	/**
	 * @param args
	 */
	public static void main(final String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell(display);
		shell.setText("Snippet"); //$NON-NLS-1$
		shell.setLayout(new FillLayout());
		shell.setSize(300, 150);

		final Button btn = new Button(shell, SWT.PUSH);
		btn.setText("Cross"); //$NON-NLS-1$

		btn.addListener(SWT.Paint, e -> {
			final GC gc = e.gc;
			gc.drawLine(0, 0, btn.getSize().x, btn.getSize().y);
			gc.drawLine(btn.getSize().x, 0, 0, btn.getSize().y);
		});

		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		display.dispose();
	}

}
