Mercurial > projects > dwt-samples
view novocode/InternalShellExample.d @ 179:89de7ff0752c default tip
Add JFace snippet Snippet054NativeControlsInViewers, thanks to WasserDragoon
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 29 Apr 2009 11:01:41 +0200 |
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(); }