comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet111.d @ 44:ed96ea2a2764

First swt win snippets are buiding with d2+phobos
author Frank Benoit <benoit@tionex.de>
date Wed, 25 Mar 2009 18:31:01 +0100
parents 69b1fa94a4a8
children
comparison
equal deleted inserted replaced
43:b98647bc0aef 44:ed96ea2a2764
32 import org.eclipse.swt.widgets.Listener; 32 import org.eclipse.swt.widgets.Listener;
33 import org.eclipse.swt.widgets.Event; 33 import org.eclipse.swt.widgets.Event;
34 import org.eclipse.swt.layout.FillLayout; 34 import org.eclipse.swt.layout.FillLayout;
35 import org.eclipse.swt.custom.TreeEditor; 35 import org.eclipse.swt.custom.TreeEditor;
36 36
37 import java.lang.all : String, substring, Math; 37 import java.lang.all;
38 38
39 import tango.util.Convert;
40 import tango.util.log.Trace;
41 version(JIVE){ 39 version(JIVE){
42 import jive.stacktrace; 40 import jive.stacktrace;
43 } 41 }
44 42
45 void main () { 43 void main () {
117 Shell shell = new Shell (display); 115 Shell shell = new Shell (display);
118 shell.setLayout (new FillLayout ()); 116 shell.setLayout (new FillLayout ());
119 tree = new Tree (shell, SWT.BORDER); 117 tree = new Tree (shell, SWT.BORDER);
120 for (int i=0; i<16; i++) { 118 for (int i=0; i<16; i++) {
121 TreeItem itemI = new TreeItem (tree, SWT.NONE); 119 TreeItem itemI = new TreeItem (tree, SWT.NONE);
122 itemI.setText ("Item " ~ to!(char[])(i)); 120 itemI.setText (Format("Item {}", i));
123 for (int j=0; j<16; j++) { 121 for (int j=0; j<16; j++) {
124 TreeItem itemJ = new TreeItem (itemI, SWT.NONE); 122 TreeItem itemJ = new TreeItem (itemI, SWT.NONE);
125 itemJ.setText ("Item " ~ to!(char[])(j) ); 123 itemJ.setText ( Format("Item {}", j) );
126 } 124 }
127 } 125 }
128 TreeItem [] lastItem = new TreeItem [1]; 126 TreeItem [] lastItem = new TreeItem [1];
129 TreeEditor editor = new TreeEditor (tree); 127 TreeEditor editor = new TreeEditor (tree);
130 tree.addListener (SWT.Selection, dgListener( &handleSelection, lastItem, editor )); 128 tree.addListener (SWT.Selection, dgListener( &handleSelection, lastItem, editor ));