# HG changeset patch # User Frank Benoit # Date 1208371010 -7200 # Node ID cca98050305614cabe7c7f1384ae23f4d3405fad # Parent 6d1762e7ebb7ee5b85d3fd9fbadeb9ef75ef7f49 sync with dwt-linux, removed the simple.d diff -r 6d1762e7ebb7 -r cca980503056 dwt/DWTError.d --- a/dwt/DWTError.d Wed Apr 16 20:36:33 2008 +0200 +++ b/dwt/DWTError.d Wed Apr 16 20:36:50 2008 +0200 @@ -44,7 +44,6 @@ */ public class DWTError : PlatformException { - /** * The DWT error code, one of DWT.ERROR_*. */ @@ -54,7 +53,13 @@ * The underlying throwable that caused the problem, * or null if this information is not available. */ - public Exception throwable; + public Exception throwable( Exception e ){ + this.next = e; + return this.next; + } + public Exception throwable(){ + return this.next; + } //static final long serialVersionUID = 3833467327105808433L; @@ -129,7 +134,7 @@ */ public char[] getMessage () { if (throwable is null) - return super.toString (); + return super.toString(); return super.toString () ~ " (" ~ throwable.toString () ~ ")"; //$NON-NLS-1$ //$NON-NLS-2$ } @@ -152,9 +157,6 @@ Stderr.formatln( "{}", msg ); } } +} } -} - - - diff -r 6d1762e7ebb7 -r cca980503056 dwt/DWTException.d --- a/dwt/DWTException.d Wed Apr 16 20:36:33 2008 +0200 +++ b/dwt/DWTException.d Wed Apr 16 20:36:50 2008 +0200 @@ -35,7 +35,6 @@ */ public class DWTException : Exception { - /** * The DWT error code, one of DWT.ERROR_*. */ @@ -45,7 +44,14 @@ * The underlying throwable that caused the problem, * or null if this information is not available. */ - public Exception throwable; + public Exception throwable( Exception e ){ + this.next = e; + return this.next; + } + public Exception throwable(){ + return this.next; + } + //static final long serialVersionUID = 3257282552304842547L; @@ -119,8 +125,7 @@ * @return the error message string of this DWTException object */ public char[] getMessage () { - if (throwable is null) - return super.toString (); + if (throwable is null) return super.toString (); return super.toString () ~ " (" ~ throwable.toString () ~ ")"; //$NON-NLS-1$ //$NON-NLS-2$ } @@ -147,3 +152,4 @@ } + diff -r 6d1762e7ebb7 -r cca980503056 dwt/dwthelper/Runnable.d --- a/dwt/dwthelper/Runnable.d Wed Apr 16 20:36:33 2008 +0200 +++ b/dwt/dwthelper/Runnable.d Wed Apr 16 20:36:50 2008 +0200 @@ -3,10 +3,37 @@ */ module dwt.dwthelper.Runnable; + +import tango.core.Tuple; +import tango.core.Traits; + public interface Runnable { public abstract void run(); } +class _DgRunnableT(Dg,T...) : Runnable { + alias ParameterTupleOf!(Dg) DgArgs; + static assert( is(DgArgs == Tuple!(T)), + "Delegate args not correct" ); + + Dg dg; + T t; + + private this( Dg dg, T t ){ + this.dg = dg; + static if( T.length > 0 ){ + this.t = t; + } + } + + void run( ){ + dg(t); + } +} + +_DgRunnableT!(Dg,T) dgRunnable(Dg,T...)( Dg dg, T args ){ + return new _DgRunnableT!(Dg,T)(dg,args); +} \ No newline at end of file diff -r 6d1762e7ebb7 -r cca980503056 dwt/dwthelper/utils.d --- a/dwt/dwthelper/utils.d Wed Apr 16 20:36:33 2008 +0200 +++ b/dwt/dwthelper/utils.d Wed Apr 16 20:36:50 2008 +0200 @@ -777,7 +777,14 @@ ExceptionPrintStackTrace( e, Stderr ); } void ExceptionPrintStackTrace( Exception e, Print!(char) print ){ - print.formatln( "Exception in {}({}): {}", e.file, e.line, e.msg ); + Exception exception = e; + while( exception !is null ){ + print.formatln( "Exception in {}({}): {}", exception.file, exception.line, exception.msg ); + foreach( msg; exception.info ){ + print.formatln( "trc {}", msg ); + } + exception = exception.next; + } } interface Reader{ diff -r 6d1762e7ebb7 -r cca980503056 simple.d --- a/simple.d Wed Apr 16 20:36:33 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -module simple; - -import dwt.DWT; -import dwt.widgets.Display; -import dwt.widgets.Shell; -import dwt.widgets.Button; -import dwt.widgets.Text; - -import tango.io.Stdout; -import tango.util.log.Trace; -import tango.math.Math; -import tango.text.convert.Format; -import tango.util.Convert; -import tango.util.PathUtil; -import dwt.events.SelectionListener; -import dwt.events.SelectionEvent; - - -import dwt.DWT; -import dwt.widgets.Display; - -void main(){ - - try{ - Display display = new Display(); - Shell shell = new Shell(display); - shell.setSize(300, 200); - shell.setText("Simple DWT Sample"); - auto btn = new Button( shell, DWT.PUSH ); - btn.setBounds(40, 50, 100, 50); - btn.setText( "hey" ); - - auto txt = new Text(shell, DWT.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(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - } - catch (Exception e) { - Stdout.formatln ( "'{}', {}:{}", e.toString, e.file, e.line ); - } -} -