changeset 174:c58389a70da3

Added novocode internal shell example, thanks WasserDragoon
author Frank Benoit <benoit@tionex.de>
date Sun, 26 Oct 2008 14:53:47 +0100
parents 33d9146198b2
children 548a657378b8
files .hgignore novocode/InternalShellExample.d novocode/dsss.conf res/novocode.InternalShellExample.bg.jpg res/novocode.InternalShellExample.ishell.png
diffstat 5 files changed, 79 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Oct 26 14:53:07 2008 +0100
+++ b/.hgignore	Sun Oct 26 14:53:47 2008 +0100
@@ -25,6 +25,11 @@
 ^jface.text/dsss_imports
 ^jface.text/Simple$
 
+^novocode/dsss_objs
+^novocode/dsss.last
+^novocode/dsss_imports
+^novocode/InternalShellExample$
+
 ^examples/dsss_objs
 ^examples/dsss.last
 ^examples/dsss_imports
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/novocode/InternalShellExample.d	Sun Oct 26 14:53:47 2008 +0100
@@ -0,0 +1,48 @@
+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();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/novocode/dsss.conf	Sun Oct 26 14:53:47 2008 +0100
@@ -0,0 +1,26 @@
+# DWT dwt-samples/jface directory
+
+[*]
+debugflags+=-g -gc
+buildflags+=-J../res
+buildflags+=-I../../dwt-addons
+buildflags+=-J../../dwt-addons/res
+
+version(Windows) {
+    buildflags+=-I../../dwt-win
+    buildflags+=-J../../dwt-win/res
+
+    # if no console window is wanted/needed use -version=gui
+    version(gui) {
+        buildflags+= -L/SUBSYSTEM:windows:5
+    } else {
+        buildflags+= -L/SUBSYSTEM:console:5
+    }
+    buildflags+= -L/rc:..\dwt
+}
+version(Posix) {
+    buildflags+=-I../../dwt-linux
+    buildflags+=-J../../dwt-linux/res
+}
+
+[InternalShellExample.d]
Binary file res/novocode.InternalShellExample.bg.jpg has changed
Binary file res/novocode.InternalShellExample.ishell.png has changed