2003/10/25 07:50:20
[org.ibex.core.git] / src / org / xwt / Box.java.pp
index 04a0ee2..2df28b0 100644 (file)
@@ -515,9 +515,9 @@ public final class Box extends JS.Scope {
             if (g.p != null)
                 buf.drawPictureAlphaOnly(g.p,
                                          x,
-                                         y + g.max_ascent - g.baseline - g.max_descent,
+                                         y + g.max_ascent - g.baseline + g.max_descent,
                                          x + g.p.getWidth(),
-                                         y + g.max_ascent - g.baseline + g.p.getHeight() - g.max_descent,
+                                         y + g.max_ascent - g.baseline + g.max_descent + g.p.getHeight(),
                                          0, 0,
                                          g.p.getWidth(), g.p.getHeight(),
                                          textcolor);
@@ -931,6 +931,16 @@ public final class Box extends JS.Scope {
 
         static {
             specialBoxProperties.put("fill", new ColorBoxProperty() {
+                    public void put(Box b, Object value) {
+                        if (value != null && value instanceof Res) {
+                            b.image = Picture.fromRes((Res)value);
+                            b.minwidth = b.image.getWidth();
+                            b.minheight = b.image.getHeight();
+                            b.dirty();
+                        } else {
+                            super.put(b, value);
+                        }
+                    }
                     public int getColor(Box b) { return b.fillcolor; }
                     public void putColor(Box b, int argb) { b.fillcolor = argb; }
                 });
@@ -1156,7 +1166,7 @@ public final class Box extends JS.Scope {
                         return new Integer(b.x);
                     }
                     public void put(Box b, Object value) {
-                        if (!((b.flags & NOTPACKED_FLAG) != 0)) return;
+                        if (!((b.flags & NOTPACKED_FLAG) != 0) && (b.parent != null || b.surface == null)) return;
                         int x = stoi(value);
                         if (x == b.x) return;
                         b.dirty();
@@ -1172,13 +1182,14 @@ public final class Box extends JS.Scope {
             specialBoxProperties.put("width", new SpecialBoxProperty() {
                     public Object get(Box b) { return new Integer(b.width); }
                     public void put(Box b, Object value) {
-                        b.width = stoi(value);
+                        int width = stoi(value);
                         if (b.parent == null && b.surface != null) {
+                            b.width = width;
                             b.surface.setSize();
                             MARK_FOR_REFLOW_b;
                         } else {
-                            if (b.minwidth == b.width && b.maxwidth == b.width) return;
-                            b.minwidth = b.maxwidth = b.width;
+                            if (b.minwidth == width && b.maxwidth == width) return;
+                            b.minwidth = b.maxwidth = width;
                             MARK_FOR_REFLOW_b;
                         }
                     } });