src/Builder4/PopoverProperty.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 29 May 2015 09:36:23 +0000 (17:36 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 29 May 2015 09:36:23 +0000 (17:36 +0800)
src/Builder4/PopoverProperty.vala

src/Builder4/PopoverProperty.bjs
src/Builder4/PopoverProperty.vala

index 3dcdd54..dd46f81 100644 (file)
          "x_options" : 4,
          "$ xns" : "Gtk"
         },
+        {
+         "id" : "build_module",
+         "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
+         "* pack" : "attach_defaults,1,2,6,7",
+         "xtype" : "ComboBox",
+         "$ xns" : "Gtk",
+         "items" : [
+          {
+           "id" : "dbcellrenderer",
+           "* pack" : "pack_start,true",
+           "xtype" : "CellRendererText",
+           "$ xns" : "Gtk"
+          },
+          {
+           "id" : "dbmodel",
+           "* pack" : "set_model",
+           "xtype" : "ListStore",
+           "$ columns" : "typeof(string),typeof(string)",
+           "n_columns" : 2,
+           "$ xns" : "Gtk",
+           "| void loadData" : "  (Gee.ArrayList<string> data, string cur) {\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n   /// el.append(out iter);\n    \n     \n   // el.set_value(iter, 0, \"\");\n   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");\n\n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a module --\");\n    _this.build_module.el.set_active_iter(iter);\n    \n    for (var i = 0; i < data.size;i++) {\n    \n\n        el.append(out iter);\n        \n        el.set_value(iter, 0, data.get(i));\n        el.set_value(iter, 1, data.get(i));\n        \n        if (data.get(i) == cur) {\n            _this.build_module.el.set_active_iter(iter);\n        }\n        \n    }\n     this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n"
+          }
+         ]
+        },
         {
          "id" : "name",
          "$ visible" : true,
          "id" : "parent",
          "$ visible" : true,
          "xtype" : "Entry",
-         "* pack" : "attach_defaults,1,2,3,4",
-         "$ xns" : "Gtk"
-        },
-        {
-         "label" : "Permission Name",
-         "$ visible" : true,
-         "xalign" : 0.90000000000000002,
-         "* pack" : "attach_defaults,0,1,4,5",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
-         "x_options" : 4,
-         "$ xns" : "Gtk"
-        },
-        {
-         "id" : "permname",
-         "$ visible" : true,
-         "xtype" : "Entry",
-         "* pack" : "attach_defaults,1,2,4,5",
-         "$ xns" : "Gtk"
-        },
-        {
-         "label" : "Order (for tabs)",
-         "$ visible" : true,
-         "xalign" : 0.90000000000000002,
-         "* pack" : "attach_defaults,0,1,5,6",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
-         "x_options" : 4,
-         "$ xns" : "Gtk"
-        },
-        {
-         "id" : "modOrder",
-         "$ visible" : true,
-         "xtype" : "Entry",
-         "* pack" : "attach_defaults,1,2,5,6",
-         "$ xns" : "Gtk"
-        },
-        {
-         "label" : "Module to build (Vala only)",
-         "$ visible" : true,
-         "xalign" : 0.90000000000000002,
-         "* pack" : "attach_defaults,0,1,6,7",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
-         "x_options" : 4,
+         "* pack" : "attach_defaults,1,2,2,3",
          "$ xns" : "Gtk"
         },
         {
index 15b9055..dd0f58e 100644 (file)
@@ -12,11 +12,12 @@ public class Xcls_PopoverProperty : Object
         }
         return _PopoverProperty;
     }
+    public Xcls_build_module build_module;
+    public Xcls_dbcellrenderer dbcellrenderer;
+    public Xcls_dbmodel dbmodel;
     public Xcls_name name;
     public Xcls_title title;
     public Xcls_parent parent;
-    public Xcls_permname permname;
-    public Xcls_modOrder modOrder;
     public Xcls_build_module build_module;
     public Xcls_dbcellrenderer dbcellrenderer;
     public Xcls_dbmodel dbmodel;
