2 * QLIB 1.0 Progress Control
\r
3 * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov
\r
4 * This program is free software; you can redistribute it and/or
\r
5 * modify it under the terms of the GNU General Public License
\r
6 * as published by the Free Software Foundation; either version 2
\r
7 * of the License, or (at your option) any later version.
\r
8 * http://qlib.quazzle.com
\r
11 function QProgress_update() {
\r
14 for (var j=0; j<size; j++) {
\r
15 images[j].src = i < value ? imgsrc1 : imgsrc0;
\r
21 function QProgress_set(value) {
\r
22 this.value = value - 0;
\r
26 function QProgress_setBounds(low, high) {
\r
27 this.low = Math.min(low, high);
\r
28 this.high = Math.max(low, high);
\r
29 this.delta = (this.high - this.low) / this.size;
\r
33 function QProgress(parent, name, res, size, style) {
\r
34 this.init(parent, name);
\r
40 this.size = size || 10;
\r
41 this.delta = 100 / this.size;
\r
42 this.style = style || 0;
\r
43 this.images = new Array(this.size);
\r
44 this.imgsrc0 = res.list[0] && res.list[0].src;
\r
45 this.imgsrc1 = res.list[1] && res.list[1].src;
\r
46 this.set = QProgress_set;
\r
47 this.update = QProgress_update;
\r
48 this.setBounds = QProgress_setBounds;
\r
50 var hor = this.style < 2;
\r
51 var rev = this.style % 2;
\r
52 document.write('<table class="qprogress" border="0" cellspacing="0" cellpadding="0" unselectable="on" ' +
\r
53 (hor ? 'width="' + (size * res.width) + '" height="' + res.height + '"><tr>' : 'width="' + res.width +
\r
54 '" height="' + (size * res.height) + '">'));
\r
55 for (var j=0; j<size; j++) {
\r
56 document.write((hor ? '' : '<tr>') + '<td width="' + res.width + '" height="' + res.height +
\r
57 '" unselectable="on"><img name="' + id + (rev ? size - j - 1 : j) + '" src="' + res.list[0].src +
\r
58 '" border="0" width="' + res.width + '" height="' + res.height + '"></td>' + (hor ? '' : '</tr>'));
\r
60 document.write((hor ? '</tr>' : '') + '</table>');
\r
61 for (var j=0; j<size; j++) {
\r
62 images[j] = document.images[id + j] || new Image(1, 1);
\r
66 this.document.write("invalid resource");
\r
69 QProgress.prototype = new QControl();
\r
70 QProgress.NORMAL = 0;
\r
71 QProgress.REVERSE = 1;
\r