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