Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.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 | 536e43f63c81 |
comparison
equal
deleted
inserted
replaced
111:b6e9904989ed | 112:9f4c18c268b2 |
---|---|
33 import org.eclipse.swt.widgets.Event; | 33 import org.eclipse.swt.widgets.Event; |
34 import org.eclipse.swt.widgets.Listener; | 34 import org.eclipse.swt.widgets.Listener; |
35 import org.eclipse.swt.layout.FormLayout; | 35 import org.eclipse.swt.layout.FormLayout; |
36 import org.eclipse.swt.layout.FormData; | 36 import org.eclipse.swt.layout.FormData; |
37 import org.eclipse.swt.layout.FormAttachment; | 37 import org.eclipse.swt.layout.FormAttachment; |
38 import java.lang.all; | |
38 | 39 |
39 import tango.util.Convert; | 40 version(Tango){ |
41 import tango.util.Convert; | |
42 } else { // Phobos | |
43 import std.conv; | |
44 } | |
40 | 45 |
41 int itemCount; | 46 int itemCount; |
42 CoolItem createItem(CoolBar coolBar, int count) { | 47 CoolItem createItem(CoolBar coolBar, int count) { |
43 ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT); | 48 ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT); |
44 for (int i = 0; i < count; i++) { | 49 for (int i = 0; i < count; i++) { |
45 ToolItem item = new ToolItem(toolBar, SWT.PUSH); | 50 ToolItem item = new ToolItem(toolBar, SWT.PUSH); |
46 item.setText(to!(char[])(itemCount++) ~""); | 51 item.setText(to!(String)(itemCount++) ~""); |
47 } | 52 } |
48 toolBar.pack(); | 53 toolBar.pack(); |
49 Point size = toolBar.getSize(); | 54 Point size = toolBar.getSize(); |
50 CoolItem item = new CoolItem(coolBar, SWT.NONE); | 55 CoolItem item = new CoolItem(coolBar, SWT.NONE); |
51 item.setControl(toolBar); | 56 item.setControl(toolBar); |
55 } | 60 } |
56 | 61 |
57 void main () { | 62 void main () { |
58 | 63 |
59 Display display = new Display(); | 64 Display display = new Display(); |
60 final Shell shell = new Shell(display); | 65 Shell shell = new Shell(display); |
61 CoolBar coolBar = new CoolBar(shell, SWT.NONE); | 66 CoolBar coolBar = new CoolBar(shell, SWT.NONE); |
62 createItem(coolBar, 3); | 67 createItem(coolBar, 3); |
63 createItem(coolBar, 2); | 68 createItem(coolBar, 2); |
64 createItem(coolBar, 3); | 69 createItem(coolBar, 3); |
65 createItem(coolBar, 4); | 70 createItem(coolBar, 4); |