Builder4/GtkView.bjs.oyWXeeZ
authorAlan Knowles <alan@roojs.com>
Fri, 19 Sep 2014 10:06:40 +0000 (18:06 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 19 Sep 2014 10:06:40 +0000 (18:06 +0800)
Attribute changed Builder4/GtkView.bjs.oyWXeeZ
Builder4/GtkView.vala.oMooDyo
Attribute changed Builder4/GtkView.vala.oMooDyo
Builder4/GtkView.bjs
Builder4/GtkView.vala

Builder4/GtkView.bjs
Builder4/GtkView.vala

index 10c6257..2260f1f 100644 (file)
@@ -6,9 +6,5 @@
     "permname" : "",
     "modOrder" : "",
     "items" : [
-        {
-            "xtype" : "Window",
-            "$ xns" : "Gtk"
-        }
     ]
 }
\ No newline at end of file
index d09b70d..9665aa9 100644 (file)
-static GtkView  _GtkView;
+static Xcls_GtkView  _GtkView;
 
-public class GtkView : Object 
+public class Xcls_GtkView : Object 
 {
-    public Gtk.Window el;
-    private GtkView  _this;
+    public Gtk.Viewport el;
+    private Xcls_GtkView  _this;
 
-    public static GtkView singleton()
+    public static Xcls_GtkView singleton()
     {
         if (_GtkView == null) {
-            _GtkView= new GtkView();
+            _GtkView= new Xcls_GtkView();
         }
         return _GtkView;
     }
+    public Xcls_container container;
 
         // my vars (def)
+    public Gtk.Widget lastObj;
+    public JsRender.JsRender file;
 
     // ctor 
-    public GtkView()
+    public Xcls_GtkView()
     {
         _this = this;
-        this.el = new Gtk.Window( null );
+        this.el = new Gtk.Viewport( null, null );
 
         // my vars (dec)
+        this.lastObj = null;
+        this.file = null;
 
         // set gobject values
+        var child_0 = new Xcls_container( _this );
+        child_0.ref();
+        this.el.add (  child_0.el  );
     }
 
     // user defined functions 
+    public void loadFile (JsRender.JsRender file) 
+    {
+        
+     
+            this.file = null;
+            
+            if (file.tree == null) {
+                return;
+            }
+            this.file = file;
+            if (this.lastObj != null) {
+                this.container.el.remove(this.lastObj);
+            }
+     
+       var x = new JsRender.NodeToGtk(file.tree);
+            var obj = x.munge() as Gtk.Widget;
+            this.lastObj = null;
+       if (obj == null) {
+               return;
+       }
+       this.lastObj = obj;
+            
+            this.container.el.add(obj);
+            obj.show_all();
+    }
+    public void createThumb () {
+        
+        
+        if (this.file == null) {
+            return;
+        }
+        var filename = this.file.getIconFileName(false);
+        
+        var  win = this.el.get_parent_window();
+        var width = win.get_width();
+        var height = win.get_height();
+    
+        Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?
+    
+        screenshot.save(filename,"png");
+        return;
+        
+        
+        
+        
+        
+         
+        
+        // should we hold until it's printed...
+        
+          
+    
+        
+        
+    
+    
+        
+         
+    }
+    public class Xcls_container : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_container(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            _this.container = this;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
 }