Mercurial > projects > dwt-mac
changeset 109:23a31de4a3ab
Ported dwt.dnd.TableDropTargetEffect
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Wed, 31 Dec 2008 14:57:48 +0100 |
parents | b0e5cad3d928 |
children | 2fb76eb49f04 |
files | dwt/dnd/TableDropTargetEffect.d |
diffstat | 1 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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 <doob@me.com> *******************************************************************************/ 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 <code>Table</code>. @@ -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 <code>Table</code> 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; } }