allow traps on all properties, add FIXMEs for required harmonizations
authoradam <adam@megacz.com>
Sun, 11 Apr 2004 20:28:32 +0000 (20:28 +0000)
committeradam <adam@megacz.com>
Sun, 11 Apr 2004 20:28:32 +0000 (20:28 +0000)
darcs-hash:20040411202832-5007d-dba0d662a29e43f579fffd1ca1ff3e2fa37a3bcf.gz

src/org/ibex/Box.java

index b2608fb..8ff61a1 100644 (file)
@@ -2,6 +2,12 @@
 // Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
 package org.ibex;
 
+// FIXME: are traps on x/y meaningful?
+// FIXME: if we trap on cols, then set rows to 0 (forcing cols to 1), does the cols trap get triggered?
+// FIXME: if we change min{width/height}, thereby forcing a change to max{min/height}, does a trap on those get triggered?
+// FIXME: trap on numchildren?  replaces ChildChanged?
+// FIXME: trap on visible, trigger when parent visibility changes
+
 // FEATURE: mark to reflow starting with a certain child
 // FEATURE: reintroduce surface.abort
 
@@ -62,15 +68,6 @@ public final class Box extends JSScope implements Scheduler.Task {
     }
 
     // FIXME update these
-    // box properties can not be trapped
-    static final String[] props = new String[] {
-        "shrink", "hshrink", "vshrink", "x", "y", "width", "height", "cols", "rows",
-        "colspan", "rowspan", "align", "visible", "packed", "globalx", "globaly",
-        "minwidth", "maxwidth", "minheight", "maxheight", "indexof", "thisbox", "clip",
-        "numchildren", "redirect", "cursor", "mouse"
-    };
-
-    // FIXME update these
     // events can have write traps, but not read traps
     static final String[] events = new String[] {
         "Press1", "Press2", "Press3",
@@ -475,18 +472,6 @@ public final class Box extends JSScope implements Scheduler.Task {
         return super.callMethod(method, a0, a1, a2, rest, nargs);
     }
 
-    protected boolean isTrappable(Object key, boolean isRead) {
-        if (key == null) return false;
-        else if (key instanceof String) {
-            // not allowed to trap box properties, and no read traps on events
-            String name = (String)key;
-            for (int i=0; i < props.length; i++) if (name.equals(props[i])) return false; 
-            if (isRead) for (int i=0; i < events.length; i++) if (name.equals(events[i])) return false; 
-        }
-
-        return true;
-    }
-
     public Object get(Object name) throws JSExn {
         if (name instanceof Number)
             return redirect == null ? null : redirect == this ? getChild(toInt(name)) : redirect.get(name);