changeset 28:69b1fa94a4a8

Added SWT snippets
author Frank Benoit <benoit@tionex.de>
date Sun, 22 Mar 2009 15:17:04 +0100
parents 1bf55a6eb092
children 4e5843b771cc
files org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet107.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet108.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet109.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet111.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet115.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet118.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet119.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet122.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet127.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet128.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130a.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet132.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet136.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet138.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet15.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet163.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet165.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet170.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet184.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet189.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet190.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet193.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet20.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet211.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet213.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet217.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet218.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet220.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet223.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet226.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet235.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet237.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet24.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet242.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet245.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet247.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet251.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet258.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet26.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet269.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet275.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet276.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet286.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet29.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet32.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet33.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet38.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet39.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet41.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet42.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet43.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet44.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet45.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet46.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet47.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet48.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet49.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet58.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet60.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet66.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet67.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet68.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet7.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet72.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet74.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet75.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet76.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet8.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet9.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet97.d org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet98.d rakefile
diffstat 116 files changed, 10104 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet10;
+
+/* 
+ * Draw using transformations, paths and alpha blending
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.1
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Path;
+import org.eclipse.swt.graphics.Transform;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+
+
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setText("Advanced Graphics");
+    FontData fd = shell.getFont().getFontData()[0];
+    Font font = new Font(display, fd.getName(), 60., SWT.BOLD | DWT.ITALIC);
+    Image image = new Image(display, 640, 480);
+    Rectangle rect = image.getBounds();
+    GC gc = new GC(image);
+    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
+    gc.fillOval(rect.x, rect.y, rect.width, rect.height);
+    gc.dispose();
+    shell.addListener(SWT.Paint, new class() Listener {
+            public void handleEvent(Event event) {
+                GC gc = event.gc;               
+                Transform tr = new Transform(display);
+                tr.translate(50, 120);
+                tr.rotate(-30);
+                gc.drawImage(image, 0, 0, rect.width, rect.height, 0, 0, rect.width / 2, rect.height / 2);
+                gc.setAlpha(100);
+                gc.setTransform(tr);
+                Path path = new Path(display);
+                path.addString("SWT", 0, 0, font);
+                gc.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
+                gc.setForeground(display.getSystemColor(SWT.COLOR_BLUE));
+                gc.fillPath(path);
+                gc.drawPath(path);
+                tr.dispose();
+                path.dispose();
+            }           
+        });
+    shell.setSize(shell.computeSize(rect.width / 2, rect.height / 2));
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    image.dispose();
+    font.dispose();
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet107.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet107;
+/*
+ * Sash example snippet: implement a simple splitter (with a 20 pixel limit)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Sash;
+import org.eclipse.swt.widgets.Shell;
+
+import tango.math.Math;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    auto button1 = new Button (shell, SWT.PUSH);
+    button1.setText ("Button 1");
+    auto sash = new Sash (shell, SWT.VERTICAL);
+    auto button2 = new Button (shell, SWT.PUSH);
+    button2.setText ("Button 2");
+    
+    auto form = new FormLayout ();
+    shell.setLayout (form);
+    
+    auto button1Data = new FormData ();
+    button1Data.left = new FormAttachment (0, 0);
+    button1Data.right = new FormAttachment (sash, 0);
+    button1Data.top = new FormAttachment (0, 0);
+    button1Data.bottom = new FormAttachment (100, 0);
+    button1.setLayoutData (button1Data);
+
+    int limit = 20, percent = 50;
+    auto sashData = new FormData ();
+    sashData.left = new FormAttachment (percent, 0);
+    sashData.top = new FormAttachment (0, 0);
+    sashData.bottom = new FormAttachment (100, 0);
+    sash.setLayoutData (sashData);
+    sash.addListener (SWT.Selection, new class Listener {
+        public void handleEvent (Event e) {
+            auto sashRect = sash.getBounds ();
+            auto shellRect = shell.getClientArea ();
+            int right = shellRect.width - sashRect.width - limit;
+            e.x = Math.max (Math.min (e.x, right), limit);
+            if (e.x !is sashRect.x)  {
+                sashData.left = new FormAttachment (0, e.x);
+                shell.layout ();
+            }
+        }
+    });
+    
+    auto button2Data = new FormData ();
+    button2Data.left = new FormAttachment (sash, 0);
+    button2Data.right = new FormAttachment (100, 0);
+    button2Data.top = new FormAttachment (0, 0);
+    button2Data.bottom = new FormAttachment (100, 0);
+    button2.setLayoutData (button2Data);
+    
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet108.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet108;
+/*
+ * Button example snippet: set the default button
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.layout.RowData;
+
+import java.lang.all;
+import tango.io.Stdout;
+
+void main(String[] args){
+    Snippet108.main(args);
+}
+
+public class Snippet108 {
+
+    public static void main (String [] args) {
+        Display display = new Display ();
+        Shell shell = new Shell (display);
+        Label label = new Label (shell, SWT.NONE);
+        label.setText ("Enter your name:");
+        Text text = new Text (shell, SWT.BORDER);
+        text.setLayoutData (new RowData (100, SWT.DEFAULT));
+        Button ok = new Button (shell, SWT.PUSH);
+        ok.setText ("OK");
+        ok.addSelectionListener(new class() SelectionAdapter {
+            public void widgetSelected(SelectionEvent e) {
+                Stdout.formatln("OK");
+            }
+        });
+        Button cancel = new Button (shell, SWT.PUSH);
+        cancel.setText ("Cancel");
+        cancel.addSelectionListener(new class() SelectionAdapter {
+            public void widgetSelected(SelectionEvent e) {
+                Stdout.formatln("Cancel");
+            }
+        });
+        shell.setDefaultButton (cancel);
+        shell.setLayout (new RowLayout ());
+        shell.pack ();
+        shell.open ();
+        while (!shell.isDisposed ()) {
+            if (!display.readAndDispatch ()) display.sleep ();
+        }
+        display.dispose ();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet109.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet109;
+ 
+/*
+ * SashForm example snippet: create a sash form with three children
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+void main () {
+    final Display display = new Display ();
+    Shell shell = new Shell(display);
+    shell.setLayout (new FillLayout());
+
+    SashForm form = new SashForm(shell,SWT.HORIZONTAL);
+    form.setLayout(new FillLayout());
+    
+    Composite child1 = new Composite(form,SWT.NONE);
+    child1.setLayout(new FillLayout());
+    (new Label(child1,SWT.NONE)).setText("Label in pane 1");
+    
+    Composite child2 = new Composite(form,SWT.NONE);
+    child2.setLayout(new FillLayout());
+    (new Button(child2,SWT.PUSH)).setText("Button in pane2");
+
+    Composite child3 = new Composite(form,SWT.NONE);
+    child3.setLayout(new FillLayout());
+    (new Label(child3,SWT.PUSH)).setText("Label in pane3");
+    
+    form.setWeights([30,40,30]);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet111.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Bill Baxter <wbaxter@gmail.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet111;
+
+/*
+ * TreeEditor example snippet: edit the text of a tree item (in place, fancy)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.custom.TreeEditor;
+
+import java.lang.all : String, substring, Math;
+
+import tango.util.Convert;
+import tango.util.log.Trace;
+version(JIVE){
+    import jive.stacktrace;
+}
+
+void main () {
+
+    Tree tree;
+    Color black;
+    void handleResize (Event e, Composite composite, Text text, int inset ) {
+        Rectangle rect = composite.getClientArea ();
+        text.setBounds (rect.x + inset, rect.y + inset, rect.width - inset * 2, rect.height - inset * 2);
+    }
+    void handleTextEvent (Event e, Composite composite, TreeItem item, TreeEditor editor,Text text, int inset ) {
+        switch (e.type) {
+        case SWT.FocusOut: {
+            item.setText (text.getText ());
+            composite.dispose ();
+        }
+        break;
+        case SWT.Verify: {
+            String newText = text.getText ();
+            String leftText = newText.substring (0, e.start);
+            String rightText = newText.substring (e.end, newText.length);
+            GC gc = new GC (text);
+            Point size = gc.textExtent (leftText ~ e.text ~ rightText);
+            gc.dispose ();
+            size = text.computeSize (size.x, SWT.DEFAULT);
+            editor.horizontalAlignment = SWT.LEFT;
+            Rectangle itemRect = item.getBounds (), rect = tree.getClientArea ();
+            editor.minimumWidth = Math.max (size.x, itemRect.width) + inset* 2;
+            int left = itemRect.x, right = rect.x + rect.width;
+            editor.minimumWidth = Math.min (editor.minimumWidth, right - left);
+            editor.minimumHeight = size.y + inset* 2;
+            editor.layout ();
+        }
+        break;
+        case SWT.Traverse: {
+            switch (e.detail) {
+            case SWT.TRAVERSE_RETURN:
+                item.setText (text.getText ());
+                //FALL THROUGH
+            case SWT.TRAVERSE_ESCAPE:
+                composite.dispose ();
+                e.doit = false;
+            default:
+                //no-op
+            }
+            break;
+        }
+        default:
+        // no-op
+        }
+    }
+    void handleSelection (Event event, TreeItem[] lastItem, TreeEditor editor ) {
+        TreeItem item = cast(TreeItem) event.item;
+        if (item !is null && item is lastItem [0]) {
+            bool showBorder = true;
+            Composite composite = new Composite (tree, SWT.NONE);
+            if (showBorder) composite.setBackground (black);
+            Text text = new Text (composite, SWT.NONE);
+            int inset = showBorder ? 1 : 0;
+            composite.addListener (SWT.Resize, dgListener( &handleResize, composite, text, inset ));
+            Listener textListener = dgListener( &handleTextEvent, composite, item, editor, text, inset);
+            text.addListener (SWT.FocusOut, textListener);
+            text.addListener (SWT.Traverse, textListener);
+            text.addListener (SWT.Verify, textListener);
+            editor.setEditor (composite, item);
+            text.setText (item.getText ());
+            text.selectAll ();
+            text.setFocus ();
+        }
+        lastItem [0] = item;
+    }
+
+    Display display = new Display ();
+    black = display.getSystemColor (SWT.COLOR_BLACK);
+    Shell shell = new Shell (display);
+    shell.setLayout (new FillLayout ());
+    tree = new Tree (shell, SWT.BORDER);
+    for (int i=0; i<16; i++) {
+        TreeItem itemI = new TreeItem (tree, SWT.NONE);
+        itemI.setText ("Item " ~ to!(char[])(i));
+        for (int j=0; j<16; j++) {
+            TreeItem itemJ = new TreeItem (itemI, SWT.NONE);
+            itemJ.setText ("Item " ~ to!(char[])(j) );
+        }
+    }
+    TreeItem [] lastItem = new TreeItem [1];
+    TreeEditor editor = new TreeEditor (tree);
+    tree.addListener (SWT.Selection, dgListener( &handleSelection, lastItem, editor ));
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet115.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet115;
+
+/*
+ * Composite example snippet: force radio behavior on two different composites
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.layout.RowLayout;
+
+import java.lang.all;
+import tango.util.Convert;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout (new RowLayout (SWT.VERTICAL));
+    Composite c1 = new Composite (shell, SWT.BORDER | DWT.NO_RADIO_GROUP);
+    c1.setLayout (new RowLayout ());
+    Composite c2 = new Composite (shell, SWT.BORDER | DWT.NO_RADIO_GROUP);
+    c2.setLayout (new RowLayout ());
+    Composite [] composites = [c1, c2];
+    Listener radioGroup = new class() Listener{
+        public void handleEvent (Event event) {
+            for (int i=0; i<composites.length; i++) {
+                Composite composite = composites [i];
+                Control [] children = composite.getChildren ();
+                for (int j=0; j<children.length; j++) {
+                    Control child = children [j];
+                    if (cast(Button)child !is  null) {
+                        Button button = cast(Button) child;
+                        if ((button.getStyle () & SWT.RADIO) != 0) button.setSelection (false);
+                    }
+                }
+            }
+            Button button = cast(Button) event.widget;
+            button.setSelection (true);
+        }
+    };
+    for (int i=0; i<4; i++) {
+        Button button = new Button (c1, SWT.RADIO);
+        button.setText ("Button " ~ to!(char[])(i));
+        button.addListener (SWT.Selection, radioGroup);
+    }
+    for (int i=0; i<4; i++) {
+        Button button = new Button (c2, SWT.RADIO);
+        button.setText ("Button " ~to!(char[])(i + 4));
+        button.addListener (SWT.Selection, radioGroup);
+    }
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet118.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet118;
+
+/*
+ * Cursor example snippet: create a color cursor from an image file
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+void main (String [] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setSize(150, 150);
+    Cursor[] cursor = new Cursor[1];
+    Button button = new Button(shell, SWT.PUSH);
+    button.setText("Change cursor");
+    Point size = button.computeSize(SWT.DEFAULT, DWT.DEFAULT);
+    button.setSize(size);
+    button.addListener(SWT.Selection, new class() Listener{
+        public void handleEvent(Event e) {
+            FileDialog dialog = new FileDialog(shell);
+            dialog.setFilterExtensions(["*.ico", "*.gif", "*.*"]);
+            String name = dialog.open();
+            if (name is null) return;
+            ImageData image = new ImageData(name);
+            Cursor oldCursor = cursor[0];
+            cursor[0] = new Cursor(display, image, 0, 0);
+            shell.setCursor(cursor[0]);
+            if (oldCursor !is null) oldCursor.dispose();
+        }
+    });
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    if (cursor[0] !is null) cursor[0].dispose();
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet119.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet119;
+
+/*
+ * Cursor example snippet: create a color cursor from a source and a mask
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+
+
+static byte[] srcData = [
+        cast(byte)0x11, cast(byte)0x11, cast(byte)0x11, cast(byte)0x00, cast(byte)0x00, cast(byte)0x11, cast(byte)0x11, cast(byte)0x11,
+        cast(byte)0x11, cast(byte)0x10, cast(byte)0x00, cast(byte)0x01, cast(byte)0x10, cast(byte)0x00, cast(byte)0x01, cast(byte)0x11,
+        cast(byte)0x11, cast(byte)0x00, cast(byte)0x22, cast(byte)0x01, cast(byte)0x10, cast(byte)0x33, cast(byte)0x00, cast(byte)0x11,
+        cast(byte)0x10, cast(byte)0x02, cast(byte)0x22, cast(byte)0x01, cast(byte)0x10, cast(byte)0x33, cast(byte)0x30, cast(byte)0x01,
+        cast(byte)0x10, cast(byte)0x22, cast(byte)0x22, cast(byte)0x01, cast(byte)0x10, cast(byte)0x33, cast(byte)0x33, cast(byte)0x01,
+        cast(byte)0x10, cast(byte)0x22, cast(byte)0x22, cast(byte)0x01, cast(byte)0x10, cast(byte)0x33, cast(byte)0x33, cast(byte)0x01,
+        cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00,
+        cast(byte)0x01, cast(byte)0x11, cast(byte)0x11, cast(byte)0x01, cast(byte)0x10, cast(byte)0x11, cast(byte)0x11, cast(byte)0x10,
+        cast(byte)0x01, cast(byte)0x11, cast(byte)0x11, cast(byte)0x01, cast(byte)0x10, cast(byte)0x11, cast(byte)0x11, cast(byte)0x10,
+        cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00, cast(byte)0x00,
+        cast(byte)0x10, cast(byte)0x44, cast(byte)0x44, cast(byte)0x01, cast(byte)0x10, cast(byte)0x55, cast(byte)0x55, cast(byte)0x01,
+        cast(byte)0x10, cast(byte)0x44, cast(byte)0x44, cast(byte)0x01, cast(byte)0x10, cast(byte)0x55, cast(byte)0x55, cast(byte)0x01,
+        cast(byte)0x10, cast(byte)0x04, cast(byte)0x44, cast(byte)0x01, cast(byte)0x10, cast(byte)0x55, cast(byte)0x50, cast(byte)0x01,
+        cast(byte)0x11, cast(byte)0x00, cast(byte)0x44, cast(byte)0x01, cast(byte)0x10, cast(byte)0x55, cast(byte)0x00, cast(byte)0x11,
+        cast(byte)0x11, cast(byte)0x10, cast(byte)0x00, cast(byte)0x01, cast(byte)0x10, cast(byte)0x00, cast(byte)0x01, cast(byte)0x11,
+        cast(byte)0x11, cast(byte)0x11, cast(byte)0x11, cast(byte)0x00, cast(byte)0x00, cast(byte)0x11, cast(byte)0x11, cast(byte)0x11,
+];
+
+static byte[] mskData = [
+        cast(byte)0x03, cast(byte)0xc0,
+        cast(byte)0x1f, cast(byte)0xf8,
+        cast(byte)0x3f, cast(byte)0xfc,
+        cast(byte)0x7f, cast(byte)0xfe,
+        cast(byte)0x7f, cast(byte)0xfe,
+        cast(byte)0x7f, cast(byte)0xfe,
+        cast(byte)0xff, cast(byte)0xff,
+        cast(byte)0xfe, cast(byte)0x7f,
+        cast(byte)0xfe, cast(byte)0x7f,
+        cast(byte)0xff, cast(byte)0xff,
+        cast(byte)0x7f, cast(byte)0xfe,
+        cast(byte)0x7f, cast(byte)0xfe,
+        cast(byte)0x7f, cast(byte)0xfe,
+        cast(byte)0x3f, cast(byte)0xfc,
+        cast(byte)0x1f, cast(byte)0xf8,
+        cast(byte)0x03, cast(byte)0xc0
+];
+
+void main (String [] args) {
+    Display display = new Display();
+    Color white = display.getSystemColor (SWT.COLOR_WHITE);
+    Color black = display.getSystemColor (SWT.COLOR_BLACK);
+    Color yellow = display.getSystemColor (SWT.COLOR_YELLOW);
+    Color red = display.getSystemColor (SWT.COLOR_RED);
+    Color green = display.getSystemColor (SWT.COLOR_GREEN);
+    Color blue = display.getSystemColor (SWT.COLOR_BLUE);
+
+    //Create a source ImageData of depth 4
+    PaletteData palette = new PaletteData ([black.getRGB(), white.getRGB(), yellow.getRGB(),
+                                            red.getRGB(), blue.getRGB(), green.getRGB()]);
+    ImageData sourceData = new ImageData (16, 16, 4, palette, 1, srcData);
+
+    //Create a mask ImageData of depth 1 (monochrome)
+    palette = new PaletteData ([black.getRGB(), white.getRGB()]);
+    ImageData maskData = new ImageData (16, 16, 1, palette, 1, mskData);
+
+    //Set mask
+    sourceData.maskData = maskData.data;
+    sourceData.maskPad = maskData.scanlinePad;
+
+    //Create cursor
+    Cursor cursor = new Cursor(display, sourceData, 10, 10);
+
+    //Remove mask to draw them separately just to show what they look like
+    sourceData.maskData = null;
+    sourceData.maskPad = -1;
+
+    Shell shell = new Shell(display);
+    Image source = new Image (display,sourceData);
+    Image mask = new Image (display, maskData);
+    shell.addPaintListener(new class() PaintListener{
+        public void paintControl(PaintEvent e) {
+            GC gc = e.gc;
+            int x = 10, y = 10;
+            String stringSource = "source: ";
+            String stringMask = "mask: ";
+            gc.drawString(stringSource, x, y);
+            gc.drawString(stringMask, x, y + 30);
+            x += Math.max(gc.stringExtent(stringSource).x, gc.stringExtent(stringMask).x);
+            gc.drawImage(source, x, y);
+            gc.drawImage(mask, x, y + 30);
+        }
+    });
+    shell.setSize(150, 150);
+    shell.open();
+    shell.setCursor(cursor);
+
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    cursor.dispose();
+    source.dispose();
+    mask.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet122.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet122;
+/*
+ * Clipboard example snippet: enable/disable menu depending on clipboard content availability
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import java.lang.all;
+
+public static void main(String[] args) {
+    Display display = new Display();
+    Clipboard cb = new Clipboard(display);
+    Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    Text text = new Text(shell, SWT.BORDER | DWT.MULTI | DWT.WRAP);
+    Menu menu = new Menu(shell, SWT.POP_UP);
+    MenuItem copyItem = new MenuItem(menu, SWT.PUSH);
+    copyItem.setText("Copy");
+    copyItem.addSelectionListener(new class() SelectionAdapter{
+        public void widgetSelected(SelectionEvent e) {
+            String selection = text.getSelectionText();
+            if (selection.length == 0) return;
+            Object[] data = [ new ArrayWrapperString(selection) ];
+            Transfer[] types = [ TextTransfer.getInstance() ];
+            cb.setContents(data, types);
+        }
+    });
+    MenuItem pasteItem = new MenuItem(menu, SWT.PUSH);
+    pasteItem.setText ("Paste");
+    pasteItem.addSelectionListener(new class() SelectionAdapter{
+        public void widgetSelected(SelectionEvent e) {
+            String string = stringcast(cb.getContents(TextTransfer.getInstance()));
+            if (string !is null) text.insert(string);
+        }
+    });
+    menu.addMenuListener(new class() MenuAdapter{
+        public void menuShown(MenuEvent e) {
+            // is copy valid?
+            String selection = text.getSelectionText();
+            copyItem.setEnabled(selection.length > 0);
+            // is paste valid?
+            TransferData[] available = cb.getAvailableTypes();
+            bool enabled = false;
+            for (int i = 0; i < available.length; i++) {
+                if (TextTransfer.getInstance().isSupportedType(available[i])) {
+                    enabled = true;
+                    break;
+                }
+            }
+            pasteItem.setEnabled(enabled);
+        }
+    });
+
+    text.setMenu (menu);
+    shell.setSize(200, 200);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    cb.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet127.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet127;
+
+/*
+ * Control example snippet: prevent Tab from traversing out of a control
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.layout.RowLayout;
+
+import java.lang.all;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout(new RowLayout ());
+    Button button1 = new Button(shell, SWT.PUSH);
+    button1.setText("Can't Traverse");
+    button1.addTraverseListener(new class() TraverseListener{
+        public void keyTraversed(TraverseEvent e) {
+            switch (e.detail) {
+            case SWT.TRAVERSE_TAB_NEXT:
+            case SWT.TRAVERSE_TAB_PREVIOUS: {
+                    e.doit = false;
+                }
+            }
+        }
+    });
+    Button button2 = new Button (shell, SWT.PUSH);
+    button2.setText("Can Traverse");
+    shell.pack ();
+    shell.open();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet128.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Ported to the D Programming Language:
+ *     by John Reimer
+ *******************************************************************************/
+module Snippet128;
+
+/*
+ * Browser example snippet: bring up a browser
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.0
+ */
+
+version(linux) 
+{
+    version(build) 
+    {
+    pragma(link,"stdc++");
+    pragma(link,"xpcomglue");
+    }
+}
+
+import tango.io.Console;
+import java.lang.all;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.DWTError;
+import org.eclipse.swt.DWTException;
+
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.browser.StatusTextEvent;
+import org.eclipse.swt.browser.StatusTextListener;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.browser.LocationListener;
+
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.GridData;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ProgressBar;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+
+public static void main(String [] args) {
+	Display display = new Display();
+	final Shell shell = new Shell(display);
+	GridLayout gridLayout = new GridLayout();
+	gridLayout.numColumns = 3;
+	shell.setLayout(gridLayout);
+	ToolBar toolbar = new ToolBar(shell, SWT.NONE);
+	ToolItem itemBack = new ToolItem(toolbar, SWT.PUSH);
+	itemBack.setText("Back");
+	ToolItem itemForward = new ToolItem(toolbar, SWT.PUSH);
+	itemForward.setText("Forward");
+	ToolItem itemStop = new ToolItem(toolbar, SWT.PUSH);
+	itemStop.setText("Stop");
+	ToolItem itemRefresh = new ToolItem(toolbar, SWT.PUSH);
+	itemRefresh.setText("Refresh");
+	ToolItem itemGo = new ToolItem(toolbar, SWT.PUSH);
+	itemGo.setText("Go");
+	
+	GridData data = new GridData();
+    data.horizontalSpan = 3;
+	toolbar.setLayoutData(data);
+
+	Label labelAddress = new Label(shell, SWT.NONE);
+	labelAddress.setText("Address");
+		
+	final Text location = new Text(shell, SWT.BORDER);
+	data = new GridData();
+	data.horizontalAlignment = GridData.FILL;
+	data.horizontalSpan = 2;
+	data.grabExcessHorizontalSpace = true;
+	location.setLayoutData(data);
+
+	Browser browser;
+	try {
+		browser = new Browser(shell, SWT.NONE);
+	} catch (DWTError e) {
+		Cout ("Could not instantiate Browser: " ~ e.getMessage());
+		return;
+	}
+	data = new GridData();
+	data.horizontalAlignment = GridData.FILL;
+	data.verticalAlignment = GridData.FILL;
+	data.horizontalSpan = 3;
+	data.grabExcessHorizontalSpace = true;
+	data.grabExcessVerticalSpace = true;
+	browser.setLayoutData(data);
+
+	Label status = new Label(shell, SWT.NONE);
+	data = new GridData(GridData.FILL_HORIZONTAL);
+	data.horizontalSpan = 2;
+	status.setLayoutData(data);
+
+	ProgressBar progressBar = new ProgressBar(shell, SWT.NONE);
+	data = new GridData();
+	data.horizontalAlignment = GridData.END;
+	progressBar.setLayoutData(data);
+
+	/* event handling */
+	Listener listener = new class() Listener {
+		public void handleEvent(Event event) {
+			ToolItem item = cast(ToolItem)event.widget;
+			String string = item.getText();
+			if (string.equals("Back")) browser.back(); 
+			else if (string.equals("Forward")) browser.forward();
+			else if (string.equals("Stop")) browser.stop();
+			else if (string.equals("Refresh")) browser.refresh();
+			else if (string.equals("Go")) browser.setUrl(location.getText());
+	   }
+	};
+	browser.addProgressListener(new class() ProgressListener {
+		public void changed(ProgressEvent event) {
+				if (event.total == 0) return;                            
+				int ratio = event.current * 100 / event.total;
+				progressBar.setSelection(ratio);
+		}
+		public void completed(ProgressEvent event) {
+			progressBar.setSelection(0);
+		}
+	});
+	browser.addStatusTextListener(new class() StatusTextListener {
+		public void changed(StatusTextEvent event) {
+			status.setText(event.text);	
+		}
+	});
+	browser.addLocationListener(new class() LocationListener {
+		public void changed(LocationEvent event) {
+			if (event.top) location.setText(event.location);
+		}
+		public void changing(LocationEvent event) {
+		}
+	});
+	itemBack.addListener(SWT.Selection, listener);
+	itemForward.addListener(SWT.Selection, listener);
+	itemStop.addListener(SWT.Selection, listener);
+	itemRefresh.addListener(SWT.Selection, listener);
+	itemGo.addListener(SWT.Selection, listener);
+	location.addListener(SWT.DefaultSelection, new class() Listener {
+		public void handleEvent(Event e) {
+			browser.setUrl(location.getText());
+		}
+	});
+		
+	shell.open();
+	browser.setUrl("http://eclipse.org");
+		
+	while (!shell.isDisposed()) {
+		if (!display.readAndDispatch())
+			display.sleep();
+	}
+	display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet130;
+/*
+ * BusyIndicator example snippet: display busy cursor during long running task
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+import org.eclipse.swt.custom.BusyIndicator;
+
+import java.lang.all;
+
+import tango.core.Thread;
+import tango.io.Stdout;
+import tango.util.Convert;
+import tango.util.log.Trace;
+
+
+void main(String[] args){
+    Snippet130.main(args);
+}
+
+public class Snippet130 {
+
+    public static void main(String[] args) {
+        Display display = new Display();
+        Shell shell = new Shell(display);
+        shell.setLayout(new GridLayout());
+        Text text = new Text(shell, SWT.MULTI | DWT.BORDER | DWT.V_SCROLL);
+        text.setLayoutData(new GridData(GridData.FILL_BOTH));
+        int[] nextId = new int[1];
+        Button b = new Button(shell, SWT.PUSH);
+        b.setText("invoke long running job");
+
+        b.addSelectionListener(new class() SelectionAdapter {
+            public void widgetSelected(SelectionEvent e) {
+                Runnable longJob = new class() Runnable {
+                    bool done = false;
+                    int id;
+                    public void run() {
+                        Thread thread = new Thread({
+                            id = nextId[0]++;
+                            display.syncExec(new class() Runnable {
+                                public void run() {
+                                if (text.isDisposed()) return;
+                                text.append("\nStart long running task "~to!(char[])(id));
+                                }
+                                }); // display.syncExec
+                            /*
+                             * This crashes when more than 1 thread gets created. THD
+                             for (int i = 0; i < 100000; i++) {
+                             if (display.isDisposed()) return;
+                             Stdout.formatln("do task that takes a long time in a separate thread {}", id);
+                             }
+                             */
+                            // This runs fine
+                            for (int i = 0; i < 6; i++) {
+                                if (display.isDisposed()) return;
+                                Trace.formatln("do task that takes a long time in a separate thread {} {}/6", id, i);
+                                Thread.sleep(0.500);
+                            }
+
+                            if (display.isDisposed()) return;
+                            display.syncExec(new class() Runnable {
+                                public void run() {
+                                    if (text.isDisposed()) return;
+                                    text.append("\nCompleted long running task "~to!(char[])(id));
+                                }
+                            }); // display.syncExec
+                            done = true;
+                            display.wake();
+                        }); // thread = ...
+                        thread.start();
+
+                        while (!done && !shell.isDisposed()) {
+                            if (!display.readAndDispatch())
+                                display.sleep();
+                        }
+                    }
+                };  // Runnable longJob = ...
+                BusyIndicator.showWhile(display, longJob);
+            } // widgetSelected();
+        }); // addSelectionListener
+
+
+        shell.setSize(250, 150);
+        shell.open();
+        while (!shell.isDisposed()) {
+            if (!display.readAndDispatch())
+                display.sleep();
+        }
+        display.dispose();
+    }
+    private void printStart(Text text, int id ) {
+        if (text.isDisposed()) return;
+        Trace.formatln( "Start long running task {}", id );
+        text.append("\nStart long running task "~to!(char[])(id));
+    }
+    private void printEnd(Text text, int id ) {
+        if (text.isDisposed()) return;
+        Trace.formatln( "Completed long running task {}", id );
+        text.append("\nCompleted long running task "~to!(char[])(id));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130a.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet130;
+/*
+ * BusyIndicator example snippet: display busy cursor during long running task
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+import org.eclipse.swt.custom.BusyIndicator;
+
+import java.lang.all;
+
+import tango.core.Thread;
+import tango.io.Stdout;
+import tango.util.Convert;
+import tango.util.log.Trace;
+
+
+void main(String[] args){
+    Snippet130.main(args);
+}
+
+public class Snippet130 {
+
+    public static void main(String[] args) {
+        Display display = new Display();
+        Shell shell = new Shell(display);
+        shell.setLayout(new GridLayout());
+        Text text = new Text(shell, SWT.MULTI | DWT.BORDER | DWT.V_SCROLL);
+        text.setLayoutData(new GridData(GridData.FILL_BOTH));
+        int[] nextId = new int[1];
+        Button b = new Button(shell, SWT.PUSH);
+        b.setText("invoke long running job");
+
+        b.addSelectionListener(new class() SelectionAdapter {
+            public void widgetSelected(SelectionEvent e) {
+                Runnable longJob = new class() Runnable {
+                    bool done = false;
+                    int id;
+                    public void run() {
+                        Thread thread = new Thread({
+                            id = nextId[0]++;
+                            display.syncExec( dgRunnable( &printStart, text, id ));
+                            for (int i = 0; i < 6; i++) {
+                            if (display.isDisposed()) return;
+                            Trace.formatln("do task that takes a long time in a separate thread {} {}/6", id, i);
+                            Thread.sleep(0.500);
+                            }
+                            /*
+                            for (int i = 0; i < 100000; i++) {
+                                if (display.isDisposed()) return;
+                                Stdout.formatln("do task that takes a long time in a separate thread {}", id);
+                            }
+                            */
+                            if (display.isDisposed()) return;
+                            display.syncExec( dgRunnable( &printEnd, text, id ));
+                            done = true;
+                            display.wake();
+                        }); // thread = ...
+                        thread.start();
+
+                        while (!done && !shell.isDisposed()) {
+                            if (!display.readAndDispatch())
+                                display.sleep();
+                        }
+                    }
+                };  // Runnable longJob = ...
+                BusyIndicator.showWhile(display, longJob);
+            } // widgetSelected();
+        }); // addSelectionListener
+
+
+        shell.setSize(250, 150);
+        shell.open();
+        while (!shell.isDisposed()) {
+            if (!display.readAndDispatch())
+                display.sleep();
+        }
+        display.dispose();
+    }
+    private void printStart(Text text, int id ) {
+        if (text.isDisposed()) return;
+        Trace.formatln( "Start long running task {}", id );
+        text.append("\nStart long running task "~to!(char[])(id));
+    }
+    private void printEnd(Text text, int id ) {
+        if (text.isDisposed()) return;
+        Trace.formatln( "Completed long running task {}", id );
+        text.append("\nCompleted long running task "~to!(char[])(id));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet132.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Adam Chrapkowski <adam DOT chrapkowski AT gmail DOT com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet132;
+  
+/*
+ * Printing example snippet: print "Hello World!" in black, outlined in red, to default printer
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+ 
+// org.eclipse.swt
+import org.eclipse.swt.SWT;
+// org.eclipse.swt.widgets
+import org.eclipse.swt.widgets.Display,
+       org.eclipse.swt.widgets.MessageBox,
+       org.eclipse.swt.widgets.Shell;
+// org.eclipse.swt.graphics
+import org.eclipse.swt.graphics.Color,
+       org.eclipse.swt.graphics.GC,
+       org.eclipse.swt.graphics.Rectangle;
+// org.eclipse.swt.printing
+import org.eclipse.swt.printing.PrintDialog, 
+       org.eclipse.swt.printing.Printer, 
+       org.eclipse.swt.printing.PrinterData;
+// java
+import java.lang.all;
+
+public void 
+main(String [] args){
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.open();
+    PrinterData data = Printer.getDefaultPrinterData();
+    if(data is null){
+        MessageBox.showWarning("Warning: No default printer.");
+        return;
+    }
+    Printer printer = new Printer(data);
+    if(printer.startJob("SWT Printing Snippet")){
+        Color black = printer.getSystemColor(SWT.COLOR_BLACK);
+        Color white = printer.getSystemColor(SWT.COLOR_WHITE);
+        Color red = printer.getSystemColor(SWT.COLOR_RED);
+        Rectangle trim = printer.computeTrim(0, 0, 0, 0);
+        Point dpi = printer.getDPI();
+        int leftMargin = dpi.x + trim.x; // one inch from left side of paper
+        int topMargin = dpi.y / 2 + trim.y; // one-half inch from top edge of paper
+        GC gc = new GC(printer);
+        if(printer.startPage()){
+            gc.setBackground(white);
+            gc.setForeground(black);
+            String testString = "Hello World!";
+            Point extent = gc.stringExtent(testString);
+            gc.drawString(testString, leftMargin, topMargin);
+            gc.setForeground(red);
+            gc.drawRectangle(leftMargin, topMargin, extent.x, extent.y);
+            printer.endPage();
+        }
+        gc.dispose();
+        printer.endJob();
+    }
+    printer.dispose();
+    while(!shell.isDisposed()){
+      if(!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,365 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Adam Chrapkowski <adam DOT chrapkowski AT gmail DOT com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet133;
+  
+/*
+ * Printing example snippet: print text to printer, with word wrap and pagination
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+
+// org.eclipse.swt
+import org.eclipse.swt.SWT;
+// org.eclipse.swt.graphics
+import org.eclipse.swt.graphics.Color,
+       org.eclipse.swt.graphics.Font,
+       org.eclipse.swt.graphics.FontData,
+       org.eclipse.swt.graphics.GC,
+       org.eclipse.swt.graphics.Rectangle,
+       org.eclipse.swt.graphics.RGB;
+// org.eclipse.swt.widgets
+import org.eclipse.swt.widgets.Display,
+       org.eclipse.swt.widgets.ColorDialog,
+       org.eclipse.swt.widgets.FileDialog,
+       org.eclipse.swt.widgets.FontDialog,
+       org.eclipse.swt.widgets.Menu,
+       org.eclipse.swt.widgets.MenuItem,
+       org.eclipse.swt.widgets.MessageBox,
+       org.eclipse.swt.widgets.Shell,
+       org.eclipse.swt.widgets.Text;
+// org.eclipse.swt.events
+import org.eclipse.swt.events.SelectionAdapter, 
+       org.eclipse.swt.events.SelectionEvent;
+// org.eclipse.swt.layout
+import org.eclipse.swt.layout.FillLayout;
+// org.eclipse.swt.printing
+import org.eclipse.swt.printing.PrintDialog,
+       org.eclipse.swt.printing.Printer,
+       org.eclipse.swt.printing.PrinterData;
+// java
+import java.lang.all;
+
+// tango
+import tango.core.Thread;
+import tango.io.File;
+import tango.text.Unicode;
+
+public void 
+main(String[] args){
+    (new Snippet133).open();
+}
+  
+class Snippet133{
+    Display display;
+    Shell shell;
+    Text text;
+    Font font;
+    Color foregroundColor, backgroundColor;
+        
+    Printer printer;
+    GC gc;
+    FontData[] printerFontData;
+    RGB printerForeground, printerBackground;
+
+    int lineHeight = 0;
+    int tabWidth = 0;
+    int leftMargin, rightMargin, topMargin, bottomMargin;
+    int x, y;
+    int index, end;
+    String textToPrint;
+    String tabs;
+    StringBuffer wordBuffer;
+     
+    public void 
+    open(){
+        display = new Display();
+        shell = new Shell(display);
+        shell.setLayout(new FillLayout());
+        shell.setText("Print Text");
+        text = new Text(shell, SWT.BORDER | DWT.MULTI | DWT.V_SCROLL | DWT.H_SCROLL);
+
+        Menu menuBar = new Menu(shell, SWT.BAR);
+        shell.setMenuBar(menuBar);
+        MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
+        item.setText("&File");
+        Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
+        item.setMenu(fileMenu);
+        item = new MenuItem(fileMenu, SWT.PUSH);
+        item.setText("&Open...");
+        item.setAccelerator(SWT.CTRL + 'O');
+        item.addSelectionListener(new class() SelectionAdapter{
+            public void 
+            widgetSelected(SelectionEvent event) {
+                menuOpen();
+            }
+        });
+        item = new MenuItem(fileMenu, SWT.PUSH);
+        item.setText("Font...");
+        item.addSelectionListener(new class() SelectionAdapter{
+            public void 
+            widgetSelected(SelectionEvent event){
+                menuFont();
+            }
+        });
+        item = new MenuItem(fileMenu, SWT.PUSH);
+        item.setText("Foreground Color...");
+        item.addSelectionListener(new class() SelectionAdapter{
+            public void 
+            widgetSelected(SelectionEvent event){
+                menuForegroundColor();
+            }
+        });
+        item = new MenuItem(fileMenu, SWT.PUSH);
+        item.setText("Background Color...");
+        item.addSelectionListener(new class() SelectionAdapter{
+            public void 
+            widgetSelected(SelectionEvent event) {
+                menuBackgroundColor();
+            }
+        });
+        item = new MenuItem(fileMenu, SWT.PUSH);
+        item.setText("&Print...");
+        item.setAccelerator(SWT.CTRL + 'P');
+        item.addSelectionListener(new class() SelectionAdapter{
+            public void 
+            widgetSelected(SelectionEvent event) {
+                menuPrint();
+            }
+        });
+        new MenuItem(fileMenu, SWT.SEPARATOR);
+        item = new MenuItem(fileMenu, SWT.PUSH);
+        item.setText("E&xit");
+        item.addSelectionListener(new class() SelectionAdapter{
+            public void 
+            widgetSelected(SelectionEvent event){
+                System.exit(0);
+            }
+        });
+           
+        shell.open();
+        while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+        }
+        if (font !is null) font.dispose();
+        if (foregroundColor !is null) foregroundColor.dispose();
+        if (backgroundColor !is null) backgroundColor.dispose();
+        display.dispose();
+    } 
+      
+    private void 
+    menuOpen(){
+        String textString;
+        FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+        dialog.setFilterExtensions(["*.java", "*.*"]);
+        String name = dialog.open();
+        if(name is null) return;
+              
+        try{
+            scope File file = new File(name);
+            try{
+                textString = cast(char[])file.read;
+            } 
+            catch (IOException e){
+                MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
+                box.setMessage("Error reading file:\n" ~ name);
+                box.open();
+                return;
+            }
+        }
+        catch(Exception e){
+            MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
+            box.setMessage("File not found:\n" ~ name);
+            box.open();
+            return;
+        }	
+        text.setText(textString);
+    }
+      
+    private void 
+    menuFont(){
+        FontDialog fontDialog = new FontDialog(shell);
+        fontDialog.setFontList(text.getFont().getFontData());
+        FontData fontData = fontDialog.open();
+        if(fontData !is null){
+            if(font !is null) font.dispose();
+            font = new Font(display, fontData);
+            text.setFont(font);
+        }
+    }
+      
+    private void 
+    menuForegroundColor(){
+        ColorDialog colorDialog = new ColorDialog(shell);
+        colorDialog.setRGB(text.getForeground().getRGB());
+        RGB rgb = colorDialog.open();
+        if(rgb !is null){
+            if(foregroundColor !is null) foregroundColor.dispose();
+            foregroundColor = new Color(display, rgb);
+            text.setForeground(foregroundColor);
+        }
+    }
+
+    private void 
+    menuBackgroundColor(){
+        ColorDialog colorDialog = new ColorDialog(shell);
+        colorDialog.setRGB(text.getBackground().getRGB());
+        RGB rgb = colorDialog.open();
+        if(rgb !is null){
+            if(backgroundColor !is null) backgroundColor.dispose();
+            backgroundColor = new Color(display, rgb);
+            text.setBackground(backgroundColor);
+        }
+    }
+
+    private void 
+    menuPrint(){
+        PrintDialog dialog = new PrintDialog(shell, SWT.NONE);
+        PrinterData data = dialog.open();
+        if(data is null) return;
+        if(data.printToFile){
+            data.fileName = "print.out"; // you probably want to ask the user for a filename
+        }
+                
+        /* Get the text to print from the Text widget (you could get it from anywhere, i.e. your java model) */
+        textToPrint = text.getText();
+
+        /* Get the font & foreground & background data. */
+        printerFontData = text.getFont().getFontData();
+        printerForeground = text.getForeground().getRGB();
+        printerBackground = text.getBackground().getRGB();
+
+        /* Do the printing in a background thread so that spooling does not freeze the UI. */
+        printer = new Printer(data);
+        Thread printingThread = new class ("Printing") Thread{
+            private void 
+            run(){
+                print(printer);
+                printer.dispose();
+            }
+            public 
+            this(char[] o_name){
+                this.name = o_name;
+                super(&run);
+            }
+        };
+        printingThread.start();
+    }
+        
+    private void 
+    print(Printer printer){
+        if(printer.startJob("Text")){   // the string is the job name - shows up in the printer's job list
+            Rectangle clientArea = printer.getClientArea();
+            Rectangle trim = printer.computeTrim(0, 0, 0, 0);
+            Point dpi = printer.getDPI();
+            leftMargin = dpi.x + trim.x; // one inch from left side of paper
+            rightMargin = clientArea.width - dpi.x + trim.x + trim.width; // one inch from right side of paper
+            topMargin = dpi.y + trim.y; // one inch from top edge of paper
+            bottomMargin = clientArea.height - dpi.y + trim.y + trim.height; // one inch from bottom edge of paper
+                
+            /* Create a buffer for computing tab width. */
+            int tabSize = 4; // is tab width a user setting in your UI?
+            StringBuffer tabBuffer = new StringBuffer(tabSize);
+            for (int i = 0; i < tabSize; i++) tabBuffer.append(' ');
+            tabs = tabBuffer.toString();
+
+            /* Create printer GC, and create and set the printer font & foreground color. */
+            gc = new GC(printer);
+            Font printerFont = new Font(printer, printerFontData);
+            Color printerForegroundColor = new Color(printer, printerForeground);
+            Color printerBackgroundColor = new Color(printer, printerBackground); 
+                
+            gc.setFont(printerFont);
+            gc.setForeground(printerForegroundColor);
+            gc.setBackground(printerBackgroundColor);
+            tabWidth = gc.stringExtent(tabs).x;
+            lineHeight = gc.getFontMetrics().getHeight();
+                    
+            /* Print text to current gc using word wrap */
+            printText();
+            printer.endJob();
+
+            /* Cleanup graphics resources used in printing */
+            printerFont.dispose();
+            printerForegroundColor.dispose();
+            printerBackgroundColor.dispose();
+            gc.dispose();
+        }
+    }
+        
+    private void 
+    printText(){
+        printer.startPage();
+        wordBuffer = new StringBuffer();
+        x = leftMargin;
+        y = topMargin;
+        index = 0;
+        end = textToPrint.length;
+        while(index < end){
+            char c = textToPrint.charAt(index);
+            index++;
+            if(c != 0){
+                if(c == 0x0a || c == 0x0d){
+                    if(c == 0x0d && index < end && textToPrint.charAt(index) == 0x0a){
+                        index++; // if this is cr-lf, skip the lf
+                    }
+                    printWordBuffer();
+                    newline();
+                } 
+                else{
+                    if(c != '\t'){
+                        wordBuffer.append(c);
+                    }
+                    if(isPrintable(c)){
+                        printWordBuffer();
+                        if (c == '\t'){
+                            x += tabWidth;
+                        }
+                    }
+                }
+            }
+        }
+        if (y + lineHeight <= bottomMargin) {
+            printer.endPage();
+        }
+    }
+
+    private void 
+    printWordBuffer(){
+        if(wordBuffer.length > 0){
+            String word = wordBuffer.toString();
+            int wordWidth = gc.stringExtent(word).x;
+            if(x + wordWidth > rightMargin){
+                /* word doesn't fit on current line, so wrap */
+                newline();
+            }
+            gc.drawString(word, x, y, false);
+            x += wordWidth;
+            wordBuffer = new StringBuffer();
+        }
+    }
+
+    private void 
+    newline(){
+        x = leftMargin;
+        y += lineHeight;
+        if(y + lineHeight > bottomMargin){
+            printer.endPage();
+            if(index + 1 < end){
+                y = topMargin;
+                printer.startPage();
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet134;
+
+/*
+ * Shell example snippet: create a non-rectangular window
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+
+import java.lang.all;
+
+version(JIVE){
+    import jive.stacktrace;
+}
+
+int[] circle(int r, int offsetX, int offsetY) {
+    int[] polygon = new int[8 * r + 4];
+    //x^2 + y^2 = r^2
+    for (int i = 0; i < 2 * r + 1; i++) {
+        int x = i - r;
+        int y = cast(int)Math.sqrt( cast(float)(r*r - x*x));
+        polygon[2*i] = offsetX + x;
+        polygon[2*i+1] = offsetY + y;
+        polygon[8*r - 2*i - 2] = offsetX + x;
+        polygon[8*r - 2*i - 1] = offsetY - y;
+    }
+    return polygon;
+}
+
+Display display;
+Shell shell;
+
+void main(char[][] args) {
+    display = new Display();
+    //Shell must be created with style SWT.NO_TRIM
+    shell = new Shell(display, SWT.NO_TRIM | DWT.ON_TOP);
+    shell.setBackground(display.getSystemColor(SWT.COLOR_RED));
+    //define a region that looks like a key hole
+    Region region = new Region();
+    region.add(circle(67, 67, 67));
+    region.subtract(circle(20, 67, 50));
+    region.subtract([67, 50, 55, 105, 79, 105]);
+    //define the shape of the shell using setRegion
+    shell.setRegion(region);
+    Rectangle size = region.getBounds();
+    shell.setSize(size.width, size.height);
+    //add ability to move shell around
+    Listener l = new class Listener {
+        Point origin;
+        public void handleEvent(Event e) {
+            switch (e.type) {
+                case SWT.MouseDown:
+                    origin = new Point(e.x, e.y);
+                    break;
+                case SWT.MouseUp:
+                    origin = null;
+                    break;
+                case SWT.MouseMove:
+                    if (origin !is null) {
+                        Point p = display.map(shell, null, e.x, e.y);
+                        shell.setLocation(p.x - origin.x, p.y - origin.y);
+                    }
+                    break;
+            }
+        }
+    };
+    shell.addListener(SWT.MouseDown, l);
+    shell.addListener(SWT.MouseUp, l);
+    shell.addListener(SWT.MouseMove, l);
+    //add ability to close shell
+    Button b = new Button(shell, SWT.PUSH);
+    b.setBackground(shell.getBackground());
+    b.setText("close");
+    b.pack();
+    b.setLocation(10, 68);
+    b.addListener(SWT.Selection, new class Listener {
+        public void handleEvent(Event e) {
+            shell.close();
+        }
+    });
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    region.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet136.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Ported to the D Programming Language
+ *     John Reimer <terminal.node@gmail.com>
+ *******************************************************************************/
+module Snippet136;
+
+/*
+ * Browser example snippet: render HTML from memory
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.DWTError;
+import org.eclipse.swt.DWTException;
+
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.layout.FillLayout;
+
+import java.lang.all;
+
+import tango.io.Console;
+
+version(linux) {
+    version(build)
+    {
+    pragma(link, "stdc++");
+    pragma(link, "xpcomglue");
+    }
+}
+
+void main() {
+		String html = "<HTML><HEAD><TITLE>HTML Test</TITLE></HEAD><BODY>";
+		for (int i = 0; i < 100; i++) html ~= "<P>This is line </P>";
+		html ~= "</BODY></HTML>";
+
+		Display display = new Display();
+		Shell shell = new Shell(display);
+		shell.setLayout(new FillLayout());
+		Browser browser;
+		try {
+			browser = new Browser(shell, SWT.NONE);
+		} catch (DWTError e) {
+			Cout("Could not instatiate Browser.").newline;
+			return;
+		}
+		browser.setText(html);
+		shell.open();
+		while (!shell.isDisposed()) {
+			if (!display.readAndDispatch())
+				display.sleep();
+		}
+		display.dispose();
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet138.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet138;
+ 
+/*
+ * example snippet: set icons with different resolutions
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+void main() {
+    Display display = new Display();
+		
+    Image small = new Image(display, 16, 16);
+    GC gc = new GC(small);
+    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
+    gc.fillArc(0, 0, 16, 16, 45, 270);
+    gc.dispose();
+		
+    Image large = new Image(display, 32, 32);
+    gc = new GC(large);
+    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
+    gc.fillArc(0, 0, 32, 32, 45, 270);
+    gc.dispose();
+		
+    /* Provide different resolutions for icons to get
+     * high quality rendering wherever the OS needs 
+     * large icons. For example, the ALT+TAB window 
+     * on certain systems uses a larger icon.
+     */
+    Shell shell = new Shell(display);
+    shell.setText("Small and Large icons");
+    shell.setImages([small, large]);
+
+    /* No large icon: the OS will scale up the
+     * small icon when it needs a large one.
+     */
+    Shell shell2 = new Shell(display);
+    shell2.setText("Small icon");
+    shell2.setImage(small);
+		
+    shell.open();
+    shell2.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    small.dispose();
+    large.dispose();
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet14;
+
+/*
+ * Control example snippet: detect mouse enter, exit and hover events
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+import tango.io.Stdout;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setSize (100, 100);
+    shell.addListener (SWT.MouseEnter, new class() Listener{
+        public void handleEvent (Event e) {
+            Stdout("ENTER\n");
+            Stdout.flush();
+        }
+    });
+    shell.addListener (SWT.MouseExit, new class() Listener{
+        public void handleEvent (Event e) {
+            Stdout("EXIT\n");
+            Stdout.flush();
+        }
+    });
+    shell.addListener (SWT.MouseHover, new class() Listener{
+        public void handleEvent (Event e) {
+            Stdout("HOVER\n");
+            Stdout.flush();
+        }
+    });
+    shell.open ();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet140;
+
+/*
+ * CoolBar example snippet: drop-down a chevron menu containing hidden tool items
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.CoolBar;
+import org.eclipse.swt.widgets.CoolItem;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.GridData;
+
+import tango.util.Convert;
+
+static Display display;
+static Shell shell;
+static CoolBar coolBar;
+static Menu chevronMenu = null;
+
+
+void main () {
+    display = new Display ();
+    shell = new Shell (display);
+    shell.setLayout(new GridLayout());
+    coolBar = new CoolBar(shell, SWT.FLAT | DWT.BORDER);
+    coolBar.setLayoutData(new GridData(GridData.FILL_BOTH));
+    ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT | DWT.WRAP);
+    int minWidth = 0;
+    for (int j = 0; j < 5; j++) {
+        int width = 0;
+        ToolItem item = new ToolItem(toolBar, SWT.PUSH);
+        item.setText("B" ~ to!(char[])(j));
+        width = item.getWidth();
+        /* find the width of the widest tool */
+        if (width > minWidth) minWidth = width;
+    }
+    CoolItem coolItem = new CoolItem(coolBar, SWT.DROP_DOWN);
+    coolItem.setControl(toolBar);
+    Point size = toolBar.computeSize(SWT.DEFAULT, DWT.DEFAULT);
+    Point coolSize = coolItem.computeSize (size.x, size.y);
+    coolItem.setMinimumSize(minWidth, coolSize.y);
+    coolItem.setPreferredSize(coolSize);
+    coolItem.setSize(coolSize);
+    coolItem.addSelectionListener(new class() SelectionAdapter {
+        public void widgetSelected(SelectionEvent event) {
+            if (event.detail == SWT.ARROW) {
+                CoolItem item = cast(CoolItem) event.widget;
+                Rectangle itemBounds = item.getBounds ();
+                Point pt = coolBar.toDisplay(new Point(itemBounds.x, itemBounds.y));
+                itemBounds.x = pt.x;
+                itemBounds.y = pt.y;
+                ToolBar bar = cast(ToolBar) item.getControl ();
+                ToolItem[] tools = bar.getItems ();
+
+                int i = 0;
+                while (i < tools.length) {
+                    Rectangle toolBounds = tools[i].getBounds ();
+                    pt = bar.toDisplay(new Point(toolBounds.x, toolBounds.y));
+                    toolBounds.x = pt.x;
+                    toolBounds.y = pt.y;
+
+                    /* Figure out the visible portion of the tool by looking at the
+                     * intersection of the tool bounds with the cool item bounds.
+                     */
+                    Rectangle intersection = itemBounds.intersection (toolBounds);
+
+                    /* If the tool is not completely within the cool item bounds, then it
+                     * is partially hidden, and all remaining tools are completely hidden.
+                     */
+                    if (intersection != toolBounds) break;
+                    i++;
+                }
+
+                /* Create a menu with items for each of the completely hidden buttons. */
+                if (chevronMenu !is null) chevronMenu.dispose();
+                chevronMenu = new Menu (coolBar);
+                for (int j = i; j < tools.length; j++) {
+                    MenuItem menuItem = new MenuItem (chevronMenu, SWT.PUSH);
+                    menuItem.setText (tools[j].getText());
+                }
+
+                /* Drop down the menu below the chevron, with the left edges aligned. */
+                pt = coolBar.toDisplay(new Point(event.x, event.y));
+                chevronMenu.setLocation (pt.x, pt.y);
+                chevronMenu.setVisible (true);
+            }
+        }
+    });
+
+    shell.pack();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet142;
+
+/*
+ * UI Automation (for testing tools) snippet: post mouse events
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+import tango.core.Thread;
+import tango.io.Stdout;
+
+void main(String[] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    Button button = new Button(shell,SWT.NONE);
+    button.setSize(100,100);
+    button.setText("Click");
+    shell.pack();
+    shell.open();
+    button.addListener(SWT.MouseDown, dgListener( (Event e){
+        Stdout.formatln("Mouse Down  (Button: {} x: {} y: {})",e.button,e.x,e.y);
+    }));
+    Point pt = display.map(shell, null, 50, 50);
+    Thread thread = new Thread({
+        Event event;
+        try {
+            Thread.sleep(300/1000.);
+        } catch (InterruptedException e) {}
+        event = new Event();
+        event.type = SWT.MouseMove;
+        event.x = pt.x;
+        event.y = pt.y;
+        display.post(event);
+        try {
+            Thread.sleep(300/1000.0);
+        } catch (InterruptedException e) {}
+        event.type = SWT.MouseDown;
+        event.button = 1;
+        display.post(event);
+        try {
+            Thread.sleep(300/1000.0);
+        } catch (InterruptedException e) {}
+        event.type = SWT.MouseUp;
+        display.post(event);
+    });
+    thread.start();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * Port to the D programming language
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet143;
+
+/*
+ * Tray example snippet: place an icon with a popup menu on the system tray
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Tray;
+import org.eclipse.swt.widgets.TrayItem;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+import tango.io.Stdout;
+import tango.text.convert.Format;
+
+TrayItem item;
+Menu menu;
+
+public static void main(char[][] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    Image image = new Image (display, 16, 16);
+    final Tray tray = display.getSystemTray ();
+    if (tray is null) {
+        Stdout.formatln ("The system tray is not available");
+    } else {
+        item = new TrayItem (tray, SWT.NONE);
+        item.setToolTipText("SWT TrayItem");
+        item.addListener (SWT.Show, new class() Listener {
+            public void handleEvent (Event event) {
+                Stdout.formatln("show");
+            }
+        });
+        item.addListener (SWT.Hide, new class() Listener {
+            public void handleEvent (Event event) {
+                Stdout.formatln("hide");
+            }
+        });
+        item.addListener (SWT.Selection, new class() Listener {
+            public void handleEvent (Event event) {
+                Stdout.formatln("selection");
+            }
+        });
+        item.addListener (SWT.DefaultSelection, new class() Listener {
+            public void handleEvent (Event event) {
+                Stdout.formatln("default selection");
+            }
+        });
+        menu = new Menu (shell, SWT.POP_UP);
+        for (int i = 0; i < 8; i++) {
+            MenuItem mi = new MenuItem (menu, SWT.PUSH);
+            mi.setText ( Format( "Item{}", i ));
+            mi.addListener (SWT.Selection, new class() Listener {
+                public void handleEvent (Event event) {
+                    Stdout.formatln("selection {}", event.widget);
+                }
+            });
+            if (i == 0) menu.setDefaultItem(mi);
+        }
+        item.addListener (SWT.MenuDetect, new class() Listener {
+            public void handleEvent (Event event) {
+                menu.setVisible (true);
+            }
+        });
+        item.setImage (image);
+    }
+    shell.setBounds(50, 50, 300, 200);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    image.dispose ();
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet144;
+
+/*
+ * Virtual Table example snippet: create a table with 1,000,000 items (lazy)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.layout.RowData;
+
+import tango.io.Stdout;
+import tango.time.StopWatch;
+import tango.util.Convert;
+
+const int COUNT = 1000000;
+
+void main() {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    shell.setLayout (new RowLayout (SWT.VERTICAL));
+    auto table = new Table (shell, SWT.VIRTUAL | DWT.BORDER);
+    table.addListener (SWT.SetData, new class Listener {
+        public void handleEvent (Event event) {
+            auto item = cast(TableItem) event.item;
+            auto index = table.indexOf (item);
+            item.setText ("Item " ~ to!(char[])(index));
+            Stdout(item.getText ()).newline;
+        }
+    });
+    table.setLayoutData (new RowData (200, 200));
+    auto button = new Button (shell, SWT.PUSH);
+    button.setText ("Add Items");
+    auto label = new Label(shell, SWT.NONE);
+    button.addListener (SWT.Selection, new class Listener {
+        public void handleEvent (Event event) {
+            StopWatch elapsed;
+            elapsed.start;
+            table.setItemCount (COUNT);
+            auto t = elapsed.stop;
+            label.setText ("Items: " ~ to!(char[])(COUNT) ~
+                           ", Time: " ~ to!(char[])(t) ~ " (sec)");
+            shell.layout ();
+        }
+    });
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet146;
+  
+/*
+ * UI Automation (for testing tools) snippet: post key events
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import java.lang.all;
+
+import tango.core.Thread;
+import tango.text.Unicode;
+
+void main(String[] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    Text text = new Text(shell, SWT.BORDER);
+    text.setSize(text.computeSize(150, SWT.DEFAULT));
+    shell.pack();
+    shell.open();
+    Thread thread = new Thread({
+        String string = "Love the method.";
+        String lstring;
+        lstring. length = string.length;
+        toLower(string, lstring);
+        for (int i = 0; i < string.length; i++) {
+            char ch = string.charAt(i);
+            bool shift = isUpper(ch);
+            ch = lstring.charAt(i);
+            if (shift) {
+                Event event = new Event();
+                event.type = SWT.KeyDown;
+                event.keyCode = SWT.SHIFT;
+                display.post(event);    
+            }
+            Event event = new Event();
+            event.type = SWT.KeyDown;
+            event.character = ch;
+            display.post(event);
+            try {
+                Thread.sleep(10/1000.);
+            } catch (InterruptedException e) {}
+            event.type = SWT.KeyUp;
+            display.post(event);
+            try {
+                Thread.sleep(100/1000.0);
+            } catch (InterruptedException e) {}
+            if (shift) {
+                event = new Event();
+                event.type = SWT.KeyUp;
+                event.keyCode = SWT.SHIFT;
+                display.post(event);    
+            }
+        }
+    });
+    thread.start();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet147;
+/*
+ * Combo example snippet: stop CR from going to the default button
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import java.lang.all;
+
+import tango.io.Stdout;
+
+void main(String[] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+    Combo combo = new Combo(shell, SWT.NONE);
+    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    combo.setText("Here is some text");
+    combo.addSelectionListener(new class() SelectionAdapter{
+        public void widgetDefaultSelected(SelectionEvent e) {
+            Stdout("Combo default selected (overrides default button)\n");
+        }
+    });
+    combo.addTraverseListener(new class() TraverseListener{
+        public void keyTraversed(TraverseEvent e) {
+            if (e.detail == SWT.TRAVERSE_RETURN) {
+                e.doit = false;
+                e.detail = SWT.TRAVERSE_NONE;
+            }
+        }
+    });
+    Button button = new Button(shell, SWT.PUSH);
+    button.setText("Ok");
+    button.addSelectionListener(new class() SelectionAdapter{
+        public void widgetSelected(SelectionEvent e) {
+            Stdout("Button selected\n");
+        }
+    });
+    shell.setDefaultButton(button);
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet15.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet15;
+ 
+/*
+ * Tree example snippet: create a tree
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+import tango.util.Convert;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    shell.setLayout(new FillLayout());
+    auto tree = new Tree (shell, SWT.BORDER);
+    for (int i=0; i<4; i++) {
+        auto iItem = new TreeItem (tree, 0);
+        iItem.setText ("TreeItem (0) -" ~ to!(char[])(i));
+        for (int j=0; j<4; j++) {
+            TreeItem jItem = new TreeItem (iItem, 0);
+            jItem.setText ("TreeItem (1) -" ~ to!(char[])(j));
+            for (int k=0; k<4; k++) {
+                TreeItem kItem = new TreeItem (jItem, 0);
+                kItem.setText ("TreeItem (2) -" ~ to!(char[])(k));
+                for (int l=0; l<4; l++) {
+                    TreeItem lItem = new TreeItem (kItem, 0);
+                    lItem.setText ("TreeItem (3) -" ~ to!(char[])(l));
+                }
+            }
+        }
+    }
+    shell.setSize (200, 200);
+    shell.open ();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Bill Baxter
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet150;
+
+/*
+ * CoolBar example snippet: create a coolbar (relayout when resized)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.CoolBar;
+import org.eclipse.swt.widgets.CoolItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormAttachment;
+
+import tango.util.Convert;
+
+int itemCount;
+CoolItem createItem(CoolBar coolBar, int count) {
+    ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT);
+    for (int i = 0; i < count; i++) {
+        ToolItem item = new ToolItem(toolBar, SWT.PUSH);
+        item.setText(to!(char[])(itemCount++) ~"");
+    }
+    toolBar.pack();
+    Point size = toolBar.getSize();
+    CoolItem item = new CoolItem(coolBar, SWT.NONE);
+    item.setControl(toolBar);
+    Point preferred = item.computeSize(size.x, size.y);
+    item.setPreferredSize(preferred);
+    return item;
+}
+
+void main () {
+
+    Display display = new Display();
+    final Shell shell = new Shell(display);
+    CoolBar coolBar = new CoolBar(shell, SWT.NONE);
+    createItem(coolBar, 3);
+    createItem(coolBar, 2);
+    createItem(coolBar, 3);
+    createItem(coolBar, 4);
+    int style = SWT.BORDER | DWT.H_SCROLL | DWT.V_SCROLL;
+    Text text = new Text(shell, style);
+    FormLayout layout = new FormLayout();
+    shell.setLayout(layout);
+    FormData coolData = new FormData();
+    coolData.left = new FormAttachment(0);
+    coolData.right = new FormAttachment(100);
+    coolData.top = new FormAttachment(0);
+    coolBar.setLayoutData(coolData);
+    coolBar.addListener(SWT.Resize, new class() Listener {
+        void handleEvent(Event event) {
+            shell.layout();
+        }
+    });
+    FormData textData = new FormData();
+    textData.left = new FormAttachment(0);
+    textData.right = new FormAttachment(100);
+    textData.top = new FormAttachment(coolBar);
+    textData.bottom = new FormAttachment(100);
+    text.setLayoutData(textData);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet152;
+
+/*
+ * Control example snippet: update a status line when an item is armed
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.0
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormAttachment;
+
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    FormLayout layout = new FormLayout();
+    shell.setLayout(layout);
+    Label label = new Label(shell, SWT.BORDER);
+    Listener armListener = new class Listener {
+        public void handleEvent(Event event) {
+            MenuItem item = cast(MenuItem) event.widget;
+            label.setText(item.getText());
+            label.update();
+        }
+    };
+    Listener showListener = new class Listener {
+        public void handleEvent(Event event) {
+            Menu menu = cast(Menu) event.widget;
+            MenuItem item = menu.getParentItem();
+            if (item !is null) {
+                label.setText(item.getText());
+                label.update();
+            }
+        }
+    };
+    Listener hideListener = new class Listener {
+        public void handleEvent(Event event) {
+            label.setText("");
+            label.update();
+        }
+    };
+    FormData labelData = new FormData();
+    labelData.left = new FormAttachment(0);
+    labelData.right = new FormAttachment(100);
+    labelData.bottom = new FormAttachment(100);
+    label.setLayoutData(labelData);
+    Menu menuBar = new Menu(shell, SWT.BAR);
+    shell.setMenuBar(menuBar);
+    MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
+    fileItem.setText("File");
+    fileItem.addListener(SWT.Arm, armListener);
+    MenuItem editItem = new MenuItem(menuBar, SWT.CASCADE);
+    editItem.setText("Edit");
+    editItem.addListener(SWT.Arm, armListener);
+    Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
+    fileMenu.addListener(SWT.Hide, hideListener);
+    fileMenu.addListener(SWT.Show, showListener);
+    fileItem.setMenu(fileMenu);
+    char[][] fileStrings = [ "New", "Close", "Exit" ];
+    for (int i = 0; i < fileStrings.length; i++) {
+        MenuItem item = new MenuItem(fileMenu, SWT.PUSH);
+        item.setText(fileStrings[i]);
+        item.addListener(SWT.Arm, armListener);
+    }
+    Menu editMenu = new Menu(shell, SWT.DROP_DOWN);
+    editMenu.addListener(SWT.Hide, hideListener);
+    editMenu.addListener(SWT.Show, showListener);
+    char[][] editStrings = [ "Cut", "Copy", "Paste" ];
+    editItem.setMenu(editMenu);
+    for (int i = 0; i < editStrings.length; i++) {
+        MenuItem item = new MenuItem(editMenu, SWT.PUSH);
+        item.setText(editStrings[i]);
+        item.addListener(SWT.Arm, armListener);
+    }
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet153;
+
+/*
+ * ToolBar example snippet: update a status line when the pointer enters a ToolItem
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Label;
+
+static char[] statusText = "";
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setBounds(10, 10, 200, 200);
+    ToolBar bar = new ToolBar(shell, SWT.BORDER);
+    bar.setBounds(10, 10, 150, 50);
+    Label statusLine = new Label(shell, SWT.BORDER);
+    statusLine.setBounds(10, 90, 150, 30);
+    (new ToolItem(bar, SWT.NONE)).setText("item 1");
+    (new ToolItem(bar, SWT.NONE)).setText("item 2");
+    (new ToolItem(bar, SWT.NONE)).setText("item 3");
+    bar.addMouseMoveListener(new class MouseMoveListener {
+        void mouseMove(MouseEvent e) {
+            ToolItem item = bar.getItem(new Point(e.x, e.y));
+            char[] name = "";
+            if (item !is null) {
+                name = item.getText();
+            }
+            if (statusText != name) {
+                statusLine.setText(name);
+                statusText = name;
+            }
+        }
+    });
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet16;
+ 
+/*
+ * Display example snippet: create one repeating timer (every 500 ms)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+import tango.io.Stdout;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    final int time = 500;
+    Runnable timer;
+    timer = dgRunnable( {
+        Point point = display.getCursorLocation ();
+        Rectangle rect = shell.getBounds ();
+        if (rect.contains (point)) {
+            Stdout("In\n");
+        } else {
+            Stdout("Out\n");
+        }
+        Stdout.flush();
+        display.timerExec (time, timer);
+    });
+    display.timerExec (time, timer);
+    shell.setSize (200, 200);
+    shell.open ();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose (); 
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet162;
+
+/*
+ * Adding an accessible listener to provide state information
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.ACC;
+import org.eclipse.swt.accessibility.Accessible;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleControlListener;
+import org.eclipse.swt.accessibility.AccessibleControlAdapter;
+import org.eclipse.swt.accessibility.AccessibleControlEvent;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+import java.lang.all;
+
+
+void main(String[] args){
+    Snippet162.main(args);
+}
+
+public class Snippet162 {
+
+    final static String STATE = "CheckedIndices";
+
+    public static void main (String [] args) {
+        final Display display = new Display ();
+        Image checkedImage = getCheckedImage (display);
+        Image uncheckedImage = getUncheckedImage (display);
+        Shell shell = new Shell (display);
+        shell.setLayout (new FillLayout ());
+        final Table table = new Table (shell, SWT.BORDER);
+        TableColumn column1 = new TableColumn (table, SWT.NONE);
+        TableColumn column2 = new TableColumn (table, SWT.NONE);
+        TableColumn column3 = new TableColumn (table, SWT.NONE);
+        TableItem item1 = new TableItem (table, SWT.NONE);
+        item1.setText ( ["first item", "a", "b"]);
+        item1.setImage (1, uncheckedImage);
+        item1.setImage (2, uncheckedImage);
+        item1.setData (STATE, null);
+        TableItem item2 = new TableItem (table, SWT.NONE);
+        item2.setText ( ["second item", "c", "d"]);
+        item2.setImage (1, uncheckedImage);
+        item2.setImage (2, checkedImage);
+        item2.setData (STATE,  new ArrayWrapperInt([2]));
+        TableItem item3 = new TableItem (table, SWT.NONE);
+        item3.setText ( ["third", "e", "f"]);
+        item3.setImage (1, checkedImage);
+        item3.setImage (2, checkedImage);
+        item3.setData (STATE, new ArrayWrapperInt( [1, 2]));
+        column1.pack ();
+        column2.pack ();
+        column3.pack ();
+
+        Accessible accessible = table.getAccessible ();
+        accessible.addAccessibleListener( new class() AccessibleAdapter  {
+            public void getName (AccessibleEvent e) {
+                super.getName (e);
+                if (e.childID >= 0 && e.childID < table.getItemCount ()) {
+                    TableItem item = table.getItem (e.childID);
+                    Point pt = display.getCursorLocation ();
+                    pt = display.map (null, table, pt);
+                    for (int i = 0; i < table.getColumnCount (); i++) {
+                        if (item.getBounds (i).contains (pt)) {
+                            int [] data = (cast(ArrayWrapperInt)item.getData (STATE)).array;
+                            bool checked = false;
+                            if (data !is null) {
+                                for (int j = 0; j < data.length; j++) {
+                                    if (data [j] == i) {
+                                        checked = true;
+                                        break;
+                                    }
+                                }
+                            }
+                            e.result = item.getText (i) ~ " " ~ (checked ? "checked" : "unchecked");
+                            break;
+                        }
+                    }
+                }
+            }
+        });
+
+        accessible.addAccessibleControlListener (new class() AccessibleControlAdapter  {
+            public void getState (AccessibleControlEvent e) {
+                super.getState (e);
+                if (e.childID >= 0 && e.childID < table.getItemCount ()) {
+                    TableItem item = table.getItem (e.childID);
+                    int [] data =(cast(ArrayWrapperInt)item.getData (STATE)).array;
+                    if (data !is null) {
+                        Point pt = display.getCursorLocation ();
+                        pt = display.map (null, table, pt);
+                        for (int i = 0; i < data.length; i++) {
+                            if (item.getBounds (data [i]).contains (pt)) {
+                                e.detail |= ACC.STATE_CHECKED;
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+        });
+        shell.open ();
+        while (!shell.isDisposed ()) {
+            if (!display.readAndDispatch ()) display.sleep ();
+        }
+        checkedImage.dispose ();
+        uncheckedImage.dispose ();
+        display.dispose ();
+    }
+
+    static Image getCheckedImage (Display display) {
+        Image image = new Image (display, 16, 16);
+        GC gc = new GC (image);
+        gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW));
+        gc.fillOval (0, 0, 16, 16);
+        gc.setForeground (display.getSystemColor (SWT.COLOR_DARK_GREEN));
+        gc.drawLine (0, 0, 16, 16);
+        gc.drawLine (16, 0, 0, 16);
+        gc.dispose ();
+        return image;
+    }
+
+    static Image getUncheckedImage (Display display) {
+        Image image = new Image (display, 16, 16);
+        GC gc = new GC (image);
+        gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW));
+        gc.fillOval (0, 0, 16, 16);
+        gc.dispose ();
+        return image;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet163.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet163;
+
+/*
+ * Setting the font style, foreground and background colors of StyledText
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+version(JIVE){
+    import jive.stacktrace;
+}
+
+void main() {
+    auto display = new Display();
+    auto shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    auto text = new StyledText (shell, SWT.BORDER);
+    text.setText("0123456789 ABCDEFGHIJKLM NOPQRSTUVWXYZ");
+    // make 0123456789 appear bold
+    auto style1 = new StyleRange();
+    style1.start = 0;
+    style1.length = 10;
+    style1.fontStyle = SWT.BOLD;
+    text.setStyleRange(style1);
+    // make ABCDEFGHIJKLM have a red font
+    auto style2 = new StyleRange();
+    style2.start = 11;
+    style2.length = 13;
+    style2.foreground = display.getSystemColor(SWT.COLOR_RED);
+    text.setStyleRange(style2);
+    // make NOPQRSTUVWXYZ have a blue background
+    auto style3 = new StyleRange();
+    style3.start = 25;
+    style3.length = 13;
+    style3.background = display.getSystemColor(SWT.COLOR_BLUE);
+    text.setStyleRange(style3);
+
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet165.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ * 	 Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet165;
+
+/*
+ * Create a CTabFolder with min and max buttons, as well as close button and 
+ * image only on selected tab.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabFolder2Adapter ;
+import org.eclipse.swt.custom.CTabFolderEvent ;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import tango.util.Convert;
+
+void main () {
+    auto display = new Display ();
+    auto image = new Image(display, 16, 16);
+    auto gc = new GC(image);
+    gc.setBackground(display.getSystemColor(SWT.COLOR_BLUE));
+    gc.fillRectangle(0, 0, 16, 16);
+    gc.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));
+    gc.fillRectangle(3, 3, 10, 10);
+    gc.dispose();
+    auto shell = new Shell (display);
+    shell.setLayout(new GridLayout());
+    auto folder = new CTabFolder(shell, SWT.BORDER);
+    folder.setLayoutData(new GridData(SWT.FILL, DWT.FILL, true, false));
+    folder.setSimple(false);
+    folder.setUnselectedImageVisible(false);
+    folder.setUnselectedCloseVisible(false);
+    for (int i = 0; i < 8; i++) {
+        CTabItem item = new CTabItem(folder, SWT.CLOSE);
+        item.setText("Item " ~ to!(char[])(i));
+        item.setImage(image);
+        Text text = new Text(folder, SWT.MULTI | DWT.V_SCROLL | DWT.H_SCROLL);
+        text.setText("Text for item " ~ to!(char[])(i) ~
+                     "\n\none, two, three\n\nabcdefghijklmnop");
+        item.setControl(text);
+    }
+    folder.setMinimizeVisible(true);
+    folder.setMaximizeVisible(true);
+    folder.addCTabFolder2Listener(new class CTabFolder2Adapter {
+        public void minimize(CTabFolderEvent event) {
+            folder.setMinimized(true);
+            shell.layout(true);
+        }
+        public void maximize(CTabFolderEvent event) {
+            folder.setMaximized(true);
+            folder.setLayoutData(new GridData(SWT.FILL, DWT.FILL, true, true));
+            shell.layout(true);
+        }
+        public void restore(CTabFolderEvent event) {
+            folder.setMinimized(false);
+            folder.setMaximized(false);
+            folder.setLayoutData(new GridData(SWT.FILL, DWT.FILL, true, false));
+            shell.layout(true);
+        }
+    });
+    shell.setSize(300, 300);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    image.dispose();
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet169;
+
+/*
+ * Make a toggle button have radio behavior
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * Port OK.
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.layout.FillLayout;
+
+import java.lang.all;
+import tango.util.Convert;
+
+void main(String[] args){
+    Snippet169.main(args);
+}
+
+
+public class Snippet169 {
+    public static void main (String [] args) {
+        Display display = new Display ();
+        final Shell shell = new Shell (display);
+        shell.setLayout (new FillLayout ());
+        Listener listener = new class() Listener {
+            public void handleEvent (Event e) {
+                Control [] children = shell.getChildren ();
+                for (int i=0; i<children.length; i++) {
+                    Control child = children [i];
+                    if (e.widget !is child && cast(Button)child !is null && (child.getStyle () & SWT.TOGGLE) != 0) {
+                        (cast(Button) child).setSelection (false);
+                    }
+                }
+                (cast(Button) e.widget).setSelection (true);
+            }
+        };
+        for (int i=0; i<20; i++) {
+            Button button = new Button (shell, SWT.TOGGLE);
+            button.setText ("B" ~to!(char[])(i));
+            button.addListener (SWT.Selection, listener);
+            if (i == 0) button.setSelection (true);
+        }
+        shell.pack ();
+        shell.open ();
+        while (!shell.isDisposed ()) {
+            if (!display.readAndDispatch ()) display.sleep ();
+        }
+        display.dispose ();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet170.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * D Port:
+ *     Bill Baxter <wbaxter@gmail.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet170;
+
+/*
+ * Tree example snippet: Create a Tree with columns
+ * 
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.1
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.layout.FillLayout;
+
+import tango.util.Convert;
+
+import java.lang.all;
+
+void main() {
+    Display display = new Display();
+    final Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    Tree tree = new Tree(shell, SWT.BORDER | DWT.H_SCROLL | DWT.V_SCROLL);
+    tree.setHeaderVisible(true);
+    TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
+    column1.setText("Column 1");
+    column1.setWidth(200);
+    TreeColumn column2 = new TreeColumn(tree, SWT.CENTER);
+    column2.setText("Column 2");
+    column2.setWidth(200);
+    TreeColumn column3 = new TreeColumn(tree, SWT.RIGHT);
+    column3.setText("Column 3");
+    column3.setWidth(200);
+    for (int i = 0; i < 4; i++) {
+        TreeItem item = new TreeItem(tree, SWT.NONE);
+        item.setText([ "item " ~ to!(String)(i), "abc", "defghi" ]);
+        for (int j = 0; j < 4; j++) {
+            TreeItem subItem = new TreeItem(item, SWT.NONE);
+            subItem.setText([ "subitem " ~ to!(String)(j), "jklmnop", "qrs" ]);
+            for (int k = 0; k < 4; k++) {
+                TreeItem subsubItem = new TreeItem(subItem, SWT.NONE);
+                subsubItem.setText([ "subsubitem " ~ to!(String)(k), "tuv", "wxyz" ]);
+            }
+        }
+    }
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) {
+            display.sleep();
+        }
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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:
+ *     Sebastian Davids - initial implementation
+ *     IBM Corporation
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet174;
+
+/*
+ * SWT OpenGL snippet: draw a square
+ * 
+ * This snippet requires the experimental org.eclipse.swt.opengl plugin, which
+ * is not included in SWT by default and should only be used with versions of
+ * SWT prior to 3.2.  For information on using OpenGL in SWT see
+ * http://www.eclipse.org/swt/opengl/ .
+ * 
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.2
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.opengl.GLCanvas;
+import org.eclipse.swt.opengl.GLData;
+
+import derelict.opengl.gl;
+import derelict.opengl.glu;
+
+import Math = tango.math.Math;
+
+public static void main() 
+{
+    DerelictGL.load();
+    DerelictGLU.load();
+
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setText("OpenGL in SWT");
+    shell.setLayout(new FillLayout());
+    GLData data = new GLData();
+    data.doubleBuffer = true;
+    final GLCanvas canvas = new GLCanvas(shell, SWT.NO_BACKGROUND, data);
+    canvas.addControlListener(new class ControlAdapter {
+        public void controlResized(ControlEvent e) {
+            resize(canvas);
+        }
+    });
+    init(canvas);
+    (new class Runnable {
+        public void run() {
+            if (canvas.isDisposed()) return;
+            render();
+            canvas.swapBuffers();
+            canvas.getDisplay().timerExec(15, this);
+        }
+    }).run();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+}
+
+static void init(GLCanvas canvas) {
+    canvas.setCurrent();
+    resize(canvas);
+    glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+    glColor3f(0.0f, 0.0f, 0.0f);
+    glClearDepth(1.0f);
+    glEnable(GL_DEPTH_TEST);
+    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
+}
+
+static void render() {
+    static int rot = 0;
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    glLoadIdentity();
+    glTranslatef(0.0f, 0.0f, -6.0f);
+    glRotatef(rot++, 0,0,1);
+    rot %= 360;
+    glBegin(GL_QUADS);
+    glVertex3f(-1.0f, 1.0f, 0.0f);
+    glVertex3f(1.0f, 1.0f, 0.0f);
+    glVertex3f(1.0f, -1.0f, 0.0f);
+    glVertex3f(-1.0f, -1.0f, 0.0f);
+    glEnd();
+}
+
+static void resize(GLCanvas canvas) {
+    canvas.setCurrent();
+    Rectangle rect = canvas.getClientArea();
+    int width = rect.width;
+    int height = Math.max(rect.height, 1);
+    glViewport(0, 0, width, height);
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+    float aspect = cast(float) width / cast(float) height;
+    gluPerspective(45.0f, aspect, 0.5f, 400.0f);
+    glMatrixMode(GL_MODELVIEW);
+    glLoadIdentity();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet184.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet184;
+
+/*
+ * Spinner example snippet: create and initialize a spinner widget
+ * 
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.1
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    Spinner spinner = new Spinner (shell, SWT.BORDER);
+    spinner.setMinimum(0);
+    spinner.setMaximum(1000);
+    spinner.setSelection(500);
+    spinner.setIncrement(1);
+    spinner.setPageIncrement(100);
+    spinner.pack();
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet189.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet189;
+
+/*
+ * Text with underline and strike through
+ * 
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.1
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    shell.setText("StyledText with underline and strike through");
+    shell.setLayout(new FillLayout());
+    auto text = new StyledText (shell, SWT.BORDER);
+    text.setText("0123456789 ABCDEFGHIJKLM NOPQRSTUVWXYZ");
+    // make 0123456789 appear underlined
+    auto style1 = new StyleRange();
+    style1.start = 0;
+    style1.length = 10;
+    style1.underline = true;
+    text.setStyleRange(style1);
+    // make ABCDEFGHIJKLM have a strike through
+    auto style2 = new StyleRange();
+    style2.start = 11;
+    style2.length = 13;
+    style2.strikeout = true;
+    text.setStyleRange(style2);
+    // make NOPQRSTUVWXYZ appear underlined and have a strike through
+    auto style3 = new StyleRange();
+    style3.start = 25;
+    style3.length = 13;
+    style3.underline = true;
+    style3.strikeout = true;
+    text.setStyleRange(style3);
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet190.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet190;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+
+import Math = tango.math.Math;
+import tango.io.Stdout;
+
+/*
+ * Floating point values in Spinner
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.1
+ */
+
+void main () {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setText("Spinner with float values");
+    shell.setLayout(new GridLayout());
+    final Spinner spinner = new Spinner(shell, SWT.NONE);
+    // allow 3 decimal places
+    spinner.setDigits(3);
+    // set the minimum value to 0.001
+    spinner.setMinimum(1);
+    // set the maximum value to 20
+    spinner.setMaximum(20000);
+    // set the increment value to 0.010
+    spinner.setIncrement(10);
+    // set the seletion to 3.456
+    spinner.setSelection(3456);
+    spinner.addSelectionListener(new class() SelectionAdapter {
+        public void widgetSelected(SelectionEvent e) {
+            int selection = spinner.getSelection();
+            float digits = spinner.getDigits();
+            Stdout.formatln("Selection is {}", selection / Math.pow(10.f, digits));
+        }
+    });
+    shell.setSize(200, 200);
+    shell.open();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet193.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * D Port:
+ *     Bill Baxter <wbaxter@gmail.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet193;
+
+/*
+ * Tree example snippet: allow user to reorder columns by dragging and programmatically.
+ * 
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.2
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.layout.RowData;
+
+import tango.util.Convert;
+import tango.io.Stdout;
+
+import java.lang.all;
+
+
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new RowLayout(SWT.HORIZONTAL));
+    final Tree tree = new Tree(shell, SWT.BORDER | DWT.CHECK);
+    tree.setLayoutData(new RowData(-1, 300));
+    tree.setHeaderVisible(true);
+    TreeColumn column = new TreeColumn(tree, SWT.LEFT);
+    column.setText("Column 0");
+    column = new TreeColumn(tree, SWT.CENTER);
+    column.setText("Column 1");
+    column = new TreeColumn(tree, SWT.LEFT);
+    column.setText("Column 2");
+    column = new TreeColumn(tree, SWT.RIGHT);
+    column.setText("Column 3");
+    column = new TreeColumn(tree, SWT.CENTER);
+    column.setText("Column 4");
+    for (int i = 0; i < 5; i++) {
+        TreeItem item = new TreeItem(tree, SWT.NONE);
+        auto istr = to!(String)(i);
+        String[] text = [istr~":0",
+                         istr~":1",
+                         istr~":2",
+                         istr~":3",
+                         istr~":4"];
+        item.setText(text);
+        for (int j = 0; j < 5; j++) {
+            auto jstr = to!(String)(j);
+            TreeItem subItem = new TreeItem(item, SWT.NONE);
+            text = [istr~","~jstr~":0",
+                    istr~","~jstr~":1", 
+                    istr~","~jstr~":2",
+                    istr~","~jstr~":3",
+                    istr~","~jstr~":4"];
+            subItem.setText(text);
+            for (int k = 0; k < 5; k++) {
+                auto kstr = to!(String)(k);
+                TreeItem subsubItem = new TreeItem(subItem, SWT.NONE);
+                text = [istr~","~jstr~","~kstr~":0",
+                        istr~","~jstr~","~kstr~":1",
+                        istr~","~jstr~","~kstr~":2",
+                        istr~","~jstr~","~kstr~":3",
+                        istr~","~jstr~","~kstr~":4"];
+                subsubItem.setText(text);
+            }
+        }
+    }
+    Listener listener = new class Listener {
+        public void handleEvent(Event e) {
+            Stdout.print("Move "~e.widget.toString).newline;
+        }
+    };
+    TreeColumn[] columns = tree.getColumns();
+    for (int i = 0; i < columns.length; i++) {
+        columns[i].setWidth(100);
+        columns[i].setMoveable(true);
+        columns[i].addListener(SWT.Move, listener);
+    }
+    Button b = new Button(shell, SWT.PUSH);
+    b.setText("invert column order");
+    b.addListener(SWT.Selection, new class Listener {
+        public void handleEvent(Event e) {
+            int[] order = tree.getColumnOrder();
+            for (int i = 0; i < order.length / 2; i++) {
+                int temp = order[i];
+                order[i] = order[order.length - i - 1];
+                order[order.length - i - 1] = temp;
+            }
+            tree.setColumnOrder(order);
+        }
+    });
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * Port to the D Programming Language:
+ *     John Reimer <terminal.node@gmail.com>
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet195;
+
+/*
+ * SWT OpenGL snippet: based on snippet195.java
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.opengl.GLCanvas;
+import org.eclipse.swt.opengl.GLData;
+
+import derelict.opengl.gl;
+import derelict.opengl.glu;
+
+import Math = tango.math.Math;
+
+void drawTorus(float r, float R, int nsides, int rings)
+{
+    float ringDelta = 2.0f * cast(float) Math.PI / rings;
+    float sideDelta = 2.0f * cast(float) Math.PI / nsides;
+    float theta = 0.0f, cosTheta = 1.0f, sinTheta = 0.0f;
+    for (int i = rings - 1; i >= 0; i--) {
+        float theta1 = theta + ringDelta;
+        float cosTheta1 = cast(float) Math.cos(theta1);
+        float sinTheta1 = cast(float) Math.sin(theta1);
+        glBegin(GL_QUAD_STRIP);
+        float phi = 0.0f;
+        for (int j = nsides; j >= 0; j--) {
+            phi += sideDelta;
+            float cosPhi = cast(float) Math.cos(phi);
+            float sinPhi = cast(float) Math.sin(phi);
+            float dist = R + r * cosPhi;
+            glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
+            glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
+            glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
+            glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi);
+        }
+        glEnd();
+        theta = theta1;
+        cosTheta = cosTheta1;
+        sinTheta = sinTheta1;
+    }
+}
+
+void main()
+{
+    DerelictGL.load();
+    DerelictGLU.load();
+
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    Composite comp = new Composite(shell, SWT.NONE);
+    comp.setLayout(new FillLayout());
+    GLData data = new GLData ();
+    data.doubleBuffer = true;
+    GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data);
+
+    canvas.setCurrent();
+
+    canvas.addListener(SWT.Resize, new class() Listener {
+        public void handleEvent(Event event) {
+            Rectangle bounds = canvas.getBounds();
+            float fAspect = cast(float) bounds.width / cast(float) bounds.height;
+
+            glViewport(0, 0, bounds.width, bounds.height);
+            glMatrixMode(GL_PROJECTION);
+            glLoadIdentity();
+            gluPerspective(45.0f, fAspect, 0.5f, 400.0f);
+            glMatrixMode(GL_MODELVIEW);
+            glLoadIdentity();
+        }
+    });
+
+    glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+    glColor3f(1.0f, 0.0f, 0.0f);
+    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
+    glClearDepth(1.0);
+    glLineWidth(2);
+    glEnable(GL_DEPTH_TEST);
+
+    shell.setText("SWT/DerelictGL Example");
+    shell.setSize(640, 480);
+    shell.open();
+
+    display.asyncExec(new class() Runnable {
+        int rot = 0;
+        public void run() {
+            if (!canvas.isDisposed()) {
+                canvas.setCurrent();
+
+                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+                glClearColor(.3f, .5f, .8f, 1.0f);
+                glLoadIdentity();
+                glTranslatef(0.0f, 0.0f, -10.0f);
+                float frot = rot;
+                glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f);
+                glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f);
+                rot++;
+                glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+                glColor3f(0.9f, 0.9f, 0.9f);
+                drawTorus(1, 1.9f + (cast(float) Math.sin((0.004f * frot))), 15, 15);
+                canvas.swapBuffers();
+                display.asyncExec(this);
+            }
+        }
+    });
+
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet20.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet20;
+
+/*
+ * CoolBar example snippet: create a cool bar
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.CoolBar;
+import org.eclipse.swt.widgets.CoolItem;
+import org.eclipse.swt.widgets.Shell;
+
+import tango.util.Convert;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    auto bar = new CoolBar (shell, SWT.BORDER);
+    for (int i=0; i<2; i++) {
+        auto item = new CoolItem (bar, SWT.NONE);
+        auto button = new Button (bar, SWT.PUSH);
+        button.setText ("Button " ~ to!(char[])(i));
+        auto size = button.computeSize (SWT.DEFAULT, DWT.DEFAULT);
+        item.setPreferredSize (item.computeSize (size.x, size.y));
+        item.setControl (button);
+    }
+    bar.pack ();
+	 shell.setSize(300, 100);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet206.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet206;
+
+/*
+ * Button example snippet: a Button with text and image
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+void main(String[] args){
+    Snippet206.main(args);
+}
+
+public class Snippet206 {
+    public static void main(String[] args) {
+        Display display = new Display();
+        Image image = display.getSystemImage(SWT.ICON_QUESTION);
+        Shell shell = new Shell(display);
+        shell.setLayout (new GridLayout());
+        Button button = new Button(shell, SWT.PUSH);
+        button.setImage(image);
+        button.setText("Button");
+        shell.setSize(300, 300);
+        shell.open();
+        while (!shell.isDisposed ()) {
+            if (!display.readAndDispatch ()) display.sleep ();
+        }
+        display.dispose ();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet207.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet207;
+
+/*
+ * Use transformation matrices to reflect, rotate and shear images
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Transform;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Canvas;
+
+import Math=tango.math.Math;
+
+void main() {
+    Display display = new Display();
+        
+    Image image = new Image(display, 110, 60);
+    GC gc = new GC(image);
+    Font font = new Font(display, "Times", 30., SWT.BOLD);
+    gc.setFont(font);
+    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
+    gc.fillRectangle(0, 0, 110, 60);
+    gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
+    gc.drawText("SWT", 10, 10, true);
+    font.dispose();
+    gc.dispose();
+        
+    Rectangle rect = image.getBounds();
+    Shell shell = new Shell(display);
+    shell.setText("Matrix Tranformations");
+    shell.setLayout(new FillLayout());
+    Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
+    canvas.addPaintListener(new class() PaintListener {
+            public void paintControl(PaintEvent e) {    
+                GC gc = e.gc;
+                gc.setAdvanced(true);
+                if (!gc.getAdvanced()){
+                    gc.drawText("Advanced graphics not supported", 30, 30, true);
+                    return;
+                }
+                
+                // Original image
+                int x = 30, y = 30;
+                gc.drawImage(image, x, y); 
+                x += rect.width + 30;
+                
+                Transform transform = new Transform(display);
+                
+                // Note that the tranform is applied to the whole GC therefore
+                // the coordinates need to be adjusted too.
+                
+                // Reflect around the y axis.
+                transform.setElements(-1, 0, 0, 1, 0 ,0);
+                gc.setTransform(transform);
+                gc.drawImage(image, -1*x-rect.width, y);
+                
+                x = 30; y += rect.height + 30;
+                
+                // Reflect around the x axis. 
+                transform.setElements(1, 0, 0, -1, 0, 0);
+                gc.setTransform(transform);
+                gc.drawImage(image, x, -1*y-rect.height);
+                
+                x += rect.width + 30;
+                
+                // Reflect around the x and y axes  
+                transform.setElements(-1, 0, 0, -1, 0, 0);
+                gc.setTransform(transform);
+                gc.drawImage(image, -1*x-rect.width, -1*y-rect.height);
+                
+                x = 30; y += rect.height + 30;
+                
+                // Shear in the x-direction
+                transform.setElements(1, 0, -1, 1, 0, 0);
+                gc.setTransform(transform);
+                gc.drawImage(image, 300, y);
+                
+                // Shear in y-direction
+                transform.setElements(1, -1, 0, 1, 0, 0);
+                gc.setTransform(transform);
+                gc.drawImage(image, 150, 475);
+                
+                // Rotate by 45 degrees 
+                float cos45 = Math.cos(45);
+                float sin45 = Math.sin(45);
+                transform.setElements(cos45, sin45, -sin45, cos45, 0, 0);
+                gc.setTransform(transform);
+                gc.drawImage(image, 350, 100);
+                
+                transform.dispose();
+            }
+        });
+        
+    shell.setSize(350, 550);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    image.dispose();
+    display.dispose();
+}
+
+    
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet208.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet208;
+
+/*
+ * Change hue, saturation and brightness of a color
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+void main (String [] args) {
+    PaletteData palette = new PaletteData(0xff, 0xff00, 0xff0000);
+
+    // ImageData showing variations of hue
+    ImageData hueData = new ImageData(360, 100, 24, palette);
+    float hue = 0;
+    for (int x = 0; x < hueData.width; x++) {
+        for (int y = 0; y < hueData.height; y++) {
+            int pixel = palette.getPixel(new RGB(hue, 1f, 1f));
+            hueData.setPixel(x, y, pixel);
+        }
+        hue += 360f / hueData.width;
+    }
+
+    // ImageData showing saturation on x axis and brightness on y axis
+    ImageData saturationBrightnessData = new ImageData(360, 360, 24, palette);
+    float saturation = 0f;
+    float brightness = 1f;
+    for (int x = 0; x < saturationBrightnessData.width; x++) {
+        brightness = 1f;
+        for (int y = 0; y < saturationBrightnessData.height; y++) {
+            int pixel = palette.getPixel(new RGB(360f, saturation, brightness));
+            saturationBrightnessData.setPixel(x, y, pixel);
+            brightness -= 1f / saturationBrightnessData.height;
+        }
+        saturation += 1f / saturationBrightnessData.width;
+    }
+
+    Display display = new Display();
+    Image hueImage = new Image(display, hueData);
+    Image saturationImage = new Image(display, saturationBrightnessData);
+    Shell shell = new Shell(display);
+    shell.setText("Hue, Saturation, Brightness");
+    GridLayout gridLayout = new GridLayout(2, false);
+    gridLayout.verticalSpacing = 10;
+    gridLayout.marginWidth = gridLayout.marginHeight = 16;
+    shell.setLayout(gridLayout);
+
+    Label label = new Label(shell, SWT.CENTER);
+    label.setImage(hueImage);
+    GridData data = new GridData(SWT.RIGHT, DWT.CENTER, false, false, 2, 1);
+    label.setLayoutData(data);
+
+    label = new Label(shell, SWT.CENTER); //spacer
+    label = new Label(shell, SWT.CENTER);
+    label.setText("Hue");
+    data = new GridData(SWT.CENTER, DWT.CENTER, false, false);
+    label.setLayoutData(data);
+    label = new Label(shell, SWT.CENTER); //spacer
+    data = new GridData(SWT.CENTER, DWT.CENTER, false, false, 2, 1);
+    label.setLayoutData(data);
+
+    label = new Label(shell, SWT.LEFT);
+    label.setText("Brightness");
+    data = new GridData(SWT.LEFT, DWT.CENTER, false, false);
+    label.setLayoutData(data);
+
+    label = new Label(shell, SWT.CENTER);
+    label.setImage(saturationImage);
+    data = new GridData(SWT.CENTER, DWT.CENTER, false, false);
+    label.setLayoutData (data);
+
+    label = new Label(shell, SWT.CENTER); //spacer
+    label = new Label(shell, SWT.CENTER);
+    label.setText("Saturation");
+    data = new GridData(SWT.CENTER, DWT.CENTER, false, false);
+    label.setLayoutData(data);
+
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) {
+            display.sleep();
+        }
+    }
+    hueImage.dispose();
+    saturationImage.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Bill Baxter <wbaxter> at gmail com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet21;
+
+/*
+ * Canvas example snippet: implement tab traversal (behave like a tab group)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Canvas;
+
+import tango.io.Stdout;
+
+import java.lang.all;
+
+void main () {
+	Display display = new Display ();
+	final Color red = display.getSystemColor (SWT.COLOR_RED);
+	final Color blue = display.getSystemColor (SWT.COLOR_BLUE);
+	Shell shell = new Shell (display);
+	Button b = new Button (shell, SWT.PUSH);
+	b.setBounds (10, 10, 100, 32);
+	b.setText ("Button");
+	shell.setDefaultButton (b);
+	final Canvas c = new Canvas (shell, SWT.BORDER);
+	c.setBounds (10, 50, 100, 32);
+
+    void onTraverse(Event e, Canvas c) {
+        switch (e.detail) {
+            /* Do tab group traversal */
+        case SWT.TRAVERSE_ESCAPE:
+        case SWT.TRAVERSE_RETURN:
+        case SWT.TRAVERSE_TAB_NEXT:	
+        case SWT.TRAVERSE_TAB_PREVIOUS:
+        case SWT.TRAVERSE_PAGE_NEXT:	
+        case SWT.TRAVERSE_PAGE_PREVIOUS:
+            e.doit = true;
+            break;
+        }
+    }
+
+    void onFocusIn(Event e, Canvas c) {
+        c.setBackground (red);
+    }
+
+    void onFocusOut(Event e, Canvas c) {
+        c.setBackground (blue);
+    }
+
+    void onKeyDown (Event e, Canvas c) {
+        Stdout("KEY").newline;
+        for (int i=0; i<64; i++) {
+            Color c1 = red, c2 = blue;
+            if (c.isFocusControl ()) {
+                c1 = blue;  c2 = red;
+            }
+            c.setBackground (c1);
+            c.update ();
+            c.setBackground (c2);
+        }
+    }
+
+	c.addListener (SWT.Traverse, dgListener(&onTraverse, c));
+	c.addListener (SWT.FocusIn, dgListener(&onFocusIn, c));
+	c.addListener (SWT.FocusOut, dgListener(&onFocusOut, c));
+	c.addListener (SWT.KeyDown, dgListener(&onKeyDown, c));
+
+	Text t = new Text (shell, SWT.SINGLE | DWT.BORDER);
+	t.setBounds (10, 85, 100, 32);
+
+	Text r = new Text (shell, SWT.MULTI | DWT.BORDER);
+	r.setBounds (10, 120, 100, 32);
+	
+	c.setFocus ();
+	shell.setSize (200, 200);
+	shell.open ();
+	while (!shell.isDisposed()) {
+		if (!display.readAndDispatch ()) display.sleep ();
+	}
+	display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet211.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     yidabu at gmail dot com  ( D China http://www.d-programming-language-china.org/ )
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet211;
+/*
+ * SWT StyledText snippet: use rise and font with StyleRange.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import java.lang.all;
+version(JIVE){
+    import jive.stacktrace;
+}
+
+void main() {
+    static String text =
+        "You can set any font you want in a range. You can also set a baseline rise and all other old features"
+        " like background and foreground, and mix them any way you want. Totally awesome.";
+
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    StyledText styledText = new StyledText(shell, SWT.WRAP | DWT.BORDER);
+    styledText.setText(text);
+    FontData data = styledText.getFont().getFontData()[0];
+    Font font1 = new Font(display, data.getName(), data.getHeight() * 2f, data.getStyle());
+    Font font2 = new Font(display, data.getName(), data.getHeight() * 4f / 5, data.getStyle());
+    StyleRange[] styles = new StyleRange[8];
+    styles[0] = new StyleRange();
+    styles[0].font = font1;
+    styles[1] = new StyleRange();
+    styles[1].rise = data.getHeight() / 3;
+    styles[2] = new StyleRange();
+    styles[2].background = display.getSystemColor(SWT.COLOR_GREEN);
+    styles[3] = new StyleRange();
+    styles[3].foreground = display.getSystemColor(SWT.COLOR_MAGENTA);
+    styles[4] = new StyleRange();
+    styles[4].font = font2;
+    styles[4].foreground = display.getSystemColor(SWT.COLOR_BLUE);;
+    styles[4].underline = true;
+    styles[5] = new StyleRange();
+    styles[5].rise = -data.getHeight() / 3;
+    styles[5].strikeout = true;
+    styles[5].underline = true;
+    styles[6] = new StyleRange();
+    styles[6].font = font1;
+    styles[6].foreground = display.getSystemColor(SWT.COLOR_YELLOW);
+    styles[6].background = display.getSystemColor(SWT.COLOR_BLUE);
+    styles[7] = new StyleRange();
+    styles[7].rise =  data.getHeight() / 3;
+    styles[7].underline = true;
+    styles[7].fontStyle = SWT.BOLD;
+    styles[7].foreground = display.getSystemColor(SWT.COLOR_RED);
+    styles[7].background = display.getSystemColor(SWT.COLOR_BLACK);
+
+    int[] ranges = [16, 4, 61, 13, 107, 10, 122, 10, 134, 3, 143, 6, 160, 7, 168, 7];
+    styledText.setStyleRanges(ranges, styles);
+
+    shell.setSize(300, 300);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    font1.dispose();
+    font2.dispose();
+    display.dispose();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet212.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     yidabu at gmail dot com  ( D China http://www.d-programming-language-china.org/ )
+ *******************************************************************************/
+/*
+Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at ntdll.dll (0x7c90316c) thread(1480)
+->us
+#0 ?? () at org.eclipse.swt\graphics\TextLayout.d:2915 from ntdll.dll
+#1 0x77f205bf in ?? () at org.eclipse.swt\graphics\TextLayout.d:2915 from GDI32.dll
+#2 0x00483c72 in  org.eclipse.swt.graphics.TextLayout.TextLayout.shape () at dwt\graphics\TextLayout.d:2915
+#3 0x0047bfff in  org.eclipse.swt.graphics.TextLayout.TextLayout.computeRuns () at dwt\graphics\TextLayout.d:267
+#4 0x00480474 in  org.eclipse.swt.graphics.Rectangle.Rectangle dwt.graphics.TextLayout.TextLayout.getBounds () at dwt\graphics\TextLayout.d:1387
+#5 0x00411ea7 in  org.eclipse.swt.graphics.Point.Point dwt.custom.StyledText.StyledText.computeSize () at dwt\custom\StyledText.d:1784
+#6 0x0041f24b in  org.eclipse.swt.layout.GridData.GridData.computeSize () at dwt\layout\GridData.d:484
+#7 0x0043258f in  org.eclipse.swt.graphics.Point.Point dwt.layout.GridLayout.GridLayout.layout () at dwt\layout\GridLayout.d:232
+#8 0x00432325 in  org.eclipse.swt.layout.GridLayout.GridLayout.layout () at dwt\layout\GridLayout.d:208
+#9 0x004999af in  org.eclipse.swt.widgets.Composite.Composite.updateLayout () at dwt\widgets\Composite.d:1170
+#10 0x00498eba in  org.eclipse.swt.widgets.Composite.Composite.sendResize () at dwt\widgets\Composite.d:879
+#11 0x00499053 in  org.eclipse.swt.widgets.Composite.Composite.setBounds () at dwt\widgets\Composite.d:924
+#12 0x004d959d in  org.eclipse.swt.widgets.Decorations.Decorations.setBounds () at dwt\widgets\Decorations.d:888
+#13 0x0042f9a2 in  org.eclipse.swt.widgets.Shell.Shell.setBounds () at dwt\widgets\Shell.d:1460
+#14 0x004733f3 in  org.eclipse.swt.widgets.Control.Control.setBounds () at dwt\widgets\Control.d:2639
+#15 0x00473d27 in  org.eclipse.swt.widgets.Control.Control.setSize () at dwt\widgets\Control.d:3153
+#16 0x004042c8 in _Dmain () at Snippet212.d:171
+#17 0x00645778 in extern (C) int dmain2.main(int, char**) . void runMain(void*) () from dmain2
+#18 0x006457af in extern (C) int dmain2.main(int, char**) . void runAll(void*) () from dmain2
+#19 0x006454f0 in _main () from dmain2
+#20 0x0065f801 in _mainCRTStartup () from constart
+#21 0x7c816fd7 in ?? () from KERNEL32.dll
+*/
+module org.eclipse.swt.snippets.Snippet212;
+/**
+ * StyledText snippet: embed images
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.custom.PaintObjectEvent;
+import org.eclipse.swt.custom.PaintObjectListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.GlyphMetrics;
+import java.lang.all;
+
+const char[] OBJ_MARKER = "\uFFFC";
+
+void main() {
+    static StyledText styledText;
+    static String text = 
+        "This snippet shows how to embed images in a StyledText.\n"
+        "Here is one: " ~ OBJ_MARKER ~ ", and here is another: " ~ OBJ_MARKER ~ "."
+        "Use the add button to add an image from your filesystem to the StyledText at the current caret offset.";
+    static Image[] images;
+    static int[] offsets;
+
+    static void addImage(Image image, int offset) {
+        StyleRange style = new StyleRange ();
+        style.start = offset;
+        style.length = OBJ_MARKER.length;
+        Rectangle rect = image.getBounds();
+        style.metrics = new GlyphMetrics(rect.height, 0, rect.width);
+        styledText.setStyleRange(style);        
+    }
+
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+    styledText = new StyledText(shell, SWT.WRAP | DWT.BORDER);
+    styledText.setLayoutData(new GridData(SWT.FILL, DWT.FILL, true, true));
+    styledText.setText(text);
+    images = [
+        display.getSystemImage(SWT.ICON_QUESTION),
+        display.getSystemImage(SWT.ICON_INFORMATION)
+    ];
+    offsets = new int[images.length];
+    int lastOffset = 0;
+    for (int i = 0; i < images.length; i++) {
+        int offset = text.indexOf(OBJ_MARKER, lastOffset);
+        offsets[i] = offset;
+        addImage(images[i], offset);
+        lastOffset = offset + 1;
+    }
+    
+    void onVerify(Event e) {
+        int start = e.start;
+        int replaceCharCount = e.end - e.start;
+        int newCharCount = e.text.length;
+        for (int i = 0; i < offsets.length; i++) {
+            int offset = offsets[i];
+            if (start <= offset && offset < start + replaceCharCount) {
+                // this image is being deleted from the text
+                if (images[i] !is null && !images[i].isDisposed()) {
+                    images[i].dispose();
+                    images[i] = null;
+                }
+                offset = -1;
+            }
+            if (offset != -1 && offset >= start) offset += newCharCount - replaceCharCount;
+            offsets[i] = offset;
+        }
+    }    
+    // use a verify listener to keep the offsets up to date
+    styledText.addListener(SWT.Verify, dgListener(&onVerify));
+
+    styledText.addPaintObjectListener(new class(images, offsets) PaintObjectListener {
+        Image[] images;
+        int[] offsets;
+        this( Image[] images_, int[] offsets_) {
+            this.images = images_;
+            this.offsets = offsets_;
+        }
+        public void paintObject(PaintObjectEvent event) {
+            GC gc = event.gc;
+            StyleRange style = event.style;
+            int start = style.start;
+            for (int i = 0; i < offsets.length; i++) {
+                int offset = offsets[i];
+                if (start == offset) {
+                    Image image = images[i];
+                    int x = event.x;
+                    int y = event.y + event.ascent - style.metrics.ascent;						
+                    gc.drawImage(image, x, y);
+                }
+            }
+        }
+    });    
+    
+    Button button = new Button (shell, SWT.PUSH);
+    button.setText("Add Image");
+    button.setLayoutData(new GridData(SWT.CENTER, DWT.CENTER, false, false));
+    
+    void onSelection(Event e) {
+       FileDialog dialog = new FileDialog(shell);
+        String filename = dialog.open();
+        if (filename !is null) {
+            try {
+                Image image = new Image(display, filename);
+                int offset = styledText.getCaretOffset();
+                styledText.replaceTextRange(offset, 0, OBJ_MARKER);
+                int index = 0;
+                while (index < offsets.length) {
+                    if (offsets[index] == -1 && images[index] is null) break;
+                    index++;
+                }
+                if (index == offsets.length) {
+                    int[] tmpOffsets = new int[index + 1];
+                    System.arraycopy(offsets, 0, tmpOffsets, 0, offsets.length);
+                    offsets = tmpOffsets;
+                    Image[] tmpImages = new Image[index + 1];
+                    System.arraycopy(images, 0, tmpImages, 0, images.length);
+                    images = tmpImages;
+                }
+                offsets[index] = offset;
+                images[index] = image;
+                addImage(image, offset);
+            } catch (Exception e) {
+                ExceptionPrintStackTrace(e);
+            }
+        }
+    }
+    button.addListener(SWT.Selection, dgListener(&onSelection));
+    shell.setSize(400, 400);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    for (int i = 0; i < images.length; i++) {
+        Image image = images[i];
+        if (image !is null && !image.isDisposed()) {
+            image.dispose();
+        }
+    }
+    display.dispose();
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet213.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     yidabu at gmail dot com  ( D China http://www.d-programming-language-china.org/ )
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet213;
+/*
+ * SWT StyledText snippet: use indent, alignment and justify.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+version(JIVE){
+    import jive.stacktrace;
+}
+
+void main() {
+    static String text =
+        "The first paragraph has an indentation of fifty pixels. Indentation is the amount of white space in front of the first line of a paragraph. If this paragraph wraps to several lines you should see the indentation only on the first line.\n\n"
+        "The second paragraph is center aligned. Alignment only works when the StyledText is using word wrap. Alignment, as with all other line attributes, can be set for the whole widget or just for a set of lines.\n\n"
+        "The third paragraph is justified. Like alignment, justify only works when the StyledText is using word wrap. If the paragraph wraps to several lines, the justification is performed on all lines but the last one.\n\n"
+        "The last paragraph is justified and right aligned. In this case, the alignment is only noticeable in the final line.";
+
+
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    StyledText styledText = new StyledText(shell, SWT.WRAP | DWT.BORDER);
+    styledText.setText(text);
+    styledText.setLineIndent(0, 1, 50);
+    styledText.setLineAlignment(2, 1, SWT.CENTER);
+    styledText.setLineJustify(4, 1, true);
+    styledText.setLineAlignment(6, 1, SWT.RIGHT);
+    styledText.setLineJustify(6, 1, true);
+
+    shell.setSize(300, 400);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet214.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet214;
+
+/*
+ * Control example snippet: set a background image (a dynamic gradient)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+import org.eclipse.swt.SWT;
+
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.layout.RowLayout;
+
+import java.lang.all;
+
+import tango.util.Convert;
+
+static Image oldImage;
+void main(String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setBackgroundMode (SWT.INHERIT_DEFAULT);
+    FillLayout layout1 = new FillLayout (SWT.VERTICAL);
+    layout1.marginWidth = layout1.marginHeight = 10;
+    shell.setLayout (layout1);
+    Group group = new Group (shell, SWT.NONE);
+    group.setText ("Group ");
+    RowLayout layout2 = new RowLayout (SWT.VERTICAL);
+    layout2.marginWidth = layout2.marginHeight = layout2.spacing = 10;
+    group.setLayout (layout2);
+    for (int i=0; i<8; i++) {
+        Button button = new Button (group, SWT.RADIO);
+        button.setText ("Button " ~ to!(char[])(i));
+    }
+    shell.addListener (SWT.Resize, new class() Listener {
+       public void handleEvent (Event event) {
+           Rectangle rect = shell.getClientArea ();
+           Image newImage = new Image (display, Math.max (1, rect.width), 1);
+           GC gc = new GC (newImage);
+           gc.setForeground (display.getSystemColor (SWT.COLOR_WHITE));
+           gc.setBackground (display.getSystemColor (SWT.COLOR_BLUE));
+           gc.fillGradientRectangle (rect.x, rect.y, rect.width, 1, false);
+           gc.dispose ();
+           shell.setBackgroundImage (newImage);
+           if (oldImage !is null) oldImage.dispose ();
+           oldImage = newImage;
+       }
+    });
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    if (oldImage !is null) oldImage.dispose ();
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet215;
+
+/*
+ * GC example snippet: take a screen shot with a GC
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.events.PaintListener;
+
+Image image;
+
+void main() {
+    final Display display = new Display();
+    final Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    Button button = new Button(shell, SWT.PUSH);
+    button.setText("Capture");
+    button.addListener(SWT.Selection, new class() Listener {
+        public void handleEvent(Event event) {
+
+            /* Take the screen shot */
+            GC gc = new GC(display);
+            image = new Image(display, display.getBounds());
+            gc.copyArea(image, 0, 0);
+            gc.dispose();
+
+            Shell popup = new Shell(shell, SWT.SHELL_TRIM);
+            popup.setLayout(new FillLayout());
+            popup.setText("Image");
+            popup.setBounds(50, 50, 200, 200);
+            popup.addListener(SWT.Close, new class() Listener {
+                    public void handleEvent(Event e) {
+                        image.dispose();
+                    }
+                });
+
+            ScrolledComposite sc = new ScrolledComposite (popup, SWT.V_SCROLL | DWT.H_SCROLL);
+            Canvas canvas = new Canvas(sc, SWT.NONE);
+            sc.setContent(canvas);
+            canvas.setBounds(display.getBounds ());
+            canvas.addPaintListener(new class() PaintListener {
+                    public void paintControl(PaintEvent e) {
+                        e.gc.drawImage(image, 0, 0);
+                    }
+                });
+            popup.open();
+        }
+    });
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet217.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     yidabu at gmail dot com  ( D China http://www.d-programming-language-china.org/ )
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet217;
+/**
+ * StyledText snippet: embed controls
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.PaintObjectEvent;
+import org.eclipse.swt.custom.PaintObjectListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.GlyphMetrics;
+
+import java.lang.all;
+version(JIVE){
+    import jive.stacktrace;
+}
+
+const char[] OBJ_MARKER = "\uFFFC";
+void main() {
+    static StyledText styledText;
+    static String text =
+        "This snippet shows how to embed widgets in a StyledText.\n"
+        "Here is one: " ~ OBJ_MARKER ~ ", and here is another: " ~ OBJ_MARKER ~ ".";
+    static int[] offsets;
+    static Control[] controls;
+    static int MARGIN = 5;
+
+    void addControl(Control control, int offset) {
+        StyleRange style = new StyleRange ();
+        style.start = offset;
+        style.length = OBJ_MARKER.length;
+        control.pack();
+        Rectangle rect = control.getBounds();
+        int ascent = 2*rect.height/3;
+        int descent = rect.height - ascent;
+        style.metrics = new GlyphMetrics(ascent + MARGIN, descent + MARGIN, rect.width + 2*MARGIN);
+        styledText.setStyleRange(style);
+    }
+
+
+    Display display = new Display();
+    Font font = new Font(display, "Tahoma", 32f, SWT.NORMAL);
+    Shell shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+    styledText = new StyledText(shell, SWT.WRAP | DWT.BORDER);
+    styledText.setFont(font);
+    styledText.setLayoutData(new GridData(SWT.FILL, DWT.FILL, true, true));
+    styledText.setText(text);
+    controls = new Control[2];
+    Button button = new Button(styledText, SWT.PUSH);
+    button.setText("Button 1");
+    controls[0] = button;
+    Combo combo = new Combo(styledText, SWT.NONE);
+    combo.add("item 1");
+    combo.add("another item");
+    controls[1] = combo;
+    offsets = new int[controls.length];
+    int lastOffset = 0;
+    for (int i = 0; i < controls.length; i++) {
+        int offset = text.indexOf( OBJ_MARKER, lastOffset);
+        offsets[i] = offset;
+        addControl(controls[i], offsets[i]);
+        lastOffset = offset + OBJ_MARKER.length;
+    }
+
+    void onVerify(Event e) {
+        int start = e.start;
+        int replaceCharCount = e.end - e.start;
+        int newCharCount = e.text.length;
+        for (int i = 0; i < offsets.length; i++) {
+            int offset = offsets[i];
+            if (start <= offset && offset < start + replaceCharCount) {
+                // this widget is being deleted from the text
+                if (controls[i] !is null && !controls[i].isDisposed()) {
+                    controls[i].dispose();
+                    controls[i] = null;
+                }
+                offset = -1;
+            }
+            if (offset != -1 && offset >= start) offset += newCharCount - replaceCharCount;
+            offsets[i] = offset;
+        }
+    }
+    // use a verify listener to keep the offsets up to date
+    styledText.addListener(SWT.Verify, dgListener(&onVerify));
+
+    // reposition widgets on paint event
+    styledText.addPaintObjectListener(new class(offsets) PaintObjectListener {
+        int[] offsets;
+        this(int[] offsets_) {
+            this.offsets = offsets_;
+        }
+        public void paintObject(PaintObjectEvent event) {
+            StyleRange style = event.style;
+            int start = style.start;
+            for (int i = 0; i < offsets.length; i++) {
+                int offset = offsets[i];
+                if (start == offset) {
+                    Point pt = controls[i].getSize();
+                    int x = event.x + MARGIN;
+                    int y = event.y + event.ascent - 2*pt.y/3;
+                    controls[i].setLocation(x, y);
+                    break;
+                }
+            }
+        }
+    });
+
+    shell.setSize(400, 400);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    font.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet218.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     yidabu at gmail dot com  ( D China http://www.d-programming-language-china.org/ )
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet218;
+/*
+ * SWT StyledText snippet: use gradient background.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+
+import java.lang.all;
+
+import Math = tango.math.Math;
+version(JIVE){
+    import jive.stacktrace;
+}
+
+void main() {
+    static String text = "Plans do not materialize out of nowhere, nor are they entirely static. To ensure the planning process is "
+        "transparent and open to the entire Eclipse community, we (the Eclipse PMC) post plans in an embryonic "
+        "form and revise them throughout the release cycle. \n"
+        "The first part of the plan deals with the important matters of release deliverables, release milestones, target "
+        "operating environments, and release-to-release compatibility. These are all things that need to be clear for "
+        "any release, even if no features were to change.  \n";
+    static Image oldImage;
+
+
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    StyledText styledText = new StyledText(shell, SWT.WRAP | DWT.BORDER);
+    styledText.setText(text);
+    FontData data = display.getSystemFont().getFontData()[0];
+    Font font = new Font(display, data.getName(), 16f, SWT.BOLD);
+    styledText.setFont(font);
+    styledText.setForeground(display.getSystemColor (SWT.COLOR_BLUE));
+
+    void onResize (Event event) {
+        Rectangle rect = styledText.getClientArea ();
+        Image newImage = new Image (display, 1, Math.max (1, rect.height));
+        GC gc = new GC (newImage);
+        gc.setForeground (display.getSystemColor (SWT.COLOR_WHITE));
+        gc.setBackground (display.getSystemColor (SWT.COLOR_YELLOW));
+        gc.fillGradientRectangle (rect.x, rect.y, 1, rect.height, true);
+        gc.dispose ();
+        styledText.setBackgroundImage (newImage);
+        if (oldImage !is null) oldImage.dispose ();
+        oldImage = newImage;
+    }
+
+    styledText.addListener (SWT.Resize, dgListener(&onResize));
+
+    shell.setSize(700, 400);
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    if (oldImage !is null) oldImage.dispose ();
+    font.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet220.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Bill Baxter <wbaxter@gmail.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet220;
+
+/*
+ * Tree example snippet: Images on the right side of the TreeItem
+ *
+ * For a detailed explanation of this snippet see
+ * http://www.eclipse.org/articles/Article-CustomDrawingTableAndTreeItems/customDraw.htm#_example5
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+import tango.util.Convert;
+
+version(JIVE){
+    import jive.stacktrace;
+}
+
+void main() {
+    const int IMAGE_MARGIN = 2;
+    void handleEventMeasureItem(Event event) {
+        TreeItem item = cast(TreeItem)event.item;
+        Image trailingImage = cast(Image)item.getData();
+        if (trailingImage !is null) {
+            int w1 = event.width;
+            event.width += trailingImage.getBounds().width + IMAGE_MARGIN;
+            int w2 = event.width;
+        }
+    }
+    void handleEventPaintItem(Event event, Tree tree ) {
+        TreeItem item = cast(TreeItem)event.item;
+        Image trailingImage = cast(Image)item.getData();
+        if (trailingImage !is null) {
+            int x = event.x + event.width + IMAGE_MARGIN;
+            int itemHeight = tree.getItemHeight();
+            int imageHeight = trailingImage.getBounds().height;
+            int y = event.y + (itemHeight - imageHeight) / 2;
+            event.gc.drawImage(trailingImage, x, y);
+        }
+    }
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setBounds(10, 10, 350, 200);
+    Image xImage = new Image (display, 16, 16);
+    GC gc = new GC(xImage);
+    gc.setForeground(display.getSystemColor(SWT.COLOR_RED));
+    gc.drawLine(1, 1, 14, 14);
+    gc.drawLine(1, 14, 14, 1);
+    gc.drawOval(2, 2, 11, 11);
+    gc.dispose();
+    Tree tree = new Tree(shell, SWT.CHECK);
+    tree.setBounds(10, 10, 300, 150);
+    TreeItem item = new TreeItem(tree, SWT.NONE);
+    item.setText("root item");
+    for (int i = 0; i < 4; i++) {
+        TreeItem newItem = new TreeItem(item, SWT.NONE);
+        newItem.setText("descendent " ~ to!(char[])(i));
+        if (i % 2 == 0) newItem.setData(xImage);
+        item.setExpanded(true);
+        item = newItem;
+    }
+
+    /*
+     * NOTE: MeasureItem and PaintItem are called repeatedly.  Therefore it is
+     * critical for performance that these methods be as efficient as possible.
+     */
+    tree.addListener(SWT.MeasureItem, dgListener( &handleEventMeasureItem ));
+    tree.addListener(SWT.PaintItem,dgListener( &handleEventPaintItem, tree ));
+
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    xImage.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     yidabu at gmail dot com  ( D China http://www.d-programming-language-china.org/ )
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet222;
+/*
+ * example snippet: StyledText bulleted list example
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.PaintObjectEvent;
+import org.eclipse.swt.custom.PaintObjectListener;
+import org.eclipse.swt.custom.Bullet;
+import org.eclipse.swt.custom.ST;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.TextLayout;
+import org.eclipse.swt.graphics.GlyphMetrics;
+import tango.text.Text;
+alias Text!(char) StringBuffer;
+import tango.util.Convert;
+
+import java.lang.all;
+version(JIVE){
+    import jive.stacktrace;
+}
+
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setText("StyledText Bullet Example");
+    shell.setLayout(new FillLayout());
+    StyledText styledText = new StyledText (shell, SWT.FULL_SELECTION | DWT.BORDER | DWT.WRAP | DWT.V_SCROLL);
+    StringBuffer text = new StringBuffer();
+    text.append("Here is StyledText with some bulleted lists:\n\n");
+    for (int i = 0; i < 4; i++) text.append("Red Bullet List Item " ~ to!(char[])(i) ~ "\n");
+    text.append("\n");
+    for (int i = 0; i < 2; i++) text.append("Numbered List Item " ~ to!(char[])(i) ~ "\n");
+    for (int i = 0; i < 4; i++) text.append("Sub List Item " ~ to!(char[])(i) ~ "\n");
+    for (int i = 0; i < 2; i++) text.append("Numbered List Item " ~ to!(char[])(2+i) ~ "\n");
+    text.append("\n");
+    for (int i = 0; i < 4; i++) text.append("Custom Draw List Item " ~ to!(char[])(i) ~ "\n");
+    styledText.setText(text.toString());
+
+    StyleRange style0 = new StyleRange();
+    style0.metrics = new GlyphMetrics(0, 0, 40);
+    style0.foreground = display.getSystemColor(SWT.COLOR_RED);
+    Bullet bullet0 = new Bullet (style0);
+    StyleRange style1 = new StyleRange();
+    style1.metrics = new GlyphMetrics(0, 0, 50);
+    style1.foreground = display.getSystemColor(SWT.COLOR_BLUE);
+    Bullet bullet1 = new Bullet (ST.BULLET_NUMBER | ST.BULLET_TEXT, style1);
+    bullet1.text = ".";
+    StyleRange style2 = new StyleRange();
+    style2.metrics = new GlyphMetrics(0, 0, 80);
+    style2.foreground = display.getSystemColor(SWT.COLOR_GREEN);
+    Bullet bullet2 = new Bullet (ST.BULLET_TEXT, style2);
+    bullet2.text = "\u2713";
+    StyleRange style3 = new StyleRange();
+    style3.metrics = new GlyphMetrics(0, 0, 50);
+    Bullet bullet3 = new Bullet (ST.BULLET_CUSTOM, style2);
+
+    styledText.setLineBullet(2, 4, bullet0);
+    styledText.setLineBullet(7, 2, bullet1);
+    styledText.setLineBullet(9, 4, bullet2);
+    styledText.setLineBullet(13, 2, bullet1);
+    styledText.setLineBullet(16, 4, bullet3);
+
+    styledText.addPaintObjectListener(new class() PaintObjectListener {
+        public void paintObject(PaintObjectEvent event) {
+            Display display = event.display;
+            StyleRange style = event.style;
+            Font font = style.font;
+            if (font is null) font = styledText.getFont();
+            TextLayout layout = new TextLayout(display);
+            layout.setAscent(event.ascent);
+            layout.setDescent(event.descent);
+            layout.setFont(font);
+            layout.setText("\u2023 1." ~ to!(char[])( event.bulletIndex) ~ ")");
+            layout.draw(event.gc, event.x + 10, event.y);
+            layout.dispose();
+        }
+    });
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet223.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet223;
+/* 
+ * example snippet: ExpandBar example
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import java.io.ByteArrayInputStream;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.ExpandBar;
+import org.eclipse.swt.widgets.ExpandItem;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Slider;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    shell.setLayout(new FillLayout());
+    shell.setText("ExpandBar Example");
+    auto bar = new ExpandBar (shell, SWT.V_SCROLL);
+    auto image = new Image(display, new ImageData(new ByteArrayInputStream( cast(byte[]) import("eclipse.png")))); 
+    
+    // First item
+    Composite composite = new Composite (bar, SWT.NONE);
+    GridLayout layout = new GridLayout ();
+    layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
+    layout.verticalSpacing = 10;
+    composite.setLayout(layout);
+    Button button = new Button (composite, SWT.PUSH);
+    button.setText("SWT.PUSH");
+    button = new Button (composite, SWT.RADIO);
+    button.setText("SWT.RADIO");
+    button = new Button (composite, SWT.CHECK);
+    button.setText("SWT.CHECK");
+    button = new Button (composite, SWT.TOGGLE);
+    button.setText("SWT.TOGGLE");
+    ExpandItem item0 = new ExpandItem (bar, SWT.NONE, 0);
+    item0.setText("What is your favorite button");
+    item0.setHeight(composite.computeSize(SWT.DEFAULT, DWT.DEFAULT).y);
+    item0.setControl(composite);
+    item0.setImage(image);
+    
+    // Second item
+    composite = new Composite (bar, SWT.NONE);
+    layout = new GridLayout (2, false);
+    layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
+    layout.verticalSpacing = 10;
+    composite.setLayout(layout);    
+    Label label = new Label (composite, SWT.NONE);
+    label.setImage(display.getSystemImage(SWT.ICON_ERROR));
+    label = new Label (composite, SWT.NONE);
+    label.setText("SWT.ICON_ERROR");
+    label = new Label (composite, SWT.NONE);
+    label.setImage(display.getSystemImage(SWT.ICON_INFORMATION));
+    label = new Label (composite, SWT.NONE);
+    label.setText("SWT.ICON_INFORMATION");
+    label = new Label (composite, SWT.NONE);
+    label.setImage(display.getSystemImage(SWT.ICON_WARNING));
+    label = new Label (composite, SWT.NONE);
+    label.setText("SWT.ICON_WARNING");
+    label = new Label (composite, SWT.NONE);
+    label.setImage(display.getSystemImage(SWT.ICON_QUESTION));
+    label = new Label (composite, SWT.NONE);
+    label.setText("SWT.ICON_QUESTION");
+    ExpandItem item1 = new ExpandItem (bar, SWT.NONE, 1);
+    item1.setText("What is your favorite icon");
+    item1.setHeight(composite.computeSize(SWT.DEFAULT, DWT.DEFAULT).y);
+    item1.setControl(composite);
+    item1.setImage(image);
+    
+    // Third item
+    composite = new Composite (bar, SWT.NONE);
+    layout = new GridLayout (2, true);
+    layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
+    layout.verticalSpacing = 10;
+    composite.setLayout(layout);
+    label = new Label (composite, SWT.NONE);
+    label.setText("Scale"); 
+    new Scale (composite, SWT.NONE);
+    label = new Label (composite, SWT.NONE);
+    label.setText("Spinner");   
+    new Spinner (composite, SWT.BORDER);
+    label = new Label (composite, SWT.NONE);
+    label.setText("Slider");    
+    new Slider (composite, SWT.NONE);
+    ExpandItem item2 = new ExpandItem (bar, SWT.NONE, 2);
+    item2.setText("What is your favorite range widget");
+    item2.setHeight(composite.computeSize(SWT.DEFAULT, DWT.DEFAULT).y);
+    item2.setControl(composite);
+    item2.setImage(image);
+    
+    item1.setExpanded(true);
+    bar.setSpacing(8);
+    shell.setSize(400, 350);
+    shell.open();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) {
+            display.sleep ();
+        }
+    }
+    image.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet224.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet224;
+
+/*
+ * implement radio behavior for setSelection()
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.layout.RowLayout;
+
+import java.lang.all;
+import tango.util.Convert;
+
+void main(String[] args){
+    Snippet224.main(args);
+}
+
+
+public class Snippet224 {
+    public static void main (String [] args) {
+        Display display = new Display ();
+        Shell shell = new Shell (display);
+        shell.setLayout (new RowLayout (SWT.VERTICAL));
+        for (int i=0; i<8; i++) {
+            Button button = new Button (shell, SWT.RADIO);
+            button.setText ("B" ~ to!(char[])(i));
+            if (i == 0) button.setSelection (true);
+        }
+        Button button = new Button (shell, SWT.PUSH);
+        button.setText ("Set Selection to B4");
+        button.addListener (SWT.Selection, new class() Listener{
+            public void handleEvent (Event event) {
+                Control [] children = shell.getChildren ();
+                Button newButton = cast(Button) children [4];
+                for (int i=0; i<children.length; i++) {
+                    Control child = children [i];
+                    if ( cast(Button)child !is null && (child.getStyle () & SWT.RADIO) != 0) {
+                        (cast(Button)child).setSelection (false);
+                    }
+                }
+                newButton.setSelection (true);
+            }
+        });
+        shell.pack ();
+        shell.open ();
+        while (!shell.isDisposed ()) {
+            if (!display.readAndDispatch ()) display.sleep ();
+        }
+        display.dispose ();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet226.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Bill Baxter <wbaxter@gmail.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet226;
+
+/* 
+ * Tree example snippet: Draw a custom gradient selection
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.3
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+
+import tango.util.Convert;
+
+import java.lang.all;
+
+void main() 
+{
+	final Display display = new Display();
+	Shell shell = new Shell(display);
+	shell.setText("Custom gradient selection for Tree");
+	shell.setLayout(new FillLayout());
+	final Tree tree = new Tree(shell, SWT.MULTI | DWT.FULL_SELECTION);
+	tree.setHeaderVisible(true);
+	tree.setLinesVisible(true);
+	int columnCount = 4;
+	for (int i=0; i<columnCount; i++) {
+        auto istr = to!(String)(i);
+		TreeColumn column = new TreeColumn(tree, SWT.NONE);
+		column.setText("Column " ~ istr);	
+	}
+	int itemCount = 3;
+	for (int i=0; i<itemCount; i++) {
+        auto istr = to!(String)(i);
+		TreeItem item1 = new TreeItem(tree, SWT.NONE);
+		item1.setText("item "~istr);
+		for (int c=1; c < columnCount; c++) {
+            auto cstr = to!(String)(c);
+			item1.setText(c, "item ["~istr~"-"~cstr~"]");
+		}
+		for (int j=0; j<itemCount; j++) {
+            auto jstr = to!(String)(j);
+			TreeItem item2 = new TreeItem(item1, SWT.NONE);
+			item2.setText("item ["~istr~" "~jstr~"]");
+			for (int c=1; c<columnCount; c++) {
+                auto cstr = to!(String)(c);
+				item2.setText(c, "item ["~istr~" "~jstr~"-"~cstr~"]");
+			}
+			for (int k=0; k<itemCount; k++) {
+                auto kstr = to!(String)(k);
+				TreeItem item3 = new TreeItem(item2, SWT.NONE);
+				item3.setText("item ["~istr~" "~jstr~" "~kstr~"]");
+				for (int c=1; c<columnCount; c++) {
+                    auto cstr = to!(String)(c);
+					item3.setText(c, "item ["~istr~" "~jstr~" "~kstr~"-"~cstr~"]");
+				}
+			}
+		}
+	}
+
+	/*
+	 * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly.
+	 * Therefore, it is critical for performance that these methods be
+	 * as efficient as possible.
+	 */
+	tree.addListener(SWT.EraseItem, new class Listener {
+		public void handleEvent(Event event) {
+			event.detail &= ~SWT.HOT;
+			if ((event.detail & SWT.SELECTED) != 0) {
+				GC gc = event.gc;
+				Rectangle area = tree.getClientArea();
+				/*
+				 * If you wish to paint the selection beyond the end of
+				 * last column, you must change the clipping region.
+				 */
+				int columnCount = tree.getColumnCount();
+				if (event.index == columnCount - 1 || columnCount == 0) {
+					int width = area.x + area.width - event.x;
+					if (width > 0) {
+						Region region = new Region();
+						gc.getClipping(region);
+						region.add(event.x, event.y, width, event.height); 
+						gc.setClipping(region);
+						region.dispose();
+					}
+				}
+				gc.setAdvanced(true);
+				if (gc.getAdvanced()) gc.setAlpha(127);								
+				Rectangle rect = event.getBounds();
+				Color foreground = gc.getForeground();
+				Color background = gc.getBackground();
+				gc.setForeground(display.getSystemColor(SWT.COLOR_RED));
+				gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+				gc.fillGradientRectangle(0, rect.y, 500, rect.height, false);
+				// restore colors for subsequent drawing
+				gc.setForeground(foreground);
+				gc.setBackground(background);
+				event.detail &= ~SWT.SELECTED;					
+			}						
+		}
+	});		
+	for (int i=0; i<columnCount; i++) {
+		tree.getColumn(i).pack();
+	}	
+	tree.setSelection(tree.getItem(0));
+	shell.setSize(500, 200);
+	shell.open();
+	while (!shell.isDisposed()) {
+		if (!display.readAndDispatch()) display.sleep();
+	}
+	display.dispose();	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet235.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet235;
+/* 
+ * example snippet: detect a system settings change
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+import java.lang.all;
+
+void main(String [] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setText("The SWT.Settings Event");
+    shell.setLayout(new GridLayout());
+    Label label = new Label(shell, SWT.WRAP);
+    label.setLayoutData(new GridData(SWT.FILL, DWT.CENTER, true, false));
+    label.setText("Change a system setting and the table below will be updated.");
+    final Table table = new Table(shell, SWT.BORDER);
+    table.setLayoutData(new GridData(SWT.FILL, DWT.FILL, true, true));
+    TableColumn column = new TableColumn(table, SWT.NONE);
+    column = new TableColumn(table, SWT.NONE);
+    column.setWidth(150);
+    column = new TableColumn(table, SWT.NONE);
+    for (int i = 0; i < colorIds.length; i++) {
+        TableItem item = new TableItem(table, SWT.NONE);
+        Color color = display.getSystemColor(colorIds[i]);
+        item.setText(0, colorNames[i]);
+        item.setBackground(1, color);
+        item.setText(2, color.toString());
+    }
+    TableColumn[] columns = table.getColumns();
+    columns[0].pack();
+    columns[2].pack();
+    display.addListener(SWT.Settings, dgListener((Event event){
+        for (int i = 0; i < colorIds.length; i++) {
+            Color color = display.getSystemColor(colorIds[i]);
+            TableItem item = table.getItem(i);
+            item.setBackground(1, color);
+        }
+        TableColumn[] columns = table.getColumns();
+        columns[0].pack();
+        columns[2].pack();
+    }));
+
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
+static int[] colorIds = 
+    [ 
+    SWT.COLOR_INFO_BACKGROUND, 
+    SWT.COLOR_INFO_FOREGROUND, 
+    SWT.COLOR_LIST_BACKGROUND,
+    SWT.COLOR_LIST_FOREGROUND,
+    SWT.COLOR_LIST_SELECTION,
+    SWT.COLOR_LIST_SELECTION_TEXT,
+    SWT.COLOR_TITLE_BACKGROUND,
+    SWT.COLOR_TITLE_BACKGROUND_GRADIENT,
+    SWT.COLOR_TITLE_FOREGROUND,
+    SWT.COLOR_TITLE_INACTIVE_BACKGROUND,
+    SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT,
+    SWT.COLOR_TITLE_INACTIVE_FOREGROUND,
+    SWT.COLOR_WIDGET_BACKGROUND,
+    SWT.COLOR_WIDGET_BORDER,
+    SWT.COLOR_WIDGET_DARK_SHADOW,
+    SWT.COLOR_WIDGET_FOREGROUND,
+    SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW,
+    SWT.COLOR_WIDGET_LIGHT_SHADOW,
+    SWT.COLOR_WIDGET_NORMAL_SHADOW,
+    ];
+static String [] colorNames = 
+    [
+    "SWT.COLOR_INFO_BACKGROUND",
+    "SWT.COLOR_INFO_FOREGROUND", 
+    "SWT.COLOR_LIST_BACKGROUND",
+    "SWT.COLOR_LIST_FOREGROUND",
+    "SWT.COLOR_LIST_SELECTION",
+    "SWT.COLOR_LIST_SELECTION_TEXT",
+    "SWT.COLOR_TITLE_BACKGROUND",
+    "SWT.COLOR_TITLE_BACKGROUND_GRADIENT",
+    "SWT.COLOR_TITLE_FOREGROUND",
+    "SWT.COLOR_TITLE_INACTIVE_BACKGROUND",
+    "SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT",
+    "SWT.COLOR_TITLE_INACTIVE_FOREGROUND",
+    "SWT.COLOR_WIDGET_BACKGROUND",
+    "SWT.COLOR_WIDGET_BORDER",
+    "SWT.COLOR_WIDGET_DARK_SHADOW",
+    "SWT.COLOR_WIDGET_FOREGROUND",
+    "SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW",
+    "SWT.COLOR_WIDGET_LIGHT_SHADOW",
+    "SWT.COLOR_WIDGET_NORMAL_SHADOW",
+    ];
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet237.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet237;
+/*
+ * Composite Snippet: inherit a background color or image
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.2
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import java.lang.all;
+
+void main(String[] args){
+    Snippet237.main(args);
+}
+public class Snippet237 {
+
+    public static void main(String[] args) {
+        Display display = new Display();
+        Shell shell = new Shell(display);
+        shell.setText("Composite.setBackgroundMode()");
+        shell.setLayout(new RowLayout(SWT.VERTICAL));
+
+        Color color = display.getSystemColor(SWT.COLOR_CYAN);
+
+        Group group = new Group(shell, SWT.NONE);
+        group.setText("SWT.INHERIT_NONE");
+        group.setBackground(color);
+        group.setBackgroundMode(SWT.INHERIT_NONE);
+        createChildren(group);
+
+        group = new Group(shell, SWT.NONE);
+        group.setBackground(color);
+        group.setText("SWT.INHERIT_DEFAULT");
+        group.setBackgroundMode(SWT.INHERIT_DEFAULT);
+        createChildren(group);
+
+        group = new Group(shell, SWT.NONE);
+        group.setBackground(color);
+        group.setText("SWT.INHERIT_FORCE");
+        group.setBackgroundMode(SWT.INHERIT_FORCE);
+        createChildren(group);
+
+        shell.pack();
+        shell.open();
+        while(!shell.isDisposed()) {
+            if(!display.readAndDispatch()) display.sleep();
+        }
+        display.dispose();
+    }
+    static void createChildren(Composite parent) {
+        parent.setLayout(new RowLayout());
+        List list = new List(parent, SWT.BORDER | DWT.MULTI);
+        list.add("List item 1");
+        list.add("List item 2");
+        Label label = new Label(parent, SWT.NONE);
+        label.setText("Label");
+        Button button = new Button(parent, SWT.RADIO);
+        button.setText("Radio Button");
+        button = new Button(parent, SWT.CHECK);
+        button.setText("Check box Button");
+        button = new Button(parent, SWT.PUSH);
+        button.setText("Push Button");
+        Text text = new Text(parent, SWT.BORDER);
+        text.setText("Text");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet24.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet24;
+
+/*
+ * example snippet: detect CR in a text or combo control (default selection)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.layout.RowLayout;
+
+import java.lang.all;
+import tango.io.Stdout;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout (new RowLayout ());
+    Combo combo = new Combo (shell, SWT.NONE);
+    combo.setItems (["A-1", "B-1", "C-1"]);
+    Text text = new Text (shell, SWT.SINGLE | DWT.BORDER);
+    text.setText ("some text");
+    combo.addListener (SWT.DefaultSelection, new class() Listener{
+        public void handleEvent (Event e) {
+            Stdout(e.widget.toString() ~ " - Default Selection\n");
+        }
+    });
+    text.addListener (SWT.DefaultSelection, new class() Listener{
+        public void handleEvent (Event e) {
+            Stdout(e.widget.toString() ~ " - Default Selection\n");
+        }
+    });
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet242.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet242;
+
+/*
+ * Cursor snippet: Hide the Cursor over a control.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+void main(String [] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setBounds(10, 10, 200, 200);
+    Canvas canvas = new Canvas(shell, SWT.BORDER);
+    canvas.setBounds(10,50,150,100);
+    canvas.addPaintListener(new class() PaintListener{
+        public void paintControl(PaintEvent e) {
+            e.gc.drawString("hide Cursor here", 10, 10);
+        }
+    });
+
+    // create a cursor with a transparent image
+    Color white = display.getSystemColor (SWT.COLOR_WHITE);
+    Color black = display.getSystemColor (SWT.COLOR_BLACK);
+    PaletteData palette = new PaletteData ([white.getRGB(), black.getRGB()]);
+    ImageData sourceData = new ImageData (16, 16, 1, palette);
+    sourceData.transparentPixel = 0;
+    Cursor cursor = new Cursor(display, sourceData, 0, 0);
+
+    shell.open();
+    canvas.setCursor(cursor);
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    cursor.dispose();
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     yidabu at gmail dot com  ( D China http://www.d-programming-language-china.org/ )
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet244;
+/*
+ * StyledText snippet: Draw a box around text.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+
+import java.lang.all;
+version(JIVE){
+    import jive.stacktrace;
+}
+
+void main() {
+    static String SEARCH_STRING = "box";
+    Display display = new Display();
+    Color RED = display.getSystemColor(SWT.COLOR_RED);
+    Shell shell = new Shell(display);
+    shell.setBounds(10,10,250,250);
+    StyledText text = new StyledText(shell, SWT.NONE);
+    text.setBounds(10,10,200,200);
+
+    void onPaint(Event event) {
+        String contents = text.getText();
+        int stringWidth = event.gc.stringExtent(SEARCH_STRING).x;
+        int lineHeight = text.getLineHeight();
+        event.gc.setForeground(RED);
+        int index = contents.indexOf(SEARCH_STRING);
+        while (index != -1) {
+            Point topLeft = text.getLocationAtOffset(index);
+            event.gc.drawRectangle(topLeft.x - 1, topLeft.y, stringWidth + 1, lineHeight - 1);
+            index = contents.indexOf(SEARCH_STRING, index + 1);
+        }
+    }
+
+    text.addListener(SWT.Paint, dgListener(&onPaint));
+
+    text.setText("This demonstrates drawing a box\naround every occurrence of the word\nbox in the StyledText");
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet245.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Bill Baxter <wbaxter> at gmail com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet245;
+
+/* 
+ * Canvas snippet: paint a circle in a canvas
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.PaintEvent;
+
+void main() 
+{
+	final Display display = new Display();
+	final Shell shell = new Shell(display);
+	shell.addPaintListener(new class(shell) PaintListener {
+        Shell shell;
+        this(Shell s) { this.shell = s; }
+        public void paintControl(PaintEvent event) {
+            Rectangle rect = shell.getClientArea();
+            event.gc.drawOval(0, 0, rect.width - 1, rect.height - 1);
+        }
+    });
+	shell.setBounds(10, 10, 200, 200);
+	shell.open ();
+	while (!shell.isDisposed()) {
+		if (!display.readAndDispatch()) display.sleep();
+	}
+	display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet247.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet247;
+
+/*
+ * Control example snippet: allow a multi-line text to process the default button
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.layout.RowLayout;
+
+import java.lang.all;
+
+import tango.io.Stdout;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout(new RowLayout());
+    Text text = new Text(shell, SWT.MULTI | DWT.BORDER);
+    String modifier = SWT.MOD1 == DWT.CTRL ? "Ctrl" : "Command";
+    text.setText("Hit " ~ modifier ~ "+Return\nto see\nthe default button\nrun");
+    text.addTraverseListener(new class() TraverseListener{
+        public void keyTraversed(TraverseEvent e) {
+          switch (e.detail) {
+          case SWT.TRAVERSE_RETURN:
+              if ((e.stateMask & SWT.MOD1) != 0) e.doit = true;
+          default:
+          }
+        }
+    });
+    Button button = new Button (shell, SWT.PUSH);
+    button.pack();
+    button.setText("OK");
+    button.addSelectionListener(new class() SelectionAdapter{
+        public void widgetSelected(SelectionEvent e) {
+            Stdout("OK selected\n");
+            Stdout.flush();
+        }
+    });
+    shell.setDefaultButton(button);
+    shell.pack ();
+    shell.open();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet25;
+ 
+/*
+ * Control example snippet: print key state, code and character
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+
+import tango.io.Stdout;
+import tango.text.convert.Format;
+
+static char[] stateMask (int stateMask) {
+	char[] string = "";
+	if ((stateMask & SWT.CTRL) != 0) string ~= " CTRL";
+	if ((stateMask & SWT.ALT) != 0) string ~= " ALT";
+	if ((stateMask & SWT.SHIFT) != 0) string ~= " SHIFT";
+	if ((stateMask & SWT.COMMAND) != 0) string ~= " COMMAND";
+	return string;
+}
+
+static char[] character (char character) {
+	switch (character) {
+    case 0: 		return "'\\0'";
+    case SWT.BS:	return "'\\b'";
+    case SWT.CR:	return "'\\r'";
+    case SWT.DEL:	return "DEL";
+    case SWT.ESC:	return "ESC";
+    case SWT.LF:	return "'\\n'";
+    case SWT.TAB:	return "'\\t'";
+    default:
+        return "'" ~ character ~"'";
+	}
+}
+
+static char[] keyCode (int keyCode) {
+	switch (keyCode) {
+		
+		/* Keyboard and Mouse Masks */
+    case SWT.ALT: 		return "ALT";
+    case SWT.SHIFT: 	return "SHIFT";
+    case SWT.CONTROL:	return "CONTROL";
+    case SWT.COMMAND:	return "COMMAND";
+			
+		/* Non-Numeric Keypad Keys */
+    case SWT.ARROW_UP:		return "ARROW_UP";
+    case SWT.ARROW_DOWN:	return "ARROW_DOWN";
+    case SWT.ARROW_LEFT:	return "ARROW_LEFT";
+    case SWT.ARROW_RIGHT:	return "ARROW_RIGHT";
+    case SWT.PAGE_UP:		return "PAGE_UP";
+    case SWT.PAGE_DOWN:		return "PAGE_DOWN";
+    case SWT.HOME:			return "HOME";
+    case SWT.END:			return "END";
+    case SWT.INSERT:		return "INSERT";
+
+		/* Virtual and Ascii Keys */
+    case SWT.BS:	return "BS";
+    case SWT.CR:	return "CR";		
+    case SWT.DEL:	return "DEL";
+    case SWT.ESC:	return "ESC";
+    case SWT.LF:	return "LF";
+    case SWT.TAB:	return "TAB";
+	
+		/* Functions Keys */
+    case SWT.F1:	return "F1";
+    case SWT.F2:	return "F2";
+    case SWT.F3:	return "F3";
+    case SWT.F4:	return "F4";
+    case SWT.F5:	return "F5";
+    case SWT.F6:	return "F6";
+    case SWT.F7:	return "F7";
+    case SWT.F8:	return "F8";
+    case SWT.F9:	return "F9";
+    case SWT.F10:	return "F10";
+    case SWT.F11:	return "F11";
+    case SWT.F12:	return "F12";
+    case SWT.F13:	return "F13";
+    case SWT.F14:	return "F14";
+    case SWT.F15:	return "F15";
+		
+		/* Numeric Keypad Keys */
+    case SWT.KEYPAD_ADD:		return "KEYPAD_ADD";
+    case SWT.KEYPAD_SUBTRACT:	return "KEYPAD_SUBTRACT";
+    case SWT.KEYPAD_MULTIPLY:	return "KEYPAD_MULTIPLY";
+    case SWT.KEYPAD_DIVIDE:		return "KEYPAD_DIVIDE";
+    case SWT.KEYPAD_DECIMAL:	return "KEYPAD_DECIMAL";
+    case SWT.KEYPAD_CR:			return "KEYPAD_CR";
+    case SWT.KEYPAD_0:			return "KEYPAD_0";
+    case SWT.KEYPAD_1:			return "KEYPAD_1";
+    case SWT.KEYPAD_2:			return "KEYPAD_2";
+    case SWT.KEYPAD_3:			return "KEYPAD_3";
+    case SWT.KEYPAD_4:			return "KEYPAD_4";
+    case SWT.KEYPAD_5:			return "KEYPAD_5";
+    case SWT.KEYPAD_6:			return "KEYPAD_6";
+    case SWT.KEYPAD_7:			return "KEYPAD_7";
+    case SWT.KEYPAD_8:			return "KEYPAD_8";
+    case SWT.KEYPAD_9:			return "KEYPAD_9";
+    case SWT.KEYPAD_EQUAL:		return "KEYPAD_EQUAL";
+
+		/* Other keys */
+    case SWT.CAPS_LOCK:		return "CAPS_LOCK";
+    case SWT.NUM_LOCK:		return "NUM_LOCK";
+    case SWT.SCROLL_LOCK:	return "SCROLL_LOCK";
+    case SWT.PAUSE:			return "PAUSE";
+    case SWT.BREAK:			return "BREAK";
+    case SWT.PRINT_SCREEN:	return "PRINT_SCREEN";
+    case SWT.HELP:			return "HELP";
+
+    default:
+        return character (cast(char) keyCode);
+	}
+
+}
+
+void main () {
+	Display display = new Display ();
+	Shell shell = new Shell (display);
+	Listener listener = new class Listener {
+		public void handleEvent (Event e) {
+			char[] string = e.type == SWT.KeyDown ? "DOWN:" : "UP  :";
+			string ~= Format("stateMask=0x{:x}{},", e.stateMask, stateMask (e.stateMask));
+			string ~= Format(" keyCode=0x{:x} {},", e.keyCode, keyCode (e.keyCode));
+			string ~= Format(" character=0x{:x} {}", e.character, character (e.character));
+			Stdout.formatln (string);
+		}
+	};
+	shell.addListener (SWT.KeyDown, listener);
+	shell.addListener (SWT.KeyUp, listener);
+	shell.setSize (200, 200);
+	shell.open ();
+	while (!shell.isDisposed ()) {
+		if (!display.readAndDispatch ()) display.sleep ();
+	}
+	display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet250.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet250;
+
+/*
+ * DateTime example snippet: create a DateTime calendar and a DateTime time.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.DateTime;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+import tango.io.Stdout;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout (new RowLayout ());
+
+    DateTime calendar = new DateTime (shell, SWT.CALENDAR);
+    calendar.addSelectionListener (new class() SelectionAdapter{
+        void widgetSelected (SelectionEvent e) {
+            Stdout("calendar date changed\n");
+            Stdout.flush();
+        }
+    });
+
+    DateTime time = new DateTime (shell, SWT.TIME);
+    time.addSelectionListener (new class() SelectionAdapter{
+        void widgetSelected (SelectionEvent e) {
+            Stdout("time changed\n");
+            Stdout.flush();
+        }
+    });
+
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet251.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet251;
+
+/*
+ * DateTime example snippet: create a DateTime calendar, date, and time in a dialog.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.DateTime;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+import tango.io.Stdout;
+
+void main (String [] args) {
+    /* These cannot be local in the
+     * listener, hence we put it here and not at the
+     * constructor. (THD)
+     * (dmd.1.028)
+     */
+    DateTime calendar, date, time;
+    Shell dialog;
+
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout(new FillLayout());
+
+    Button open = new Button (shell, SWT.PUSH);
+    open.setText ("Open Dialog");
+    open.addSelectionListener (new class() SelectionAdapter{
+        public void widgetSelected (SelectionEvent e) {
+            dialog = new Shell (shell, SWT.DIALOG_TRIM);
+            dialog.setLayout (new GridLayout (3, false));
+
+            calendar = new DateTime (dialog, SWT.CALENDAR | DWT.BORDER);
+            date = new DateTime (dialog, SWT.DATE | DWT.SHORT);
+            time = new DateTime (dialog, SWT.TIME | DWT.SHORT);
+
+            new Label (dialog, SWT.NONE);
+            new Label (dialog, SWT.NONE);
+            Button ok = new Button (dialog, SWT.PUSH);
+            ok.setText ("OK");
+            ok.setLayoutData(new GridData (SWT.FILL, DWT.CENTER, false, false));
+            ok.addSelectionListener (new class() SelectionAdapter{
+                void widgetSelected (SelectionEvent e) {
+                    Stdout.formatln("Calendar date selected (MM/DD/YYYY) = {:d02}/{:d02}/{:d04}",
+                                    (calendar.getMonth () + 1),calendar.getDay (),calendar.getYear ());
+                    Stdout.formatln("Date selected (MM/YYYY)= {:d02}/{:d04}",
+                                    (date.getMonth () + 1), date.getYear ());
+                    Stdout.formatln("Time selected (HH:MM) = {:d02}:{:d02}",
+                                    time.getHours(), time.getMinutes());
+                    Stdout.flush();
+                    dialog.close ();
+                }
+            });
+            dialog.setDefaultButton (ok);
+            dialog.pack ();
+            dialog.open ();
+        }
+    });
+    shell.pack ();
+    shell.open ();
+
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet258.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ * Port to the D programming language:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet258;
+
+/*
+ * Create a search text control
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.3
+ */
+import org.eclipse.swt.SWT;
+import java.io.ByteArrayInputStream;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+import tango.io.Stdout;
+
+void main() {
+    auto display = new Display();
+    auto shell = new Shell(display);
+    shell.setLayout(new GridLayout(2, false));
+
+    auto text = new Text(shell, SWT.SEARCH | DWT.CANCEL);
+    Image image = null;
+    if ((text.getStyle() & SWT.CANCEL) == 0) {
+        image = new Image (display, new ImageData(new ByteArrayInputStream( cast(byte[]) import("links_obj.gif" ))));
+        auto toolBar = new ToolBar (shell, SWT.FLAT);
+        auto item = new ToolItem (toolBar, SWT.PUSH);
+        item.setImage (image);
+        item.addSelectionListener(new class SelectionAdapter {
+            public void widgetSelected(SelectionEvent e) {
+                text.setText("");
+                Stdout("Search cancelled").newline;
+            }
+        });
+    }
+    text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    text.setText("Search text");
+    text.addSelectionListener(new class SelectionAdapter {
+        public void widgetDefaultSelected(SelectionEvent e) {
+            if (e.detail == SWT.CANCEL) {
+                Stdout("Search cancelled").newline;
+            } else {
+                Stdout("Searching for: ")(text.getText())("...").newline;
+            }
+        }
+    });
+
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    if (image !is null) image.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet26.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet26;
+
+/*
+ * Combo example snippet: create a combo box (non-editable)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Combo;
+
+char[][] content = ["A", "B", "C"];
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    auto combo = new Combo (shell, SWT.READ_ONLY);
+    combo.setItems (content);
+    combo.setSize (200, 200);
+
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet268;
+  
+/*
+ * UI Automation (for testing tools) snippet: post mouse wheel events to a styled text
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ * 
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+
+import tango.io.Stdout;
+import tango.util.Convert;
+import tango.core.Thread;
+
+void main(String[] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    StyledText styledText = new StyledText(shell, SWT.V_SCROLL);
+    String multiLineString = "";
+    for (int i = 0; i < 200; i++) {
+        multiLineString ~= "This is line number " ~ to!(String)(i) ~
+            " in the multi-line string.\n";
+    }
+    styledText.setText(multiLineString);
+    shell.setSize(styledText.computeSize(SWT.DEFAULT, 400));
+    shell.open();
+    styledText.addListener(SWT.MouseWheel, dgListener( (Event e){
+        Stdout.formatln("Mouse Wheel event \n"); //" + e);
+        Stdout.flush();
+    }));
+    final Point pt = display.map(shell, null, 50, 50);
+    Thread thread = new Thread({
+        Event event;
+        for (int i = 0; i < 50; i++) {
+            event = new Event();
+            event.type = SWT.MouseWheel;
+            event.detail = SWT.SCROLL_LINE;
+            event.x = pt.x;
+            event.y = pt.y;
+            event.count = -2;
+            display.post(event);
+            try {
+                Thread.sleep(400/1000);
+            } catch (InterruptedException e) {}
+        }
+        Stdout("Thread done\n").flush(); 
+    });
+  
+    thread.start();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet269.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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.html37
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet269;
+
+/*
+ * Combo example snippet: set the caret position within a Combo's text
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+
+import java.lang.all;
+
+void main(String[] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout (new FillLayout ());
+    Combo combo = new Combo (shell, SWT.NONE);
+    combo.add ("item");
+    combo.select (0);
+    shell.pack ();
+    shell.open ();
+    int stringLength = combo.getText().length;
+    combo.setSelection (new Point (stringLength, stringLength));
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet275.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 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
+ * D Port:
+ *     Bill Baxter <wbaxter> at gmail com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet275;
+
+/*
+ * Canvas snippet: update a portion of a Canvas frequently
+ * 
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Canvas;
+
+import java.lang.all;
+
+import tango.util.Convert;
+
+static String value;
+public static void main () {
+	final int INTERVAL = 888;
+	final Display display = new Display ();
+	final Image image = new Image (display, 750, 750);
+	GC gc = new GC (image);
+	gc.setBackground (display.getSystemColor (SWT.COLOR_RED));
+	gc.fillRectangle (image.getBounds ());
+	gc.dispose ();
+
+	Shell shell = new Shell (display);
+	shell.setBounds (10, 10, 790, 790);
+	final Canvas canvas = new Canvas (shell, SWT.NONE);
+	canvas.setBounds (10, 10, 750, 750);
+
+    void onPaint (Event event) {
+        value = to!(char[])(System.currentTimeMillis ());
+        event.gc.drawImage (image, 0, 0);
+        event.gc.drawString (value, 10, 10, true);
+    }
+	canvas.addListener (SWT.Paint, dgListener(&onPaint));
+
+	display.timerExec (INTERVAL, new class Runnable {
+        void run () {
+			if (canvas.isDisposed ()) return;
+			// canvas.redraw (); // <-- bad, damages more than is needed
+			GC gc = new GC (canvas);
+			Point extent = gc.stringExtent (value ~ '0');
+			gc.dispose ();
+			canvas.redraw (10, 10, extent.x, extent.y, false);
+			display.timerExec (INTERVAL, this);
+		}
+	});
+	shell.open ();
+	while (!shell.isDisposed ()){
+		if (!display.readAndDispatch ()) display.sleep ();
+	}
+	image.dispose ();
+	display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet276.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet276;
+
+/*
+ * Display snippet: map from control-relative to display-relative coordinates
+ * 
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+import tango.io.Stdout;
+
+void main (String[] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setBounds (200, 200, 400, 400);
+    Label label = new Label (shell, SWT.NONE);
+    label.setText ("click in shell to print display-relative coordinate");
+    Listener listener = dgListener( (Event event) {
+        Point point = new Point (event.x, event.y);
+        Stdout(display.map (cast(Control)event.widget, null, point)).newline().flush();
+    });
+    shell.addListener (SWT.MouseDown, listener);
+    label.addListener (SWT.MouseDown, listener);
+    label.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()){
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet282.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippets282;
+
+/*
+ * Copy/paste image to/from clipboard.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.ImageTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.GridData;
+
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+public static void main(String[] args) {
+    Display display = new Display();
+    Clipboard clipboard = new Clipboard(display);
+    Shell shell = new Shell(display, SWT.SHELL_TRIM);
+    shell.setLayout(new GridLayout());
+    shell.setText("Clipboard ImageTransfer");
+
+    Button imageButton = new Button(shell, SWT.NONE );
+    GridData gd = new GridData(SWT.FILL, DWT.FILL, true, true);
+    gd.minimumHeight = 400;
+    gd.minimumWidth = 600;
+    imageButton.setLayoutData(gd);
+
+    Composite buttons = new Composite(shell, SWT.NONE);
+    buttons.setLayout(new GridLayout(4, true));
+    Button button = new Button(buttons, SWT.PUSH);
+    button.setText("Open");
+    button.addListener(SWT.Selection, new class() Listener {
+            public void handleEvent(Event event) {
+            FileDialog dialog = new FileDialog (shell, SWT.OPEN);
+            dialog.setText("Open an image file or cancel");
+            String string = dialog.open ();
+            if (string !is null) {
+            Image image = imageButton.getImage();
+            if (image !is null) image.dispose();
+            image = new Image(display, string);
+            imageButton.setImage(image);
+            }
+            }
+            });
+
+    button = new Button(buttons, SWT.PUSH);
+    button.setText("Copy");
+    button.addListener(SWT.Selection, new class() Listener {
+            public void handleEvent(Event event) {
+            Image image = imageButton.getImage();
+            if (image !is null) {
+            ImageTransfer transfer = ImageTransfer.getInstance();
+
+            Transfer[] xfer = [ transfer ];
+            Object[] td = [ image.getImageData ];
+
+            clipboard.setContents(td,xfer);
+            }
+            }
+            });
+    button = new Button(buttons, SWT.PUSH);
+    button.setText("Paste");
+    button.addListener(SWT.Selection, new class() Listener {
+            public void handleEvent(Event event) {
+            ImageTransfer transfer = ImageTransfer.getInstance();
+            ImageData imageData = cast(ImageData)clipboard.getContents(transfer);
+            if (imageData !is null) {
+            imageButton.setText("");
+            Image image = imageButton.getImage();
+            if (image !is null) image.dispose();
+            image = new Image(display, imageData);
+            imageButton.setImage(image);
+            } else {
+            imageButton.setText("No image");
+            }
+            }
+            });
+
+    button = new Button(buttons, SWT.PUSH);
+    button.setText("Clear");
+    button.addListener(SWT.Selection, new class() Listener {
+            public void handleEvent(Event event) {
+            imageButton.setText("");
+            Image image = imageButton.getImage();
+            if (image !is null) image.dispose();
+            imageButton.setImage(null);
+            }
+            });
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet286.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet286;
+
+/*
+ * use a menu item's armListener to update a status line.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ArmEvent;
+import org.eclipse.swt.events.ArmListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+import tango.util.Convert;
+
+
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+		
+    Canvas blankCanvas = new Canvas(shell, SWT.BORDER);
+    blankCanvas.setLayoutData(new GridData(200, 200));
+    Label statusLine = new Label(shell, SWT.NONE);
+    statusLine.setLayoutData(new GridData(SWT.FILL, DWT.CENTER, true, false));
+
+    Menu bar = new Menu (shell, SWT.BAR);
+    shell.setMenuBar (bar);
+		
+    MenuItem menuItem = new MenuItem (bar, SWT.CASCADE);
+    menuItem.setText ("Test");
+    Menu menu = new Menu(bar);
+    menuItem.setMenu (menu);
+		
+    for (int i = 0; i < 5; i++) {
+        MenuItem item = new MenuItem (menu, SWT.PUSH);
+        item.setText ("Item " ~ to!(char[])(i));
+        item.addArmListener(new class ArmListener {
+            public void widgetArmed(ArmEvent e) {
+                statusLine.setText((cast(MenuItem)e.getSource()).getText());
+            }
+        });
+    }
+		
+    shell.pack();
+    shell.open();
+		
+    while(!shell.isDisposed()) {
+        if(!display.readAndDispatch()) display.sleep();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet288;
+
+/*
+ * Create a ToolBar containing animated GIFs
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.DWTException;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.FileDialog;
+
+import tango.io.FilePath;
+import tango.io.FileConst;
+import tango.core.Thread;
+import tango.io.Stdout;
+import tango.util.Convert;
+import tango.core.Exception;
+
+static Display display;
+static Shell shell;
+static GC shellGC;
+static Color shellBackground;
+static ImageLoader[] loader;
+static ImageData[][] imageDataArray;
+static Thread[] animateThread;
+static Image[][] image;
+private static ToolItem[] item;
+static final bool useGIFBackground = false;
+
+void main () {
+    display = new Display();
+    Shell shell = new Shell (display);
+    shellBackground = shell.getBackground();
+    FileDialog dialog = new FileDialog(shell, SWT.OPEN | DWT.MULTI);
+    dialog.setText("Select Multiple Animated GIFs");
+    dialog.setFilterExtensions(["*.gif"]);
+    char[] filename = dialog.open();
+    char[][] filenames = dialog.getFileNames();
+    int numToolBarItems = filenames.length;
+    if (numToolBarItems > 0) {
+        try {
+            loadAllImages((new FilePath(filename)).parent, filenames);
+        } catch (DWTException e) {
+            Stdout.print("There was an error loading an image.").newline;
+            e.printStackTrace();
+        }
+        ToolBar toolBar = new ToolBar (shell, SWT.FLAT | DWT.BORDER | DWT.WRAP);
+        item = new ToolItem[numToolBarItems];
+        for (int i = 0; i < numToolBarItems; i++) {
+            item[i] = new ToolItem (toolBar, SWT.PUSH);
+            item[i].setImage(image[i][0]);
+        }
+        toolBar.pack ();
+        shell.open ();
+			
+        startAnimationThreads();
+			
+        while (!shell.isDisposed()) {
+            if (!display.readAndDispatch ()) display.sleep ();
+        }
+			
+        for (int i = 0; i < numToolBarItems; i++) {
+            for (int j = 0; j < image[i].length; j++) {
+                image[i][j].dispose();
+            }
+        }
+        display.dispose ();
+    }
+    thread_joinAll();
+}
+
+private static void loadAllImages(char[] directory, char[][] filenames) {
+    int numItems = filenames.length;
+    loader.length = numItems;
+    imageDataArray.length = numItems;
+    image.length = numItems;
+    for (int i = 0; i < numItems; i++) {
+        loader[i] = new ImageLoader();
+        int fullWidth = loader[i].logicalScreenWidth;
+        int fullHeight = loader[i].logicalScreenHeight;
+        imageDataArray[i] = loader[i].load(directory ~ FileConst.PathSeparatorChar ~ filenames[i]);
+        int numFramesOfAnimation = imageDataArray[i].length;
+        image[i] = new Image[numFramesOfAnimation];
+        for (int j = 0; j < numFramesOfAnimation; j++) {
+            if (j == 0) {
+                //for the first frame of animation, just draw the first frame
+                image[i][j] = new Image(display, imageDataArray[i][j]);
+                fullWidth = imageDataArray[i][j].width;
+                fullHeight = imageDataArray[i][j].height;
+            }
+            else {
+                //after the first frame of animation, draw the background or previous frame first, then the new image data 
+                image[i][j] = new Image(display, fullWidth, fullHeight);
+                GC gc = new GC(image[i][j]);
+                gc.setBackground(shellBackground);
+                gc.fillRectangle(0, 0, fullWidth, fullHeight);
+                ImageData imageData = imageDataArray[i][j];
+                switch (imageData.disposalMethod) {
+                case SWT.DM_FILL_BACKGROUND:
+                    /* Fill with the background color before drawing. */
+                    Color bgColor = null;
+                    if (useGIFBackground && loader[i].backgroundPixel != -1) {
+                        bgColor = new Color(display, imageData.palette.getRGB(loader[i].backgroundPixel));
+                    }
+                    gc.setBackground(bgColor !is null ? bgColor : shellBackground);
+                    gc.fillRectangle(imageData.x, imageData.y, imageData.width, imageData.height);
+                    if (bgColor !is null) bgColor.dispose();
+                    break;
+                default:
+                    /* Restore the previous image before drawing. */
+                    gc.drawImage(
+                        image[i][j-1],
+                        0,
+                        0,
+                        fullWidth,
+                        fullHeight,
+                        0,
+                        0,
+                        fullWidth,
+                        fullHeight);
+                    break;
+                }
+                Image newFrame = new Image(display, imageData);
+                gc.drawImage(newFrame,
+                             0,
+                             0,
+                             imageData.width,
+                             imageData.height,
+                             imageData.x,
+                             imageData.y,
+                             imageData.width,
+                             imageData.height);
+                newFrame.dispose();
+                gc.dispose();
+            }
+        }
+    }
+}
+
+private static void startAnimationThreads() {
+    animateThread = new Thread[image.length];
+    for (int ii = 0; ii < image.length; ii++) {
+        animateThread[ii] = new class(ii) Thread {
+            int imageDataIndex = 0;
+            int id = 0;
+            this(int _id) { 
+                id = _id;
+                name = "Animation "~to!(char[])(ii);
+                isDaemon = true;
+                super(&run);
+            }
+            void run() {
+                try {
+                    int repeatCount = loader[id].repeatCount;
+                    while (loader[id].repeatCount == 0 || repeatCount > 0) {
+                        imageDataIndex = (imageDataIndex + 1) % imageDataArray[id].length;
+                        if (!display.isDisposed()) {
+                            display.asyncExec(new class Runnable {
+									public void run() {
+										if (!item[id].isDisposed())
+											item[id].setImage(image[id][imageDataIndex]);
+									}
+								});
+                        }
+							
+                        /* Sleep for the specified delay time (adding commonly-used slow-down fudge factors). */
+                        try {
+                            int ms = imageDataArray[id][imageDataIndex].delayTime * 10;
+                            if (ms < 20) ms += 30;
+                            if (ms < 30) ms += 10;
+                            Thread.sleep(0.001*ms);
+                        } catch (ThreadException e) {
+                        }
+
+                        /* If we have just drawn the last image, decrement the repeat count and start again. */
+                        if (imageDataIndex == imageDataArray[id].length - 1) repeatCount--;
+                    }
+                } catch (DWTException ex) {
+                    Stdout.print("There was an error animating the GIF").newline;
+                    ex.printStackTrace();
+                }
+            }
+        };
+        animateThread[ii].start();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet289.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet289;
+
+/*
+ * Combo example snippet: add an item to a combo box
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import java.lang.all;
+
+void main(String[] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    Combo combo = new Combo(shell, SWT.NONE);
+    combo.setItems(["1111", "2222", "3333", "4444"]);
+    combo.setText(combo.getItem(0));
+    combo.addVerifyListener(new class() VerifyListener{
+        public void verifyText(VerifyEvent e) {
+            String newText = e.text;
+            try {
+                Integer.parseInt(newText);
+            } catch (NumberFormatException ex) {
+                e.doit = false;
+            }
+        }
+    });
+    combo.addTraverseListener(new class() TraverseListener {
+        public void keyTraversed(TraverseEvent e) {
+            if (e.detail == SWT.TRAVERSE_RETURN) {
+                e.doit = false;
+                e.detail = SWT.TRAVERSE_NONE;
+                String newText = combo.getText();
+                try {
+                    Integer.parseInt(newText);
+                    combo.add(newText);
+                    combo.setSelection(new Point(0, newText.length));
+                } catch (NumberFormatException ex) {
+                }
+            }
+        }
+    });
+
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet29.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet29;
+
+/*
+ * Menu example snippet: create a bar and pull down menu (accelerators, mnemonics)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+
+import tango.io.Stdout;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    auto bar = new Menu (shell, SWT.BAR);
+    shell.setMenuBar (bar);
+    auto fileItem = new MenuItem (bar, SWT.CASCADE);
+    fileItem.setText ("&File");
+    auto submenu = new Menu (shell, SWT.DROP_DOWN);
+    fileItem.setMenu (submenu);
+    auto item = new MenuItem (submenu, SWT.PUSH);
+    item.addListener (SWT.Selection, new class Listener {
+        public void handleEvent (Event e) {
+            Stdout("Select All").newline;
+        }
+    });
+    item.setText ("Select &All\tCtrl+A");
+    item.setAccelerator (SWT.CTRL + 'A');
+    shell.setSize (200, 200);
+    shell.open ();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * D Port:
+ *     Bill Baxter <wbaxter> at gmail com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet290;
+
+/* 
+ * Canvas snippet: ignore 2nd mouse up event after double-click
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseAdapter;
+
+import tango.io.Stdout;
+
+void main() {
+	final Display display = new Display();
+	final Shell shell = new Shell(display);
+	shell.addMouseListener(new class MouseAdapter {
+		public void mouseUp(MouseEvent e) {
+			if (e.count == 1) {
+				Stdout("Mouse up").newline;
+			}
+		}
+		public void mouseDoubleClick(MouseEvent e) {
+            Stdout("Double-click").newline;
+		}
+	});
+	shell.setBounds(10, 10, 200, 200);
+	shell.open ();
+	while (!shell.isDisposed()) {
+		if (!display.readAndDispatch()) display.sleep();
+	}
+	display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet293;
+
+/*
+ * create a tri-state button.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Button;
+
+void main() {
+    auto display = new Display();
+    auto shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+
+    auto b1 = new Button (shell, SWT.CHECK);
+    b1.setText("State 1");
+    b1.setSelection(true);
+
+    auto b2 = new Button (shell, SWT.CHECK);
+    b2.setText("State 2");
+    b2.setSelection(false);
+
+    auto b3 = new Button (shell, SWT.CHECK);
+    b3.setText("State 3");
+    b3.setSelection(true);
+
+    // This function does not appear in the api for swt 3.3
+    //	b3.setGrayed(true);
+
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet294;
+
+/* Port OK */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+import tango.util.Convert;
+
+void main(String[] args){
+    Snippet294.main(args);
+}
+
+/*
+ * Region on a control: create a non-rectangular button
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.4
+ */
+
+public class Snippet294 {
+
+    static int[] circle(int r, int offsetX, int offsetY) {
+        int[] polygon = new int[8 * r + 4];
+        // x^2 + y^2 = r^2
+        for (int i = 0; i < 2 * r + 1; i++) {
+            int x = i - r;
+            int y = cast(int)Math.sqrt(cast(real)(r*r - x*x));
+            polygon[2*i] = offsetX + x;
+            polygon[2*i+1] = offsetY + y;
+            polygon[8*r - 2*i - 2] = offsetX + x;
+            polygon[8*r - 2*i - 1] = offsetY - y;
+        }
+        return polygon;
+    }
+
+    public static void main(String[] args) {
+        Display display = new Display();
+        Shell shell = new Shell(display);
+        shell.setText("Regions on a Control");
+        shell.setLayout(new FillLayout());
+        shell.setBackground(display.getSystemColor(SWT.COLOR_DARK_RED));
+
+        Button b2 = new Button(shell, SWT.PUSH);
+        b2.setText("Button with Regions");
+
+        // define a region that looks like a circle with two holes in ot
+        Region region = new Region();
+        region.add(circle(67, 87, 77));
+        region.subtract(circle(20, 87, 47));
+        region.subtract(circle(20, 87, 113));
+
+        // define the shape of the button using setRegion
+        b2.setRegion(region);
+        b2.setLocation(100,50);
+
+        b2.addListener(SWT.Selection, new class() Listener {
+                public void handleEvent(Event e) {
+                shell.close();
+                }
+                });
+
+        shell.setSize(200,200);
+        shell.open();
+
+        while (!shell.isDisposed()) {
+            if (!display.readAndDispatch())
+                display.sleep();
+        }
+        region.dispose();
+        display.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet32.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet32;
+
+/*
+ * Program example snippet: find the icon of the program that edits .bmp files
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.program.Program;
+
+void main () {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    Label label = new Label (shell, SWT.NONE);
+    label.setText ("Can't find icon for .bmp");
+    Image image = null;
+    Program p = Program.findProgram (".bmp");
+    if (p !is null) {
+        ImageData data = p.getImageData ();
+        if (data !is null) {
+            image = new Image (display, data);
+            label.setImage (image);
+        }
+    }
+    label.pack ();
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    if (image !is null) image.dispose ();
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet33.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet33;
+
+/*
+ * DirectoryDialog example snippet: prompt for a directory
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import tango.io.FileSystem;
+import tango.io.Stdout;
+import tango.util.Convert;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    shell.open ();
+    auto dialog = new DirectoryDialog (shell);
+    dialog.setFilterPath (FileSystem.getDirectory());
+    Stdout("RESULT=" ~ to!(char[])(dialog.open())).newline;
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet38.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet38;
+
+/*
+ * Table example snippet: create a table (columns, headers, lines)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+import tango.util.Convert;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    auto table = new Table (shell, SWT.MULTI | DWT.BORDER | DWT.FULL_SELECTION);
+    table.setLinesVisible (true);
+    table.setHeaderVisible (true);
+    char[][] titles = [" ", "C", "!", "Description", "Resource", "In Folder", "Location"];
+    int[]    styles = [SWT.NONE, DWT.LEFT, DWT.RIGHT, DWT.CENTER, DWT.NONE, DWT.NONE, DWT.NONE];
+    foreach (i,title; titles) {
+        auto column = new TableColumn (table, styles[i]);
+        column.setText (title);
+    }
+    int count = 128;
+    for (int i=0; i<count; i++) {
+        auto item = new TableItem (table, SWT.NONE);
+        item.setText (0, "x");
+        item.setText (1, "y");
+        item.setText (2, "!");
+        item.setText (3, "this stuff behaves the way I expect");
+        item.setText (4, "almost everywhere");
+        item.setText (5, "some.folder");
+        item.setText (6, "line " ~ to!(char[])(i) ~ " in nowhere");
+    }
+    for (int i=0; i<titles.length; i++) {
+        table.getColumn (i).pack ();
+    }
+    table.setSize (table.computeSize (SWT.DEFAULT, 200));
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet39.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet39;
+
+/*
+ * CCombo example snippet: create a CCombo
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+import tango.util.Convert;
+import tango.io.Stdout;
+public static void main(String[] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+
+    CCombo combo = new CCombo(shell, SWT.FLAT | DWT.BORDER);
+    combo.setLayoutData(new GridData(SWT.FILL, DWT.CENTER, true, false));
+    for (int i = 0; i < 5; i++) {
+        combo.add("item" ~ to!(char[])(i));
+    }
+    combo.setText("item0");
+
+    combo.addSelectionListener(new class() SelectionAdapter {
+        public void widgetSelected(SelectionEvent e) {
+            Stdout.formatln("Item selected");
+        };
+    });
+
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch()) display.sleep();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet41.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet41;
+
+/*
+ * Tool Tips example snippet: create tool tips for a tab item, tool item, and shell
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+void main () {
+    auto string = "This is a string\nwith a new line.";
+    auto display = new Display ();
+    auto shell = new Shell (display);
+
+    TabFolder folder = new TabFolder (shell, SWT.BORDER);
+
+    folder.setSize (200, 200);
+    auto item0 = new TabItem (folder, 0);
+    item0.setText( "Text" );
+    item0.setToolTipText ("TabItem toolTip: " ~ string);
+
+    auto bar = new ToolBar (shell, SWT.BORDER);
+    bar.setBounds (0, 200, 200, 64);
+
+    ToolItem item1 = new ToolItem (bar, 0);
+    item1.setText( "Text" );
+    item1.setToolTipText ("ToolItem toolTip: " ~ string);
+    shell.setToolTipText ("Shell toolTip: " ~ string);
+
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet42.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet42;
+
+/*
+ * Display example snippet: get the bounds and client area of a display
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.widgets.Display;
+
+import java.lang.all;
+
+import tango.io.Stdout;
+void main (String [] args) {
+    Display display = new Display ();
+    Stdout.formatln("Display Bounds= {}  Display ClientArea= {}" 
+                    ,display.getBounds(),display.getClientArea());
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet43.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet43;
+/*
+ * Caret example snippet: create a caret (using an image)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.swt.widgets.Caret;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.open ();
+    Caret caret = new Caret (shell, SWT.NONE);
+    Color white = display.getSystemColor (SWT.COLOR_WHITE);
+    Color black = display.getSystemColor (SWT.COLOR_BLACK);
+    Image image = new Image (display, 20, 20);
+    GC gc = new GC (image);
+    gc.setBackground (black);
+    gc.fillRectangle (0, 0, 20, 20);
+    gc.setForeground (white);
+    gc.drawLine (0, 0, 19, 19);
+    gc.drawLine (19, 0, 0, 19);
+    gc.dispose ();
+    caret.setLocation (10, 10);
+    caret.setImage (image);
+    gc = new GC (shell);
+    gc.drawImage (image, 10, 64);
+    caret.setVisible (false);
+    gc.drawString ("Test", 12, 12);
+    caret.setVisible (true);
+    gc.dispose ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    image.dispose ();
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet44.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet44;
+
+/*
+ * Cursor example snippet: set the hand cursor into a control
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Cursor cursor = new Cursor (display, SWT.CURSOR_HAND);
+    Shell shell = new Shell (display);
+    shell.open ();
+    Button b = new Button (shell, 0);
+    b.setBounds (10, 10, 200, 200);
+    b.addListener (SWT.Selection, new class() Listener{
+        public void handleEvent (Event e) {
+            b.setCursor (cursor);
+        }
+    });
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    cursor.dispose ();
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet45.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet45;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Scale;
+
+import java.lang.all;
+
+
+public static void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    Scale scale = new Scale (shell, SWT.BORDER);
+    scale.setSize (200, 64);
+    scale.setMaximum (40);
+    scale.setPageIncrement (5);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet46.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet46;
+
+/*
+ * Composite example snippet: intercept mouse events (drag a button with the mouse)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.layout.FillLayout;
+
+import java.lang.all;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    Composite composite = new Composite (shell, SWT.NONE);
+    composite.setEnabled (false);
+    composite.setLayout (new FillLayout ());
+    Button button = new Button (composite, SWT.PUSH);
+    button.setText ("Button");
+    composite.pack ();
+    composite.setLocation (10, 10);
+    Point [] offset = new Point [1];
+    Listener listener = new class() Listener{
+        public void handleEvent (Event event) {
+            switch (event.type) {
+                case SWT.MouseDown:
+                Rectangle rect = composite.getBounds ();
+                if (rect.contains (event.x, event.y)) {
+                    Point pt1 = composite.toDisplay (0, 0);
+                    Point pt2 = shell.toDisplay (event.x, event.y);
+                    offset [0] = new Point (pt2.x - pt1.x, pt2.y - pt1.y);
+                }
+                break;
+                case SWT.MouseMove:
+                if (offset [0] !is null) {
+                    Point pt = offset [0];
+                    composite.setLocation (event.x - pt.x, event.y - pt.y);
+                }
+                break;
+                case SWT.MouseUp:
+                offset [0] = null;
+                break;
+            }
+        }
+    };
+    shell.addListener (SWT.MouseDown, listener);
+    shell.addListener (SWT.MouseUp, listener);
+    shell.addListener (SWT.MouseMove, listener);
+    shell.setSize (300, 300);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet47.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet47;
+
+/*
+ * ToolBar example snippet: create tool bar (normal, hot and disabled images)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+void main () {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+
+    Image image = new Image (display, 20, 20);
+    Color color = display.getSystemColor (SWT.COLOR_BLUE);
+    GC gc = new GC (image);
+    gc.setBackground (color);
+    gc.fillRectangle (image.getBounds ());
+    gc.dispose ();
+    
+    Image disabledImage = new Image (display, 20, 20);
+    color = display.getSystemColor (SWT.COLOR_GREEN);
+    gc = new GC (disabledImage);
+    gc.setBackground (color);
+    gc.fillRectangle (disabledImage.getBounds ());
+    gc.dispose ();
+    
+    Image hotImage = new Image (display, 20, 20);
+    color = display.getSystemColor (SWT.COLOR_RED);
+    gc = new GC (hotImage);
+    gc.setBackground (color);
+    gc.fillRectangle (hotImage.getBounds ());
+    gc.dispose ();
+    
+    ToolBar bar = new ToolBar (shell, SWT.BORDER | DWT.FLAT);
+    bar.setSize (200, 32);
+    for (int i=0; i<12; i++) {
+        ToolItem item = new ToolItem (bar, 0);
+        item.setImage (image);
+        item.setDisabledImage (disabledImage);
+        item.setHotImage (hotImage);
+        if (i % 3 == 0) item.setEnabled (false);
+    }
+    
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    image.dispose ();
+    disabledImage.dispose ();
+    hotImage.dispose ();
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet48.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Bill Baxter <wbaxter> at gmail com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet48;
+ 
+/*
+ * Canvas example snippet: scroll an image (flicker free, no double buffering)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.layout.FillLayout;
+
+import java.lang.all;
+
+void main () {
+	Display display = new Display ();
+	Shell shell = new Shell (display);
+	shell.setLayout(new FillLayout());
+	Image originalImage = null;
+	FileDialog dialog = new FileDialog (shell, SWT.OPEN);
+	dialog.setText ("Open an image file or cancel");
+	String string = dialog.open ();
+	if (string !is null) {
+		originalImage = new Image (display, string);
+	}
+	if (originalImage is null) {
+		int width = 150, height = 200;
+		originalImage = new Image (display, width, height);
+		GC gc = new GC (originalImage);
+		gc.fillRectangle (0, 0, width, height);
+		gc.drawLine (0, 0, width, height);
+		gc.drawLine (0, height, width, 0);
+		gc.drawText ("Default Image", 10, 10);
+		gc.dispose ();
+	}
+	final Image image = originalImage;
+	final Point origin = new Point (0, 0);
+	final Canvas canvas = new Canvas (shell, SWT.NO_BACKGROUND |
+			SWT.NO_REDRAW_RESIZE | DWT.V_SCROLL | DWT.H_SCROLL);
+	final ScrollBar hBar = canvas.getHorizontalBar ();
+    void onHBarSelection (Event e) {
+        int hSelection = hBar.getSelection ();
+        int destX = -hSelection - origin.x;
+        Rectangle rect = image.getBounds ();
+        canvas.scroll (destX, 0, 0, 0, rect.width, rect.height, false);
+        origin.x = -hSelection;
+    }
+	final ScrollBar vBar = canvas.getVerticalBar ();
+    void onVBarSelection(Event e) {
+        int vSelection = vBar.getSelection ();
+        int destY = -vSelection - origin.y;
+        Rectangle rect = image.getBounds ();
+        canvas.scroll (0, destY, 0, 0, rect.width, rect.height, false);
+        origin.y = -vSelection;
+    }
+    void onResize(Event e) {
+        Rectangle rect = image.getBounds ();
+        Rectangle client = canvas.getClientArea ();
+        hBar.setMaximum (rect.width);
+        vBar.setMaximum (rect.height);
+        hBar.setThumb (Math.min (rect.width, client.width));
+        vBar.setThumb (Math.min (rect.height, client.height));
+        int hPage = rect.width - client.width;
+        int vPage = rect.height - client.height;
+        int hSelection = hBar.getSelection ();
+        int vSelection = vBar.getSelection ();
+        if (hSelection >= hPage) {
+            if (hPage <= 0) hSelection = 0;
+            origin.x = -hSelection;
+        }
+        if (vSelection >= vPage) {
+            if (vPage <= 0) vSelection = 0;
+            origin.y = -vSelection;
+        }
+        canvas.redraw ();
+    }
+    void onPaint (Event e) {
+        GC gc = e.gc;
+        gc.drawImage (image, origin.x, origin.y);
+        Rectangle rect = image.getBounds ();
+        Rectangle client = canvas.getClientArea ();
+        int marginWidth = client.width - rect.width;
+        if (marginWidth > 0) {
+            gc.fillRectangle (rect.width, 0, marginWidth, client.height);
+        }
+        int marginHeight = client.height - rect.height;
+        if (marginHeight > 0) {
+            gc.fillRectangle (0, rect.height, client.width, marginHeight);
+        }
+    }
+
+	hBar.addListener (SWT.Selection, dgListener(&onHBarSelection));
+	vBar.addListener (SWT.Selection, dgListener(&onVBarSelection));
+	canvas.addListener (SWT.Resize,  dgListener(&onResize));
+	canvas.addListener (SWT.Paint, dgListener(&onPaint));
+
+	shell.setSize (200, 150);
+	shell.open ();
+	while (!shell.isDisposed ()) {
+		if (!display.readAndDispatch ()) display.sleep ();
+	}
+	originalImage.dispose();
+	display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet49.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet49;
+
+/*
+ * ToolBar example snippet: create tool bar (wrap on resize)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+import tango.util.Convert;
+
+void main () {
+	Display display = new Display ();
+	Shell shell = new Shell (display);
+	ToolBar toolBar = new ToolBar (shell, SWT.WRAP);
+	for (int i=0; i<12; i++) {
+		ToolItem item = new ToolItem (toolBar, SWT.PUSH);
+		item.setText ("Item " ~ to!(char[])(i));
+	}
+	shell.addListener (SWT.Resize, new class Listener {
+		void handleEvent (Event e) {
+			Rectangle rect = shell.getClientArea ();
+			Point size = toolBar.computeSize (rect.width, SWT.DEFAULT);
+			toolBar.setSize (size);
+		}
+	});
+	toolBar.pack ();
+	shell.pack ();
+	shell.open ();
+	while (!shell.isDisposed ()) {
+		if (!display.readAndDispatch ()) display.sleep ();
+	}
+	display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet58.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet58;
+
+/*
+ * ToolBar example snippet: place a combo box in a tool bar
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Combo;
+
+import tango.util.Convert;
+
+void main () {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    ToolBar bar = new ToolBar (shell, SWT.BORDER);
+    for (int i=0; i<4; i++) {
+        ToolItem item = new ToolItem (bar, 0);
+        item.setText ("Item " ~ to!(char[])(i));
+    }
+    ToolItem sep = new ToolItem (bar, SWT.SEPARATOR);
+    int start = bar.getItemCount ();
+    for (int i=start; i<start+4; i++) {
+        ToolItem item = new ToolItem (bar, 0);
+        item.setText ("Item " ~ to!(char[])(i));
+    }
+    Combo combo = new Combo (bar, SWT.READ_ONLY);
+    for (int i=0; i<4; i++) {
+        combo.add ("Item " ~ to!(char[])(i));
+    }
+    combo.pack ();
+    sep.setWidth (combo.getSize ().x);
+    sep.setControl (combo);
+    bar.pack ();
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet60.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet60;
+
+/*
+ * Display example snippet: create two one shot timers (5000 ms, 2000 ms)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+import tango.io.Stdout;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setSize (200, 200);
+    shell.open ();
+    display.timerExec (5000, dgRunnable({
+        Stdout("5000\n").flush();
+    }));
+    display.timerExec (2000, dgRunnable({
+        Stdout("2000\n").flush();
+    }));
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+ module control.Snippet62;
+
+ /*
+  * Control example snippet: print mouse state and button (down, move, up)
+  *
+  * For a list of all SWT example snippets see
+  * http://www.eclipse.org/swt/snippets/
+  * 
+  * @since 3.1
+  */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+
+import tango.io.Stdout;
+import tango.util.Convert;
+
+static char[] stateMask (int stateMask) {
+    char[] str = "";
+    if ((stateMask & SWT.CTRL) != 0) str ~= " CTRL";
+    if ((stateMask & SWT.ALT) != 0) str ~= " ALT";
+    if ((stateMask & SWT.SHIFT) != 0) str ~= " SHIFT";
+    if ((stateMask & SWT.COMMAND) != 0) str ~= " COMMAND";
+    return str;
+}
+
+void main () {
+    Display display = new Display ();
+    final Shell shell = new Shell (display);
+    Listener listener = new class Listener {
+        public void handleEvent (Event e) {
+            char[] str = "Unknown";
+            switch (e.type) {
+            case SWT.MouseDown: str = "DOWN"; break;
+            case SWT.MouseMove: str = "MOVE"; break;
+            case SWT.MouseUp: str = "UP"; break;
+            }
+            str ~=": button: " ~ to!(char[])(e.button) ~ ", ";
+            str ~= "stateMask=0x" ~ to!(char[])(e.stateMask) 
+            ~ stateMask (e.stateMask) 
+            ~ ", x=" ~ to!(char[])(e.x) ~ ", y=" ~ to!(char[])(e.y);
+            if ((e.stateMask & SWT.BUTTON1) != 0) str ~= " BUTTON1";
+            if ((e.stateMask & SWT.BUTTON2) != 0) str ~= " BUTTON2";
+            if ((e.stateMask & SWT.BUTTON3) != 0) str ~= " BUTTON3";
+            if ((e.stateMask & SWT.BUTTON4) != 0) str ~= " BUTTON4";
+            if ((e.stateMask & SWT.BUTTON5) != 0) str ~= " BUTTON5";
+            Stdout.formatln (str);
+        }
+    };
+    shell.addListener (SWT.MouseDown, listener);
+    shell.addListener (SWT.MouseMove, listener);
+    shell.addListener (SWT.MouseUp, listener);
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet66.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet66;
+
+/*
+ * GC example snippet: implement a simple scribble program
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+
+void main () {
+    Display display = new Display ();
+    final Shell shell = new Shell (display);
+    Listener listener = new class() Listener {
+        int lastX = 0, lastY = 0;
+        public void handleEvent (Event event) {
+            switch (event.type) {
+            case SWT.MouseMove:
+                if ((event.stateMask & SWT.BUTTON1) == 0) break;
+                GC gc = new GC (shell);
+                gc.drawLine (lastX, lastY, event.x, event.y);
+                gc.dispose ();
+                //FALL THROUGH
+            case SWT.MouseDown:
+                lastX = event.x;
+                lastY = event.y;
+                break;
+            }
+        }
+    };
+    shell.addListener (SWT.MouseDown, listener);
+    shell.addListener (SWT.MouseMove, listener);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet67.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet67;
+
+/*
+ * ToolBar example snippet: place a drop down menu in a tool bar
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Event;
+
+import tango.util.Convert;
+
+void main () {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    ToolBar toolBar = new ToolBar (shell, SWT.NONE);
+    Menu menu = new Menu (shell, SWT.POP_UP);
+    for (int i=0; i<8; i++) {
+        MenuItem item = new MenuItem (menu, SWT.PUSH);
+        item.setText ("Item " ~ to!(char[])(i));
+    }
+    ToolItem item = new ToolItem (toolBar, SWT.DROP_DOWN);
+    item.addListener (SWT.Selection, new class Listener {
+        void handleEvent (Event event) {
+            if (event.detail == SWT.ARROW) {
+                Rectangle rect = item.getBounds ();
+                Point pt = new Point (rect.x, rect.y + rect.height);
+                pt = toolBar.toDisplay (pt);
+                menu.setLocation (pt.x, pt.y);
+                menu.setVisible (true);
+            }
+        }
+    });
+    toolBar.pack ();
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    menu.dispose ();
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet68.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet68;
+ 
+/*
+ * Display example snippet: stop a repeating timer when a button is pressed
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+
+void main (String [] args) {
+    Display display = new Display ();
+    final Color red = display.getSystemColor (SWT.COLOR_RED);
+    final Color blue = display.getSystemColor (SWT.COLOR_BLUE);
+    Shell shell = new Shell (display);
+    shell.setLayout (new RowLayout ());
+    Button button = new Button (shell, SWT.PUSH);
+    button.setText ("Stop Timer");
+    final Label label = new Label (shell, SWT.BORDER);
+    label.setBackground (red);
+    final int time = 500;
+    Runnable timer;
+    timer = dgRunnable({
+        if (label.isDisposed ()) return;
+        Color color = label.getBackground ().opEquals (red) ? blue : red;
+        label.setBackground (color);
+        display.timerExec (time, timer);
+    });
+    display.timerExec (time, timer);
+    button.addListener (SWT.Selection, dgListener( (Event event) {
+       display.timerExec (-1, timer);
+    }));
+    button.pack ();
+    label.setLayoutData (new RowData (button.getSize ()));
+    shell.pack ();
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet7.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet7;
+
+/*
+ * example snippet: create a table (lazy)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+import java.lang.all;
+
+import tango.core.Thread;
+import tango.util.Convert;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Image image = new Image (display, 16, 16);
+    GC gc = new GC (image);
+    gc.setBackground (display.getSystemColor (SWT.COLOR_RED));
+    gc.fillRectangle (image.getBounds ());
+    gc.dispose ();
+  
+    Shell shell = new Shell (display);
+    shell.setText ("Lazy Table");
+    shell.setLayout (new FillLayout ());
+    Table table = new Table (shell, SWT.BORDER | DWT.MULTI);
+    table.setSize (200, 200);
+    Thread thread = new Thread({
+        for(int i=0; i< 20000; i++){
+            if (table.isDisposed ()) return;
+
+            int [] index =  [i];
+            display.syncExec (new class() Runnable{
+                public void run () {
+                    if (table.isDisposed ()) return;
+                    TableItem item = new TableItem (table, SWT.NONE);
+                    item.setText ("Table Item " ~ to!(String)(index [0]));
+                    item.setImage (image);
+                }
+        });
+        }
+    });
+
+    thread.start ();
+    shell.setSize (200, 200);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    image.dispose ();
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet72.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Bill Baxter <bill@billbaxter.com>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet72;
+
+/*
+ * FileDialog example snippet: prompt for a file name (to save)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.FileDialog;
+
+import tango.io.Stdout;
+
+void main () {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.open ();
+    FileDialog dialog = new FileDialog (shell, SWT.SAVE);
+    dialog.setFilterNames (["Batch Files", "All Files (*.*)"]);
+    dialog.setFilterExtensions (["*.bat", "*.*"]); //Windows wild cards
+    dialog.setFilterPath ("c:\\"); //Windows path
+    dialog.setFileName ("fred.bat");
+    Stdout.formatln ("Save to: {}", dialog.open ());
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet74.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet74;
+
+/*
+ * Caret example snippet: create a caret
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Caret;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    Caret caret = new Caret (shell, SWT.NONE);
+    caret.setBounds (10, 10, 2, 32);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet75.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet75;
+
+/*
+ * Composite example snippet: set the tab traversal order of children
+ * In this example, composite1 (i.e. c1) tab order is set to: B2, B1, B3, and
+ * shell tab order is set to: c1, B7, toolBar1, (c4: no focusable children), c2, L2
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.RowLayout;
+
+import java.lang.all;
+
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setLayout (new RowLayout ());
+
+    Composite c1 = new Composite (shell, SWT.BORDER);
+    c1.setLayout (new RowLayout ());
+    Button b1 = new Button (c1, SWT.PUSH);
+    b1.setText ("B&1");
+    Button r1 = new Button (c1, SWT.RADIO);
+    r1.setText ("R1");
+    Button r2 = new Button (c1, SWT.RADIO);
+    r2.setText ("R&2");
+    Button r3 = new Button (c1, SWT.RADIO);
+    r3.setText ("R3");
+    Button b2 = new Button (c1, SWT.PUSH);
+    b2.setText ("B2");
+    List l1 = new List (c1, SWT.SINGLE | DWT.BORDER);
+    l1.setItems (["L1"]);
+    Button b3 = new Button (c1, SWT.PUSH);
+    b3.setText ("B&3");
+    Button b4 = new Button (c1, SWT.PUSH);
+    b4.setText ("B&4");
+
+    Composite c2 = new Composite (shell, SWT.BORDER);
+    c2.setLayout (new RowLayout ());
+    Button b5 = new Button (c2, SWT.PUSH);
+    b5.setText ("B&5");
+    Button b6 = new Button (c2, SWT.PUSH);
+    b6.setText ("B&6");
+
+    List l2 = new List (shell, SWT.SINGLE | DWT.BORDER);
+    l2.setItems ( ["L2"] );
+
+    ToolBar tb1 = new ToolBar (shell, SWT.FLAT | DWT.BORDER);
+    ToolItem i1 = new ToolItem (tb1, SWT.RADIO);
+    i1.setText ("I1");
+    ToolItem i2 = new ToolItem (tb1, SWT.RADIO);
+    i2.setText ("I2");
+    Combo combo1 = new Combo (tb1, SWT.READ_ONLY | DWT.BORDER);
+    combo1.setItems (["C1"]);
+    combo1.setText ("C1");
+    combo1.pack ();
+    ToolItem i3 = new ToolItem (tb1, SWT.SEPARATOR);
+    i3.setWidth (combo1.getSize ().x);
+    i3.setControl (combo1);
+    ToolItem i4 = new ToolItem (tb1, SWT.PUSH);
+    i4.setText ("I&4");
+    ToolItem i5 = new ToolItem (tb1, SWT.CHECK);
+    i5.setText ("I5");
+
+    Button b7 = new Button (shell, SWT.PUSH);
+    b7.setText ("B&7");
+
+    Composite c4 = new Composite (shell, SWT.BORDER);
+    Composite c5 = new Composite (c4, SWT.BORDER);
+    c5.setLayout(new FillLayout());
+    (new Label(c5, SWT.NONE)).setText("No");
+    c5.pack();
+
+
+    Control [] tabList1 = [cast(Control)b2, b1, b3];
+    c1.setTabList (tabList1);
+    Control [] tabList2 = [cast(Control)c1, b7, tb1, c4, c2, l2];
+    shell.setTabList (tabList2);
+    shell.pack ();
+    shell.open ();
+
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet76.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Bill Baxter <wbaxter> at gmail com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet76;
+
+/*
+ * TabFolder example snippet: create a tab folder (six pages)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Button;
+
+import tango.util.Convert;
+
+void main () {
+	Display display = new Display ();
+	final Shell shell = new Shell (display);
+	final TabFolder tabFolder = new TabFolder (shell, SWT.BORDER);
+	for (int i=0; i<6; i++) {
+		TabItem item = new TabItem (tabFolder, SWT.NONE);
+		item.setText ("TabItem " ~ to!(char[])(i));
+		Button button = new Button (tabFolder, SWT.PUSH);
+		button.setText ("Page " ~ to!(char[])(i));
+		item.setControl (button);
+	}
+	tabFolder.pack ();
+	shell.pack ();
+	shell.open ();
+	while (!shell.isDisposed ()) {
+		if (!display.readAndDispatch ()) display.sleep ();
+	}
+	display.dispose ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet8.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet8;
+
+/*
+ * Tree example snippet: create a tree (lazy)
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+import java.lang.all;
+import tango.io.FilePath;
+import tango.io.FileSystem;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    shell.setText ("Lazy Tree");
+    shell.setLayout (new FillLayout ());
+    auto tree = new Tree (shell, SWT.BORDER);
+    auto roots = FileSystem.roots();
+    foreach (file; roots) {
+        auto root = new TreeItem (tree, 0);
+        root.setText (file);
+        root.setData (new FilePath(file));
+        new TreeItem (root, 0);
+    }
+    tree.addListener (SWT.Expand, new class Listener {
+        public void handleEvent (Event event) {
+            auto root = cast(TreeItem) event.item;
+            auto items = root.getItems ();
+            foreach(item; items) {
+                if (item.getData () !is null) return;
+                item.dispose ();
+            }
+            auto file = cast(FilePath) root.getData ();
+            auto files = file.toList();
+            if (files is null) return;
+            foreach (f; files) {
+                TreeItem item = new TreeItem (root, 0);
+                item.setText (f.toString());
+                item.setData (f);
+                if (f.isFolder()) {
+                    new TreeItem (item, 0);
+                }
+            }
+        }
+    });
+    auto size = tree.computeSize (300, SWT.DEFAULT);
+    auto width = Math.max (300, size.x);
+    auto height = Math.max (300, size.y);
+    shell.setSize (shell.computeSize (width, height));
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     Enzo Petrelli
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet81;
+
+/*
+ * OLE and ActiveX example snippet: browse the typelibinfo for a program id (win32 only)
+ * NOTE: This snippet uses internal SWT packages that are
+ * subject to change without notice.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;             // String
+import org.eclipse.swt.internal.ole.win32.OAIDL;
+import org.eclipse.swt.ole.win32.OLE;
+import org.eclipse.swt.ole.win32.OleAutomation;
+import org.eclipse.swt.ole.win32.OleControlSite;
+import org.eclipse.swt.ole.win32.OleFrame;
+import org.eclipse.swt.ole.win32.OleFunctionDescription;
+import org.eclipse.swt.ole.win32.OlePropertyDescription;
+
+import tango.io.Stdout;
+import tango.io.Print;
+import tango.text.convert.Format;
+
+int main() {
+    int iRes = 0;
+
+    String progID = "Shell.Explorer";
+    //String progID = "Excel.Application";
+
+    Display oDisplay = new Display();
+    Shell oShell = new Shell(oDisplay);
+
+    OleFrame frame = new OleFrame(oShell, SWT.NONE);
+    OleControlSite oOleSite = null;
+    OleAutomation oOleAutoObj = null;
+    try {
+        oOleSite = new OleControlSite(frame, SWT.NONE, progID); 
+    }
+    catch (Exception oExc) {
+        Stdout.formatln("Exception {} creating OleControlSite on type library for {}", oExc.toString(), progID);
+        return 1;
+    }
+    try {
+        oOleAutoObj = new OleAutomation(oOleSite);
+    }
+    catch (Exception oExc) {
+        Stdout.formatln("Exception {}  OleAutomation on type library for {}", oExc.toString(), progID);
+        return 1;
+    }
+
+    Stdout.formatln("TypeLibrary for: '{}'", progID);
+    printTypeInfo(oOleAutoObj, Stdout);
+
+    oShell.dispose();
+    oDisplay.dispose();
+    return iRes;
+}
+
+private static void printTypeInfo(OleAutomation oOleAutoObj, Print!(char) oOut)
+{
+    org.eclipse.swt.internal.ole.win32.OAIDL.TYPEATTR * pTypeAttr = oOleAutoObj.getTypeInfoAttributes();
+    if (pTypeAttr !is null) {
+        if (pTypeAttr.cFuncs > 0) {
+            oOut.formatln("Functions :");
+            for (int iIdx = 0; iIdx < pTypeAttr.cFuncs; ++iIdx) {
+                OleFunctionDescription oData = oOleAutoObj.getFunctionDescription(iIdx);
+                char[] sArgList = "";
+                int iFirstOptionalArgIndex = oData.args.length - oData.optionalArgCount;
+                for (int iArg = 0; iArg < oData.args.length; ++iArg) {
+                    sArgList ~= "[";
+                    if (iArg >= iFirstOptionalArgIndex){
+                        sArgList ~= "optional, ";
+                    }
+                    sArgList ~= getDirection(oData.args[iArg].flags) ~ "] " ~
+                        getTypeName(oData.args[iArg].type) ~ " " ~
+                        oData.args[iArg].name
+                        ;
+                    if (iArg < oData.args.length - 1){
+                        sArgList ~= ", ";
+                    }
+                }
+                oOut.formatln("{} (id = {} (0x{:X8}))", getInvokeKind(oData.invokeKind), oData.id, oData.id);
+                oOut.formatln("\tSignature  : {} {}({})", getTypeName(oData.returnType), oData.name, sArgList);
+                oOut.formatln("\tDescription: {}", oData.documentation);
+                oOut.formatln("\tHelp File  : {}", oData.helpFile);
+                oOut.formatln("");
+            }
+        }
+
+        if (pTypeAttr.cVars > 0) {
+            oOut.formatln("\n\nVariables :");
+            for (int iIdx = 0; iIdx < pTypeAttr.cVars; ++iIdx) {
+                OlePropertyDescription oData = oOleAutoObj.getPropertyDescription(iIdx);
+                oOut.formatln("PROPERTY (id = {} (0x{:X8})", oData.id, oData.id);
+                oOut.formatln("\tName : {}", oData.name);
+                oOut.formatln("\tType : {}", getTypeName(oData.type));
+                oOut.formatln("");
+            }
+        }
+    }
+}
+private static char[] getTypeName(int iType) {
+    int iBase = iType & ~OLE.VT_BYREF;
+    char[] sDsc = null;
+    switch (iBase) {
+        case OLE.VT_BOOL :          sDsc = "boolean"; break;
+        case OLE.VT_R4 :            sDsc = "float"; break;
+        case OLE.VT_R8 :            sDsc = "double"; break;
+        case OLE.VT_I4 :            sDsc = "int"; break;
+        case OLE.VT_DISPATCH :      sDsc = "IDispatch"; break;
+        case OLE.VT_UNKNOWN :       sDsc = "IUnknown"; break;
+        case OLE.VT_I2 :            sDsc = "short"; break;
+        case OLE.VT_BSTR :          sDsc = "String"; break;
+        case OLE.VT_VARIANT :       sDsc = "Variant"; break;
+        case OLE.VT_CY :            sDsc = "Currency"; break;
+        case OLE.VT_DATE :          sDsc = "Date"; break;
+        case OLE.VT_UI1 :           sDsc = "unsigned char"; break;
+        case OLE.VT_UI4 :           sDsc = "unsigned int"; break;
+        case OLE.VT_USERDEFINED :   sDsc = "UserDefined"; break;
+        case OLE.VT_HRESULT :       sDsc = "HRESULT"; break;
+        case OLE.VT_VOID :          sDsc = "void"; break;
+        case OLE.VT_UI2 :           sDsc = "unsigned short"; break;
+        case OLE.VT_UINT :          sDsc = "unsigned int"; break;
+        case OLE.VT_PTR :           sDsc = "void *"; break;
+        default: break;
+    }
+    if (sDsc !is null) {
+        if ((iType & OLE.VT_BYREF) == OLE.VT_BYREF){
+            return sDsc ~ " *";
+        }
+        return sDsc;
+    }
+    return Format("unknown {} (0x{:X4})", iType, iType);
+}
+
+char[] getDirection(int bDirection) {
+    char[] sDirString = "";
+    bool bComma = false;
+    if ((bDirection & OLE.IDLFLAG_FIN) != 0) {
+        sDirString ~= "in";
+        bComma = true;
+    }
+    if ((bDirection & OLE.IDLFLAG_FOUT) != 0) {
+        if (bComma) sDirString ~= ", ";
+        sDirString ~= "out";
+        bComma = true;
+    }
+    if ((bDirection & OLE.IDLFLAG_FLCID) != 0) {
+        if (bComma) sDirString ~= ", ";
+        sDirString ~= "lcid";
+        bComma = true;
+    }
+    if ((bDirection & OLE.IDLFLAG_FRETVAL) != 0) {
+        if (bComma) sDirString ~= ", "; 
+        sDirString ~= "retval";
+    }
+    return sDirString;
+}
+private static char[] getInvokeKind(int iInvKind) {
+    switch (iInvKind) {
+        case OLE.INVOKE_FUNC : return "METHOD";
+        case OLE.INVOKE_PROPERTYGET : return "PROPERTY GET";
+        case OLE.INVOKE_PROPERTYPUT : return "PROPERTY PUT";
+        case OLE.INVOKE_PROPERTYPUTREF : return "PROPERTY PUT BY REF";
+        default: break;
+    }
+    return Format("unknown {}", iInvKind);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet82;
+
+/*
+ * CTabFolder example snippet: prevent an item from closing
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabFolder2Adapter;
+import org.eclipse.swt.custom.CTabFolderEvent;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import java.lang.all;
+
+import tango.util.Convert;
+
+void main(String[] args) {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new FillLayout());
+    CTabFolder folder = new CTabFolder(shell, SWT.BORDER);
+    for (int i = 0; i < 4; i++) {
+        CTabItem item = new CTabItem(folder, SWT.CLOSE);
+        item.setText("Item " ~ to!(String)(i) );
+        Text text = new Text(folder, SWT.MULTI);
+        text.setText("Content for Item "~ to!(String)(i));
+        item.setControl(text);
+    }
+
+    CTabItem specialItem = new CTabItem(folder, SWT.CLOSE);
+    specialItem.setText("Don't Close Me");
+    Text text = new Text(folder, SWT.MULTI);
+    text.setText("This tab can never be closed");
+    specialItem.setControl(text);
+
+    folder.addCTabFolder2Listener(new class() CTabFolder2Adapter {
+        public void close(CTabFolderEvent event) {
+            if (event.item == specialItem) {
+                event.doit = false;
+            }
+        }
+    });
+
+    CTabItem noCloseItem = new CTabItem(folder, SWT.NONE);
+    noCloseItem.setText("No Close Button");
+    Text text2 = new Text(folder, SWT.MULTI);
+    text2.setText("This tab does not have a close button");
+    noCloseItem.setControl(text2);
+
+    shell.pack();
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet9.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippit9;
+
+/*
+ * Composite example snippet: scroll a child control automatically
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.Shell;
+import java.lang.all;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell
+       (display, SWT.SHELL_TRIM | DWT.H_SCROLL | DWT.V_SCROLL);
+    auto composite = new Composite (shell, SWT.BORDER);
+    composite.setSize (700, 600);
+    auto red = display.getSystemColor (SWT.COLOR_RED);
+    composite.addPaintListener (new class PaintListener {
+        public void paintControl (PaintEvent e) {
+            e.gc.setBackground (red);
+            e.gc.fillOval (5, 5, 690, 590);
+        }
+    });
+    auto hBar = shell.getHorizontalBar ();
+    hBar.addListener (SWT.Selection, new class Listener {
+        public void handleEvent (Event e) {
+            auto location = composite.getLocation ();
+            location.x = -hBar.getSelection ();
+            composite.setLocation (location);
+        }
+    });
+    ScrollBar vBar = shell.getVerticalBar ();
+    vBar.addListener (SWT.Selection, new class Listener {
+        public void handleEvent (Event e) {
+            Point location = composite.getLocation ();
+            location.y = -vBar.getSelection ();
+            composite.setLocation (location);
+        }
+    });
+    shell.addListener (SWT.Resize,  new class Listener {
+        public void handleEvent (Event e) {
+            Point size = composite.getSize ();
+            Rectangle rect = shell.getClientArea ();
+            hBar.setMaximum (size.x);
+            vBar.setMaximum (size.y);
+            hBar.setThumb (Math.min (size.x, rect.width));
+            vBar.setThumb (Math.min (size.y, rect.height));
+            int hPage = size.x - rect.width;
+            int vPage = size.y - rect.height;
+            int hSelection = hBar.getSelection ();
+            int vSelection = vBar.getSelection ();
+            Point location = composite.getLocation ();
+            if (hSelection >= hPage) {
+                if (hPage <= 0) hSelection = 0;
+                location.x = -hSelection;
+            }
+            if (vSelection >= vPage) {
+                if (vPage <= 0) vSelection = 0;
+                location.y = -vSelection;
+            }
+            composite.setLocation (location);
+        }
+    });
+    shell.open ();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet92;
+
+/*
+ * Cursor example snippet: create a cursor from a source and a mask
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.all;
+
+
+void main (String [] args) {
+    Display display = new Display();
+    Color white = display.getSystemColor (SWT.COLOR_WHITE);
+    Color black = display.getSystemColor (SWT.COLOR_BLACK);
+
+    //Create a source ImageData of depth 1 (monochrome)
+    PaletteData palette = new PaletteData ([white.getRGB(), black.getRGB()]);
+    ImageData sourceData = new ImageData (20, 20, 1, palette);
+    for (int i = 0; i < 10; i ++) {
+        for (int j = 0; j < 20; j++) {
+            sourceData.setPixel(i, j, 1);
+        }
+    }
+
+    //Create a mask ImageData of depth 1 (monochrome)
+    palette = new PaletteData ([white.getRGB(), black.getRGB()]);
+    ImageData maskData = new ImageData (20, 20, 1, palette);
+    for (int i = 0; i < 20; i ++) {
+        for (int j = 0; j < 10; j++) {
+            maskData.setPixel(i, j, 1);
+        }
+    }
+    //Create cursor
+    Cursor cursor = new Cursor(display, sourceData, maskData, 10, 10);
+
+    Shell shell = new Shell(display);
+    Image source = new Image (display,sourceData);
+    Image mask = new Image (display, maskData);
+    //Draw source and mask just to show what they look like
+    shell.addPaintListener(new class() PaintListener{
+        void paintControl(PaintEvent e) {
+            GC gc = e.gc;
+            gc.drawString("source: ", 10, 10);
+            gc.drawImage(source, 0, 0, 20, 20, 60, 10, 20, 20);
+            gc.drawString("mask: ",10, 40);
+            gc.drawImage(mask, 0, 0, 20, 20, 60, 40, 20, 20);
+        }
+    });
+    shell.setSize(150, 150);
+    shell.open();
+    shell.setCursor(cursor);
+
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    cursor.dispose();
+    source.dispose();
+    mask.dispose();
+    display.dispose();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet94;
+/*
+ * Clipboard example snippet: copy and paste data with the clipboard
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.dnd.TextTransfer;
+
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import java.lang.all;
+
+
+public static void main( String[] args) {
+    Display display = new Display ();
+    Clipboard cb = new Clipboard(display);
+    Shell shell = new Shell (display);
+    shell.setLayout(new FormLayout());
+    Text text = new Text(shell, SWT.BORDER | DWT.MULTI | DWT.V_SCROLL | DWT.H_SCROLL);
+
+    Button copy = new Button(shell, SWT.PUSH);
+    copy.setText("Copy");
+    copy.addListener (SWT.Selection, new class() Listener {
+        public void handleEvent (Event e) {
+            String textData = text.getSelectionText();
+            if (textData.length > 0) {
+                TextTransfer textTransfer = TextTransfer.getInstance();
+                // this is ugly, but works.
+                Transfer[] xfer = [ textTransfer];
+                Object[] td = [ new ArrayWrapperString(textData) ];
+                cb.setContents(td,xfer);
+            }
+        }
+    });
+
+    Button paste = new Button(shell, SWT.PUSH);
+    paste.setText("Paste");
+    paste.addListener (SWT.Selection, new class() Listener {
+        public void handleEvent (Event e) {
+            TextTransfer transfer = TextTransfer.getInstance();
+            String data = stringcast(cb.getContents(transfer));
+            if (data !is null) {
+                text.insert(data);
+            }
+        }
+    });
+
+    FormData data = new FormData();
+    data.left = new FormAttachment(paste, 0, SWT.LEFT);
+    data.right = new FormAttachment(100, -5);
+    data.top = new FormAttachment(0, 5);
+    copy.setLayoutData(data);
+
+    data = new FormData();
+    data.right = new FormAttachment(100, -5);
+    data.top = new FormAttachment(copy, 5);
+    paste.setLayoutData(data);
+
+    data = new FormData();
+    data.left = new FormAttachment(0, 5);
+    data.top = new FormAttachment(0, 5);
+    data.right = new FormAttachment(paste, -5);
+    data.bottom = new FormAttachment(100, -5);
+    text.setLayoutData(data);
+
+    shell.setSize(200, 200);
+    shell.open();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    cb.dispose();
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * Port to the D programming language:
+ *     yidabu at gmail dot com  ( D China http://www.d-programming-language-china.org/ )
+ *******************************************************************************/
+
+module org.eclipse.swt.snippets.Snippet96;
+
+// http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.java?view=co
+
+/*
+ * TableCursor example snippet: navigate a table cells with arrow keys.
+ * Edit when user hits Return key.  Exit edit mode by hitting Escape (cancels edit)
+ * or Return (applies edit to table).
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+
+import org.eclipse.swt.custom.TableCursor;
+import org.eclipse.swt.custom.ControlEditor;
+
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseAdapter;
+
+import java.lang.all;
+
+import tango.util.Convert;
+
+
+void main() {
+    Display display = new Display();
+    Shell shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+
+    // create a a table with 3 columns and fill with data
+    final Table table = new Table(shell, SWT.BORDER | DWT.MULTI | DWT.FULL_SELECTION);
+    table.setLayoutData(new GridData(GridData.FILL_BOTH));
+    TableColumn column1 = new TableColumn(table, SWT.NONE);
+    TableColumn column2 = new TableColumn(table, SWT.NONE);
+    TableColumn column3 = new TableColumn(table, SWT.NONE);
+    for (int i = 0; i < 100; i++) {
+        TableItem item = new TableItem(table, SWT.NONE);
+        item.setText(["cell " ~ to!(char[])(i) ~ " 0",  "cell " ~ to!(char[])(i) ~ " 1", "cell " ~ to!(char[])(i) ~ " 2" ]);
+    }
+    column1.pack();
+    column2.pack();
+    column3.pack();
+
+    // create a TableCursor to navigate around the table
+    final TableCursor cursor = new TableCursor(table, SWT.NONE);
+    // create an editor to edit the cell when the user hits "ENTER"
+    // while over a cell in the table
+    final ControlEditor editor = new ControlEditor(cursor);
+    editor.grabHorizontal = true;
+    editor.grabVertical = true;
+
+    cursor.addSelectionListener(new class(table, editor, cursor) SelectionAdapter {
+        // when the TableEditor is over a cell, select the corresponding row in
+        // the table
+
+        Table table;
+        ControlEditor editor;
+        TableCursor cursor;
+        this(Table table_, ControlEditor editor_, TableCursor cursor_)
+        {
+            table = table_;
+            editor = editor_;
+            cursor = cursor_;
+        }
+
+        public void widgetSelected(SelectionEvent e) {
+            table.setSelection([cursor.getRow()]);
+        }
+        // when the user hits "ENTER" in the TableCursor, pop up a text editor so that
+        // they can change the text of the cell
+        public void widgetDefaultSelected(SelectionEvent e) {
+            final Text text = new Text(cursor, SWT.NONE);
+            TableItem row = cursor.getRow();
+            int column = cursor.getColumn();
+            text.setText(row.getText(column));
+            text.addKeyListener(new class(text, cursor) KeyAdapter {
+                Text text;
+                TableCursor cursor;
+                this(Text text_, TableCursor cursor_)
+                {
+                    text = text_;
+                    cursor = cursor_;
+                }
+                public void keyPressed(KeyEvent e) {
+                    // close the text editor and copy the data over
+                    // when the user hits "ENTER"
+                    if (e.character == SWT.CR) {
+                        TableItem row = cursor.getRow();
+                        int column = cursor.getColumn();
+                        row.setText(column, text.getText());
+                        text.dispose();
+                    }
+                    // close the text editor when the user hits "ESC"
+                    if (e.character == SWT.ESC) {
+                        text.dispose();
+                    }
+                }
+            });
+            // close the text editor when the user tabs away
+            text.addFocusListener(new class(text) FocusAdapter {
+                Text text;
+                this(Text text_)
+                {
+                    text = text_;
+                }
+                public void focusLost(FocusEvent e) {
+                    text.dispose();
+                }
+            });
+            editor.setEditor(text);
+            text.setFocus();
+        }
+    });
+    // Hide the TableCursor when the user hits the "CTRL" or "SHIFT" key.
+    // This alows the user to select multiple items in the table.
+    cursor.addKeyListener(new class(cursor) KeyAdapter {
+        TableCursor cursor;
+        this(TableCursor cursor_)
+        {
+            cursor = cursor_;
+        }
+        public void keyPressed(KeyEvent e) {
+            if (e.keyCode == SWT.CTRL
+                || e.keyCode == SWT.SHIFT
+                || (e.stateMask & SWT.CONTROL) != 0
+                || (e.stateMask & SWT.SHIFT) != 0) {
+                cursor.setVisible(false);
+            }
+        }
+    });
+    // When the user double clicks in the TableCursor, pop up a text editor so that
+    // they can change the text of the cell
+    cursor.addMouseListener(new class(cursor, editor) MouseAdapter {
+        ControlEditor editor;
+        TableCursor cursor;
+        this(TableCursor cursor_, ControlEditor editor_)
+        {
+            cursor = cursor_;
+            editor = editor_;
+        }
+
+        public void mouseDown(MouseEvent e) {
+            final Text text = new Text(cursor, SWT.NONE);
+            TableItem row = cursor.getRow();
+            int column = cursor.getColumn();
+            text.setText(row.getText(column));
+            text.addKeyListener(new class(text, cursor) KeyAdapter {
+                Text text;
+                TableCursor cursor;
+                this(Text text_, TableCursor cursor_)
+                {
+                    text = text_;
+                    cursor = cursor_;
+                }
+                public void keyPressed(KeyEvent e) {
+                    // close the text editor and copy the data over
+                    // when the user hits "ENTER"
+                    if (e.character == SWT.CR) {
+                        TableItem row = cursor.getRow();
+                        int column = cursor.getColumn();
+                        row.setText(column, text.getText());
+                        text.dispose();
+                    }
+                    // close the text editor when the user hits "ESC"
+                    if (e.character == SWT.ESC) {
+                        text.dispose();
+                    }
+                }
+            });
+            // close the text editor when the user clicks away
+            text.addFocusListener(new class(text) FocusAdapter {
+                Text text;
+                this(Text text_)
+                {
+                    text = text_;
+                }
+                public void focusLost(FocusEvent e) {
+                    text.dispose();
+                }
+            });
+            editor.setEditor(text);
+            text.setFocus();
+        }
+    });
+
+    // Show the TableCursor when the user releases the "SHIFT" or "CTRL" key.
+    // This signals the end of the multiple selection task.
+    table.addKeyListener(new class(table, cursor) KeyAdapter {
+        Table table;
+        TableCursor cursor;
+        this(Table table_, TableCursor cursor_)
+        {
+            table = table_;
+            cursor = cursor_;
+        }
+        public void keyReleased(KeyEvent e) {
+            if (e.keyCode == SWT.CONTROL && (e.stateMask & DWT.SHIFT) != 0)
+                return;
+            if (e.keyCode == SWT.SHIFT && (e.stateMask & DWT.CONTROL) != 0)
+                return;
+            if (e.keyCode != SWT.CONTROL
+                && (e.stateMask & SWT.CONTROL) != 0)
+                return;
+            if (e.keyCode != SWT.SHIFT && (e.stateMask & DWT.SHIFT) != 0)
+                return;
+
+            TableItem[] selection = table.getSelection();
+            TableItem row = (selection.length == 0) ? table.getItem(table.getTopIndex()) : selection[0];
+            table.showItem(row);
+            cursor.setSelection(row, 0);
+            cursor.setVisible(true);
+            cursor.setFocus();
+        }
+    });
+
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet97.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Jesse Phillips <Jesse.K.Phillips+D> gmail.com
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet97;
+ 
+/*
+ * Menu example snippet: fill a menu dynamically (when menu shown)
+ * Select items then right click to show menu.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+import tango.util.Convert;
+
+void main () {
+    auto display = new Display ();
+    auto shell = new Shell (display);
+    auto tree = new Tree (shell, SWT.BORDER | DWT.MULTI);
+    auto menu = new Menu (shell, SWT.POP_UP);
+    tree.setMenu (menu);
+    for (int i=0; i<12; i++) {
+        auto item = new TreeItem (tree, SWT.NONE);
+        item.setText ("Item " ~ to!(char[])(i));
+    }
+    menu.addListener (SWT.Show, new class Listener {
+        public void handleEvent (Event event) {
+            auto menuItems = menu.getItems ();
+            foreach (item; menuItems) {
+                item.dispose ();
+            }
+            auto treeItems = tree.getSelection ();
+            foreach (item; treeItems) {
+                auto menuItem = new MenuItem (menu, SWT.PUSH);
+                menuItem.setText (item.getText ());
+            }
+        }
+    });
+    tree.setSize (200, 200);
+    shell.setSize (300, 300);
+    shell.open ();
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet98.d	Sun Mar 22 15:17:04 2009 +0100
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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
+ * D Port:
+ *     Thomas Demmer <t_demmer AT web DOT de>
+ *******************************************************************************/
+module org.eclipse.swt.snippets.Snippet98;
+
+/*
+ * Composite example snippet: create and dispose children of a composite
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+import java.lang.all;
+
+import tango.util.Convert;
+
+static int pageNum = 0;
+static Composite pageComposite;
+
+void main(String args[]) {
+    Display display = new Display();
+    final Shell shell = new Shell(display);
+    shell.setLayout(new GridLayout());
+    Button button = new Button(shell, SWT.PUSH);
+    button.setText("Push");
+    pageComposite = new Composite(shell, SWT.NONE);
+    pageComposite.setLayout(new GridLayout());
+    pageComposite.setLayoutData(new GridData());
+
+    button.addListener(SWT.Selection, new class() Listener{
+        public void handleEvent(Event event) {
+            if ((pageComposite !is null) && (!pageComposite.isDisposed())) {
+                pageComposite.dispose();
+            }
+            pageComposite = new Composite(shell, SWT.NONE);
+            pageComposite.setLayout(new GridLayout());
+            pageComposite.setLayoutData(new GridData());
+            if (pageNum++ % 2 == 0) {
+                Table table = new Table(pageComposite, SWT.BORDER);
+                table.setLayoutData(new GridData());
+                for (int i = 0; i < 5; i++) {
+                    (new TableItem(table, SWT.NONE)).setText("table item " ~ to!(char[])(i));
+                }
+            } else {
+                (new Button(pageComposite, SWT.RADIO)).setText("radio");
+            }
+            shell.layout(true);
+        }
+    });
+
+    shell.open();
+    while (!shell.isDisposed()) {
+        if (!display.readAndDispatch())
+            display.sleep();
+    }
+    display.dispose();
+}
--- a/rakefile	Sat Mar 21 11:33:57 2009 +0100
+++ b/rakefile	Sun Mar 22 15:17:04 2009 +0100
@@ -8,20 +8,29 @@
 
 #DMD="c:\\project\\dmd-2.026\\dmd\\windows\\bin\\dmd.exe"
 DMD="dmd"
-LOCALOBJDIR="obj"
-OBJDIR="obj"
-DIMPDIR="imp"
-RSPNAME="rsp"
+OBJDIR  =File.expand_path("obj")
+DIMPDIR =File.expand_path("imp")
+LIBDIR  =File.expand_path("lib")
+RSPNAME =File.expand_path("rsp")
 ALL_RESDIRS= [ "base/res", "res" ]
 
+LOG_STDOUT = File.expand_path("olog.txt")
+LOG_STDERR = File.expand_path("elog.txt")
+
 def isWindows
     Config::CONFIG['host_os'] =~ /mswin/
 end
 
 if isWindows
     ALL_RESDIRS << "org.eclipse.swt.win32.win32.x86/res"
+    LIBEXT = ".lib"
+    OBJEXT = ".obj"
+    EXEEXT = ".exe"
 else
     ALL_RESDIRS << "org.eclipse.swt.gtk.linux.x86/res"
+    LIBEXT = ".a"
+    OBJEXT = ".o"
+    EXEEXT = ""
 end
 
 class String
@@ -34,22 +43,19 @@
     end
 end
 
-def buildTree( basedir, srcdir, resdir, dcargs="" )
+def buildTree( basedir, srcdir, resdir, dcargs="", libname="" )
     puts "Building #{basedir}/#{srcdir}"
 
-    objdir_abs = File.expand_path( OBJDIR )
-    dimpdir_abs = File.expand_path( DIMPDIR )
     resdir_abs = File.expand_path( File.join( basedir, resdir ))
     srcdir_abs = File.expand_path( File.join( basedir, srcdir ))
-    rspfile_abs = File.expand_path( RSPNAME )
 
-    FileUtils.mkdir_p dimpdir_abs
-    FileUtils.mkdir_p objdir_abs
+    FileUtils.mkdir_p DIMPDIR
+    FileUtils.mkdir_p OBJDIR
 
-    rsp = File.new( rspfile_abs, "w+" )
+    rsp = File.new( RSPNAME, "w+" )
     rsp.puts "-H"
     rsp.puts "-I#{srcdir_abs.to_path}"
-    rsp.puts "-I#{dimpdir_abs.to_path}"
+    rsp.puts "-I#{DIMPDIR.to_path}"
     rsp.puts "-J#{resdir_abs.to_path}"
     if dcargs.size > 0 then
         rsp.puts dcargs
@@ -68,9 +74,9 @@
 
     Dir.chdir(basedir) do
         if isWindows
-            cmd = "#{DMD} @#{rspfile_abs.to_path}"
+            cmd = "#{DMD} @#{RSPNAME.to_path}"
         else
-            cmd = "cat #{rspfile_abs.to_path} | xargs #{DMD}"
+            cmd = "cat #{RSPNAME.to_path} | xargs #{DMD}"
         end
         sh cmd, :verbose => false do |ok, res|
             if !ok then
@@ -87,17 +93,40 @@
 
     Find.find( srcdir_abs ) do |path|
         if FileTest.file?(path) && path =~ /\.di$/ then
-            trgfile = File.join( dimpdir_abs, path[ srcdir_abs.length+1 .. -1 ])
+            trgfile = File.join( DIMPDIR, path[ srcdir_abs.length+1 .. -1 ])
             FileUtils.mkdir_p File.dirname(trgfile)
             FileUtils.mv path, trgfile
         end
     end
 
+    libobjs = Array.new
     srcdirparts = split_all( srcdir_abs ).length
     Find.find( srcdir_abs ) do |path|
         if FileTest.file?(path) && path =~ /\.o(bj)?$/ then
             trgfile = split_all( path )[ srcdirparts .. -1 ].join( "-" )
-            FileUtils.mv path, File.join( objdir_abs, trgfile )
+            FileUtils.mv path, File.join( OBJDIR, trgfile )
+            libobjs << File.join( OBJDIR, trgfile )
+        end
+    end
+
+    if libname.size == 0
+        libname = basedir
+    end
+    createLib( libobjs, libname )
+end
+
+def createLib( libobjs, name )
+    FileUtils.mkdir_p LIBDIR.to_path
+    rsp = File.new( RSPNAME, "w+" )
+    rsp.puts "-p512 -n -c #{LIBDIR}/#{name}#{LIBEXT}"
+    libobjs.each do |obj|
+        rsp.puts obj.to_path
+    end
+    rsp.close
+    cmd = "lib @#{RSPNAME} > #{LOG_STDOUT}"
+    sh cmd, :verbose => false do |ok, res|
+        if !ok then
+            raise "librarian error"
         end
     end
 
@@ -108,12 +137,15 @@
     puts "Cleaning"
     FileUtils.rm_rf DIMPDIR
     FileUtils.rm_rf OBJDIR
-    FileUtils.rm_rf RSPNAME
+    FileUtils.rm_rf LIBDIR
+    FileUtils.rm RSPNAME
+    FileUtils.rm LOG_STDOUT
+    FileUtils.rm LOG_STDERR
 end
 
 desc "Build Base (Java Environment and Helpers)"
 task :base do
-    buildTree( "base", "src", "res" )
+    buildTree( "base", "src", "res", "", "dwt-base" )
 end
 
 desc "Build SWT"
@@ -147,7 +179,7 @@
 desc "Build JFace.Text"
 task :jfacetext do
     buildTree( "org.eclipse.text", "src", "res" )
-    buildTree( "org.eclipse.jface.text", "projection", "res", "-Isrc" )
+    buildTree( "org.eclipse.jface.text", "projection", "res", "-Isrc", "org.eclipse.jface.text.projection" )
     buildTree( "org.eclipse.jface.text", "src", "res" )
 end