DWT information, requirements and installation
History and packages:
- DWT - the initial port of SWT (3.0.2) by Shawn Liu (from now on know as "old dwt"). Windows only, Phobos
- Tioport – an attempt to port SWT automatically by Frank Benoit, Windows, Linux, Tango
- DWT-Win/DWT-Linux - a new manually port of SWT (3.3) by Frank Benoit and John Reimer (from now on known as "dwt"). This is the package you want. Windows, Linux, Tango
- DWT-Addons – Ports of JFace functionality and other high-level stuff building on top of dwt. Builds upon DWT-Win/DWT-Linux
- DWT-Samples - DWT examples and snippets. Perhaps additional tutorial sources. A wild growing examples collection. Builds upon DWT-Win/DWT-Linux
Ports available:
- win32-win32-x86
- gtk-linux-x86
Requirements:
D version:
- D 1.x
Compiler:
- DMD – known to work - http://www.digitalmars.com/d/1.0/changelog.html
- GDC – untested
Build system:
- DSSS – known to work - http://www.dsource.org/projects/dsss
- Bud/Build – untested (should work)
Runtime library:
Version system:
- Mercurial - http://www.selenic.com/mercurial/wiki/
DWT
- DWT-Win - http://www.dsource.org/projects/dwt-win
- DWT-Linux - http://www.dsource.org/projects/dwt-linux
Mercurial - http://www.selenic.com/mercurial/wiki/
Installation
Installation of DWT requires a D 1.x compiler, Tango and DSSS.
Mercurial is also recommended, but not required.
If you have all the prerequisites you can skip directly to step E. below.
A. Install D 1.x Compiler
There are several ways to get the D compiler. Two possible ways are:
- Download from DigitalMars (http://www.digitalmars.com/d/download.html) (Current version 1.028)
- Download Tango bundled with DMD - http://www.dsource.org/projects/tango/wiki/DmdDownloads. If you choose this option, obviously you can skip step B below, installing Tango.
Hints on installing DMD:
- Put the DMD files in a directory path without spaces
- Put dmd/bin in some environment variable to be able to access DMD from the command line/terminal
B. Install Tango
Instructions for installing Tango are here: http://www.dsource.org/projects/tango/wiki/TopicInstallTango
C. Install DSSS
- Download latest DSSS - http://svn.dsource.org/projects/dsss/downloads/
- Unpack DSSS in directory path without spaces
- Put dsss/bin in some environment variable to be able to access DSSS from the command line/terminal
- Open dsss/etc/rebuild/default with a text editor
- Change to one of the following:
- profile=dmd-win-tango
- profile=dmd-posix-tango
- Change the oneatatime option in the DSSS compiler profile (dmd-win-tango or dmd-posix-tango) to oneatatime=off (twice) (Recommended for faster builds)
D. Install Mercurial
For more info see here - http://www.dsource.org/projects/dwt/wiki/AccessMercurialRepo
E. Install DWT
- In the command line/terminal change to the directory you want to download DWT to
- Download DWT by running from the command line one of the following commands:
hg clone http://hg.dsource.org/projects/dwt-linux hg clone http://hg.dsource.org/projects/dwt-winYou may also like to check out the growing repository of samples, which work with all versions of DWT.hg clone http://hg.dsource.org/projects/dwt-samples
Automatically-generated snapshots of the latest source code are also available: - (Windows only) Download some additional libraries and put them in dmd/lib - dwt-win-importlibs.zip
- In the command line/terminal, change into the newly created directory dwt-linux or dwt-win
- Run "dsss build" to build DWT
DWT has changed it build type to source library so if you want it to behave as previously (building a .lib/.a file) you have to open "dsss.conf" in the top directory of DWT and remove this: "type=sourcelibrary".
- Run "dsss install" to install DWT. After the installation process you should be able to build a dwt application with dsss anywhere in your system and you DON'T have to rename anything.
F. Testing your DWT installation
- You can test DWT with the following example (a similar example can be found in the dwt-samples project, dwtexamples/simple.d):
module main; import dwt.widgets.Display; import dwt.widgets.Shell; void main () { Display display = new Display; Shell shell = new Shell(display); shell.setText = "Hello DWT World"; shell.open; while (!shell.isDisposed) if (!display.readAndDispatch) display.sleep; display.dispose; } - Put the above code in a new file "main.d" into another directory
- Create a minimal file named "dsss.conf" in the same directory as above
[main.d]
Windows only, optional add this line to "dsss.conf" to suppress the console window
buildflags+=-L/SUBSYSTEM:windows:5
- Run "dsss build" in the same directory as above
In case you get linker errors verify that:- on windows, that the location of the import libs is known to dsss also. To be sure you can give that path to dsss with -S"path"
- that you did "dsss install" after building dwt
- Run main
Further Information
Differences between SWT and DWT:
- Change all package name from "org.eclipse.swt" to "dwt".
- Change every "SWT" to "DWT".
- Examples:
- "org.eclipse.swt.widgets.Button" becomes "dwt.widgets.Button",
- "org.eclipse.swt.SWT" becomes "dwt.DWT".
- "org.eclipse.swt.widgets.Button" becomes "dwt.widgets.Button",
Things added or changed in DWT:
- MessageBox can have null as parent to allow a MessageBox without a Shell
- There are five new static methods in MessageBox:
- showMessageBox
- showInfo
- showInformation (an alias to showInfo)
- showWarning
- showError
- Not everything has been ported yet.
API documentation:
The SWT API documentation works for DWT with minor changes:
http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/overview-summary.html
Snippets and examples: The SWT snippets and examples work for DWT with minor changes:
