1 <!-- Copyleft 2004 - see COPYING for details [LGPL] -->
5 See xwt.theme.redirect for details
13 thisbox.redirectTo = function(v) {
15 ibex.log.warn("Attempted to redirect properties to a null value");
19 for (var i=1; arguments.length > i; i++) {
20 // get property from arguments
23 // remove the trap if it already exists
24 if (redirects[p]) dropRedirect(v, p);
26 // create and store redirecting functions
29 if (!locks[p]) { locks[p] = true; cascade = w; thisbox[p] = w; locks[p] = null; }
32 if (!locks[p]) { locks[p] = true; v[p] = w; locks[p] = null; }
35 function() { return v[p]; }];
37 // assign redirecting traps
38 try { // try/catch for properties that can't have write traps
39 thisbox[p] ++= redirects[p][2];
40 v[p] ++= redirects[p][1];
42 redirects[p][1] = null;
43 redirects[p][2] = null;
45 // try/catch for properties that can't have read traps
46 try { thisbox[p] ++= redirects[p][3]; }
47 catch(e) { redirects[p][3] = null; }
54 thisbox.dropRedirect = function(v) {
55 for (var i=1; arguments.length > i; i++) {
56 // get property from arguments
59 // remove redirect traps and reference
61 if (redirects[p][1]) redirects[p][0] --= redirects[p][1];
62 if (redirects[p][2]) thisbox[p] --= redirects[p][2];
63 if (redirects[p][3]) thisbox[p] --= redirects[p][3];