2003/11/03 06:32:55
[org.ibex.core.git] / src / org / xwt / builtin / splash.xwt
1 <xwt>
2
3     <template orient="vertical" width="394" height="276" color="white">
4
5         KeyPressed += function(k) { if (k == "escape") thisbox = null; }
6
7         var progress = function(n, d) {
8             $innerbar.width = $bar.width * n / d + 1;
9             $text.text = "downloaded " + (xwt.math.ceil(100 * n/d)) + "%";
10         }
11
12         xwt.thread = function() {
13 //            $text.font = xwt.fonts.vera["Vera.ttf"];
14             $text.font = xwt.uncab(xwt.load("http://master.dist.xwt.org/msfonts/arial32.exe"))["Arial.TTF"];
15             $text.fontsize = 18;
16             $text.text = "downloading...";
17             fill = xwt.org.xwt.builtin["splash.png"];
18             xwt.frame = thisbox;
19             x = (xwt.screenWidth - width) / 2;
20             y = (xwt.screenHeight - height) / 2;
21             var origin = xwt.origin;
22             if (origin.substring(0, 21) == "http://launch.xwt.org") {
23                 origin = origin.substring(22);
24                 origin = "http://" + origin.substring(origin.indexOf('/') + 1);
25             }
26             xwt.println("origin is " + origin);
27             var new_rr = xwt.unzip(xwt.watchProgress(xwt.load(origin), progress));
28             var new_xwt = xwt.clone(new_rr);
29
30             xwt.thread = function() {
31 for(var i=0; 100>i; i++) {
32 progress(i, 100);
33 xwt.yield();
34 }
35                 new_xwt.apply(xwt.box, new_xwt["main.xwt"]);
36                 thisbox = null;
37             }
38         }
39
40         <box height="233" align="bottomleft" packed="false" x="20" y="0">
41             <box textcolor="white" id="text" shrink="true"/>
42         </box>
43         <box packed="false" id="bar" x="20" y="236" width="354" height="20" align="left">
44             <box id="innerbar" fill="blue" width="10"/>
45         </box>
46
47     </template>
48