1 <!-- Copyleft 2004 - see COPYING for details [LGPL] -->
5 See ibex.widget.cardpane for details
8 Make cardpane aware of 'enabled' cards
28 // childadded write trap
29 childadded ++= function(v) {
30 // show v if it is the first card
31 if (numchildren > 1) v.visible = false;
32 else { cascade = v; show = v; }
35 // childremoved write trap
36 childremoved ++= function(v) {
37 // if v is the shown card, attempt to show another
39 if (next) next = true;
40 else if (prev) prev = true;
44 // write trap to show the next card in the cardpane
45 nextcard ++= function(v) {
46 if (nextcard) nextcard.show = true;
49 // read trap to fetch the next card in the cardpane
50 nextcard ++= function() {
51 if (show and numchildren - 1 > show) return thisbox[show + 1];
55 // write trap to step forward to the next in the show-chain
56 nextstep ++= function(v) {
58 if (nextstep) nextstep.show = true;
62 // read trap to fetch the next step in the show-chain
63 nextstep ++= function() {
64 if (steps.length - 1 > stepmarker) return steps[stepmarker + 1];
68 // write trap to show the previous card in the cardpane
69 prevcard ++= function(v) {
70 if (prevcard) prevcard.show = true;
73 // read trap to fetch the previous card in the cardpane
74 prevcard ++= function() {
75 if (show and show > 0) return thisbox[show - 1];
79 // write trap to step back to the previous in the show-chain
80 prevstep ++= function(v) {
82 if (prevstep) prevstep.show = true;
86 // read trap to fetch the previous step in the show-chain
87 prevstep ++= function() {
88 if (stepmarker > 0) return steps[stepmarker - 1];
92 // write trap to show a card by box or index
93 show ++= function(v) {
96 if (typeof(v) == "number" and numchildren > v) card = thisbox[v];
97 else if (typeof(v) == "object" and (thisbox.indexof(v) or thisbox.indexof(v) == 0)) card = v;
100 // hide the previously shown card and show the new one
101 //if (cascade) cascade.visible = false;
102 for (var i=0; numchildren > i; i++) { thisbox[i].visible = false; }
105 // remember where we are
108 if (stepmarker != steps.length) steps.splice(stepmarker, steps.length - stepsmarker);
109 if (stepmarker > 100) steps.splice(0);
110 steps[stepmarker] = card;