@jswf/core
Version:
JavaScript Window Framework
59 lines • 2.33 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable @typescript-eslint/class-name-casing */
var BaseView_1 = require("./BaseView");
var Button_1 = require("./Button");
var FrameWindow_1 = require("./FrameWindow");
require("../scss/MessageBox.scss");
var MessageBox = /** @class */ (function (_super) {
__extends(MessageBox, _super);
function MessageBox(title, msg, buttons) {
var _this = _super.call(this) || this;
_this.setJwfStyle("MessageBox");
_this.setSize(300, 200);
_this.setPos();
_this.setTitle(title);
_this.active();
_this.setPadding(10, 10, 10, 10);
var label = new BaseView_1.BaseView();
_this.label = label;
label.setJwfStyle("MessageBoxLabel");
_this.addChild(label, "client");
if (msg)
label.getClient().innerText = msg;
var that = _this;
if (!buttons) {
buttons = [["OK", true]];
}
for (var i = buttons.length - 1; i >= 0; i--) {
var buttonData = buttons[i];
var b = new Button_1.Button(buttonData[0], buttonData[1]);
b.setAlign("center");
_this.addChild(b, "bottom");
b.addEventListener("buttonClick", function () {
that.callEvent("buttonClick", this.getValue());
that.close();
}.bind(b));
}
return _this;
}
MessageBox.prototype.setText = function (text) {
this.label.getClient().innerText = text;
};
return MessageBox;
}(FrameWindow_1.FrameWindow));
exports.MessageBox = MessageBox;
//# sourceMappingURL=MessageBox.js.map