@@ -169,7 +170,7 @@ public class Xcls_PopoverProperty : Object
             var child_1 = new Xcls_Table4( _this );
             child_1.ref();
             this.el.pack_start (  child_1.el , false,false,4 );
-            var child_2 = new Xcls_HButtonBox19( _this );
+            var child_2 = new Xcls_HButtonBox17( _this );
             child_2.ref();
             this.el.pack_end (  child_2.el , false,true,0 );
         }
@@ -222,39 +223,27 @@ public class Xcls_PopoverProperty : Object
             var child_0 = new Xcls_Label5( _this );
             child_0.ref();
             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
-            var child_1 = new Xcls_name( _this );
+            var child_1 = new Xcls_build_module( _this );
             child_1.ref();
-            this.el.attach_defaults (  child_1.el , 1,2,0,1 );
-            var child_2 = new Xcls_Label7( _this );
+            this.el.attach_defaults (  child_1.el , 1,2,6,7 );
+            var child_2 = new Xcls_name( _this );
             child_2.ref();
-            this.el.attach_defaults (  child_2.el , 0,1,1,2 );
-            var child_3 = new Xcls_title( _this );
+            this.el.attach_defaults (  child_2.el , 1,2,0,1 );
+            var child_3 = new Xcls_Label10( _this );
             child_3.ref();
-            this.el.attach_defaults (  child_3.el , 1,2,1,2 );
-            var child_4 = new Xcls_Label9( _this );
+            this.el.attach_defaults (  child_3.el , 0,1,1,2 );
+            var child_4 = new Xcls_title( _this );
             child_4.ref();
-            this.el.attach_defaults (  child_4.el , 0,1,2,3 );
-            var child_5 = new Xcls_parent( _this );
+            this.el.attach_defaults (  child_4.el , 1,2,1,2 );
+            var child_5 = new Xcls_Label12( _this );
             child_5.ref();
-            this.el.attach_defaults (  child_5.el , 1,2,3,4 );
-            var child_6 = new Xcls_Label11( _this );
+            this.el.attach_defaults (  child_5.el , 0,1,2,3 );
+            var child_6 = new Xcls_parent( _this );
             child_6.ref();
-            this.el.attach_defaults (  child_6.el , 0,1,4,5 );
-            var child_7 = new Xcls_permname( _this );
+            this.el.attach_defaults (  child_6.el , 1,2,2,3 );
+            var child_7 = new Xcls_build_module( _this );
             child_7.ref();
-            this.el.attach_defaults (  child_7.el , 1,2,4,5 );
-            var child_8 = new Xcls_Label13( _this );
-            child_8.ref();
-            this.el.attach_defaults (  child_8.el , 0,1,5,6 );
-            var child_9 = new Xcls_modOrder( _this );
-            child_9.ref();
-            this.el.attach_defaults (  child_9.el , 1,2,5,6 );
-            var child_10 = new Xcls_Label15( _this );
-            child_10.ref();
-            this.el.attach_defaults (  child_10.el , 0,1,6,7 );
-            var child_11 = new Xcls_build_module( _this );
-            child_11.ref();
-            this.el.attach_defaults (  child_11.el , 1,2,6,7 );
+            this.el.attach_defaults (  child_7.el , 1,2,6,7 );
         }
 
         // user defined functions
@@ -283,106 +272,120 @@ public class Xcls_PopoverProperty : Object
         // user defined functions
     }
 
