Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine2002-01-04 16:40:40 +0000
committerVeronika Irvine2002-01-04 16:40:40 +0000
commita8572c6cc26f10065a551c341c7572dbf9ac7ea9 (patch)
tree0f668052fddd26be9db08091a4f8b34a54d3807b
parentceacfe3340475d49bde455c948f23bd29ffc704e (diff)
downloadeclipse.platform.swt-a8572c6cc26f10065a551c341c7572dbf9ac7ea9.tar.gz
eclipse.platform.swt-a8572c6cc26f10065a551c341c7572dbf9ac7ea9.tar.xz
eclipse.platform.swt-a8572c6cc26f10065a551c341c7572dbf9ac7ea9.zip
mouse wheel scroll hack2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java33
1 files changed, 30 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
index 6893e4ed6c..02fceaaca5 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
@@ -235,16 +235,41 @@ LRESULT WM_HSCROLL (int wParam, int lParam) {
LRESULT WM_MOUSEWHEEL (int wParam, int lParam) {
LRESULT result = super.WM_MOUSEWHEEL (wParam, lParam);
if (result != null) return result;
- int position = verticalBar == null ? 0 : verticalBar.getSelection ();
+
+ // Implement scrolling for Canvas type widgets.
+ // For all native widgets, rely on the native widget to handle WM_MOUSEWHEEL
+ if ((state & CANVAS) != 0) {
+ if (verticalBar == null && horizontalBar == null) return LRESULT.ZERO;
+ int wheelDelta = (short)-(wParam >> 16);
+ if (wheelDelta < OS.WHEEL_DELTA) return new LRESULT(0);
+ int[] value = new int[1];
+ OS.SystemParametersInfo(OS.SPI_GETWHEELSCROLLLINES, 0, value, 0);
+ int increment = value[0] * wheelDelta / OS.WHEEL_DELTA;
+ System.out.println("Scroll canvas by "+increment);
+
+ return LRESULT.ZERO;
+ }
+
+ // When the native widget scrolls inside the WM_MOUSEWHEEL event, no WM_VSCROLL or WM_HSCROLL event
+ // is sent and the application does not get notified that the widget has scrolled.
+ // Check for a change in the scrollbar position and notify the application.
+ int vPosition = verticalBar == null ? 0 : verticalBar.getSelection ();
+ int hPosition = horizontalBar == null ? 0 : horizontalBar.getSelection ();
int code = callWindowProc (OS.WM_MOUSEWHEEL, wParam, lParam);
if (verticalBar != null) {
- if (verticalBar.getSelection() != position) {
+ if (verticalBar.getSelection() != vPosition) {
Event event = new Event ();
event.detail = SWT.DRAG;
- //CAN SEND MULTIPLE
verticalBar.sendEvent (SWT.Selection, event);
}
}
+ if (horizontalBar != null) {
+ if (horizontalBar.getSelection() != hPosition) {
+ Event event = new Event ();
+ event.detail = SWT.DRAG;
+ horizontalBar.sendEvent (SWT.Selection, event);
+ }
+ }
return new LRESULT (code);
}
@@ -257,6 +282,8 @@ LRESULT WM_SIZE (int wParam, int lParam) {
}
LRESULT WM_VSCROLL (int wParam, int lParam) {
+ new Error().printStackTrace();
+
LRESULT result = super.WM_VSCROLL (wParam, lParam);
if (result != null) return result;

Back to the top