This commit is contained in:
Namhyeon Go 2020-10-26 17:52:27 +09:00
parent 5e412918c3
commit efa4d07720

View File

@ -2,6 +2,8 @@
// GTKServer API
////////////////////////////////////////////////////////////////////////
var SHELL = require("lib/shell");
// set binPath
var binPath = "bin\\gtk-server.exe";
@ -10,15 +12,15 @@ var GTKElements = [];
// Common (Element)
var GTKElement = function() {
this.Type = "GTKElement";
this.Width = 0;
this.Height = 0;
this.type = "GTKElement";
this.width = 0;
this.height = 0;
this.setWidth = function(width) {
this.Width = width;
this.width = width;
};
this.setHeight = function(height) {
this.Height = height;
this.height = height;
};
this,onchange = function() {};
@ -38,12 +40,20 @@ var GTKElement = function() {
GTKElements.push(this);
};
// start GTKServer
var = function() {
SHELL.run([
binPath,
"-stdin"
]);
};
// Window
var Window = function() {
GTKElement.apply(this, arguments);
this.Type = "Window";
this.Title = "WelsonJS GTK GUI Application";
this.type = "Window";
this.title = "WelsonJS GTK GUI Application";
this.setTitle = function(title) {
this.Title = title;
};
@ -55,7 +65,7 @@ Window.prototype.constructor = Window;
var Table = function() {
GTKElement.apply(this, arguments);
this.Type = "Table";
this.type = "Table";
this.attach = function(element, left, right, top, buttom) {
// TODO: Table.attach()
};
@ -67,12 +77,11 @@ Table.prototype.constructor = Table;
var Button = function() {
GTKElement.apply(this, arguments);
this.Type = "Button";
this.Text = "New Button";
this.type = "Button";
this.text = "New Button";
this.setText = function(text) {
this.Text = text;
};
};
Button.prototype = new GTKElement();
Button.prototype.constructor = Button;
@ -81,10 +90,10 @@ Button.prototype.constructor = Button;
var Label = function() {
GTKElement.apply(this, arguments);
this.Type = "Label";
this.Text = "New Label";
this.type = "Label";
this.text = "New Label";
this.setText = function(text) {
this.Text = text;
this.text = text;
};
};
Label.prototype = new GTKElement();
@ -94,8 +103,8 @@ Label.prototype.constructor = Label;
var RadioBox = function() {
GTKElement.apply(this, arguments);
this.Type = "RadioBox";
this.Text = "New RadioBox";
this.type = "RadioBox";
this.text = "New RadioBox";
this.setText = function(text) {
this.Text = text;
};
@ -107,8 +116,8 @@ RadioBox.prototype.constructor = RadioBox;
var CheckBox = function() {
GTKElement.apply(this, arguments);
this.Type = "CheckBox";
this.Text = "New CheckBox";
this.type = "CheckBox";
this.text = "New CheckBox";
this.setText = function(text) {
this.Text = text;
};
@ -120,8 +129,8 @@ CheckBox.prototype.constructor = CheckBox;
var TextBox = function() {
GTKElement.apply(this, arguments);
this.Type = "TextBox";
this.Text = "New TextBox";
this.type = "TextBox";
this.text = "New TextBox";
this.setText = function(text) {
this.Text = text;
};