misc native build fixups
[org.ibex.core.git] / src / org / ibex / Surface.java
index 383e7a8..48eb198 100644 (file)
@@ -88,7 +88,6 @@ public abstract class Surface extends PixelBuffer implements Scheduler.Task {
         if (button == 1) new Message("_Press1", T, root);
         else if (button == 2) new Message("_Press2", T, root);
         else if (button == 3) {
-            final Box who = root;
             Scheduler.add(new Scheduler.Task() { public void perform() throws JSExn {
                 Platform.clipboardReadEnabled = true;
                 try {
@@ -150,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;
@@ -301,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);