update core for recent js changes
[org.ibex.core.git] / src / org / ibex / core / Box.java
index 053357a..96aa0a0 100644 (file)
@@ -38,7 +38,7 @@ import org.ibex.graphics.*;
  *  trigger a Surface.abort; if rendering were done in the same pass,
  *  rendering work done prior to the Surface.abort would be wasted.
  */
-public final class Box extends JSScope implements Task {
+public final class Box extends JS.O implements Task {
 
     // Macros //////////////////////////////////////////////////////////////////////
 
@@ -52,8 +52,6 @@ public final class Box extends JSScope implements Task {
     //#define CHECKSET_BOOLEAN(prop) boolean nu = toBoolean(value); if (nu == prop) break; prop = nu;
     //#define CHECKSET_STRING(prop) if ((value==null&&prop==null)||(value!=null&&JS.toString(value).equals(prop))) break; prop=JS.toString(value);
 
-    public Box() { super(null); }
-
     // FIXME memory leak
     static Hash boxToCursor = new Hash(500, 3);
 
@@ -99,6 +97,8 @@ public final class Box extends JSScope implements Task {
     Box redirect = this;
     int flags = VISIBLE | PACKED | REPACK | RECONSTRAIN | REPLACE | FIXED | STOP_UPWARD_PROPAGATION | CLIP | MOVED;
 
+    private BalancedTree bt;
+    
     private String text = null;
     private Font font = DEFAULT_FONT; 
     private Picture texture = null;
@@ -938,4 +938,15 @@ public final class Box extends JSScope implements Task {
             JS.log(e);
         }
     }
+    
+    // BalancedTree functions
+    private void insertNode(int p, Box b) {
+        if(bt == null) bt = new BalancedTree();
+        bt.insertNode(p,b);
+    }
+    
+    private int treeSize() { return bt == null ? 0 : bt.treeSize(); }
+    private int indexNode(Box b) { return bt == null ? -1 : bt.indexNode(b); }
+    private void deleteNode(int p) { bt.deleteNode(p); }
+    private Box getNode(int p) { return (Box)bt.getNode(p); }
 }