XObjectBase/GtkClutterEmbed.js
[app.Builder.js] / XObjectBase / GtkClutterEmbed.js
1 //<Script type="Text/javascript">
2
3 XObject = imports.XObject.XObject
4 GtkClutter = imports.gi.GtkClutter;
5
6 //GtkClutter.Embed..
7 // children are not added at init / but at show stage..
8 // listener is added on show..
9 // we should really add a hock to destroy it..
10 GtkClutterEmbed = XObject.define(
11     function(cfg) {
12         XObject.call(this, cfg);
13         this.items.forEach( function(i) {
14             i.pack = false;
15         });
16     }, 
17 GtkClutterEmbed = {
18     onConstruct :  function (x)
19     {
20         // make sure all the child elements are packed as false.
21         this.items.forEach( function(i) {
22             i.pack = false;
23         });
24                
25     },
26     
27     init : function() {
28         // add the event listener..
29         
30         XObject.prototype.init.call(this);
31         
32         print("----------Embed init");
33         this.addListener('show', function () {
34             print("-------EMBED - show");
35             var stage = this.el.get_stage(); 
36             //print(this.items.length);
37             this.items.forEach( function(e) { 
38                   //print(e.xtype);
39                 stage.add_actor(e.el);
40             });
41         });
42        
43        
44     }
45
46 };