2002/07/16 01:27:39
[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
15             xwt.loadArchive(origin, function(num, den) {
16                     $left.flex = 50 * (num / den);
17                     $right.flex = 50 + 50 * (1.0 - num /den);
18                     var pct = xwt.math.ceil(num * 100 / den);
19                     if (1024 > num) {
20                         num = "" + num + " bytes";
21                     } else if (1024 * 1024 > num) {
22                         num = "" + xwt.math.ceil(num / 1024) + "kb";
23                     } else {
24                         num = "" + xwt.math.ceil(num / (1024 * 1024)) + "Mb";
25                     }
26                     $status.text = "Downloading: " + pct + "% [" + num + "]";
27                 });
28
29             xwt.newBox("main", function(num, den) {
30                     $left.flex = 50 + 50 * (num / den);
31                     $right.flex = 50 * (1.0 - num / den);
32                     if ($right.flex == 0) $right.width = 0;
33                     $status.text = "Initializing: " + xwt.math.ceil(num * 100 / den) + "%";
34                 });
35
36             thisbox = null;
37         }
38
39         <box absolute="true" sizetoimage="true" id="inner" image="org.xwt.builtin.lithium"/>
40
41         <box/>
42         <box text="Downloading user interface..." vshrink="true" hpad="30" vpad="3" id="status" textcolor="white"/>
43         <box hpad="4" height="10">
44             <box width="25"/>
45             <box flex="0.0" image="org.xwt.builtin.progress" tile="true" id="left"/>
46             <box flex="100.0" id="right"/>
47         </box>
48         <box height="5"/>
49
50     </template>
51