Mercurial > projects > dwt-samples
changeset 12:47a66440dddd
made the resources for Snippet258 included at compile time
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 15 Feb 2008 00:17:21 +0100 |
parents | b61e7baf0574 |
children | 4406de6f216f |
files | dsss.conf dwtsnippets/text/Snippet258.d |
diffstat | 2 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/dsss.conf Thu Feb 14 13:04:14 2008 -0800 +++ b/dsss.conf Fri Feb 15 00:17:21 2008 +0100 @@ -1,12 +1,19 @@ [*] -buildflags+=-g -gc -debug +debugflags+=-g -gc -debug + +#used for dwtsnippets/text/Snippet258 +buildflags+=-Jdwtsnippets/images + version(Windows){ #buildflags+= -L/SUBSYSTEM:windows:5 buildflags+= -L/SUBSYSTEM:console:5 } + # The linker error work around -buildflags+= -L-lDD-tango-util +version(linux){ + buildflags+= -L-lDD-tango-util +} [dwtexamples/simple.d] [dwtexamples/helloworld/HelloWorld1.d]
--- a/dwtsnippets/text/Snippet258.d Thu Feb 14 13:04:14 2008 -0800 +++ b/dwtsnippets/text/Snippet258.d Fri Feb 15 00:17:21 2008 +0100 @@ -18,9 +18,9 @@ * * For a list of all SWT example snippets see * http://www.eclipse.org/swt/snippets/ - * + * * @since 3.3 - */ + */ import dwt.DWT; import dwt.graphics.Image; import dwt.widgets.Display; @@ -32,18 +32,19 @@ import dwt.layout.GridData; import dwt.events.SelectionAdapter; import dwt.events.SelectionEvent; - +import dwt.graphics.ImageData; +import dwt.dwthelper.ByteArrayInputStream; import tango.io.Stdout; void main() { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(2, false)); - + final Text text = new Text(shell, DWT.SEARCH | DWT.CANCEL); Image image = null; if ((text.getStyle() & DWT.CANCEL) == 0) { - image = new Image (display, "../images/cancel.gif"); + image = new Image (display, new ImageData(new ByteArrayInputStream( cast(byte[]) import("cancel.gif" )))); ToolBar toolBar = new ToolBar (shell, DWT.FLAT); ToolItem item = new ToolItem (toolBar, DWT.PUSH); item.setImage (image);