src/Builder4/WindowAddProp.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 17 Mar 2015 14:24:41 +0000 (22:24 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 17 Mar 2015 14:24:41 +0000 (22:24 +0800)
src/Builder4/WindowAddProp.vala

src/Builder4/WindowAddProp.bjs
src/Builder4/WindowAddProp.vala

index 6e33494..9981361 100644 (file)
@@ -1,61 +1,60 @@
 {
-    "id": "file-gtk-14",
-    "name": "WindowAddProp",
-    "parent": "",
-    "title": false,
-    "path": "/home/alan/gitlive/app.Builder.js/Builder4/WindowAddProp.bjs",
-    "items": [
+ "name" : "WindowAddProp",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/WindowAddProp.bjs",
+ "permname" : "",
+ "modOrder" : "",
+ "items" : [
+  {
+   "id" : "WindowAddProp",
+   "* init" : "    this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n ",
+   "$ shadow_type" : "Gtk.ShadowType.IN",
+   "| void show" : "(Palete.Palete pal, string etype, string xtype) {\n    this.model.el.clear();\n\n    Gtk.TreeIter iter;\n    var elementList = pal.getPropertiesFor( xtype,etype);\n    \n    \n    //print (\"GOT \" + elementList.length + \" items for \" + fullpath + \"|\" + type);\n           // console.dump(elementList);\n           \n    var miter = elementList.map_iterator();\n    while (miter.next()) {\n       var p = miter.get_value();\n        \n        this.model.el.append(out iter);\n\n        this.model.el.set(iter,\n                0,  p.name, \n                1, p.type,\n                2, \"<b>\" + p.name +\"</b> <i>\"+p.type+\"</i>\\n\" + \n                        GLib.Markup.escape_text(p.doctxt),\n                3, p.sig,\n                4, \"<b>\" + p.name +\"</b> <span size=\\\"small\\\"><i>\"+p.type+\"</i></span>\",\n                5, etype,\n                -1\n        );\n    }\n    this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n                             \n}\n",
+   "xtype" : "ScrolledWindow",
+   "@ void select" : "(string key, string type, string skel, string etype)",
+   "$ xns" : "Gtk",
+   "| void clear" : "() {\n    this.model.el.clear();\n\n}",
+   "items" : [
+    {
+     "listeners" : {
+      "row_activated" : "(path, column)  => {\n\n        Gtk.TreeIter iter;\n\n\n        var m = _this.model;\n        \n        m.el.get_iter(out iter,path);\n        \n        \n        // var val = \"\";\n        \n        \n        var key = m.getValue(iter, 0);\n        \n        var type = m.getValue(iter, 1);\n        var skel = m.getValue(iter, 3);\n        var etype = m.getValue(iter, 5);\n        \n        \n        _this.select(key,etype == \"signals\" ? \"\" : type,skel, etype);\n        \n}\n"
+     },
+     "* init" : "{  \n       var description = new Pango.FontDescription();\n     description.set_size(8000);\n    this.el.modify_font(description);     \n                    \n    this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);\n \n\n    \n  \n    \n}\n",
+     "tooltip_column" : 2,
+     "xtype" : "TreeView",
+     "* pack" : "add",
+     "$ enable_tree_lines" : true,
+     "$ headers_visible" : true,
+     "$ xns" : "Gtk",
+     "items" : [
+      {
+       "| string getValue" : "(Gtk.TreeIter iter, int col)\n{\n\n    GLib.Value value;\n    this.el.get_value(iter, col, out value);\n\n    return (string)value;\n    \n}",
+       "id" : "model",
+       "* pack" : "set_model",
+       "xtype" : "ListStore",
+       "$ columns" : "typeof(string),  // 0 real key\ntypeof(string), // 1 real type\ntypeof(string), // 2 docs ?\ntypeof(string), // 3 visable desc\ntypeof(string), // 4 function desc\ntypeof(string) // 5 element type (event|prop)\n        ",
+       "n_columns" : 6,
+       "$ xns" : "Gtk"
+      },
+      {
+       "id" : "namecol",
+       "* init" : "  this.el.add_attribute(_this.namerender.el , \"markup\", 4  );\n \n",
+       "xtype" : "TreeViewColumn",
+       "* pack" : "append_column",
+       "$ xns" : "Gtk",
+       "items" : [
         {
-            "|void:clear": "() {\n    this.model.el.clear();\n\n}",
-            ".signal:void:select": "(string key, string type, string skel, string etype)",
-            "id": "WindowAddProp",
-            "xtype": "ScrolledWindow",
-            "|init": "    this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n ",
-            "|shadow_type": "Gtk.ShadowType.IN",
-            "|void:show": "(Palete.Palete pal, string etype, string xtype) {\n    this.model.el.clear();\n\n    Gtk.TreeIter iter;\n    var elementList = pal.getPropertiesFor( xtype,etype);\n    \n    \n    //print (\"GOT \" + elementList.length + \" items for \" + fullpath + \"|\" + type);\n           // console.dump(elementList);\n           \n    var miter = elementList.map_iterator();\n    while (miter.next()) {\n       var p = miter.get_value();\n        \n        this.model.el.append(out iter);\n\n        this.model.el.set(iter,\n                0,  p.name, \n                1, p.type,\n                2, \"<b>\" + p.name +\"</b> <i>\"+p.type+\"</i>\\n\" + \n                        GLib.Markup.escape_text(p.doctxt),\n                3, p.sig,\n                4, \"<b>\" + p.name +\"</b> <span size=\\\"small\\\"><i>\"+p.type+\"</i></span>\",\n                5, etype,\n                -1\n        );\n    }\n    this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n                             \n}\n",
-            "|xns": "Gtk",
-            "items": [
-                {
-                    "listeners": {
-                        "row_activated": "(path, column)  => {\n\n        Gtk.TreeIter iter;\n\n\n        var m = _this.model;\n        \n        m.el.get_iter(out iter,path);\n        \n        \n        // var val = \"\";\n        \n        \n        var key = m.getValue(iter, 0);\n        \n        var type = m.getValue(iter, 1);\n        var skel = m.getValue(iter, 3);\n        var etype = m.getValue(iter, 5);\n        \n        \n        _this.select(key,etype == \"signals\" ? \"\" : type,skel, etype);\n        \n}\n"
-                    },
-                    "pack": "add",
-                    "tooltip_column": 2,
-                    "xtype": "TreeView",
-                    "|enable_tree_lines": "true",
-                    "|headers_visible": "false",
-                    "|init": "{  \n       var description = new Pango.FontDescription();\n     description.set_size(8000);\n    this.el.modify_font(description);     \n                    \n    this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);\n \n\n    \n  \n    \n}\n",
-                    "|xns": "Gtk",
-                    "items": [
-                        {
-                            "id": "model",
-                            "n_columns": 6,
-                            "pack": "set_model",
-                            "xtype": "ListStore",
-                            "|columns": "typeof(string),  // 0 real key\ntypeof(string), // 1 real type\ntypeof(string), // 2 docs ?\ntypeof(string), // 3 visable desc\ntypeof(string), // 4 function desc\ntypeof(string) // 5 element type (event|prop)\n        ",
-                            "|string:getValue": "(Gtk.TreeIter iter, int col)\n{\n\n    GLib.Value value;\n    this.el.get_value(iter, col, out value);\n\n    return (string)value;\n    \n}",
-                            "|xns": "Gtk"
-                        },
-                        {
-                            "id": "namecol",
-                            "pack": "append_column",
-                            "xtype": "TreeViewColumn",
-                            "|init": "  this.el.add_attribute(_this.namerender.el , \"markup\", 4  );\n \n",
-                            "|xns": "Gtk",
-                            "items": [
-                                {
-                                    "id": "namerender",
-                                    "pack": "pack_start,true",
-                                    "xtype": "CellRendererText",
-                                    "|xns": "Gtk"
-                                }
-                            ]
-                        }
-                    ]
-                }
-            ]
+         "id" : "namerender",
+         "xtype" : "CellRendererText",
+         "* pack" : "pack_start,true",
+         "$ xns" : "Gtk"
         }
-    ],
-    "permname": "",
-    "modOrder": ""
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
 }
\ No newline at end of file
index 8eba9ee..c156dd4 100644 (file)
@@ -1,42 +1,31 @@
-/* -- to compile
-valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \
-    /tmp/WindowAddProp.vala  -o /tmp/WindowAddProp
-*/
-
-
-/* -- to test class
-static int main (string[] args) {
-    Gtk.init (ref args);
-    new Xcls_WindowAddProp();
-    WindowAddProp.show_all();
-     Gtk.main ();
-    return 0;
-}
-*/
-
-
-public static Xcls_WindowAddProp  WindowAddProp;
+static Xcls_WindowAddProp  _WindowAddProp;
 
 public class Xcls_WindowAddProp : Object 
 {
     public Gtk.ScrolledWindow el;
     private Xcls_WindowAddProp  _this;
 
+    public static Xcls_WindowAddProp singleton()
+    {
+        if (_WindowAddProp == null) {
+            _WindowAddProp= new Xcls_WindowAddProp();
+        }
+        return _WindowAddProp;
+    }
     public Xcls_model model;
     public Xcls_namecol namecol;
     public Xcls_namerender namerender;
 
-        // my vars
-    public signal void select(string key, string type, string skel, string etype);
+        // my vars (def)
+    public signal void select (string key, string type, string skel, string etype);
 
-        // ctor 
+    // ctor 
     public Xcls_WindowAddProp()
     {
         _this = this;
-        WindowAddProp = this;
         this.el = new Gtk.ScrolledWindow( null, null );
 
-        // my vars
+        // my vars (dec)
 
         // set gobject values
         this.el.shadow_type = Gtk.ShadowType.IN;
@@ -45,67 +34,65 @@ public class Xcls_WindowAddProp : Object
         this.el.add (  child_0.el  );
 
         // init method 
-            this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-         
+
+        this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
     }
 
-    // userdefined functions 
-    public void clear() {
-            this.model.el.clear();
+    // user defined functions 
+    public void show (Palete.Palete pal, string etype, string xtype) {
+        this.model.el.clear();
+    
+        Gtk.TreeIter iter;
+        var elementList = pal.getPropertiesFor( xtype,etype);
         
-        }
-    public void show(Palete.Palete pal, string etype, string xtype) {
-            this.model.el.clear();
         
-            Gtk.TreeIter iter;
-            var elementList = pal.getPropertiesFor( xtype,etype);
-            
+        //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
+               // console.dump(elementList);
+               
+        var miter = elementList.map_iterator();
+        while (miter.next()) {
+           var p = miter.get_value();
             
-            //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
-                   // console.dump(elementList);
-                   
-            var miter = elementList.map_iterator();
-            while (miter.next()) {
-               var p = miter.get_value();
-                
-                this.model.el.append(out iter);
-        
-                this.model.el.set(iter,
-                        0,  p.name, 
-                        1, p.type,
-                        2, "<b>" + p.name +"</b> <i>"+p.type+"</i>\n" + 
-                                GLib.Markup.escape_text(p.doctxt),
-                        3, p.sig,
-                        4, "<b>" + p.name +"</b> <span size=\"small\"><i>"+p.type+"</i></span>",
-                        5, etype,
-                        -1
-                );
-            }
-            this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-                                     
+            this.model.el.append(out iter);
+    
+            this.model.el.set(iter,
+                    0,  p.name, 
+                    1, p.type,
+                    2, "<b>" + p.name +"</b> <i>"+p.type+"</i>\n" + 
+                            GLib.Markup.escape_text(p.doctxt),
+                    3, p.sig,
+                    4, "<b>" + p.name +"</b> <span size=\"small\"><i>"+p.type+"</i></span>",
+                    5, etype,
+                    -1
+            );
         }
-
-    // skip |xns - no return type
+        this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+                                 
+    }
+    public void clear () {
+        this.model.el.clear();
+    
+    }
     public class Xcls_TreeView2 : Object 
     {
         public Gtk.TreeView el;
         private Xcls_WindowAddProp  _this;
 
 
-            // my vars
+            // my vars (def)
 
-            // ctor 
+        // ctor 
         public Xcls_TreeView2(Xcls_WindowAddProp _owner )
         {
             _this = _owner;
             this.el = new Gtk.TreeView();
 
-            // my vars
+            // my vars (dec)
 
             // set gobject values
-            this.el.enable_tree_lines = true;
-            this.el.headers_visible = false;
             this.el.tooltip_column = 2;
+            this.el.enable_tree_lines = true;
+            this.el.headers_visible = true;
             var child_0 = new Xcls_model( _this );
             child_0.ref();
             this.el.set_model (  child_0.el  );
@@ -114,6 +101,7 @@ public class Xcls_WindowAddProp : Object
             this.el.append_column (  child_1.el  );
 
             // init method 
+
             {  
                    var description = new Pango.FontDescription();
                  description.set_size(8000);
@@ -150,13 +138,10 @@ public class Xcls_WindowAddProp : Object
                     
                     _this.select(key,etype == "signals" ? "" : type,skel, etype);
                     
-            }
-             );
+            });
         }
 
-        // userdefined functions 
-
-        // skip |xns - no return type
+        // user defined functions 
     }
     public class Xcls_model : Object 
     {
@@ -164,9 +149,9 @@ public class Xcls_WindowAddProp : Object
         private Xcls_WindowAddProp  _this;
 
 
-            // my vars
+            // my vars (def)
 
-            // ctor 
+        // ctor 
         public Xcls_model(Xcls_WindowAddProp _owner )
         {
             _this = _owner;
@@ -179,23 +164,21 @@ typeof(string), // 4 function desc
 typeof(string) // 5 element type (event|prop)
          );
 
-            // my vars
+            // my vars (dec)
 
             // set gobject values
         }
 
-        // userdefined functions 
-        public string getValue(Gtk.TreeIter iter, int col)
-            {
-            
-                GLib.Value value;
-                this.el.get_value(iter, col, out value);
+        // user defined functions 
+        public string getValue (Gtk.TreeIter iter, int col)
+        {
+        
+            GLib.Value value;
+            this.el.get_value(iter, col, out value);
+        
+            return (string)value;
             
-                return (string)value;
-                
-            }
-
-        // skip |xns - no return type
+        }
     }
     public class Xcls_namecol : Object 
     {
@@ -203,16 +186,16 @@ typeof(string) // 5 element type (event|prop)
         private Xcls_WindowAddProp  _this;
 
 
-            // my vars
+            // my vars (def)
 
-            // ctor 
+        // ctor 
         public Xcls_namecol(Xcls_WindowAddProp _owner )
         {
             _this = _owner;
             _this.namecol = this;
             this.el = new Gtk.TreeViewColumn();
 
-            // my vars
+            // my vars (dec)
 
             // set gobject values
             var child_0 = new Xcls_namerender( _this );
@@ -220,13 +203,11 @@ typeof(string) // 5 element type (event|prop)
             this.el.pack_start (  child_0.el , true );
 
             // init method 
-              this.el.add_attribute(_this.namerender.el , "markup", 4  );
-             
-        }
 
-        // userdefined functions 
+            this.el.add_attribute(_this.namerender.el , "markup", 4  );
+        }
 
-        // skip |xns - no return type
+        // user defined functions 
     }
     public class Xcls_namerender : Object 
     {
@@ -234,22 +215,20 @@ typeof(string) // 5 element type (event|prop)
         private Xcls_WindowAddProp  _this;
 
 
-            // my vars
+            // my vars (def)
 
-            // ctor 
+        // ctor 
         public Xcls_namerender(Xcls_WindowAddProp _owner )
         {
             _this = _owner;
             _this.namerender = this;
             this.el = new Gtk.CellRendererText();
 
-            // my vars
+            // my vars (dec)
 
             // set gobject values
         }
 
-        // userdefined functions 
-
-        // skip |xns - no return type
+        // user defined functions 
     }
 }