Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet258.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 |
comparison
equal
deleted
inserted
replaced
111:b6e9904989ed | 112:9f4c18c268b2 |
---|---|
33 import org.eclipse.swt.widgets.Shell; | 33 import org.eclipse.swt.widgets.Shell; |
34 import org.eclipse.swt.widgets.Text; | 34 import org.eclipse.swt.widgets.Text; |
35 import org.eclipse.swt.widgets.ToolBar; | 35 import org.eclipse.swt.widgets.ToolBar; |
36 import org.eclipse.swt.widgets.ToolItem; | 36 import org.eclipse.swt.widgets.ToolItem; |
37 | 37 |
38 import tango.io.Stdout; | 38 version(Tango){ |
39 import tango.io.Stdout; | |
40 } else { // Phobos | |
41 import std.stdio; | |
42 } | |
39 | 43 |
40 void main() { | 44 void main() { |
41 auto display = new Display(); | 45 auto display = new Display(); |
42 auto shell = new Shell(display); | 46 auto shell = new Shell(display); |
43 shell.setLayout(new GridLayout(2, false)); | 47 shell.setLayout(new GridLayout(2, false)); |
50 auto item = new ToolItem (toolBar, SWT.PUSH); | 54 auto item = new ToolItem (toolBar, SWT.PUSH); |
51 item.setImage (image); | 55 item.setImage (image); |
52 item.addSelectionListener(new class SelectionAdapter { | 56 item.addSelectionListener(new class SelectionAdapter { |
53 public void widgetSelected(SelectionEvent e) { | 57 public void widgetSelected(SelectionEvent e) { |
54 text.setText(""); | 58 text.setText(""); |
55 Stdout("Search cancelled").newline; | 59 version(Tango){ |
60 Stdout("Search cancelled").newline; | |
61 } else { // Phobos | |
62 writeln("Search cancelled"); | |
63 } | |
56 } | 64 } |
57 }); | 65 }); |
58 } | 66 } |
59 text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); | 67 text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
60 text.setText("Search text"); | 68 text.setText("Search text"); |
61 text.addSelectionListener(new class SelectionAdapter { | 69 text.addSelectionListener(new class SelectionAdapter { |
62 public void widgetDefaultSelected(SelectionEvent e) { | 70 public void widgetDefaultSelected(SelectionEvent e) { |
63 if (e.detail == SWT.CANCEL) { | 71 version(Tango){ |
64 Stdout("Search cancelled").newline; | 72 if (e.detail == SWT.CANCEL) { |
65 } else { | 73 Stdout("Search cancelled").newline; |
66 Stdout("Searching for: ")(text.getText())("...").newline; | 74 } else { |
75 Stdout("Searching for: ")(text.getText())("...").newline; | |
76 } | |
77 } else { // Phobos | |
78 if (e.detail == SWT.CANCEL) { | |
79 writeln("Search cancelled"); | |
80 } else { | |
81 writeln("Searching for: " ~ text.getText() ~ "..."); | |
82 } | |
67 } | 83 } |
68 } | 84 } |
69 }); | 85 }); |
70 | 86 |
71 shell.pack(); | 87 shell.pack(); |