# HG changeset patch # User Jacob Carlborg # Date 1230726118 -3600 # Node ID 43123e716bdaa95ef3070e921a6cdd1327d03dff # Parent c2f1ba00473b90efaad38c549ecaec8a89309d1e Ported dwt.dnd.DropTargetEffect diff -r c2f1ba00473b -r 43123e716bda dwt/dnd/DropTargetEffect.d --- a/dwt/dnd/DropTargetEffect.d Wed Dec 31 13:17:35 2008 +0100 +++ b/dwt/dnd/DropTargetEffect.d Wed Dec 31 13:21:58 2008 +0100 @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg *******************************************************************************/ module dwt.dnd.DropTargetEffect; @@ -22,6 +25,8 @@ import dwt.widgets.TreeItem; import dwt.widgets.Widget; +import dwt.dnd.DropTargetAdapter; + /** * This class provides a default drag under effect during a drag and drop. @@ -56,7 +61,7 @@ * * @since 3.3 */ -public class DropTargetEffect extends DropTargetAdapter { +public class DropTargetEffect : DropTargetAdapter { Control control; /** @@ -69,7 +74,7 @@ *
  • ERROR_NULL_ARGUMENT - if the control is null
  • * */ - public DropTargetEffect(Control control) { + public this(Control control) { if (control is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); this.control = control; } @@ -94,11 +99,11 @@ * @return the item at the given x-y coordinate, or null if the coordinate is not in a selectable item */ public Widget getItem(int x, int y) { - if (control instanceof Table) { - return getItem((Table) control, x, y); + if (cast(Table) control) { + return getItem(cast(Table) control, x, y); } - if (control instanceof Tree) { - return getItem((Tree) control, x, y); + if (cast(Tree) control) { + return getItem(cast(Tree) control, x, y); } return null; } @@ -167,12 +172,12 @@ TreeItem parentItem = childItem.getParentItem(); int index = parentItem is null ? tree.indexOf(childItem) : parentItem.indexOf(childItem); if (index is 0) return parentItem; - TreeItem nextItem = parentItem is null ? tree.getItem(index-1) : parentItem.getItem(index-1); - int count = nextItem.getItemCount(); - while (count > 0 && nextItem.getExpanded()) { - nextItem = nextItem.getItem(count - 1); - count = nextItem.getItemCount(); + TreeItem nextItem_ = parentItem is null ? tree.getItem(index-1) : parentItem.getItem(index-1); + int count = nextItem_.getItemCount(); + while (count > 0 && nextItem_.getExpanded()) { + nextItem_ = nextItem_.getItem(count - 1); + count = nextItem_.getItemCount(); } - return nextItem; + return nextItem_; } } diff -r c2f1ba00473b -r 43123e716bda dwt/dnd/DropTargetListener.d --- a/dwt/dnd/DropTargetListener.d Wed Dec 31 13:17:35 2008 +0100 +++ b/dwt/dnd/DropTargetListener.d Wed Dec 31 13:21:58 2008 +0100 @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg *******************************************************************************/ module dwt.dnd.DropTargetListener; @@ -14,6 +17,8 @@ import dwt.internal.DWTEventListener; +import dwt.dnd.DropTargetEvent; + /** * The DropTargetListener class provides event notification to the application * for DropTarget events. @@ -35,7 +40,7 @@ * @see DropTargetEvent * */ -public interface DropTargetListener extends DWTEventListener { +public interface DropTargetListener : DWTEventListener { /** * The cursor has entered the drop target boundaries.