updated xobject , clutter base objects started
authorAlan Knowles <alan@akkbhome.com>
Thu, 30 Sep 2010 09:15:00 +0000 (17:15 +0800)
committerAlan Knowles <alan@akkbhome.com>
Thu, 30 Sep 2010 09:15:00 +0000 (17:15 +0800)
XObjectBase/GtkClutter/Actor.js [new file with mode: 0644]
XObjectBase/GtkClutter/Embed.js [new file with mode: 0644]
XObjectBase/GtkClutterActor.js [new file with mode: 0644]
XObjectBase/GtkClutterEmbed.js [new file with mode: 0644]

diff --git a/XObjectBase/GtkClutter/Actor.js b/XObjectBase/GtkClutter/Actor.js
new file mode 100644 (file)
index 0000000..67a2339
--- /dev/null
@@ -0,0 +1,37 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+
+
+//GtkClutter.Embed..
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+
+Actor = XObject.define(
+    function (x)
+    {
+        XObject.call(this,x);
+       
+               
+    },
+    XObject,
+    {
+        init : function() {
+            print ("Actor init");
+            var child = new XObject(this.items[0]);
+            child.init();
+            child.parent = this;
+            //var contents = new Gtk.Button({ label: 'test' }); 
+            var contents = child.el;
+           
+           // print(JSON.stringify(this.items));
+            
+            
+            this.el = new GtkClutter.Actor.with_contents (  contents) ;
+            XObject.prototype.init.call(this);
+        }
+
+    }
+);
\ No newline at end of file
diff --git a/XObjectBase/GtkClutter/Embed.js b/XObjectBase/GtkClutter/Embed.js
new file mode 100644 (file)
index 0000000..c9e5c0e
--- /dev/null
@@ -0,0 +1,42 @@
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+
+
+//GtkClutter.Embed..
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+
+Embed = XObject.define(
+    function (x)
+    {
+        XObject.call(this,x);
+        // make sure all the child elements are packed as false.
+        this.items.forEach( function(i) {
+            i.pack = false;
+        });
+               
+    },
+    XObject,
+    {
+        init : function() {
+            // add the event listener..
+            
+            XObject.init.call(this);
+            
+            print("----------Embed init");
+            this.addListener('show', function () {
+                print("-------EMBED - show");
+                var stage = this.el.get_stage(); 
+                //print(this.items.length);
+                this.items.forEach( function(e) { 
+                      //print(e.xtype);
+                    stage.add_actor(e.el);
+                });
+            }
+           
+           
+        }
+    }
+);
\ No newline at end of file
diff --git a/XObjectBase/GtkClutterActor.js b/XObjectBase/GtkClutterActor.js
new file mode 100644 (file)
index 0000000..a1e5de3
--- /dev/null
@@ -0,0 +1,36 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GtkClutter = imports.gi.GtkClutter;
+
+//GtkClutter.Embed..
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+
+GtkClutterActor = {
+    
+    onConstruct : function() {
+        this.items[0].pack = false;
+        
+    },
+    
+    init : function() {
+        print ("Actor init");
+        var child = this.items[0];
+        child.init();
+        
+        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
diff --git a/XObjectBase/GtkClutterEmbed.js b/XObjectBase/GtkClutterEmbed.js
new file mode 100644 (file)
index 0000000..2cab5b6
--- /dev/null
@@ -0,0 +1,40 @@
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GtkClutter = imports.gi.GtkClutter;
+
+//GtkClutter.Embed..
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+
+GtkClutterEmbed = {
+    onConstruct :  function (x)
+    {
+        // make sure all the child elements are packed as false.
+        this.items.forEach( function(i) {
+            i.pack = false;
+        });
+               
+    },
+    
+    init : function() {
+        // add the event listener..
+        
+        XObject.prototype.init.call(this);
+        
+        print("----------Embed init");
+        this.addListener('show', function () {
+            print("-------EMBED - show");
+            var stage = this.el.get_stage(); 
+            //print(this.items.length);
+            this.items.forEach( function(e) { 
+                  //print(e.xtype);
+                stage.add_actor(e.el);
+            });
+        });
+       
+       
+    }
+
+};
\ No newline at end of file