summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine <veronika>2006-02-08 19:31:11 +0000
committerVeronika Irvine <veronika>2006-02-08 19:31:11 +0000
commit5f940602d150ddecc3ad5c22d4a23b1c0646f04e (patch)
tree220dfc8d305232e05294b93ba4c73998ba0f8c39
parent00da0905d97ffea48b43d35672001260f4e19536 (diff)
downloadeclipse.platform.swt-5f940602d150ddecc3ad5c22d4a23b1c0646f04e.tar.gz
eclipse.platform.swt-5f940602d150ddecc3ad5c22d4a23b1c0646f04e.tar.xz
eclipse.platform.swt-5f940602d150ddecc3ad5c22d4a23b1c0646f04e.zip
Add drag over image support
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java29
-rw-r--r--[-rwxr-xr-x]bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragAndDropEffect.java (renamed from bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java)20
-rw-r--r--[-rwxr-xr-x]bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragAndDropEffect.java (renamed from bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java)28
3 files changed, 46 insertions, 31 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
index 2a6687935c..a3093a389b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.dnd;
import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.internal.ole.win32.*;
import org.eclipse.swt.internal.win32.*;
@@ -95,20 +96,23 @@ import org.eclipse.swt.internal.win32.*;
public class DragSource extends Widget {
// info for registering as a drag source
- private Control control;
- private Listener controlListener;
- private Transfer[] transferAgents = new Transfer[0];
+ Control control;
+ Listener controlListener;
+ Transfer[] transferAgents = new Transfer[0];
+ DragAndDropEffect effect;
// ole interfaces
- private COMObject iDropSource;
- private COMObject iDataObject;
- private int refCount;
+ COMObject iDropSource;
+ COMObject iDataObject;
+ int refCount;
//workaround - track the operation performed by the drop target for DragEnd event
- private int dataEffect = DND.DROP_NONE;
+ int dataEffect = DND.DROP_NONE;
+
+ Runnable dragMove;
- private static final String DRAGSOURCEID = "DragSource"; //$NON-NLS-1$
- private static final int CFSTR_PERFORMEDDROPEFFECT = Transfer.registerType("Performed DropEffect"); //$NON-NLS-1$
+ static final String DRAGSOURCEID = "DragSource"; //$NON-NLS-1$
+ static final int CFSTR_PERFORMEDDROPEFFECT = Transfer.registerType("Performed DropEffect"); //$NON-NLS-1$
/**
* Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
@@ -171,6 +175,13 @@ public DragSource(Control control, int style) {
DragSource.this.onDispose();
}
});
+ if (control instanceof Tree) {
+ effect = new TreeDragAndDropEffect((Tree)control);
+ } else if (control instanceof Table) {
+ effect = new TableDragAndDropEffect((Table)control);
+ } else {
+ effect = new NoDragAndDropEffect(control);
+ }
}
static int checkStyle(int style) {
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/TableDragAndDropEffect.java
index b6e9c723da..27360da805 100755..100644
--- 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/TableDragAndDropEffect.java
@@ -10,25 +10,28 @@
*******************************************************************************/
package org.eclipse.swt.dnd;
-import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.widgets.*;
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
+class TableDragAndDropEffect extends DragAndDropEffect {
+ Table table;
int scrollIndex;
- private long scrollBeginTime;
- private static final int SCROLL_HYSTERESIS = 150; // milli seconds
+ long scrollBeginTime;
+
+ static final int SCROLL_HYSTERESIS = 150; // milli seconds
-TableDragUnderEffect(Table table) {
+TableDragAndDropEffect(Table table) {
this.table = table;
}
+
private int checkEffect(int effect) {
// Some effects are mutually exclusive. Make sure that only one of the mutually exclusive effects has been specified.
if ((effect & DND.FEEDBACK_SELECT) != 0) effect = effect & ~DND.FEEDBACK_INSERT_AFTER & ~DND.FEEDBACK_INSERT_BEFORE;
if ((effect & DND.FEEDBACK_INSERT_BEFORE) != 0) effect = effect & ~DND.FEEDBACK_INSERT_AFTER;
return effect;
}
+
Widget getItem(int x, int y) {
Point coordinates = new Point(x, y);
coordinates = table.toControl(coordinates);
@@ -48,7 +51,8 @@ Widget getItem(int x, int y) {
}
return item;
}
-void show(int effect, int x, int y) {
+
+void showDropTargetEffect(int effect, int x, int y) {
effect = checkEffect(effect);
int handle = table.handle;
Point coordinates = new Point(x, y);
@@ -82,7 +86,7 @@ void show(int effect, int x, int y) {
lvItem.state = OS.LVIS_DROPHILITED;
OS.SendMessage (handle, OS.LVM_SETITEMSTATE, pinfo.iItem, lvItem);
}
-// Insert mark only supported on Windows XP with manifest
+ //Insert mark only supported on Windows XP with manifest
// if (OS.COMCTL32_MAJOR >= 6) {
// if ((effect & DND.FEEDBACK_INSERT_BEFORE) != 0 || (effect & DND.FEEDBACK_INSERT_AFTER) != 0) {
// LVINSERTMARK lvinsertmark = new LVINSERTMARK();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragAndDropEffect.java
index f4f36c7e60..8e547ae243 100755..100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragAndDropEffect.java
@@ -10,28 +10,28 @@
*******************************************************************************/
package org.eclipse.swt.dnd;
-import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.widgets.*;
-class TreeDragUnderEffect extends DragUnderEffect {
- private Tree tree;
- private int dropIndex;
- private int scrollIndex;
- private long scrollBeginTime;
- private int expandIndex;
- private long expandBeginTime;
- private boolean clearInsert = false;
+class TreeDragAndDropEffect extends DragAndDropEffect {
+ Tree tree;
+ int dropIndex;
+ int scrollIndex;
+ long scrollBeginTime;
+ int expandIndex;
+ long expandBeginTime;
+ boolean clearInsert = false;
- private static final int SCROLL_HYSTERESIS = 150; // milli seconds
- private static final int EXPAND_HYSTERESIS = 300; // milli seconds
+ static final int SCROLL_HYSTERESIS = 150; // milli seconds
+ static final int EXPAND_HYSTERESIS = 300; // milli seconds
-TreeDragUnderEffect(Tree tree) {
+TreeDragAndDropEffect(Tree tree) {
this.tree = tree;
}
-private int checkEffect(int effect) {
+int checkEffect(int effect) {
// Some effects are mutually exclusive. Make sure that only one of the mutually exclusive effects has been specified.
if ((effect & DND.FEEDBACK_SELECT) != 0) effect = effect & ~DND.FEEDBACK_INSERT_AFTER & ~DND.FEEDBACK_INSERT_BEFORE;
if ((effect & DND.FEEDBACK_INSERT_BEFORE) != 0) effect = effect & ~DND.FEEDBACK_INSERT_AFTER;
@@ -58,7 +58,7 @@ Widget getItem(int x, int y) {
return item;
}
-void show(int effect, int x, int y) {
+void showDropTargetEffect(int effect, int x, int y) {
effect = checkEffect(effect);
int handle = tree.handle;
Point coordinates = new Point(x, y);