# HG changeset patch # User John Reimer # Date 1225640112 28800 # Node ID 548a657378b8a3221207e260fc95570e7607ff22 # Parent c58389a70da3f05748c5bec99ee5a1917c3d9459 First Browser snippet added diff -r c58389a70da3 -r 548a657378b8 snippets/browser/Snippet136.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/snippets/browser/Snippet136.d Sun Nov 02 07:35:12 2008 -0800 @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Ported to the D Programming Language + * John Reimer + *******************************************************************************/ +module Snippet136; + +/* + * Browser example snippet: render HTML from memory + * + * For a list of all SWT example snippets see + * http://www.eclipse.org/swt/snippets/ + * + * @since 3.0 + */ +import dwt.DWT; +import dwt.DWTError; +import dwt.DWTException; + +import dwt.browser.Browser; +import dwt.widgets.Display; +import dwt.widgets.Shell; +import dwt.layout.FillLayout; + +import dwt.dwthelper.utils; + +import tango.io.Console; + +version(linux) { + version(build) + { + pragma(link, "stdc++"); + pragma(link, "xpcomglue"); + } +} + +void main() { + String html = "HTML Test"; + for (int i = 0; i < 100; i++) html ~= "

This is line

"; + html ~= ""; + + Display display = new Display(); + Shell shell = new Shell(display); + shell.setLayout(new FillLayout()); + Browser browser; + try { + browser = new Browser(shell, DWT.NONE); + } catch (DWTError e) { + Cout("Could not instatiate Browser.").newline; + return; + } + browser.setText(html); + shell.open(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) + display.sleep(); + } + display.dispose(); +} + + diff -r c58389a70da3 -r 548a657378b8 snippets/dsss.conf --- a/snippets/dsss.conf Sun Oct 26 14:53:47 2008 +0100 +++ b/snippets/dsss.conf Sun Nov 02 07:35:12 2008 -0800 @@ -136,7 +136,9 @@ version(Windows){ [ole/Snippet81.d] } - +version(linux) { + [browser/Snippet136.d] +} version(Derelict){ [opengl] type=subdir