summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuong Nguyen <dnguyen>2008-02-01 22:10:59 +0000
committerDuong Nguyen <dnguyen>2008-02-01 22:10:59 +0000
commitea9e9e9b15cb9bb6ee79b2bb765a1332130e536a (patch)
treeed27069e8c477cf820a5f821dfce10bd6c750cb7
parentb48f47315274da6406e90da95302589c7ab9c724 (diff)
downloadeclipse.platform.swt-ea9e9e9b15cb9bb6ee79b2bb765a1332130e536a.tar.gz
eclipse.platform.swt-ea9e9e9b15cb9bb6ee79b2bb765a1332130e536a.tar.xz
eclipse.platform.swt-ea9e9e9b15cb9bb6ee79b2bb765a1332130e536a.zip
Bug 150559 - [DND] No insertion feedback for dragging in a tree on Mac
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TreeDropTargetEffect.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java16
2 files changed, 18 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TreeDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TreeDropTargetEffect.java
index 400df25b27..cb1f7e55cb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TreeDropTargetEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TreeDropTargetEffect.java
@@ -54,7 +54,6 @@ public class TreeDropTargetEffect extends DropTargetEffect {
static final int EXPAND_HYSTERESIS = 1000; // milli seconds
int currentEffect = DND.FEEDBACK_NONE;
- TreeItem currentItem;
TreeItem insertItem = null;
boolean insertBefore = false;
@@ -242,12 +241,12 @@ public class TreeDropTargetEffect extends DropTargetEffect {
if ((effect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
(effect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- if (currentItem != item ||
+ if (insertItem != item ||
((effect & DND.FEEDBACK_INSERT_AFTER) != (currentEffect & DND.FEEDBACK_INSERT_AFTER)) ||
((effect & DND.FEEDBACK_INSERT_BEFORE) != (currentEffect & DND.FEEDBACK_INSERT_BEFORE))) {
setInsertMark(tree, item, (effect & DND.FEEDBACK_INSERT_BEFORE) != 0);
currentEffect = effect;
- currentItem = item;
+ insertItem = item;
}
} else {
setInsertMark(tree, null, false);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
index 3a1714a64a..f3c06dbc97 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
@@ -88,6 +88,8 @@ public class Tree extends Composite {
boolean ignoreRedraw, ignoreSelect, wasSelected, ignoreExpand, wasExpanded, inClearAll, drawBackground;
Rectangle imageBounds;
TreeItem showItem;
+ TreeItem insertItem;
+ boolean insertBefore;
int lastHittest, lastHittestColumn, visibleCount;
static final int CHECK_COLUMN_ID = 1024;
static final int COLUMN_ID = 1025;
@@ -353,6 +355,13 @@ int callPaintEventHandler (int control, int damageRgn, int visibleRgn, int theEv
rect.height -= headerHeight;
fillBackground (handle, paintGC.handle, rect);
}
+ if (insertItem != null && !insertItem.isDisposed()) {
+ Rectangle itemRect = insertItem.getImageBounds(0).union(insertItem.getBounds());
+ Rectangle clientRect = getClientArea();
+ int x = clientRect.x + clientRect.width;
+ int posY = insertBefore ? itemRect.y : itemRect.y + itemRect.height - 1;
+ paintGC.drawLine(itemRect.x, posY, x, posY);
+ }
if (currentGC == null) {
paintGC.dispose ();
paintGC = null;
@@ -2708,8 +2717,15 @@ void resetVisibleRegion (int control) {
*/
public void setInsertMark (TreeItem item, boolean before) {
checkWidget ();
+ TreeItem oldMark = insertItem;
+ insertItem = item;
+ insertBefore = before;
+ if (oldMark != null && !oldMark.isDisposed()) {
+ oldMark.redraw (OS.kDataBrowserNoItem);
+ }
if (item != null) {
if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
+ item.redraw (OS.kDataBrowserNoItem);
}
}