summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2006-11-03 16:19:11 +0000
committerSteve Northover <steve>2006-11-03 16:19:11 +0000
commit8125f06984a633112c1abe6c13a5e079b80b2773 (patch)
treeba735ff10cc08e5e73280a54e463d6ea089f4492
parent2f936f69312a9448a129e0fd5972442e772bfaf7 (diff)
downloadeclipse.platform.swt-8125f06984a633112c1abe6c13a5e079b80b2773.tar.gz
eclipse.platform.swt-8125f06984a633112c1abe6c13a5e079b80b2773.tar.xz
eclipse.platform.swt-8125f06984a633112c1abe6c13a5e079b80b2773.zip
drag detect work
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java6
5 files changed, 16 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index fe3d53ee46..8259812086 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -571,9 +571,13 @@ void destroyWidget () {
}
/**
- * ...
+ * Detects a drag and drop gesture. If the gesture occurs
+ * then an event is returned that can be used to notify listeners
+ * that a drag detect has happened. If no gesture is detected,
+ * then <code>null</code> is returned.
*
* @param event the mouse down event
+ * @return the drag detect event
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the event is null</li>
@@ -583,6 +587,8 @@ void destroyWidget () {
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
+ * @see notifyListeners
+ *
* @since 3.3
*/
//TODO - Javadoc
@@ -592,11 +598,9 @@ void destroyWidget () {
if (!dragDetect (handle, event.x, event.y, false, null, null)) return null;
Event dragEvent = new Event ();
dragEvent.button = event.button;
- dragEvent.detail = event.detail;
- dragEvent.count = event.count;
- dragEvent.stateMask = event.stateMask;
dragEvent.x = event.x;
dragEvent.y = event.y;
+ dragEvent.stateMask = event.stateMask;
return dragEvent;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
index 1c61ccfba0..3bb482bf15 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
@@ -1103,7 +1103,8 @@ LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) {
pt.x = (short) (pos & 0xFFFF);
pt.y = (short) (pos >> 16);
OS.ScreenToClient (handle, pt);
- if (!sendDragEvent (pt.x, pt.y)) return LRESULT.ONE;
+ int button = display.lastButton != 0 ? display.lastButton : 1;
+ if (!sendDragEvent (button, pt.x, pt.y)) return LRESULT.ONE;
break;
}
case OS.RBN_CHILDSIZE: {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index 1866ed1efc..fd94e14e3e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -5666,7 +5666,7 @@ LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) {
pt.x = (short) (pos & 0xFFFF);
pt.y = (short) (pos >> 16);
OS.ScreenToClient (handle, pt);
- sendDragEvent (pt.x, pt.y);
+ sendDragEvent (1, pt.x, pt.y);
}
break;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
index 5825a53b54..cd6b34657c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
@@ -5655,7 +5655,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
* issue a fake mouse up.
*/
if (dragStarted) {
- sendDragEvent ((short) (lParam & 0xFFFF), (short) (lParam >> 16));
+ sendDragEvent (1, (short) (lParam & 0xFFFF), (short) (lParam >> 16));
} else {
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
if ((bits & OS.TVS_DISABLEDRAGDROP) == 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
index aaa4c48c40..3dfed57e08 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
@@ -910,10 +910,12 @@ public void removeDisposeListener (DisposeListener listener) {
eventTable.unhook (SWT.Dispose, listener);
}
-boolean sendDragEvent (int x, int y) {
+boolean sendDragEvent (int button, int x, int y) {
Event event = new Event ();
+ event.button = button;
event.x = x;
event.y = y;
+ setInputState (event, SWT.DragDetect);
postEvent (SWT.DragDetect, event);
if (isDisposed ()) return false;
return event.doit;
@@ -1764,7 +1766,7 @@ LRESULT wmLButtonDown (int hwnd, int wParam, int lParam) {
}
}
if (dragging) {
- sendDragEvent (x, y);
+ sendDragEvent (1, x, y);
} else {
if (detect != null && detect [0]) {
/*