mousewheel support on all platforms (X11,Darwin,Win32,Java14) and in the core (bug...
[org.ibex.core.git] / src / org / ibex / Surface.java
index 2d577e6..48eb198 100644 (file)
@@ -149,6 +149,11 @@ public abstract class Surface extends PixelBuffer implements Scheduler.Task {
         Scheduler.add(this);
     }
 
+    protected final void HScroll(int pixels) { new Message("_HScroll", new Integer(pixels), root); }
+    protected final void VScroll(int pixels) { new Message("_VScroll", new Integer(pixels), root); }
+    protected final void HScroll(float lines) { new Message("_HScroll", new Float(lines), root); }
+    protected final void VScroll(float lines) { new Message("_VScroll", new Float(lines), root); }
+
     /** subclasses should invoke this method when the user resizes the window */
     protected final void SizeChange(final int width, final int height) {
         if (pendingWidth == width && pendingHeight == height) return;
@@ -300,6 +305,10 @@ public abstract class Surface extends PixelBuffer implements Scheduler.Task {
                 else if (value.toLowerCase().equals("control")) control = false;
                 else if (value.toLowerCase().equals("shift")) shift = false;
                 this.value = value;
+            } else if (name.equals("_HScroll") || name.equals("_VScroll")) {
+                // FIXME: technically points != pixels
+                if (value instanceof Integer)
+                    value = new Float(((Integer)value).intValue() * root.fontSize());
             }
             try {
                 boxContainingMouse.putAndTriggerTrapsAndCatchExceptions(name, value);