Mercurial > projects > dwt-linux
annotate helloworld.d @ 64:42e997034df9
Label
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 12 Jan 2008 15:16:49 +0100 |
parents | 6537a52fde85 |
children |
rev | line source |
---|---|
36
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
1 module helloworld; |
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
2 |
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
3 import dwt.SWT; |
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
4 import dwt.widgets.Display; |
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
5 import dwt.widgets.Shell; |
58
a5c274fa5af9
extended helloworld crashing
Frank Benoit <benoit@tionex.de>
parents:
54
diff
changeset
|
6 import dwt.widgets.Composite; |
a5c274fa5af9
extended helloworld crashing
Frank Benoit <benoit@tionex.de>
parents:
54
diff
changeset
|
7 import dwt.widgets.Button; |
60 | 8 import dwt.widgets.Text; |
36
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
9 |
54 | 10 import tango.io.Stdout; |
11 import tango.math.Math; | |
12 import tango.text.convert.Format; | |
13 import tango.util.Convert; | |
14 import tango.util.PathUtil; | |
15 import dwt.graphics.Device; | |
16 import dwt.graphics.ImageData; | |
60 | 17 import dwt.events.SelectionListener; |
18 import dwt.events.SelectionEvent; | |
54 | 19 |
20 | |
21 import dwt.accessibility.AccessibleObject; | |
22 import dwt.accessibility.AccessibleFactory; | |
23 import dwt.SWT; | |
24 import dwt.dwthelper.File; | |
25 import dwt.widgets.Display; | |
26 import dwt.internal.Library; | |
27 import dwt.internal.Platform; | |
28 import dwt.internal.image.PngChunk; | |
29 import dwt.internal.image.JPEGFileFormat; | |
30 import dwt.internal.gtk.OS; | |
31 | |
32 import jive.stacktrace; | |
33 | |
36
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
34 void main(){ |
54 | 35 |
36 TraceConfig.throwOnAll = true; | |
37 try{ | |
60 | 38 |
39 File.static_this(); | |
40 Library.static_this(); | |
41 Platform.static_this(); | |
42 OS.static_this(); | |
43 SWT.static_this(); | |
44 AccessibleObject.static_this(); | |
45 AccessibleFactory.static_this(); | |
46 ImageData.static_this(); | |
47 Device.static_this(); | |
48 Display.static_this(); | |
49 PngChunk.static_this(); | |
50 JPEGFileFormat.static_this(); | |
36
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
51 |
60 | 52 Display display = new Display(); |
53 Shell shell = new Shell(display); | |
54 shell.setSize(300, 200); | |
55 shell.setText("Simple SWT Sample"); | |
56 auto btn = new Button( shell, SWT.PUSH ); | |
57 btn.setBounds(40, 50, 100, 50); | |
58 btn.setText( "hey" ); | |
59 | |
60 auto txt = new Text(shell, SWT.BORDER); | |
61 txt.setBounds(170, 50, 100, 40); | |
54 | 62 |
60 | 63 btn.addSelectionListener(new class () SelectionListener { |
64 public void widgetSelected(SelectionEvent event) { | |
65 txt.setText("No problem"); | |
66 } | |
67 public void widgetDefaultSelected(SelectionEvent event) { | |
68 txt.setText("No worries!"); | |
69 } | |
70 }); | |
71 | |
72 shell.open(); | |
54 | 73 Stdout.formatln( "loop entered" ); |
74 while (!shell.isDisposed()) { | |
75 if (!display.readAndDispatch()) { | |
76 display.sleep(); | |
77 } | |
36
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
78 } |
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
79 } |
54 | 80 catch (Exception e) |
81 { | |
82 Stdout.formatln (e.toString); | |
83 } | |
36
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
84 } |
f0cac58ac62b
added helloworld, certainly not yet compiling/working
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
85 |