-    public class Xcls_name : Object
+    public class Xcls_build_module : Object
     {
-        public Gtk.Entry el;
+        public Gtk.ComboBox el;
         private Xcls_PopoverProperty  _this;
 
 
             // my vars (def)
 
         // ctor
-        public Xcls_name(Xcls_PopoverProperty _owner )
+        public Xcls_build_module(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
-            _this.name = this;
-            this.el = new Gtk.Entry();
+            _this.build_module = this;
+            this.el = new Gtk.ComboBox();
 
             // my vars (dec)
 
             // set gobject values
-            this.el.visible = true;
-        }
-
-        // user defined functions
-    }
-
-    public class Xcls_Label7 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverProperty  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_Label7(Xcls_PopoverProperty _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.Label( "Title" );
+            var child_0 = new Xcls_dbcellrenderer( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+            var child_1 = new Xcls_dbmodel( _this );
+            child_1.ref();
+            this.el.set_model (  child_1.el  );
 
-            // my vars (dec)
+            // init method
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.visible = true;
+            this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
         }
 
         // user defined functions
     }
-
-    public class Xcls_title : Object
+    public class Xcls_dbcellrenderer : Object
     {
-        public Gtk.Entry el;
+        public Gtk.CellRendererText el;
         private Xcls_PopoverProperty  _this;
 
 
             // my vars (def)
 
         // ctor
-        public Xcls_title(Xcls_PopoverProperty _owner )
+        public Xcls_dbcellrenderer(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
-            _this.title = this;
-            this.el = new Gtk.Entry();
+            _this.dbcellrenderer = this;
+            this.el = new Gtk.CellRendererText();
 
             // my vars (dec)
 
             // set gobject values
-            this.el.visible = true;
         }
 
         // user defined functions
     }
 
-    public class Xcls_Label9 : Object
+    public class Xcls_dbmodel : Object
     {
-        public Gtk.Label el;
+        public Gtk.ListStore el;
         private Xcls_PopoverProperty  _this;
 
 
             // my vars (def)
 
         // ctor
-        public Xcls_Label9(Xcls_PopoverProperty _owner )
+        public Xcls_dbmodel(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
-            this.el = new Gtk.Label( "Name" );
+            _this.dbmodel = this;
+            this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
 
             // my vars (dec)
 
             // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.tooltip_text = "center, north, south, east, west";
-            this.el.visible = true;
         }
 
         // user defined functions
+        public void loadData (Gee.ArrayList<string> data, string cur) {
+            this.el.clear();                                    
+            Gtk.TreeIter iter;
+            var el = this.el;
+            
+           /// el.append(out iter);
+            
+             
+           // el.set_value(iter, 0, "");
+           // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
+        
+            el.append(out iter);
+        
+            
+            el.set_value(iter, 0, "");
+            el.set_value(iter, 1, "-- select a module --");
+            _this.build_module.el.set_active_iter(iter);
+            
+            for (var i = 0; i < data.size;i++) {
+            
+        
+                el.append(out iter);
+                
+                el.set_value(iter, 0, data.get(i));
+                el.set_value(iter, 1, data.get(i));
+                
+                if (data.get(i) == cur) {
+                    _this.build_module.el.set_active_iter(iter);
+                }
+                
+            }
+             this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
+                                             
+        }
     }
 
