X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FBox.java;h=864d332ed0f2a31e5f80e77d20638316ef368805;hb=7f5df8070a5551fe66abd11a589677e285ca62f8;hp=3ac48d42f00f940982be3c05a3d4990b1531592f;hpb=a7bc8922080f56017b141a3835c722344fa4cffc;p=org.ibex.core.git diff --git a/src/org/xwt/Box.java b/src/org/xwt/Box.java index 3ac48d4..864d332 100644 --- a/src/org/xwt/Box.java +++ b/src/org/xwt/Box.java @@ -97,7 +97,7 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { private String text = null; private Font font = null; - private Picture texture; + private Picture.Holder texture; private short strokewidth = 1; private int fillcolor = 0x00000000; private int strokecolor = 0xFF000000; @@ -152,9 +152,8 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { } } - // fixme public void putAndTriggerJSTraps(Object key, Object value) { - put(key, value); + JSContext.invokeTrap(this, key, value); } /** update MOUSEINSIDE, check for Enter/Leave/Move */ @@ -334,10 +333,10 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { if ((fillcolor & 0xFF000000) != 0x00000000) buf.fillTrapezoid(globalx, globalx + width, globaly, globalx, globalx + width, globaly + height, fillcolor); - if (texture != null) - for(int x = globalx; x < cx2; x += texture.getWidth()) - for(int y = globaly; y < cy2; y += texture.getHeight()) - buf.drawPicture(texture, x, y, cx1, cy1, cx2, cy2); + if (texture != null && texture.picture != null) + for(int x = globalx; x < cx2; x += texture.picture.getWidth()) + for(int y = globaly; y < cy2; y += texture.picture.getHeight()) + buf.drawPicture(texture.picture, x, y, cx1, cy1, cx2, cy2); if (text != null && !text.equals("") && font != null) if (font.rasterizeGlyphs(text, buf, strokecolor, globalx, globaly, cx1, cy1, cx2, cy2, null) == -1) @@ -529,23 +528,26 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { if (value == null) return; if (value instanceof String) { // FIXME check double set - fillcolor = stringToColor((String)value); + int newfillcolor = stringToColor((String)value); + if (newfillcolor == fillcolor) return; + fillcolor = newfillcolor; + dirty(); + return; } if (!(value instanceof Res)) return; - Picture pic = Picture.fromRes((Res)value, null); - if (pic != null) { - texture = pic; - minwidth = texture.getWidth(); - minheight = texture.getHeight(); + texture = Picture.fromRes((Res)value, null); + if (texture != null) { + minwidth = texture.picture.getWidth(); + minheight = texture.picture.getHeight(); MARK_REFLOW; dirty(); - } else Picture.fromRes((Res)value, new Callback() { public Object call(Object arg) { - texture = (Picture)arg; - minwidth = texture.getWidth(); - minheight = texture.getHeight(); + return; + } + texture = Picture.fromRes((Res)value, new Scheduler.Task() { public void perform() { + minwidth = texture.picture.getWidth(); + minheight = texture.picture.getHeight(); Box b = Box.this; MARK_REFLOW_b; dirty(); - return null; } }); }