mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-11 16:35:13 +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].right,
|
||||
subWidgets[i].top,
|
||||
subWidgets[i].buttom
|
||||
subWidgets[i].bottom
|
||||
]);
|
||||
|
||||
countSubWidgets--;
|
||||
|
@ -108,10 +108,14 @@ var GTKExecCommand = function(command) {
|
|||
var line, _command = [];
|
||||
|
||||
for (var i = 0; i < command.length; i++) {
|
||||
if (typeof(command[i]) == "number") {
|
||||
_command.push((command[i] == 0 ? '0' : command[i]));
|
||||
} else if (typeof(command[i]) == "string") {
|
||||
_command.push(command[i]);
|
||||
var term = command[i];
|
||||
|
||||
if (typeof(term) == "number") {
|
||||
_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
|
||||
var Window = function() {
|
||||
GTKWidget.apply(this, arguments);
|
||||
|
@ -156,7 +167,6 @@ var Table = function() {
|
|||
this.rows = 1;
|
||||
this.columns = 1;
|
||||
this.homogeneous = true;
|
||||
|
||||
this.attachedWidgets = [];
|
||||
|
||||
this.attach = function(widget, left, right, top, bottom) {
|
||||
|
@ -262,6 +272,8 @@ TextBox.prototype.constructor = TextBox;
|
|||
var GTKWait = function() {
|
||||
var even;
|
||||
|
||||
GTKInit();
|
||||
|
||||
while (true) {
|
||||
even = GTKExecCommand([
|
||||
"gtk_server_callback",
|
||||
|
@ -272,6 +284,8 @@ var GTKWait = function() {
|
|||
GTKWidgets[even].onEventTriggered();
|
||||
}
|
||||
}
|
||||
|
||||
GTKExit();
|
||||
};
|
||||
|
||||
exports.wait = GTKWait;
|
||||
|
|
Loading…
Reference in New Issue
Block a user