Builder4/GtkView.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 19 Sep 2014 09:49:03 +0000 (17:49 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 19 Sep 2014 09:49:03 +0000 (17:49 +0800)
Builder4/GtkView.bjs

index b98d3a0..fee61cb 100644 (file)
@@ -7,8 +7,21 @@
     "modOrder" : "",
     "items" : [
         {
-            "xtype" : "VPaned",
-            "$ xns" : "Gtk"
+            "id" : "GtkView",
+            "# Gtk.Widget lastObj" : "null",
+            "| void loadFile" : "(JsRender.JsRender file) \n{\n    \n \n        this.file = null;\n        \n        if (file.tree == null) {\n            return;\n        }\n        this.file = file;\n        if (this.lastObj != null) {\n            this.container.el.remove(this.lastObj);\n        }\n \n\tvar x = new JsRender.NodeToGtk(file.tree);\n        var obj = x.munge() as Gtk.Widget;\n        this.lastObj = null;\n\tif (obj == null) {\n        \treturn;\n\t}\n\tthis.lastObj = obj;\n        \n        this.container.el.add(obj);\n        obj.show_all();\n}\n",
+            "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n\n    Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?\n\n    screenshot.save(filename,\"png\");\n    return;\n    \n    \n    \n    \n    \n     \n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
+            "xtype" : "Viewport",
+            "# JsRender.JsRender file" : "null",
+            "$ xns" : "Gtk",
+            "items" : [
+                {
+                    "id" : "container",
+                    "xtype" : "HBox",
+                    "* pack" : "add",
+                    "$ xns" : "Gtk"
+                }
+            ]
         }
     ]
 }
\ No newline at end of file