2 * QLIB 1.0 Message Box 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 QMessageBox_alert(msg) {
\r
12 if (typeof(msg) == "string") {
\r
13 this.label.set(this.value = msg);
\r
20 function QMessageBox_close() {
\r
21 with (this.parent) {
\r
22 if (!onClose(tag)) show(false);
\r
26 function QMessageBox_body() {
\r
28 document.write('<table border="0" width="' + cwidth + '"><tr><td align="left" valign="top" unselectable="on">');
\r
29 this.label = new QLabel(this, "label", value);
\r
30 document.write('</td></tr><tr><td height="' + (bres.height + 14) + '" align="center" valign="bottom" unselectable="on">');
\r
31 this.button = new QButton(this, "button", bres, "Close");
\r
32 document.write('</td></tr></table>');
\r
33 button.onClick = QMessageBox_close;
\r
37 function QMessageBox(parent, name, box, btn, msg, effects, opacity) {
\r
38 this.init(parent, name);
\r
39 if ((this.res = box) && (this.bres = btn)) {
\r
40 this.value = typeof(msg) == "string" ? msg : "";
\r
41 this.width = Math.max(200, Math.floor(Math.sqrt(555 * this.value.length)));
\r
43 this.x = this.y = 0;
\r
44 this.visible = false;
\r
46 this.body = QMessageBox_body;
\r
47 var j = QMessageBox.arguments.length;
\r
48 this.effects = j > 5 ? effects : (box.effects != null ? box.effects : 0);
\r
49 this.opacity = j > 6 ? opacity : (box.opacity != null ? box.opacity : 100);
\r
51 this.alert = QMessageBox_alert;
\r
52 this.onClose = QControl.event;
\r
54 this.document.write("invalid resource");
\r
57 QMessageBox.prototype = new QBoxCtrl();
\r