Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java36
1 files changed, 27 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java
index e0babbfe6f..85ea33c175 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java
@@ -1,13 +1,13 @@
package org.eclipse.swt.dnd;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
class TreeDragUnderEffect extends DragUnderEffect {
private Tree tree;
@@ -36,16 +36,34 @@ void show(int effect, int x, int y) {
private TreeItem findItem(int x , int y){
Point coordinates = new Point(x, y);
coordinates = tree.toControl(coordinates);
+ Rectangle area = tree.getClientArea();
+ if (!area.contains(coordinates)) return null;
+
TreeItem item = tree.getItem(coordinates);
if (item != null) return item;
- Rectangle area = tree.getClientArea();
for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = tree.toControl(coordinates);
+ coordinates = new Point(x1, coordinates.y);
item = tree.getItem(coordinates);
if (item != null) return item;
}
+ // Check if we are just below the last item of the tree
+ coordinates = new Point(x, y);
+ coordinates = tree.toControl(coordinates);
+ if (coordinates.y > area.y + area.height - tree.getItemHeight()) {;
+ int y1 = area.y + area.height - tree.getItemHeight();
+ coordinates = new Point(coordinates.x, y1);
+
+ item = tree.getItem(coordinates);
+ if (item != null) return item;
+
+ // Scan across the width of the tree just above the bottom..
+ for (int x1 = area.x; x1 < area.x + area.width; x1++) {
+ coordinates = new Point(x1, y1);
+ item = tree.getItem(coordinates);
+ if (item != null) return item;
+ }
+ }
return null;
}
private void setDragUnderEffect(int effect, TreeItem item) {
@@ -97,4 +115,4 @@ private void setDropSelection (TreeItem item) {
}
}
-} \ No newline at end of file
+}

Back to the top