welsonjs/lib/gtkserver.js

135 lines
3.0 KiB
JavaScript
Raw Normal View History

2020-10-20 08:58:58 +00:00
////////////////////////////////////////////////////////////////////////
// GTKServer API
////////////////////////////////////////////////////////////////////////
2020-10-20 09:12:32 +00:00
// set binPath
var binPath = "bin\\gtk-server.exe";
2020-10-20 08:58:58 +00:00
// Common (Elements)
var GTKElements = [];
// Common (Element)
2020-10-20 09:14:35 +00:00
var GTKElement = function() {
this.Type = "GTKElement";
2020-10-20 08:58:58 +00:00
this.Width = 0;
this.Height = 0;
2020-10-20 09:14:35 +00:00
2020-10-20 08:58:58 +00:00
this.setWidth = function(width) {
this.Width = width;
};
this.setHeight = function(height) {
this.Height = height;
};
this,onchange = function() {};
this.onclick = function() {};
this.onmouseover = function() {};
this.onmouseout = function() {};
this.onkeydown = function() {};
this.onload = function() {};
this.addEventListener = function(ev, fn) {
if (typeof(fn) == "function") {
this['on' + ev] = fn;
} else {
throw new TypeError("listener must be a function");
}
};
GTKElements.push(this);
};
// Window
var Window = function() {
GTKElement.apply(this, arguments);
2020-10-20 09:12:32 +00:00
this.Type = "Window";
2020-10-20 08:58:58 +00:00
this.Title = "WelsonJS GTK GUI Application";
this.setTitle = function(title) {
this.Title = title;
};
};
Window.prototype = new GTKElement();
Window.prototype.constructor = Window;
// Table
var Table = function() {
GTKElement.apply(this, arguments);
2020-10-20 09:12:32 +00:00
this.Type = "Table";
2020-10-20 08:58:58 +00:00
this.attach = function(element, left, right, top, buttom) {
2020-10-20 09:14:35 +00:00
// TODO: Table.attach()
2020-10-20 08:58:58 +00:00
};
};
Table.prototype = new GTKElement();
Table.prototype.constructor = Table;
// Button
var Button = function() {
GTKElement.apply(this, arguments);
2020-10-20 09:12:32 +00:00
this.Type = "Button";
this.Text = "New Button";
2020-10-20 08:58:58 +00:00
this.setText = function(text) {
this.Text = text;
};
};
Button.prototype = new GTKElement();
Button.prototype.constructor = Button;
// Label
var Label = function() {
GTKElement.apply(this, arguments);
2020-10-20 09:12:32 +00:00
this.Type = "Label";
this.Text = "New Label";
2020-10-20 08:58:58 +00:00
this.setText = function(text) {
this.Text = text;
};
};
Label.prototype = new GTKElement();
Label.prototype.constructor = Label;
// RadioBox
var RadioBox = function() {
GTKElement.apply(this, arguments);
2020-10-20 09:12:32 +00:00
this.Type = "RadioBox";
this.Text = "New RadioBox";
2020-10-20 08:58:58 +00:00
this.setText = function(text) {
this.Text = text;
};
};
RadioBox.prototype = new GTKElement();
RadioBox.prototype.constructor = RadioBox;
// CheckBox
var CheckBox = function() {
GTKElement.apply(this, arguments);
2020-10-20 09:12:32 +00:00
this.Type = "CheckBox";
this.Text = "New CheckBox";
2020-10-20 08:58:58 +00:00
this.setText = function(text) {
this.Text = text;
};
};
CheckBox.prototype = new GTKElement();
CheckBox.prototype.constructor = CheckBox;
// TextBox
var TextBox = function() {
2020-10-20 09:12:32 +00:00
GTKElement.apply(this, arguments);
this.Type = "TextBox";
this.Text = "New TextBox";
2020-10-20 08:58:58 +00:00
this.setText = function(text) {
this.Text = text;
};
};
TextBox.prototype = new GTKElement();
TextBox.prototype.constructor = TextBox;
2020-10-20 09:12:32 +00:00
exports.start = function(callback) {
// TODO: start
};