-    public class Xcls_parent : Object
+
+    public class Xcls_name : Object
     {
         public Gtk.Entry el;
         private Xcls_PopoverProperty  _this;
@@ -391,10 +394,10 @@ public class Xcls_PopoverProperty : Object
             // my vars (def)
 
         // ctor
-        public Xcls_parent(Xcls_PopoverProperty _owner )
+        public Xcls_name(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
-            _this.parent = this;
+            _this.name = this;
             this.el = new Gtk.Entry();
 
             // my vars (dec)
@@ -406,7 +409,7 @@ public class Xcls_PopoverProperty : Object
         // user defined functions
     }
 
-    public class Xcls_Label11 : Object
+    public class Xcls_Label10 : Object
     {
         public Gtk.Label el;
         private Xcls_PopoverProperty  _this;
@@ -415,10 +418,10 @@ public class Xcls_PopoverProperty : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Label11(Xcls_PopoverProperty _owner )
+        public Xcls_Label10(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
-            this.el = new Gtk.Label( "Permission Name" );
+            this.el = new Gtk.Label( "Title" );
 
             // my vars (dec)
 
@@ -431,7 +434,7 @@ public class Xcls_PopoverProperty : Object
         // user defined functions
     }
 
-    public class Xcls_permname : Object
+    public class Xcls_title : Object
     {
         public Gtk.Entry el;
         private Xcls_PopoverProperty  _this;
@@ -440,10 +443,10 @@ public class Xcls_PopoverProperty : Object
             // my vars (def)
 
         // ctor
-        public Xcls_permname(Xcls_PopoverProperty _owner )
+        public Xcls_title(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
-            _this.permname = this;
+            _this.title = this;
             this.el = new Gtk.Entry();
 
             // my vars (dec)
@@ -455,7 +458,7 @@ public class Xcls_PopoverProperty : Object
         // user defined functions
     }
 
-    public class Xcls_Label13 : Object
+    public class Xcls_Label12 : Object
     {
         public Gtk.Label el;
         private Xcls_PopoverProperty  _this;
@@ -464,23 +467,24 @@ public class Xcls_PopoverProperty : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Label13(Xcls_PopoverProperty _owner )
+        public Xcls_Label12(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
-            this.el = new Gtk.Label( "Order (for tabs)" );
+            this.el = new Gtk.Label( "Name" );
 
             // my vars (dec)
 
             // set gobject values
             this.el.justify = Gtk.Justification.RIGHT;
             this.el.xalign = 0.900000f;
+            this.el.tooltip_text = "center, north, south, east, west";
             this.el.visible = true;
         }
 
         // user defined functions
     }
 
-    public class Xcls_modOrder : Object
+    public class Xcls_parent : Object
     {
         public Gtk.Entry el;
         private Xcls_PopoverProperty  _this;
@@ -489,10 +493,10 @@ public class Xcls_PopoverProperty : Object
             // my vars (def)
 
         // ctor
-        public Xcls_modOrder(Xcls_PopoverProperty _owner )
+        public Xcls_parent(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
-            _this.modOrder = this;
+            _this.parent = this;
             this.el = new Gtk.Entry();
 
             // my vars (dec)
@@ -504,31 +508,6 @@ public class Xcls_PopoverProperty : Object
         // user defined functions
     }
 
-    public class Xcls_Label15 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverProperty  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_Label15(Xcls_PopoverProperty _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.Label( "Module to build (Vala only)" );
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.visible = true;
-        }
-
-        // user defined functions
-    }
-
     public class Xcls_build_module : Object
     {
         public Gtk.ComboBox el;
@@ -643,7 +622,7 @@ public class Xcls_PopoverProperty : Object
 
 
 
-    public class Xcls_HButtonBox19 : Object
+    public class Xcls_HButtonBox17 : Object
     {
         public Gtk.HButtonBox el;
         private Xcls_PopoverProperty  _this;
@@ -652,7 +631,7 @@ public class Xcls_PopoverProperty : Object
             // my vars (def)
 
         // ctor
-        public Xcls_HButtonBox19(Xcls_PopoverProperty _owner )
+        public Xcls_HButtonBox17(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
             this.el = new Gtk.HButtonBox();
@@ -663,7 +642,7 @@ public class Xcls_PopoverProperty : Object
             this.el.margin_right = 4;
             this.el.margin_left = 4;
             this.el.margin_bottom = 4;
-            var child_0 = new Xcls_Button20( _this );
+            var child_0 = new Xcls_Button18( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
             var child_1 = new Xcls_save_btn( _this );
@@ -673,7 +652,7 @@ public class Xcls_PopoverProperty : Object
 
         // user defined functions
     }
-    public class Xcls_Button20 : Object
+    public class Xcls_Button18 : Object
     {
         public Gtk.Button el;
         private Xcls_PopoverProperty  _this;
@@ -682,7 +661,7 @@ public class Xcls_PopoverProperty : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Button20(Xcls_PopoverProperty _owner )
+        public Xcls_Button18(Xcls_PopoverProperty _owner )
         {
             _this = _owner;
             this.el = new Gtk.Button();