src/Builder4/PopoverProperty.bjs
authorAlan Knowles <alan@roojs.com>
Sat, 3 Feb 2024 21:56:39 +0000 (05:56 +0800)
committerAlan Knowles <alan@roojs.com>
Sat, 3 Feb 2024 21:56:39 +0000 (05:56 +0800)
src/Builder4/PopoverProperty.vala

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

index 90ea656..7434e81 100644 (file)
          "* prop" : "model",
          "id" : "pmodel",
          "xtype" : "ListStore"
+        },
+        {
+         "$ xns" : "Gtk",
+         "* prop" : "factory",
+         "listeners" : {
+          "bind" : [
+           "(listitem) => {",
+           "",
+           " \tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child(); ",
+           " \tvar np = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
+           " ",
+           "\t",
+           "  ",
+           "\tlbl.label = np.ptype.to_name();",
+           " \t ",
+           "}",
+           ""
+          ],
+          "setup" : [
+           "(listitem) => {",
+           "",
+           "\t ",
+           "\tvar label = new Gtk.Label(\"\");",
+           "\tlabel.xalign = 0;",
+           "\t ",
+           "\t((Gtk.ListItem)listitem).set_child(label);",
+           "\t((Gtk.ListItem)listitem).activatable = false;",
+           "\t",
+           "}",
+           ""
+          ]
+         },
+         "xtype" : "SignalListItemFactory"
         }
        ],
        "xtype" : "DropDown"
index 09916bc..74eed5b 100644 (file)
@@ -331,6 +331,8 @@ public class Xcls_PopoverProperty : Object
                        // my vars (dec)
 
                        // set gobject values
+                       var child_2 = new Xcls_SignalListItemFactory986( _this );
+                       this.el.factory = child_2.el;
                }
 
                // user defined functions
@@ -374,6 +376,50 @@ public class Xcls_PopoverProperty : Object
                // user defined functions
        }
 
+       public class Xcls_SignalListItemFactory986 : Object
+       {
+               public Gtk.SignalListItemFactory el;
+               private Xcls_PopoverProperty  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_SignalListItemFactory986(Xcls_PopoverProperty _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.SignalListItemFactory();
+
+                       // my vars (dec)
+
+                       // set gobject values
+
+                       //listeners
+                       this.el.setup.connect( (listitem) => {
+                       
+                                
+                               var label = new Gtk.Label("");
+                               label.xalign = 0;
+                                
+                               ((Gtk.ListItem)listitem).set_child(label);
+                               ((Gtk.ListItem)listitem).activatable = false;
+                               
+                       });
+                       this.el.bind.connect( (listitem) => {
+                       
+                               var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child(); 
+                               var np = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+                        
+                               
+                         
+                               lbl.label = np.ptype.to_name();
+                                
+                       });
+               }
+
+               // user defined functions
+       }
+
 
        public class Xcls_ptype : Object
        {