src/Builder4/CodeInfo.bjs
authorAlan Knowles <alan@roojs.com>
Sat, 16 Mar 2024 08:04:16 +0000 (16:04 +0800)
committerAlan Knowles <alan@roojs.com>
Sat, 16 Mar 2024 08:04:16 +0000 (16:04 +0800)
src/Builder4/CodeInfo.vala

src/Builder4/CodeInfo.bjs
src/Builder4/CodeInfo.vala

index aa892a7..c173e53 100644 (file)
                "* prop" : "factory",
                "listeners" : {
                 "bind" : [
-                 "(object) => {",
-                 "",
-                 "",
+                 "(listitem) => {",
+                 "\t// GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
+                 "\t",
+                 "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
+                 "\tvar expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();",
+                 "\t ",
+                 "\t ",
+                 "\tvar hbox = (Gtk.Box) expand.child;",
+                 " ",
+                 "\t",
+                 "\tvar img = (Gtk.Image) hbox.get_first_child();",
+                 "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
+                 "\t",
+                 "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+                 "\tvar node = (JsRender.Node) lr.get_item();",
+                 "\tif (node == null || node.fqn() == \"\") {",
+                 "\t\treturn;",
+                 "\t}",
+                 "   ",
+                 "    expand.set_hide_expander( !node.hasChildren() );",
+                 " \texpand.set_list_row(lr);",
+                 " \t",
+                 " \tnode.bind_property(\"iconResourceName\",",
+                 "                    img, \"resource\",",
+                 "                   GLib.BindingFlags.SYNC_CREATE);",
+                 " \t",
+                 " \tnode.bind_property(\"nodeTitleProp\",",
+                 "                    lbl, \"label\",",
+                 "                   GLib.BindingFlags.SYNC_CREATE);",
+                 " \tnode.bind_property(\"nodeTipProp\",",
+                 "                    lbl, \"tooltip_markup\",",
+                 "                   GLib.BindingFlags.SYNC_CREATE);",
+                 " \t// bind image...",
+                 " \t",
                  "}",
                  ""
                 ],
index 48c4067..5b9a85c 100644 (file)
@@ -326,9 +326,40 @@ public class CodeInfo : Object
                                ((Gtk.ListItem)listitem).set_child(expand);
                                
                        });
-                       this.el.bind.connect( (object) => {
-                       
-                       
+                       this.el.bind.connect( (listitem) => {
+                               // GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+                               
+                               //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+                               var expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();
+                                
+                                
+                               var hbox = (Gtk.Box) expand.child;
+                        
+                               
+                               var img = (Gtk.Image) hbox.get_first_child();
+                               var lbl = (Gtk.Label) img.get_next_sibling();
+                               
+                               var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+                               var node = (JsRender.Node) lr.get_item();
+                               if (node == null || node.fqn() == "") {
+                                       return;
+                               }
+                          
+                           expand.set_hide_expander( !node.hasChildren() );
+                               expand.set_list_row(lr);
+                               
+                               node.bind_property("iconResourceName",
+                                           img, "resource",
+                                          GLib.BindingFlags.SYNC_CREATE);
+                               
+                               node.bind_property("nodeTitleProp",
+                                           lbl, "label",
+                                          GLib.BindingFlags.SYNC_CREATE);
+                               node.bind_property("nodeTipProp",
+                                           lbl, "tooltip_markup",
+                                          GLib.BindingFlags.SYNC_CREATE);
+                               // bind image...
+                               
                        });
                }