Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet49.d @ 112:9f4c18c268b2
Update to compile and execute with dmd 2.052.
author | kntroh |
---|---|
date | Wed, 16 Mar 2011 21:53:53 +0900 |
parents | 69b1fa94a4a8 |
children |
comparison
equal
deleted
inserted
replaced
111:b6e9904989ed | 112:9f4c18c268b2 |
---|---|
25 import org.eclipse.swt.widgets.Shell; | 25 import org.eclipse.swt.widgets.Shell; |
26 import org.eclipse.swt.widgets.ToolBar; | 26 import org.eclipse.swt.widgets.ToolBar; |
27 import org.eclipse.swt.widgets.ToolItem; | 27 import org.eclipse.swt.widgets.ToolItem; |
28 import org.eclipse.swt.widgets.Event; | 28 import org.eclipse.swt.widgets.Event; |
29 import org.eclipse.swt.widgets.Listener; | 29 import org.eclipse.swt.widgets.Listener; |
30 import java.lang.all; | |
30 | 31 |
31 import tango.util.Convert; | 32 version(Tango){ |
33 import tango.util.Convert; | |
34 } else { // Phobos | |
35 import std.conv; | |
36 } | |
32 | 37 |
33 void main () { | 38 void main () { |
34 Display display = new Display (); | 39 Display display = new Display (); |
35 Shell shell = new Shell (display); | 40 Shell shell = new Shell (display); |
36 ToolBar toolBar = new ToolBar (shell, SWT.WRAP); | 41 ToolBar toolBar = new ToolBar (shell, SWT.WRAP); |
37 for (int i=0; i<12; i++) { | 42 for (int i=0; i<12; i++) { |
38 ToolItem item = new ToolItem (toolBar, SWT.PUSH); | 43 ToolItem item = new ToolItem (toolBar, SWT.PUSH); |
39 item.setText ("Item " ~ to!(char[])(i)); | 44 item.setText ("Item " ~ to!(String)(i)); |
40 } | 45 } |
41 shell.addListener (SWT.Resize, new class Listener { | 46 shell.addListener (SWT.Resize, new class Listener { |
42 void handleEvent (Event e) { | 47 void handleEvent (Event e) { |
43 Rectangle rect = shell.getClientArea (); | 48 Rectangle rect = shell.getClientArea (); |
44 Point size = toolBar.computeSize (rect.width, SWT.DEFAULT); | 49 Point size = toolBar.computeSize (rect.width, SWT.DEFAULT); |