Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.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 |
---|---|
23 import org.eclipse.swt.widgets.Display; | 23 import org.eclipse.swt.widgets.Display; |
24 import org.eclipse.swt.widgets.Shell; | 24 import org.eclipse.swt.widgets.Shell; |
25 | 25 |
26 import java.lang.all; | 26 import java.lang.all; |
27 | 27 |
28 import tango.io.Stdout; | 28 version(Tango){ |
29 import tango.io.Stdout; | |
30 } else { // Phobos | |
31 import std.stdio; | |
32 } | |
29 | 33 |
30 void main (String [] args) { | 34 void main (String [] args) { |
31 Display display = new Display (); | 35 Display display = new Display (); |
32 Shell shell = new Shell (display); | 36 Shell shell = new Shell (display); |
33 final int time = 500; | 37 int time = 500; |
34 Runnable timer; | 38 Runnable timer; |
35 timer = dgRunnable( { | 39 timer = dgRunnable( { |
36 Point point = display.getCursorLocation (); | 40 Point point = display.getCursorLocation (); |
37 Rectangle rect = shell.getBounds (); | 41 Rectangle rect = shell.getBounds (); |
38 if (rect.contains (point)) { | 42 version(Tango){ |
39 Stdout("In\n"); | 43 if (rect.contains (point)) { |
40 } else { | 44 Stdout("In\n"); |
41 Stdout("Out\n"); | 45 } else { |
46 Stdout("Out\n"); | |
47 } | |
48 Stdout.flush(); | |
49 } else { // Phobos | |
50 if (rect.contains (point)) { | |
51 writeln("In"); | |
52 } else { | |
53 writeln("Out"); | |
54 } | |
42 } | 55 } |
43 Stdout.flush(); | |
44 display.timerExec (time, timer); | 56 display.timerExec (time, timer); |
45 }); | 57 }); |
46 display.timerExec (time, timer); | 58 display.timerExec (time, timer); |
47 shell.setSize (200, 200); | 59 shell.setSize (200, 200); |
48 shell.open (); | 60 shell.open (); |