Update gtk.js

This commit is contained in:
Namhyeon Go 2020-10-28 15:14:04 +09:00
parent 8560f2eb45
commit 8bba929f18

View File

@ -16,7 +16,7 @@ var GTKWidgets = {};
// Common (Element)
var GTKWidget = function() {
this.widgetType = "GTKWidget";
this.dispatchEvent = function(event) {
event.target = this;
if(event.eventName in this) {
@ -37,10 +37,11 @@ var GTKWidget = function() {
this.setWidgetType = function(widgetType) {
this.widgetType = widgetType;
};
this.dispatchEvent(new GTKEvent("load"));
this.widgetID = GTKCreateWidget(this);
GTKWidgets[this.widgetID] = this;
this.create = function() {
this.dispatchEvent(new GTKEvent("load"));
this.widgetID = GTKCreateWidget(this);
GTKWidgets[this.widgetID] = this;
}
};
// Common (definedEvents)
@ -190,6 +191,7 @@ var Window = function() {
]);
};
this.setWidgetType(this.widgetType);
this.create();
};
Window.prototype = new GTKWidget();
Window.prototype.constructor = Window;
@ -219,6 +221,7 @@ var Table = function() {
};
this.setWidgetType(this.widgetType);
this.create();
};
Table.prototype = new GTKWidget();
Table.prototype.constructor = Table;
@ -231,6 +234,7 @@ var Button = function() {
this.text = "New Button";
this.setWidgetType(this.widgetType);
this.create();
};
Button.prototype = new GTKWidget();
Button.prototype.constructor = Button;
@ -277,6 +281,7 @@ var Entry = function() {
this.setText(this.text);
this.setWidgetType(this.widgetType);
this.create();
};
Entry.prototype = new GTKWidget();
Entry.prototype.constructor = Entry;
@ -290,6 +295,7 @@ var RadioBox = function() {
this.member = "NULL";
this.setWidgetType(this.widgetType);
this.create();
};
RadioBox.prototype = new GTKWidget();
RadioBox.prototype.constructor = RadioBox;
@ -316,6 +322,7 @@ var TextBox = function() {
this.setText(this.text);
this.setWidgetType(this.widgetType);
this.create();
};
TextBox.prototype = new GTKWidget();
TextBox.prototype.constructor = TextBox;
@ -351,6 +358,7 @@ exports.Button = Button;
exports.Entry = Entry;
exports.RadioBox = RadioBox;
exports.TextBox = TextBox;
exports.init = GTKInit;
exports.wait = GTKWait;