mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 21:26:04 +00:00
Update gtk.js
This commit is contained in:
parent
e2c927f9ad
commit
2bc2759f96
26
lib/gtk.js
26
lib/gtk.js
|
@ -52,7 +52,7 @@ var GTKCreateWidget = function(widget) {
|
||||||
subWidgets[i].left,
|
subWidgets[i].left,
|
||||||
subWidgets[i].right,
|
subWidgets[i].right,
|
||||||
subWidgets[i].top,
|
subWidgets[i].top,
|
||||||
subWidgets[i].buttom
|
subWidgets[i].bottom
|
||||||
]);
|
]);
|
||||||
|
|
||||||
countSubWidgets--;
|
countSubWidgets--;
|
||||||
|
@ -108,10 +108,14 @@ var GTKExecCommand = function(command) {
|
||||||
var line, _command = [];
|
var line, _command = [];
|
||||||
|
|
||||||
for (var i = 0; i < command.length; i++) {
|
for (var i = 0; i < command.length; i++) {
|
||||||
if (typeof(command[i]) == "number") {
|
var term = command[i];
|
||||||
_command.push((command[i] == 0 ? '0' : command[i]));
|
|
||||||
} else if (typeof(command[i]) == "string") {
|
if (typeof(term) == "number") {
|
||||||
_command.push(command[i]);
|
_command.push(term == 0 ? '0' : command[i]);
|
||||||
|
} else if (typeof(term) == "boolean") {
|
||||||
|
_command.push(!term ? '0' : '1');
|
||||||
|
} else if (typeof(term) == "string") {
|
||||||
|
_command.push(term);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +134,13 @@ var GTKInit = function() {
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// GTKExit
|
||||||
|
var GTKExit = function() {
|
||||||
|
return GTKExecCommand([
|
||||||
|
"gtk_server_exit"
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
var Window = function() {
|
var Window = function() {
|
||||||
GTKWidget.apply(this, arguments);
|
GTKWidget.apply(this, arguments);
|
||||||
|
@ -156,7 +167,6 @@ var Table = function() {
|
||||||
this.rows = 1;
|
this.rows = 1;
|
||||||
this.columns = 1;
|
this.columns = 1;
|
||||||
this.homogeneous = true;
|
this.homogeneous = true;
|
||||||
|
|
||||||
this.attachedWidgets = [];
|
this.attachedWidgets = [];
|
||||||
|
|
||||||
this.attach = function(widget, left, right, top, bottom) {
|
this.attach = function(widget, left, right, top, bottom) {
|
||||||
|
@ -262,6 +272,8 @@ TextBox.prototype.constructor = TextBox;
|
||||||
var GTKWait = function() {
|
var GTKWait = function() {
|
||||||
var even;
|
var even;
|
||||||
|
|
||||||
|
GTKInit();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
even = GTKExecCommand([
|
even = GTKExecCommand([
|
||||||
"gtk_server_callback",
|
"gtk_server_callback",
|
||||||
|
@ -272,6 +284,8 @@ var GTKWait = function() {
|
||||||
GTKWidgets[even].onEventTriggered();
|
GTKWidgets[even].onEventTriggered();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GTKExit();
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.wait = GTKWait;
|
exports.wait = GTKWait;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user