Differences between SWT and DWT

Package and Module renames

  • packages rename: "org.eclipse.swt" to "dwt"
  • packages rename: "org.eclipse" to "dwtx" for all non-swt packages (jface,...)
  • Renamed every "SWT" to "DWT".

Examples:

  • "org.eclipse.swt.widgets.Button" becomes "dwt.widgets.Button",
  • "org.eclipse.swt.SWT" becomes "dwt.DWT".


Widget getData, setData

All SWT widgets have the possibility to set and get a data values that are passed as Objects. DWT extends those for Strings explicitly and adds:

public void setDataStr( String value );
public void setDataStr( String key, String value );
public String getDataStr();
public String getDataStr( String value );

Strings passed as an argument can be null in DWT

Many of the SWT methods do accept the empty string, but not the null string. In D there is no such difference. This is the same for arrays of other type. This is, why many methods in DWT are made to accept the null argument. This is made by simply deactivating this check. If the error was documented in the associated JavaDoc, it is removed in DWT.

This looks typically like this:

// DWT extension: allow null for zero length string
//if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
Module/Class Method Info
dwt.custom.CCombo public int indexOf (String string, int start) linux,win
dwt.custom.CCombo public int indexOf (String string) linux,win
dwt.custom.CCombo public void add (String string, int index) linux,win
dwt.custom.CCombo public void add (String string) linux,win
dwt.custom.CCombo public void remove (String string) linux,win
dwt.custom.CCombo public void setItem (int index, String string) linux,win
dwt.custom.CCombo public void setItems (String [] items) linux,win
dwt.custom.CCombo public void setText (String string) linux,win
dwt.custom.CTabItem public override void setText (String string) linux,win
dwt.custom.PopupList public void setItems (String[] strings) linux,win
dwt.custom.StyledText public void append(String string) linux,win
dwt.custom.StyledText public void insert(String string) linux,win
dwt.custom.StyledText public void replaceStyleRanges(int start, int length, StyleRange[] ranges) linux,win
dwt.custom.StyledText public void replaceTextRange(int start, int length, String text) linux,win
dwt.custom.StyledText public void setStyleRanges(StyleRange[] ranges) linux,win
dwt.custom.StyledText public void setText(String text) linux,win
dwt.custom.TableTreeItem public void setText(int index, String text) linux,win
dwt.custom.TableTree public void setSelection (TableTreeItem[] items) linux,win
dwt.graphics.GC public void drawPolygon(int[] pointArray) linux,win
dwt.graphics.GC public void drawPolyline(int[] pointArray) linux,win
dwt.graphics.GC public void drawString (String str, int x, int y) linux,win
dwt.graphics.GC public void drawString(String str, int x, int y, bool isTransparent) linux,win
dwt.graphics.GC public void drawText(String str, int x, int y) linux,win
dwt.graphics.GC public void drawText(String str, int x, int y, bool isTransparent) linux,win
dwt.graphics.GC public void drawText (String str, int x, int y, int flags) linux,win
dwt.graphics.GC public void fillPolygon(int[] pointArray) linux,win
dwt.graphics.GC public Point stringExtent(String string) linux,win
dwt.graphics.GC public Point textExtent(String string) linux,win
dwt.graphics.GC public Point textExtent(String string, int flags) linux,win
dwt.program.Program public static Program findProgram(String extension) linux,win
dwt.widgets.Button public void setText (String string) linux,win
dwt.widgets.Combo public int indexOf (String string, int start) linux,win
dwt.widgets.Combo public int indexOf (String string) linux,win
dwt.widgets.Combo public void add (String string, int index) linux,win
dwt.widgets.Combo public void add (String string) linux,win
dwt.widgets.Combo public void remove (String string) linux,win
dwt.widgets.Combo public void setItem (int index, String string) linux,win
dwt.widgets.Combo public void setItems (String [] items) linux,win
dwt.widgets.Combo public void setText (String string) linux,win
dwt.widgets.CoolBar public void setItemLayout (int[] itemOrder, int[] wrapIndices, Point[] sizes) linux,win
dwt.widgets.Decorations public void setImages (Image [] images) linux,win
dwt.widgets.Decorations public void setText (String string) linux,win
dwt.widgets.Dialog public void setText (String string) linux,win
dwt.widgets.DirectoryDialog public void setMessage (String string) linux,win
dwt.widgets.Display public Object getData (String key) linux,win
dwt.widgets.Display public void setData (String key, Object value) linux,win
dwt.widgets.Group public void setText (String string) linux,win
dwt.widgets.Item public void setText (String string) linux,win
dwt.widgets.Label public void setText (String string) linux,win
dwt.widgets.Link public void setText (String string) linux,win
dwt.widgets.List public int indexOf (String string, int start) linux,win
dwt.widgets.List public int indexOf (String string) linux,win
dwt.widgets.List public void add (String string, int index) linux,win
dwt.widgets.List public void add (String string) linux,win
dwt.widgets.List public void deselect (int [] indices) linux,win
dwt.widgets.List public void remove (int [] indices) linux,win
dwt.widgets.List public void remove (String string) linux,win
dwt.widgets.List public void select (int [] indices) linux,win
dwt.widgets.List public void setItem (int index, String string) linux,win
dwt.widgets.List public void setItems (String [] items) linux,win
dwt.widgets.List public void setSelection(int[] indices) linux,win
dwt.widgets.List public void setSelection (String [] items) linux,win
dwt.widgets.MenuItem public override void setText (String string) linux,win
dwt.widgets.TabFolder public void setSelection (TabItem [] items) linux,win
dwt.widgets.TabItem public override void setText (String string) linux,win
dwt.widgets.TableColumn public void setText (String string) linux,win
dwt.widgets.TableItem public void setImage (Images[] images) linux,win
dwt.widgets.TableItem public void setText (String[] string) linux,win
dwt.widgets.TableItem public void setText (int index, String string) linux,win
dwt.widgets.TableItem public void setText (String string) linux,win
dwt.widgets.Table public void clear (int [] indices) linux,win
dwt.widgets.Table public void deselect (int [] indices) linux,win
dwt.widgets.Table public void remove (int [] indices) linux,win
dwt.widgets.Table public void select (int [] indices) linux,win
dwt.widgets.Table public void setColumnOrder (int [] order) linux,win
dwt.widgets.Table public void setSelection (int [] indices) linux,win
dwt.widgets.Table public void setSelection (TableItem [] items) linux,win
dwt.widgets.Text public void append (String string) linux,win
dwt.widgets.Text public void insert (String string) linux,win
dwt.widgets.Text public void setMessage (String message) linux,win
dwt.widgets.Text public void setText (String string) linux,win
dwt.widgets.ToolItem public override void setText (String string) linux,win
dwt.widgets.ToolTip public void setMessage (String string) linux,win
dwt.widgets.ToolTip public void setText (String string) linux,win
dwt.widgets.Tracker public void setRectangles (Rectangle [] rectangles) linux,win
dwt.widgets.TreeColumn public override void setText (String string) linux,win
dwt.widgets.TreeItem public void setImage (Image [] images) linux,win
dwt.widgets.TreeItem public void setText (int index, String string) linux,win
dwt.widgets.TreeItem public void setText (String [] strings) linux,win
dwt.widgets.Tree public void setColumnOrder (int [] order) linux,win
dwt.widgets.Tree public void setSelection (TreeItem [] items) linux,win
dwt.widgets.Widget public Object getData (String key) linux,win
dwt.widgets.Widget public void setData (String key, Object value) linux,win

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
  • dwt.dwthelper.Runnable has a dgRunnable template function to use delegates and to buffer arguments.
  • dwt.widgets.Listener has a dgListener template function to use delegates and to buffer arguments.