diff options
author | Felipe Heidrich <fheidric> | 2009-08-21 15:59:52 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2009-08-21 15:59:52 +0000 |
commit | b72a54c239832030fdc651f7ab7e2873109921f3 (patch) | |
tree | df89ea697fbfe1791d1105b6d96fcee267fe22f7 /bundles/org.eclipse.swt/Eclipse SWT Drag and Drop | |
parent | 494a07a91e999bc680c78e11c98014ab6f49ad58 (diff) | |
download | eclipse.platform.swt-b72a54c239832030fdc651f7ab7e2873109921f3.tar.gz eclipse.platform.swt-b72a54c239832030fdc651f7ab7e2873109921f3.tar.xz eclipse.platform.swt-b72a54c239832030fdc651f7ab7e2873109921f3.zip |
Bug 126158: [DND] Provide support for FEEDBACK_INSERT_BEFORE for drag under effects in table
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop')
3 files changed, 37 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java index c1a553154d..732438c7ca 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java @@ -150,13 +150,13 @@ public class DND { /** * DropTarget drag under effect: An insertion mark is shown before the item under the cursor; applies to - * trees (value is 2). + * tables and trees (value is 2). */ public static final int FEEDBACK_INSERT_BEFORE = 2; /** * DropTarget drag under effect: An insertion mark is shown after the item under the cursor; applies to - * trees (value is 4). + * tables and trees (value is 4). */ public static final int FEEDBACK_INSERT_AFTER = 4; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java index f4ab889ff1..a00e53baf1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java @@ -169,12 +169,12 @@ public class TableDropTargetEffect extends DropTargetEffect { } } if (path[0] != 0) { - int position = 0; + int position = -1; if ((effect & DND.FEEDBACK_SELECT) != 0) position = OS.GTK_TREE_VIEW_DROP_INTO_OR_BEFORE; - //if ((effect & DND.FEEDBACK_INSERT_BEFORE) != 0) position = OS.GTK_TREE_VIEW_DROP_BEFORE; - //if ((effect & DND.FEEDBACK_INSERT_AFTER) != 0) position = OS.GTK_TREE_VIEW_DROP_AFTER; - if (position != 0) { - OS.gtk_tree_view_set_drag_dest_row(handle, path[0], OS.GTK_TREE_VIEW_DROP_INTO_OR_BEFORE); + if ((effect & DND.FEEDBACK_INSERT_BEFORE) != 0) position = OS.GTK_TREE_VIEW_DROP_BEFORE; + if ((effect & DND.FEEDBACK_INSERT_AFTER) != 0) position = OS.GTK_TREE_VIEW_DROP_AFTER; + if (position != -1) { + OS.gtk_tree_view_set_drag_dest_row(handle, path[0], position); } else { OS.gtk_tree_view_set_drag_dest_row(handle, 0, OS.GTK_TREE_VIEW_DROP_BEFORE); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java index 6d27948cc1..7bc1db58ee 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java @@ -50,6 +50,7 @@ public class TableDropTargetEffect extends DropTargetEffect { int scrollIndex = -1; long scrollBeginTime; TableItem dropHighlight; + int iItemInsert = -1; /** * Creates a new <code>TableDropTargetEffect</code> to handle the drag under effect on the specified @@ -86,6 +87,7 @@ public class TableDropTargetEffect extends DropTargetEffect { scrollBeginTime = 0; scrollIndex = -1; dropHighlight = null; + iItemInsert = -1; } /** @@ -111,6 +113,15 @@ public class TableDropTargetEffect extends DropTargetEffect { OS.SendMessage(handle, OS.LVM_SETITEMSTATE, -1, lvItem); dropHighlight = null; } + if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(5, 1)) { + if (iItemInsert != -1) { + LVINSERTMARK plvim = new LVINSERTMARK (); + plvim.cbSize = LVINSERTMARK.sizeof; + plvim.iItem = -1; + OS.SendMessage(handle, OS.LVM_SETINSERTMARK, 0, plvim); + iItemInsert = -1; + } + } scrollBeginTime = 0; scrollIndex = -1; } @@ -200,5 +211,24 @@ public class TableDropTargetEffect extends DropTargetEffect { dropHighlight = null; } } + if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(5, 1)) { + if (pinfo.iItem != -1 && (effect & (DND.FEEDBACK_INSERT_BEFORE | DND.FEEDBACK_INSERT_AFTER)) != 0) { + LVINSERTMARK plvim = new LVINSERTMARK (); + plvim.cbSize = LVINSERTMARK.sizeof; + plvim.dwFlags = (effect & DND.FEEDBACK_INSERT_AFTER) != 0 ? OS.LVIM_AFTER : 0; + plvim.iItem = pinfo.iItem; + if (OS.SendMessage(handle, OS.LVM_SETINSERTMARK, 0, plvim) != 0) { + iItemInsert = pinfo.iItem; + } + } else { + if (iItemInsert != -1) { + LVINSERTMARK plvim = new LVINSERTMARK (); + plvim.cbSize = LVINSERTMARK.sizeof; + plvim.iItem = -1; + OS.SendMessage(handle, OS.LVM_SETINSERTMARK, 0, plvim); + iItemInsert = -1; + } + } + } } } |