Permalink
Browse files

Start of refactor. Window done.

  • Loading branch information...
1 parent 34921be commit 4903ea85469fa21afc8c861fdca553c50894c4a6 @tim-smart tim-smart committed Oct 9, 2010
Showing with 484 additions and 428 deletions.
  1. +2 −0 Makefile
  2. +0 −69 gtk.js
  3. +0 −325 src/gtk-window.cc
  4. +0 −4 src/gtk-window.h
  5. +8 −18 src/gtk.cc
  6. +32 −0 src/ngtk.cc
  7. +27 −0 src/ngtk.h
  8. +22 −0 src/ngtk_widget.cc
  9. +23 −0 src/ngtk_widget.h
  10. +289 −0 src/ngtk_window.cc
  11. +47 −0 src/ngtk_window.h
  12. +22 −11 test.js
  13. +12 −1 wscript
View
@@ -1,5 +1,7 @@
all:
node-waf configure build
+pre:
+ node-waf configure prebuild
tests:
node ./test.js
install:
View
69 gtk.js
@@ -25,12 +25,6 @@ var Window = function (params) {
self.emit('close');
};
- this.widget.container = exports.v({items: params.items});
- this.widget.add(this.widget.container);
- this.widget.add = function(obj) {
- self.widget.container.add(obj);
- };
-
for (var i = 0, il = keys.length; i < il; i++) {
key = keys[i];
@@ -73,66 +67,3 @@ proto.show = function () {
this.widget.show();
return this;
};
-
-exports.window = function(params) {
- var window = gtk.window();
- params || (params = {});
- if (params.width != null || params.height != null) {
- window.setSize(params.width, params.height);
- }
- if (params.dimensions != null) {
- window.setFrameDimensions(params.dimensions.left, params.dimensions.top, params.dimensions.right, params.dimensions.bottom);
- }
- if (params.position != null) {
- window.setPosition(params.position);
- }
- if (params.opacity != null) {
- window.setOpacity(params.opacity);
- }
-
- window.onShow = exports.main;
-
- window.container = exports.v({items: params.items});
- window.add(window.container);
- window.add = function(obj) {
- window.container.add(obj);
- };
- return window;
-};
-
-exports.button = function(params) {
- var button = gtk.button();
-
- if (params.title != null) button.setTitle(params.title);
- if (params.onClick != null) button.onClick(params.onClick);
-
- return button;
-};
-
-exports.entry = function(params) {
- var entry = gtk.entry();
- if (params.text != null) entry.setText(params.text);
- return entry;
-};
-
-exports.hbox = exports.h = function(params) {
- var hbox = gtk.hbox();
- if (typeof(params)=='object' && (params instanceof Array)) params = {items: params};
- if (params.items) for (i in params.items) {
- hbox.add(params.items[i]);
- }
- return hbox;
-};
-
-exports.vbox = exports.v = function(params) {
- var vbox = gtk.vbox();
- if (typeof(params)=='object' && (params instanceof Array)) params = {items: params};
- if (params.items) for (i in params.items) {
- vbox.add(params.items[i]);
- }
- return vbox;
-};
-
-exports.alert = function(title) {
- gtk.alert(title);
-};
Oops, something went wrong.

0 comments on commit 4903ea8

Please sign in to comment.