Fix #8076 - gtknotebookpage fake wrapper
[roobuilder] / src / Palete / Gtk.vala
index f880ebd..ccc94c0 100644 (file)
@@ -3,33 +3,7 @@ using Gtk;
 
 /**
 
-Palete.map
- -> contains a list of parent and child classes
- // eg. what can be added to what.
-// defaults
-
-// node properties??
-  (mostly from 
-
-Known issues with Palete
-
-
-Object Add:
-
-SourceView/TextView - can add widget (which doesnt really seem to work) - as it's subclassing a container
-Gtk.Table - adding children? (nothing is currently allowed.
-
-
-Properties list 
-- need to remove widgets from this..
-- help / show source interface etc..?
-- make wider?
-
-Events list
-- signature on insert
-- show source interface / help
-
+This basically provides all the data needed to add stuff to gtk objects 
   
 
 */
@@ -101,10 +75,7 @@ namespace Palete {
                    //return typeof(this.comments[ns][what]) == 'undefined' ?  '' : this.comments[ns][what];
                }
 
-                       // does not handle implements...
-               public override GirObject? getClass(string ename)
-               {
-
+               public GirObject? loadGir (string ename) {
                        var es = ename.split(".");
                        if (es.length < 2) {
                                return null;
@@ -113,39 +84,33 @@ namespace Palete {
                        if (gir == null) {
                                return null;
                        }
-                       return gir.classes.get(es[1]);
-               
+                       return gir;
+                       
                }
+
+                       // does not handle implements...
+               public override GirObject? getClass(string ename)
+               {
+                       var es = ename.split(".");
+                       var gir = this.loadGir(ename);
+                       return gir  == null ? null : gir.classes.get(es[1]);
                
+               }
+                
                public  GirObject? getDelegate(string ename) 
                {
                        var es = ename.split(".");
-                       if (es.length < 2) {
-                               return null;
-                       }
-                       var gir = Gir.factory(this.project,es[0]);
-                       if (gir == null) {
-                               return null;
-                       }
-                       return gir.delegates.get(es[1]);
-               
+                       var gir = this.loadGir(ename);
+                       return gir  == null ? null : gir.delegates.get(es[1]);
                }
-
+               
                public  GirObject? getClassOrEnum(string ename)
                {
-
                        var es = ename.split(".");
-                       if (es.length < 2) {
-                               return null;
-                       }
-                       var gir = Gir.factory(this.project,es[0]);
-                       if (gir.classes.has_key(es[1])) {
-                               return gir.classes.get(es[1]);
-                       }
-                       if (gir.consts.has_key(es[1])) {
-                               return  gir.consts.get(es[1]);
-                       }
-                       return null;
+                       var gir = this.loadGir(ename);
+                       return gir  == null ? null : 
+                                       (gir.classes.has_key(es[1]) ?  gir.classes.get(es[1]) : gir.consts.get(es[1]) );
+                
                }
 
 
@@ -231,6 +196,10 @@ namespace Palete {
                                if (val.is_deprecated) {
                                        continue;
                                }
+                               if (!val.is_writable && !val.ctor_only ) { // if it's ctor we accept it.
+                                       continue;
+                               }
+                               
                                if (val.type == "GLib.Object") { /// this is practually everything? ?? shoud we display it as a property?
                                        continue;
                                }
@@ -479,10 +448,14 @@ namespace Palete {
                           // GLib.debug("adding property from ctor : %s, %s, %s  [%s]", cname , prop.name, prop.type, sub == null ? "-" : sub.nodetype);
  
                            if (sub != null) { // can't add child classes here...
-                           
+                               if (sub.nodetype == "Struct") {
+                                       this.node_defaults.get(cname).set(prop.name, new JsRender.NodeProp.raw(prop.name, prop.type, ""));
+                                               continue;
+                               }
                                    GLib.debug("skipping ctor argument proprty is an object");
                                    continue;
                            }
+                            
                            sub = this.getDelegate(prop.type);
                             if (sub != null) { // can't add child classes here...
                                this.node_defaults.get(cname).set(prop.name, new JsRender.NodeProp.raw(prop.name, prop.type, sub.sig));
@@ -693,6 +666,13 @@ namespace Palete {
                        // skip dupe // skip depricated
                        // skip not object // skip GLib.Object (base)
                        
+                       
+                       //if (cls.fqn() == "GLib.Menu" && method == "append_submenu") {
+                       //      ty = m.paramset.params.get(1).type;
+                       //      GLib.debug("add  %s   method %s arg1 = %s", cls.fqn(), method, ty);
+                       //      this.addRealClasses(ret, ty);
+                       //}
+                        
                }
                
                void addRealClasses(Gee.ArrayList<string>  ret, string cn, bool allow_root = false)
@@ -703,6 +683,7 @@ namespace Palete {
                        
                        var w = this.getClass(cn);
                        if (w == null) {
+                               
                                return;
                        }
                        
@@ -789,7 +770,8 @@ namespace Palete {
                this.add_classes_from_method(cls, "add_tick_callback", ret); // wtf does this do.
                this.add_classes_from_method(cls, "append", ret);
                this.add_classes_from_method(cls, "append_column", ret); // columnview column
-               this.add_classes_from_method(cls, "append_item", ret); // GLib.Menu
+               this.add_classes_from_method(cls, "append_item", ret); // GLib.Menu 
+               //this.add_classes_from_method(cls, "append_submenu", ret); // GLib.Menu - complicated to support
                this.add_classes_from_method(cls, "attach", ret); // grid column                
                this.add_classes_from_method(cls, "pack_start", ret); // headerbar (also has pack end?)
                
@@ -799,6 +781,10 @@ namespace Palete {
                 // add_tick_callback ?
                 // append << core one to add stuff..
                 
+               if (in_rval == "Gtk.Notebook") {
+                       ret.add( "Gtk.NotebookPage" );
+               }
+                
                if (!with_props) {
                        
                        pr.child_list_cache.set(in_rval, ret);