Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java
new file mode 100755
index 0000000000..5cd21361d0
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java
@@ -0,0 +1,61 @@
+package org.eclipse.swt.dnd;
+
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.win32.LVITEM;
+import org.eclipse.swt.internal.win32.OS;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ */
+
+class TableDragUnderEffect extends DragUnderEffect {
+ private Table table;
+ private TableItem currentItem;
+
+TableDragUnderEffect(Table table) {
+ this.table = table;
+}
+void show(int effect, int x, int y) {
+ TableItem item = findItem(x, y);
+ if (item == null) {
+ effect = DND.FEEDBACK_NONE;
+ }
+ setDragUnderEffect(effect, item);
+}
+private TableItem findItem(int x, int y){
+ if (table == null) return null;
+ Point coordinates = new Point(x, y);
+ coordinates = table.toControl(coordinates);
+ TableItem item = table.getItem(coordinates);
+ if (item != null) return item;
+
+ Rectangle area = table.getClientArea();
+ for (int x1 = area.x; x1 < area.x + area.width; x1++) {
+ coordinates = new Point(x1, y);
+ coordinates = table.toControl(coordinates);
+ item = table.getItem(coordinates);
+ if (item != null) return item;
+ }
+ return null;
+
+}
+private void setDragUnderEffect(int effect, TableItem item) {
+ if (currentItem != item) {
+ setDropSelection(item);
+ currentItem = item;
+ }
+}
+private void setDropSelection (TableItem item) {
+ LVITEM lvItem = new LVITEM ();
+ lvItem.stateMask = OS.LVIS_DROPHILITED;
+ // remove all drop highlighting
+ OS.SendMessage (table.handle, OS.LVM_SETITEMSTATE, -1, lvItem);
+ if (item != null) {
+ lvItem.state = OS.LVIS_DROPHILITED;
+ int index = table.indexOf(item);
+ OS.SendMessage (table.handle, OS.LVM_SETITEMSTATE, index, lvItem);
+ }
+}
+} \ No newline at end of file

Back to the top