# HG changeset patch # User Jacob Carlborg # Date 1230731868 -3600 # Node ID 23a31de4a3ab0893d3a8dcabeb761db0946dad95 # Parent b0e5cad3d9286f1cc3c607c9b4f02849fe6a1b85 Ported dwt.dnd.TableDropTargetEffect diff -r b0e5cad3d928 -r 23a31de4a3ab dwt/dnd/TableDropTargetEffect.d --- a/dwt/dnd/TableDropTargetEffect.d Wed Dec 31 14:48:35 2008 +0100 +++ b/dwt/dnd/TableDropTargetEffect.d Wed Dec 31 14:57:48 2008 +0100 @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg *******************************************************************************/ module dwt.dnd.TableDropTargetEffect; @@ -17,6 +20,11 @@ import dwt.widgets.Table; import dwt.widgets.TableItem; +import dwt.dnd.DND; +import dwt.dnd.DropTarget; +import dwt.dnd.DropTargetEffect; +import dwt.dnd.DropTargetEvent; + /** * This class provides a default drag under effect (eg. select, insert and scroll) * when a drag occurs over a Table. @@ -47,8 +55,8 @@ * * @since 3.3 */ -public class TableDropTargetEffect extends DropTargetEffect { - static final int SCROLL_HYSTERESIS = 150; // milli seconds +public class TableDropTargetEffect : DropTargetEffect { + static const int SCROLL_HYSTERESIS = 150; // milli seconds TableItem scrollItem; long scrollBeginTime; @@ -82,7 +90,7 @@ * * @param table the Table over which the user positions the cursor to drop the data */ - public TableDropTargetEffect(Table table) { + public this(Table table) { super(table); } @@ -156,16 +164,16 @@ * @see DND#FEEDBACK_SCROLL */ public void dragOver(DropTargetEvent event) { - Table table = (Table) control; + Table table = cast(Table) control; int effect = checkEffect(event.feedback); - TableItem item = (TableItem)getItem(table, event.x, event.y); + TableItem item = cast(TableItem)getItem(table, event.x, event.y); if ((effect & DND.FEEDBACK_SCROLL) is 0) { scrollBeginTime = 0; scrollItem = null; } else { - if (item !is null && item.equals(scrollItem) && scrollBeginTime !is 0) { + if (item !is null && item.opEquals(scrollItem) && scrollBeginTime !is 0) { if (System.currentTimeMillis() >= scrollBeginTime) { Rectangle area = table.getClientArea(); int headerHeight = table.getHeaderHeight(); @@ -192,6 +200,6 @@ } // store current effect for selection feedback - ((DropTarget)event.widget).feedback = effect; + (cast(DropTarget)event.widget).feedback = effect; } }