XObjectBase/GtkClutterActor.js
[app.Builder.js] / XObjectBase / GtkClutterActor.js
1
2 //<Script type="Text/javascript">
3
4 XObject = imports.XObject.XObject
5 GtkClutter = imports.gi.GtkClutter;
6
7 //GtkClutter.Embed..
8 // children are not added at init / but at show stage..
9 // listener is added on show..
10 // we should really add a hock to destroy it..
11
12 GtkClutterActor = {
13     
14     pack : function(parent, item)
15     {
16         print('actor pack: ' +  XObject.type(parent.xtype));
17         
18         
19     },
20     
21     onConstruct : function() {
22         if (!this.items.length) {
23             XObject.fatal("Actor does not have any children");
24             return;
25         }
26         
27         this.items[0].pack = false;
28         
29     },
30     
31     init : function() {
32         print ("Actor init");
33         if (!this.items.length) {
34             print ("Actor does not have any children");
35             return;
36         }
37         var child = this.items[0];
38         child.init();
39         child.pack = false;
40         child.parent = this;
41         //var contents = new Gtk.Button({ label: 'test' }); 
42         
43        // print(JSON.stringify(this.items));
44         child.el.show();
45         
46         this.el = new GtkClutter.Actor.with_contents (  child.el) ;
47         
48         XObject.prototype.init.call(this);
49         this.el.show_all();
50     }
51
52 };