Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet193.d @ 112:9f4c18c268b2
Update to compile and execute with dmd 2.052.
author | kntroh |
---|---|
date | Wed, 16 Mar 2011 21:53:53 +0900 |
parents | 4e5843b771cc |
children |
comparison
equal
deleted
inserted
replaced
111:b6e9904989ed | 112:9f4c18c268b2 |
---|---|
30 import org.eclipse.swt.widgets.Listener; | 30 import org.eclipse.swt.widgets.Listener; |
31 import org.eclipse.swt.widgets.Event; | 31 import org.eclipse.swt.widgets.Event; |
32 import org.eclipse.swt.layout.RowLayout; | 32 import org.eclipse.swt.layout.RowLayout; |
33 import org.eclipse.swt.layout.RowData; | 33 import org.eclipse.swt.layout.RowData; |
34 | 34 |
35 import tango.util.Convert; | 35 version(Tango){ |
36 import tango.io.Stdout; | 36 import tango.util.Convert; |
37 import tango.io.Stdout; | |
38 } else { // Phobos | |
39 import std.conv; | |
40 import std.stdio; | |
41 } | |
37 | 42 |
38 import java.lang.all; | 43 import java.lang.all; |
39 | 44 |
40 | 45 |
41 void main() { | 46 void main() { |
42 Display display = new Display(); | 47 Display display = new Display(); |
43 Shell shell = new Shell(display); | 48 Shell shell = new Shell(display); |
44 shell.setLayout(new RowLayout(SWT.HORIZONTAL)); | 49 shell.setLayout(new RowLayout(SWT.HORIZONTAL)); |
45 final Tree tree = new Tree(shell, SWT.BORDER | SWT.CHECK); | 50 Tree tree = new Tree(shell, SWT.BORDER | SWT.CHECK); |
46 tree.setLayoutData(new RowData(-1, 300)); | 51 tree.setLayoutData(new RowData(-1, 300)); |
47 tree.setHeaderVisible(true); | 52 tree.setHeaderVisible(true); |
48 TreeColumn column = new TreeColumn(tree, SWT.LEFT); | 53 TreeColumn column = new TreeColumn(tree, SWT.LEFT); |
49 column.setText("Column 0"); | 54 column.setText("Column 0"); |
50 column = new TreeColumn(tree, SWT.CENTER); | 55 column = new TreeColumn(tree, SWT.CENTER); |
85 } | 90 } |
86 } | 91 } |
87 } | 92 } |
88 Listener listener = new class Listener { | 93 Listener listener = new class Listener { |
89 public void handleEvent(Event e) { | 94 public void handleEvent(Event e) { |
90 Stdout.print("Move "~e.widget.toString).newline; | 95 version(Tango){ |
96 Stdout.print("Move "~e.widget.toString).newline; | |
97 } else { | |
98 writeln("Move "~e.widget.toString); | |
99 } | |
91 } | 100 } |
92 }; | 101 }; |
93 TreeColumn[] columns = tree.getColumns(); | 102 TreeColumn[] columns = tree.getColumns(); |
94 for (int i = 0; i < columns.length; i++) { | 103 for (int i = 0; i < columns.length; i++) { |
95 columns[i].setWidth(100); | 104 columns[i].setWidth(100); |