Mercurial > projects > dwt-linux
view helloworld.d @ 64:42e997034df9
Label
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 12 Jan 2008 15:16:49 +0100 |
parents | 6537a52fde85 |
children |
line wrap: on
line source
module helloworld; import dwt.SWT; import dwt.widgets.Display; import dwt.widgets.Shell; import dwt.widgets.Composite; import dwt.widgets.Button; import dwt.widgets.Text; import tango.io.Stdout; import tango.math.Math; import tango.text.convert.Format; import tango.util.Convert; import tango.util.PathUtil; import dwt.graphics.Device; import dwt.graphics.ImageData; import dwt.events.SelectionListener; import dwt.events.SelectionEvent; import dwt.accessibility.AccessibleObject; import dwt.accessibility.AccessibleFactory; import dwt.SWT; import dwt.dwthelper.File; import dwt.widgets.Display; import dwt.internal.Library; import dwt.internal.Platform; import dwt.internal.image.PngChunk; import dwt.internal.image.JPEGFileFormat; import dwt.internal.gtk.OS; import jive.stacktrace; void main(){ TraceConfig.throwOnAll = true; try{ File.static_this(); Library.static_this(); Platform.static_this(); OS.static_this(); SWT.static_this(); AccessibleObject.static_this(); AccessibleFactory.static_this(); ImageData.static_this(); Device.static_this(); Display.static_this(); PngChunk.static_this(); JPEGFileFormat.static_this(); Display display = new Display(); Shell shell = new Shell(display); shell.setSize(300, 200); shell.setText("Simple SWT Sample"); auto btn = new Button( shell, SWT.PUSH ); btn.setBounds(40, 50, 100, 50); btn.setText( "hey" ); auto txt = new Text(shell, SWT.BORDER); txt.setBounds(170, 50, 100, 40); btn.addSelectionListener(new class () SelectionListener { public void widgetSelected(SelectionEvent event) { txt.setText("No problem"); } public void widgetDefaultSelected(SelectionEvent event) { txt.setText("No worries!"); } }); shell.open(); Stdout.formatln( "loop entered" ); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } catch (Exception e) { Stdout.formatln (e.toString); } }