X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=XObjectBase%2FGtkClutterActor.js;h=369855892bbf76ed6663e67a3291bcdc144445e2;hb=119290bc3234e9ece1c64dbd72ca486d9633b5b7;hp=ab912da7748a0914890200c0b1fe32b942d2eaed;hpb=814daa46f9785d2c432015dd0adfdfb21b02a09e;p=app.Builder.js diff --git a/XObjectBase/GtkClutterActor.js b/XObjectBase/GtkClutterActor.js index ab912da77..369855892 100644 --- a/XObjectBase/GtkClutterActor.js +++ b/XObjectBase/GtkClutterActor.js @@ -9,47 +9,53 @@ GtkClutter = imports.gi.GtkClutter; // listener is added on show.. // we should really add a hock to destroy it.. -GtkClutterActor = { - - pack : function(parent, item) - { - print('actor pack: ' + XObject.type(parent.xtype)); - if (XObject.type(parent.xtype) == 'GtkClutterWindow') { - var st = parent.el.getStage(); - st.add_actor(this.el); - } - - }, - - onConstruct : function() { + +GtkClutterActor = XObject.define( + function(cfg) { + XObject.call(this, cfg); if (!this.items.length) { XObject.fatal("Actor does not have any children"); return; } this.items[0].pack = false; - - }, + }, + XObject, + { - init : function() { - print ("Actor init"); - if (!this.items.length) { - print ("Actor does not have any children"); - return; - } - var child = this.items[0]; - child.init(); - child.pack = false; - child.parent = this; - //var contents = new Gtk.Button({ label: 'test' }); + pack : function(parent, item) + { + + if (XObject.type(parent.xtype) == 'GtkClutterWindow') { + var st = parent.el.get_stage(); + st.add_actor(this.el); + return; + } + XObject.fatal("do not know how to pack actor into " + XObject.type(parent.xtype)); + + }, - // print(JSON.stringify(this.items)); - child.el.show(); + - this.el = new GtkClutter.Actor.with_contents ( child.el) ; - - XObject.prototype.init.call(this); - this.el.show_all(); + init : function() { + print ("Actor init"); + if (!this.items.length) { + print ("Actor does not have any children"); + return; + } + var child = this.items[0]; + child.init(); + child.pack = false; + child.parent = this; + //var contents = new Gtk.Button({ label: 'test' }); + + // print(JSON.stringify(this.items)); + child.el.show(); + + this.el = new GtkClutter.Actor.with_contents ( child.el) ; + + XObject.prototype.init.call(this); + this.el.show_all(); + } } - -}; \ No newline at end of file +); \ No newline at end of file