src/Builder4/GtkView.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 19 May 2015 06:53:22 +0000 (14:53 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 19 May 2015 06:53:22 +0000 (14:53 +0800)
src/Builder4/GtkView.vala

src/Builder4/GtkView.bjs
src/Builder4/GtkView.vala

index f96ef03..d8fb84b 100644 (file)
@@ -12,8 +12,8 @@
     "size_allocate" : "(aloc) => {\n\n    this.width = aloc.width;\n    this.height =aloc.height;\n    }\n"
    },
    "id" : "GtkView",
-   "# Gtk.Widget lastObj" : "null",
    "| 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",
+   "# Gtk.Widget lastObj" : "null",
    "| void loadFile" : "(JsRender.JsRender file) \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        // hide the compile view at present..\n          \n        \n        var w = this.width;\n        var h = this.height;\n        \n        print(\"ALLOC SET SIZES %d, %d\\n\", w,h); \n        \n        // set the container size min to 500/500 or 20 px less than max..\n        w = int.max (w-20, 500);\n        h = int.max (h-20, 500); \n        \n        print(\"SET SIZES %d, %d\\n\", w,h);       \n        _this.container.el.set_size_request(w,h);\n        \n        _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.\n        var rgba = Gdk.RGBA ();\n        rgba.parse (\"#ccc\");\n        _this.view_layout.el.override_background_color(Gtk.StateFlags.NORMAL, rgba);\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         \n        \n}\n ",
    "int width" : 0,
    "Xcls_MainWindow main_window" : "",
    "int height" : 0,
    "$ xns" : "Gtk",
    "items" : [
+    {
+     "* pack" : "pack_start,?bool?,?bool?,?uint?",
+     "xtype" : "Notebook",
+     "$ xns" : "Gtk"
+    },
     {
      "* pack" : "pack_start,true,true,0",
      "xtype" : "ScrolledWindow",
      "items" : [
       {
        "id" : "view_layout",
-       "* pack" : "add",
        "xtype" : "Layout",
+       "* pack" : "add",
        "$ xns" : "Gtk",
        "items" : [
         {
          "id" : "container",
-         "xtype" : "HBox",
          "* pack" : "put,10,10",
+         "xtype" : "HBox",
          "$ xns" : "Gtk"
         }
        ]
index fa3d562..340fc57 100644 (file)
@@ -1,6 +1,6 @@
 static Xcls_GtkView  _GtkView;
 
-public class Xcls_GtkView : Object 
+public class Xcls_GtkView : Object
 {
     public Gtk.VBox el;
     private Xcls_GtkView  _this;
@@ -22,7 +22,7 @@ public class Xcls_GtkView : Object
     public JsRender.JsRender file;
     public int height;
 
-    // ctor 
+    // ctor
     public Xcls_GtkView()
     {
         _this = this;
@@ -35,11 +35,14 @@ public class Xcls_GtkView : Object
         this.height = 0;
 
         // set gobject values
-        var child_0 = new Xcls_ScrolledWindow2( _this );
+        var child_0 = new Xcls_Notebook2( _this );
         child_0.ref();
-        this.el.pack_start (  child_0.el , true,true,0 );
+        this.el.pack_start (  child_0.el , ?bool?,?bool?,?uint? );
+        var child_1 = new Xcls_ScrolledWindow3( _this );
+        child_1.ref();
+        this.el.pack_start (  child_1.el , true,true,0 );
 
-        // listeners 
+        //listeners
         this.el.size_allocate.connect( (aloc) => {
         
             this.width = aloc.width;
@@ -47,7 +50,7 @@ public class Xcls_GtkView : Object
             });
     }
 
-    // user defined functions 
+    // user defined functions
     public void createThumb () {
         
         
@@ -129,7 +132,29 @@ public class Xcls_GtkView : Object
              
             
     }
-    public class Xcls_ScrolledWindow2 : Object 
+    public class Xcls_Notebook2 : Object
+    {
+        public Gtk.Notebook el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Notebook2(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Notebook();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions
+    }
+
+    public class Xcls_ScrolledWindow3 : Object
     {
         public Gtk.ScrolledWindow el;
         private Xcls_GtkView  _this;
@@ -137,8 +162,8 @@ public class Xcls_GtkView : Object
 
             // my vars (def)
 
-        // ctor 
-        public Xcls_ScrolledWindow2(Xcls_GtkView _owner )
+        // ctor
+        public Xcls_ScrolledWindow3(Xcls_GtkView _owner )
         {
             _this = _owner;
             this.el = new Gtk.ScrolledWindow( null, null );
@@ -151,9 +176,9 @@ public class Xcls_GtkView : Object
             this.el.add (  child_0.el  );
         }
 
-        // user defined functions 
+        // user defined functions
     }
-    public class Xcls_view_layout : Object 
+    public class Xcls_view_layout : Object
     {
         public Gtk.Layout el;
         private Xcls_GtkView  _this;
@@ -161,7 +186,7 @@ public class Xcls_GtkView : Object
 
             // my vars (def)
 
-        // ctor 
+        // ctor
         public Xcls_view_layout(Xcls_GtkView _owner )
         {
             _this = _owner;
@@ -176,9 +201,9 @@ public class Xcls_GtkView : Object
             this.el.put (  child_0.el , 10,10 );
         }
 
-        // user defined functions 
+        // user defined functions
     }
-    public class Xcls_container : Object 
+    public class Xcls_container : Object
     {
         public Gtk.HBox el;
         private Xcls_GtkView  _this;
@@ -186,7 +211,7 @@ public class Xcls_GtkView : Object
 
             // my vars (def)
 
-        // ctor 
+        // ctor
         public Xcls_container(Xcls_GtkView _owner )
         {
             _this = _owner;
@@ -198,6 +223,9 @@ public class Xcls_GtkView : Object
             // set gobject values
         }
 
-        // user defined functions 
+        // user defined functions
     }
+
+
+
 }