Mercurial > projects > dwt-samples
view novocode/InternalShellExample.d @ 176:219f3c1087d1
Second browser test -- loads eclipse.org url
author | John Reimer <terminal.node@gmail.com> |
---|---|
date | Sun, 02 Nov 2008 08:12:48 -0800 |
parents | c58389a70da3 |
children |
line wrap: on
line source
module InternalShellExample; import dwt.std; import dwt.dwthelper.ByteArrayInputStream; import dwtx.novocode.ScaledImage; import dwtx.novocode.ishell.DesktopForm; import dwtx.novocode.ishell.InternalShell; const char[] res_prefix = "novocode.InternalShellExample."; void main() { Display display = new Display(); Shell shell = new Shell( display ); shell.setLayout( new FillLayout() ); shell.setImage( new Image( display, new ImageData( new ByteArrayInputStream( cast( byte[] ) import( res_prefix~"ishell.png" ) ) ) ) ); shell.setText( "Internal Shell Example" ); DesktopForm desktop = new DesktopForm( shell, DWT.NONE ); ScaledImage si = new ScaledImage( desktop, DWT.NONE ); si.setImage( new Image( display, new ImageData( new ByteArrayInputStream( cast( byte[] ) import( res_prefix~"bg.jpg" ) ) ) ) ); si.setImagePlacement( ScaledImage.IMAGE_PLACEMENT_TILE ); si.setLocation( 0, 0 ); si.setSize( desktop.getSize() ); desktop.addListener( DWT.Resize, new class( si ) Listener { ScaledImage si; this( ScaledImage si ) { this.si = si; } public void handleEvent(Event event) { si.setSize(desktop.getSize()); } }); InternalShell ishell = new InternalShell( desktop, DWT.SHELL_TRIM ); ishell.setText( "Internal Shell" ); shell.pack(); shell.open(); ishell.open(); while ( !shell.isDisposed ) { if ( !display.readAndDispatch() ) display.sleep(); } display.dispose(); }