Changed src/JsRender/NodeToVala.valasrc/Palete/Gtk.vala
authorAlan <alan@roojs.com>
Wed, 31 Aug 2022 08:21:08 +0000 (16:21 +0800)
committerAlan <alan@roojs.com>
Wed, 31 Aug 2022 08:21:08 +0000 (16:21 +0800)
src/JsRender/NodeToVala.vala
src/Palete/Gtk.vala

index 6178db3..e73eb43 100644 (file)
@@ -188,6 +188,8 @@ public class JsRender.NodeToVala : Object {
                this.addInitMyVars();
                this.addWrappedProperties();
                this.addChildren();
+               this.addAutoShow(); // autoshow menuitems
+               
                this.addInit();
                this.addListeners();
                this.addEndCtor();
@@ -615,6 +617,24 @@ public class JsRender.NodeToVala : Object {
                
 
                        
+       }
+       public static Gee.ArrayList<string> menuitem_children = null;
+       
+       void addAutoShow()
+       {
+               if (menuitem_children == null) {
+                       menuitem_children = new Gee.ArrayList<string>();
+                       menuitem_children.add("Gtk.MenuItem");
+                       var gir = this.file.project.palete.getClass("Gtk.MenuItem");
+                       foreach(var impl in gir.implementations) {
+                               menuitem_children.add(impl);
+                       }
+               }
+
+               if (menuitem_children.contains(this.node.fqn())) {
+                       this.addLine(this.ipad + "this.el.show_all();");
+               
+               }
        }
 
        void addInitMyVars()
index 202d2f0..6e968ae 100644 (file)
@@ -293,7 +293,10 @@ namespace Palete {
                                        continue;
                                }
                                this.generic_child_widgets.add(fqn);
-                               this.add_special_children(fqn, "Gtk.Menu", "_menu"); // fake propety
+                               
+                               
+                               
+                               //this.add_special_children(fqn, "Gtk.Menu", "_menu"); // fake propety
                        }
                
                }