X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2FBox.java;h=6bd6ddf088e412115a8365d88e7b7cc8b2d0d890;hb=bf0e7b510f32df7da4684fd19fc55aef8156e9f5;hp=1301639bc5e6706d1d928eceb1d01d5448652c87;hpb=3591b88b94a6bb378af3d4abe6eb5233ce583104;p=org.ibex.core.git diff --git a/src/org/ibex/Box.java b/src/org/ibex/Box.java index 1301639..6bd6ddf 100644 --- a/src/org/ibex/Box.java +++ b/src/org/ibex/Box.java @@ -14,7 +14,7 @@ package org.ibex; import java.util.*; import org.ibex.js.*; import org.ibex.util.*; -import org.xwt.translators.*; +import org.ibex.translators.*; /** *

@@ -166,6 +166,7 @@ public final class Box extends JSScope implements Scheduler.Task { // Instance Methods ///////////////////////////////////////////////////////////////////// + public int fontSize() { return (font == null ? DEFAULT_FONT : font).pointsize; } /** invoked when a resource needed to render ourselves finishes loading */ public void perform() throws JSExn { @@ -566,6 +567,11 @@ public final class Box extends JSScope implements Scheduler.Task { case "Enter": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); case "Leave": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "HScroll": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) + parent.putAndTriggerTraps(name, N(((Number)value).floatValue() * ((float)parent.fontSize()) / ((float)fontSize()))); + case "VScroll": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) + parent.putAndTriggerTraps(name, N(((Number)value).floatValue() * ((float)parent.fontSize()) / ((float)fontSize()))); + case "_Move": propagateDownward(name, value, false); case "_Press1": propagateDownward(name, value, false); case "_Press2": propagateDownward(name, value, false); @@ -581,6 +587,8 @@ public final class Box extends JSScope implements Scheduler.Task { case "_DoubleClick3": propagateDownward(name, value, false); case "_KeyPressed": propagateDownward(name, value, false); case "_KeyReleased": propagateDownward(name, value, false); + case "_HScroll": propagateDownward(name, value, false); + case "_VScroll": propagateDownward(name, value, false); case "PosChange": return; case "SizeChange": return; @@ -629,10 +637,11 @@ public final class Box extends JSScope implements Scheduler.Task { set(CURSOR); boxToCursor.put(this, value); Surface surface = getSurface(); - String tempcursor = surface.cursor; - // FIXME - //Move(surface.mousex, surface.mousey, surface.mousex, surface.mousey); - if (surface.cursor != tempcursor) surface.syncCursor(); + if (surface != null) { + String tempcursor = surface.cursor; + propagateDownward(null, null, false); + if (surface.cursor != tempcursor) surface.syncCursor(); + } } private void setFill(Object value) throws JSExn { @@ -666,29 +675,42 @@ public final class Box extends JSScope implements Scheduler.Task { int y = globalToLocalY(getSurface()._mousey); boolean wasinside = test(MOUSEINSIDE); boolean isinside = test(VISIBLE) && inside(x, y) && !obscured; - if (!wasinside && isinside) { set(MOUSEINSIDE); putAndTriggerTrapsAndCatchExceptions("Enter", T); } - if (wasinside && !isinside) { clear(MOUSEINSIDE); putAndTriggerTrapsAndCatchExceptions("Leave", T); } + if (!wasinside && isinside) { + set(MOUSEINSIDE); + putAndTriggerTrapsAndCatchExceptions("Enter", T); + } + if (isinside && test(CURSOR)) getSurface().cursor = (String)boxToCursor.get(this); + if (wasinside && !isinside) { + clear(MOUSEINSIDE); + putAndTriggerTrapsAndCatchExceptions("Leave", T); + } boolean found = false; if (wasinside || isinside) for(Box child = getChild(treeSize() - 1); child != null; child = child.prevSibling()) { boolean save_stop = child.test(STOP_UPWARD_PROPAGATION); + Object value2 = value; + if (name.equals("_HScroll") || name.equals("_VScroll")) + value2 = N(((Number)value).floatValue() * ((float)child.fontSize()) / (float)fontSize()); if (obscured || !child.inside(x - child.x, y - child.y)) { - child.propagateDownward(name, value, true); + child.propagateDownward(name, value2, true); } else try { found = true; child.clear(STOP_UPWARD_PROPAGATION); - child.putAndTriggerTrapsAndCatchExceptions(name, value); + if (name != null) child.putAndTriggerTrapsAndCatchExceptions(name, value2); + else child.propagateDownward(name, value2, obscured); } finally { if (save_stop) child.set(STOP_UPWARD_PROPAGATION); else child.clear(STOP_UPWARD_PROPAGATION); } if (child.inside(x - child.x, y - child.y)) - if (name.equals("_Move")) obscured = true; + if (name != null && name.equals("_Move")) obscured = true; else break; } if (!obscured && !found) - if (!name.equals("_Move") || wasinside) putAndTriggerTrapsAndCatchExceptions(name.substring(1), value); + if ("_Move".equals(name) || wasinside) + if (name != null) + putAndTriggerTrapsAndCatchExceptions(name.substring(1), value); } private static int stringToColor(String s) {