X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FBox.java;h=35c0723c7d4af197608f85eacb2dabfb0d743a14;hb=120ba254de55dfb9275155c889896c695e8d8649;hp=186e93dbf433fb1e0e0759654622bca1d3c3cb7f;hpb=89afe7ee10eddb1876e2a94a5630748837c29e16;p=org.ibex.core.git diff --git a/src/org/xwt/Box.java b/src/org/xwt/Box.java index 186e93d..35c0723 100644 --- a/src/org/xwt/Box.java +++ b/src/org/xwt/Box.java @@ -67,7 +67,7 @@ public final class Box extends JSScope implements Scheduler.Task { static { Font f = null; - try { f = Font.getFont((Res)Main.builtin.get("fonts/vera/Vera.ttf"), 10); } + try { f = Font.getFont((Stream)Main.builtin.get("fonts/vera/Vera.ttf"), 10); } catch(JSExn e) { Log.info(Box.class, "should never happen: "+e); } DEFAULT_FONT = f; } @@ -177,7 +177,7 @@ public final class Box extends JSScope implements Scheduler.Task { // as external events have occured, check the state of box if (texture != null) { if (texture.isLoaded) { minwidth = min(texture.width, maxwidth); minheight = min(texture.height, maxheight); } - else { Res res = texture.res; texture = null; throw new JSExn("image not found: "+res); } + else { Stream res = texture.res; texture = null; throw new JSExn("image not found: "+res); } } MARK_REPACK; @@ -302,7 +302,8 @@ public final class Box extends JSScope implements Scheduler.Task { int increment = max(1, x_slack / cols); startslack = x_slack; for(short col=0; col < cols; col++) { - int diff = min(colMaxWidth[col], colWidth[col] + increment) - colWidth[col]; + // FIXME: double check this + int diff = min(min(colMaxWidth[col], colWidth[col] + increment) - colWidth[col], x_slack); x_slack -= diff; colWidth[col] += diff; } @@ -419,7 +420,7 @@ public final class Box extends JSScope implements Scheduler.Task { return redirect == null ? null : redirect == this ? getChild(toInt(name)) : redirect.get(name); //#switch(name) - case "surface": return parent == null ? null : parent.get("surface"); + case "surface": return parent == null ? null : parent.getAndTriggerTraps("surface"); case "indexof": return METHOD; case "text": return text; case "path": throw new JSExn("cannot read from the path property"); @@ -529,28 +530,28 @@ public final class Box extends JSScope implements Scheduler.Task { case "toback": if (parent == null && getSurface() != null && toBoolean(value)) { getSurface().toBack(); } case "tofront": if (parent == null && getSurface() != null && toBoolean(value)) { getSurface().toFront(); } case "redirect": if (redirect == this) redirect = (Box)value; else Log.info(this, "redirect can only be set once"); - case "font": font = value == null ? null : Font.getFont((Res)value, font == null ? 10 : font.pointsize); MARK_RESIZE; dirty(); + case "font": font = value == null ? null : Font.getFont((Stream)value, font == null ? 10 : font.pointsize); MARK_RESIZE; dirty(); case "fontsize": font = Font.getFont(font == null ? null : font.res, toInt(value)); MARK_RESIZE; dirty(); case "x": if (parent==null && Surface.fromBox(this)!=null) { CHECKSET_INT(x); } else { if (test(PACKED) && parent != null) return; CHECKSET_INT(x); dirty(); MARK_RESIZE; dirty(); } case "y": if (parent==null && Surface.fromBox(this)!=null) { CHECKSET_INT(y); } else { if (test(PACKED) && parent != null) return; CHECKSET_INT(y); dirty(); MARK_RESIZE; dirty(); } - case "Press1": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Press2": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Press3": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Release1": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Release2": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Release3": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Click1": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Click2": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Click3": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "DoubleClick1": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "DoubleClick2": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "DoubleClick3": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "KeyPressed": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "KeyReleased": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Move": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Enter": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); - case "Leave": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.put(name, value); + case "Press1": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "Press2": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "Press3": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "Release1": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "Release2": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "Release3": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "Click1": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "Click2": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "Click3": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "DoubleClick1": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "DoubleClick2": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "DoubleClick3": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "KeyPressed": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "KeyReleased": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + case "Move": if (!test(STOP_UPWARD_PROPAGATION) && parent != null) parent.putAndTriggerTraps(name, value); + 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 "_Move": propagateDownward(name, value, false); case "_Press1": propagateDownward(name, value, false); @@ -631,8 +632,8 @@ public final class Box extends JSScope implements Scheduler.Task { dirty(); return; } - if (!(value instanceof Res)) return; - texture = Picture.load((Res)value, this); + if (!(value instanceof Stream)) return; + texture = Picture.load((Stream)value, this); } // FIXME: mouse move/release still needs to propagate to boxen in which the mouse was pressed and is still held down