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()
15     {
16         
17     },
18     
19     onConstruct : function() {
20         if (!this.items.length) {
21             XObject.fatal("Actor does not have any children");
22             return;
23         }
24         
25         this.items[0].pack = false;
26         
27     },
28     
29     init : function() {
30         print ("Actor init");
31         if (!this.items.length) {
32             print ("Actor does not have any children");
33             return;
34         }
35         var child = this.items[0];
36         child.init();
37         child.pack = false;
38         child.parent = this;
39         //var contents = new Gtk.Button({ label: 'test' }); 
40         
41        // print(JSON.stringify(this.items));
42         child.el.show();
43         
44         this.el = new GtkClutter.Actor.with_contents (  child.el) ;
45         
46         XObject.prototype.init.call(this);
47         this.el.show_all();
48     }
49
50 };