Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet67.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 |
---|---|
27 import org.eclipse.swt.widgets.ToolItem; | 27 import org.eclipse.swt.widgets.ToolItem; |
28 import org.eclipse.swt.widgets.Menu; | 28 import org.eclipse.swt.widgets.Menu; |
29 import org.eclipse.swt.widgets.MenuItem; | 29 import org.eclipse.swt.widgets.MenuItem; |
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 java.lang.all; | |
32 | 33 |
33 import tango.util.Convert; | 34 version(Tango){ |
35 import tango.util.Convert; | |
36 } else { // Phobos | |
37 import std.conv; | |
38 } | |
34 | 39 |
35 void main () { | 40 void main () { |
36 Display display = new Display (); | 41 Display display = new Display (); |
37 Shell shell = new Shell (display); | 42 Shell shell = new Shell (display); |
38 ToolBar toolBar = new ToolBar (shell, SWT.NONE); | 43 ToolBar toolBar = new ToolBar (shell, SWT.NONE); |
39 Menu menu = new Menu (shell, SWT.POP_UP); | 44 Menu menu = new Menu (shell, SWT.POP_UP); |
40 for (int i=0; i<8; i++) { | 45 for (int i=0; i<8; i++) { |
41 MenuItem item = new MenuItem (menu, SWT.PUSH); | 46 MenuItem item = new MenuItem (menu, SWT.PUSH); |
42 item.setText ("Item " ~ to!(char[])(i)); | 47 item.setText ("Item " ~ to!(String)(i)); |
43 } | 48 } |
44 ToolItem item = new ToolItem (toolBar, SWT.DROP_DOWN); | 49 ToolItem item = new ToolItem (toolBar, SWT.DROP_DOWN); |
45 item.addListener (SWT.Selection, new class Listener { | 50 item.addListener (SWT.Selection, new class Listener { |
46 void handleEvent (Event event) { | 51 void handleEvent (Event event) { |
47 if (event.detail == SWT.ARROW) { | 52 if (event.detail == SWT.ARROW) { |