* changes.
*/
static int FONT_CHANGED_FLAG = 0x00000100;
+ static int ISROOT_FLAG = 0x00000200;
static int ALIGN_FLAG = 0x00000000;
static int FIXEDASPECT_FLAG = 0x00000000;
// FIXME: clipping
char c = text.charAt(i);
Glyph g = Glyph.getGlyph(font, fontsize, c);
- System.out.println("rendering glyph for " + c + " as " + g + " @ " + (x+hpad) + ", " + (y+vpad));
buf.drawPicture(g.p,
x + hpad,
y + vpad + g.max_ascent - g.baseline,
Template t = Template.buildTemplate(res.getInputStream(), "fromResource");
if (ThreadMessage.suspendThread()) try {
JS.Callable callback = args.length() < 2 ? null : (Callable)args.elementAt(1);
- t.apply(this, null, null, callback, 0, t.numUnits());
+
+ // FIXME!!! needs to be xwt.apply(template, box)
+ t.apply(this, null, null, callback, 0, t.numUnits(), null);
} finally {
ThreadMessage.resumeThread();
}
} else {
if (ThreadMessage.suspendThread()) try {
JS.Callable callback = args.length() < 2 ? null : (Callable)args.elementAt(1);
- t.apply(this, null, null, callback, 0, t.numUnits());
+ // FIXME!!! needs to be xwt.apply(template, box)
+ t.apply(this, null, null, callback, 0, t.numUnits(), null);
} finally {
ThreadMessage.resumeThread();
}
String name = (String)name_;
if (name.equals("")) return null;
- // See if we're reading back the function value of a trap
- if (name.charAt(0) == '_') {
- if (name.charAt(1) == '_') name = name.substring(2);
- else name = name.substring(1);
- Trap t = Trap.getTrap(this, name);
- return t == null ? null : t.f;
- }
-
// See if we're triggering a trap
Trap t = traps == null || ignoretraps ? null : (Trap)traps.get(name);
- if (t != null && t.isreadtrap) return t.perform(Trap.emptyargs);
+ if (t != null) return t.perform();
// Check for a special handler
SpecialBoxProperty gph = (SpecialBoxProperty)SpecialBoxProperty.specialBoxProperties.get(name);
return ret;
}
+ public void addTrap(Object name, Object value) { Trap.addTrap(this, name, ((JS.CompiledFunction)value)); }
+ public void delTrap(Object name, Object value) { Trap.delTrap(this, name, ((JS.CompiledFunction)value)); }
+
+
/**
* Scriptable.put()
* @param ignoretraps if set, no traps will be triggered (set when 'cascade' reaches the bottom of the trap stack)
if (!ignoretraps && traps != null) {
Trap t = (Trap)traps.get(name);
if (t != null) {
- JS.Array arg = new JS.Array();
- arg.addElement(value);
- t.perform(arg);
- arg.setElementAt(null, 0);
+ t.perform(value);
return;
}
}
SpecialBoxProperty gph = (SpecialBoxProperty)SpecialBoxProperty.specialBoxProperties.get(name);
if (gph != null) { gph.put(name, this, value); return; }
- if (name.charAt(0) == '_') {
- if (value != null && !(value instanceof JS.Callable)) {
- if (Log.on) Log.logJS(this, "attempt to put a non function value (" + value + ") to " + name);
- } else if (value != null && !(value instanceof JS.CompiledFunction)) {
- if (Log.on) Log.logJS(this, "attempt to put a non-compiled function value (" + value + ") to " + name);
- } else if (name.charAt(1) == '_') {
- name = name.substring(2).intern();
- Trap t = Trap.getTrap(this, name);
- if (t != null) t.delete();
- if (value != null) Trap.addTrap(this, name, ((JS.CompiledFunction)value), true, rp);
- } else {
- name = name.substring(1).intern();
- Trap t = Trap.getTrap(this, name);
- if (t != null) t.delete();
- if (value != null) Trap.addTrap(this, name, ((JS.CompiledFunction)value), false, rp);
- }
- return;
- }
-
super.put(name, value);
}
specialBoxProperties.put("DoubleClick3", mouseEventHandler);
specialBoxProperties.put("root", new SpecialBoxProperty() {
+ public void put(Box b, Object value) {
+ if (stob(value)) b.flags |= ISROOT_FLAG;
+ else b.flags &= ~ISROOT_FLAG;
+ }
public Object get(Box b) {
- if (b.getRoot() == null) return null;
- else if (b.parent == null) return b;
- else return b.getRoot().getRootProxy();
+ if (b.parent == null || ((b.flags & ISROOT_FLAG) != 0)) return b;
+ else return get(b.parent);
} });
specialBoxProperties.put("Minimized", new SpecialBoxProperty() {