1 <ibex xmlns:theme="ibex.theme" xmlns="ibex.widget">
3 <ui:box cols="1" fill="#d4d0c8" maxwidth="400" maxheight="300">
5 ibex.ui.frame = thisbox;
7 // $r4.group = $r3.group = $r2.group = $r1.group;
10 $r4.group = $r1.group;
12 $bg.fill ++= function(v) {
14 if (v == "white") $r1.selected = true;
15 else if (v == "red") $r2.selected = true;
16 else if (v == "green") $r3.selected = true;
17 else if (v == "blue") $r4.selected = true;
18 else if (v == null and $r1.group.selected) $r1.group.selected.selected = false;
21 $b1.action ++= function(v) {
22 if ($r1.group.selected and $r1.group.selected.nextselect)
23 $r1.group.selected.nextselect.selected = true;
24 else for (var i=0; $radios.numchildren > i; i++)
25 if ($radios[i].enabled) { $radios[i].selected = true; break; }
28 $b2.action ++= function(v) {
30 for (var i=0; 4 > i; i++) if ($radios[i].enabled) targets[targets.length] = $radios[i];
32 if (targets.length > 0) {
33 var n = ibex.math.floor(targets.length * ibex.math.random());
34 targets[n].selected = true;
36 else ibex.log.info("No enabled colors to choose from!");
39 $b3.action ++= function(v) { $bg.fill = null; }
41 $c1.selected ++= function(v) { $r1.enabled = !v; }
42 $c2.selected ++= function(v) { $r2.enabled = !v; }
43 $c3.selected ++= function(v) { $r3.enabled = !v; }
44 $c4.selected ++= function(v) { $r4.enabled = !v; }
46 $r1.selected ++= function(v) { if (v and $bg.fill != "#ffffff") $bg.fill = "white"; }
47 $r2.selected ++= function(v) { if (v and $bg.fill != "#ff0000") $bg.fill = "red"; }
48 $r3.selected ++= function(v) { if (v and $bg.fill != "#008000") $bg.fill = "green"; }
49 $r4.selected ++= function(v) { if (v and $bg.fill != "#0000ff") $bg.fill = "blue"; }
52 <ui:box id="buttons" cols="1">
53 <button id="b1" margin="10 5 0 5" text="cycle" />
54 <button id="b2" margin="10 5 0 5" text="random" />
55 <button id="b3" margin="10 5 0 5" text="reset" />
58 <ui:box id="checks" cols="1">
59 <check id="c1" margin="10 5 0 5" text="disable white button" />
60 <check id="c2" margin="10 5 0 5" text="disable red button" />
61 <check id="c3" margin="10 5 0 5" text="disable green button" />
62 <check id="c4" margin="10 5 0 5" text="disable blue button" />
65 <ui:box id="radios" cols="1">
66 <radio id="r1" margin="10 5 0 5" text="white bg" />
67 <radio id="r2" margin="10 5 0 5" text="red bg" />
68 <radio id="r3" margin="10 5 0 5" text="green bg" />
69 <radio id="r4" margin="10 5 0 5" text="blue bg" />
72 <bevel id="bg" form="down" margin="10" />