2002/07/19 04:41:24
[org.ibex.core.git] / src / org / xwt / builtin / splash.xwt
1 <xwt>
2
3     <template thisbox="window" orient="vertical">
4
5         minwidth = maxwidth = $inner.width;
6         minheight = maxheight = $inner.height;
7         x = (xwt.screenWidth - width) / 2;
8         y = (xwt.screenHeight - height) / 2;
9
10         xwt.thread = function() {
11             var origin = xwt.origin;
12             if (origin.substring(0, 21) == "http://launch.xwt.org") {
13                 origin = origin.substring(22);
14                 origin = "http://" + origin.substring(origin.indexOf('/') + 1);
15             }
16             xwt.println("origin is " + origin);
17
18             xwt.loadArchive(origin, function(num, den) {
19                     $left.flex = 50 * (num / den);
20                     $right.flex = 50 + 50 * (1.0 - num /den);
21                     var pct = xwt.math.ceil(num * 100 / den);
22                     if (1024 > num) {
23                         num = "" + num + " bytes";
24                     } else if (1024 * 1024 > num) {
25                         num = "" + xwt.math.ceil(num / 1024) + "kb";
26                     } else {
27                         num = "" + xwt.math.ceil(num / (1024 * 1024)) + "Mb";
28                     }
29                     $status.text = "Downloading: " + pct + "% [" + num + "]";
30                 });
31
32             xwt.newBox("main", function(num, den) {
33                     $left.flex = 50 + 50 * (num / den);
34                     $right.flex = 50 * (1.0 - num / den);
35                     if ($right.flex == 0) $right.width = 0;
36                     $status.text = "Initializing: " + xwt.math.ceil(num * 100 / den) + "%";
37                 });
38
39             thisbox = null;
40         }
41
42         <box absolute="true" sizetoimage="true" id="inner" image="org.xwt.builtin.lithium"/>
43
44         <box/>
45         <box text="Downloading user interface..." vshrink="true" hpad="4" vpad="3" id="status" textcolor="white"/>
46         <box hpad="4" height="10">
47             <box flex="0.0" image="org.xwt.builtin.progress" tile="true" id="left"/>
48             <box flex="100.0" id="right"/>
49         </box>
50         <box height="5"/>
51
52     </template>
53