Update gtk.js

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

View File

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