Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet276.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 | 536e43f63c81 |
comparison
equal
deleted
inserted
replaced
111:b6e9904989ed | 112:9f4c18c268b2 |
---|---|
27 import org.eclipse.swt.widgets.Label; | 27 import org.eclipse.swt.widgets.Label; |
28 import org.eclipse.swt.widgets.Listener; | 28 import org.eclipse.swt.widgets.Listener; |
29 import org.eclipse.swt.widgets.Shell; | 29 import org.eclipse.swt.widgets.Shell; |
30 | 30 |
31 import java.lang.all; | 31 import java.lang.all; |
32 import tango.io.Stdout; | 32 version(Tango){ |
33 import tango.io.Stdout; | |
34 } else { // Phobos | |
35 import std.stdio; | |
36 } | |
33 | 37 |
34 void main (String[] args) { | 38 void main (String[] args) { |
35 Display display = new Display (); | 39 Display display = new Display (); |
36 Shell shell = new Shell (display); | 40 Shell shell = new Shell (display); |
37 shell.setBounds (200, 200, 400, 400); | 41 shell.setBounds (200, 200, 400, 400); |
38 Label label = new Label (shell, SWT.NONE); | 42 Label label = new Label (shell, SWT.NONE); |
39 label.setText ("click in shell to print display-relative coordinate"); | 43 label.setText ("click in shell to print display-relative coordinate"); |
40 Listener listener = dgListener( (Event event) { | 44 Listener listener = dgListener( (Event event) { |
41 Point point = new Point (event.x, event.y); | 45 Point point = new Point (event.x, event.y); |
42 Stdout(display.map (cast(Control)event.widget, null, point)).newline().flush(); | 46 version(Tango){ |
47 Stdout(display.map (cast(Control)event.widget, null, point)).newline().flush(); | |
48 } else { // Phobos | |
49 writeln(display.map (cast(Control)event.widget, null, point)); | |
50 } | |
43 }); | 51 }); |
44 shell.addListener (SWT.MouseDown, listener); | 52 shell.addListener (SWT.MouseDown, listener); |
45 label.addListener (SWT.MouseDown, listener); | 53 label.addListener (SWT.MouseDown, listener); |
46 label.pack (); | 54 label.pack (); |
47 shell.open (); | 55 shell.open (); |