public string ns;
public string propertyof;
public string type;
- public string nodetype;
+ public string nodetype; // eg. Signal / prop etc.
public string package;
public string direction; // used for vala in/out/ref...
public GirObject paramset = null;
public GirObject return_value = null;
-
+ public bool is_deprecated = false;
public bool is_instance;
public bool is_array;
public bool is_varargs;
public bool ctor_only; // specially added ctor properties..
+ public bool is_writable = true;
+ public bool is_readable = true;
+ public bool is_abstract = false;
+ public bool is_sealed = false;
public string parent;
public string value;
// to be filled in...
- public string sig;
+ public string sig; // signture (used to create event handlers)
public bool is_overlaid;
public GirObject gparent;
public Gee.ArrayList<GirObject> params;
public Gee.ArrayList<string> implements;
+ public Gee.ArrayList<string> implementations;
public Gee.ArrayList<string> inherits; // full list of all classes and interfaces...
public Gee.HashMap<string,GirObject> ctors;
public Gee.HashMap<string,GirObject> methods;
public Gee.HashMap<string,GirObject> props;
public Gee.HashMap<string,GirObject> consts;
public Gee.HashMap<string,GirObject> signals;
+ public Gee.HashMap<string,GirObject> delegates;
public Gee.ArrayList<string> optvalues; // used by Roo only..
+
+ public Gee.ArrayList<string> can_drop_onto; // used by Roo only.. at present
+ public Gee.ArrayList<string> valid_cn; // used by Roo only.. at present
+
public string doctxt;
this.gparent = null;
this.implements = new Gee.ArrayList<string>();
+ this.implementations = new Gee.ArrayList<string>();
this.inherits = new Gee.ArrayList<string>(); // list of all ancestors. (interfaces and parents)
this.includes = new Gee.HashMap<string,string>();
this.props = new Gee.HashMap<string,GirObject>();
this.consts = new Gee.HashMap<string,GirObject>();
this.signals = new Gee.HashMap<string,GirObject>();
+ this.delegates = new Gee.HashMap<string,GirObject>();
this.optvalues = new Gee.ArrayList<string>();
+ this.can_drop_onto = new Gee.ArrayList<string>();
+ this.valid_cn = new Gee.ArrayList<string>();
+
+
+
this.is_overlaid = false;
this.paramset = null;
}
for(var i =0;i< this.inherits.size; i++) {
ret += this.inherits.get(i);
}
+ for(var i =0;i< this.implements.size; i++) {
+ ret += this.implements.get(i);
+ }
return ret;
}
public string fqn() {
// not sure if fqn really is correct here...
//
- return this.nodetype == "Class" || this.nodetype=="Interface"
+ return this.nodetype.down() == "class" || this.nodetype.down() =="interface"
? this.name : (this.ns + this.name);
}
}
- public GirObject fetchByFqn(string fqn) {
- GLib.debug("Searching (%s)%s for %s\n", this.nodetype, this.name, fqn);
+ public GirObject? fetchByFqn(string fqn) {
+ // GLib.debug("Searching (%s)%s for %s", this.nodetype, this.name, fqn);
var bits = fqn.split(".");
var ret = this.classes.get(bits[0]);
}
ret = this.ctors.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
}
ret = this.methods.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
return ret.fetchByFqn(fqn.substring(bits[0].length+1));
}
ret = this.props.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
return ret.fetchByFqn(fqn.substring(bits[0].length+1));
}
ret = this.consts.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
}
ret = this.signals.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
return ret.fetchByFqn(fqn.substring(bits[0].length+1));
}
+ ret = this.delegates.get(bits[0]);
+ if (ret != null) {
+ // delegates are only on namespaces...
+ return ret;
+
+ }
+
if (this.paramset == null) {
return null;
}
}
- /*
- //public string fqtype() {
- // return Gir.fqtypeLookup(this.type, this.ns);
+
+
+ public JsRender.NodeProp toNodeProp( Palete pal, string par_xtype)
+ {
+
+ if (this.nodetype.down() == "signal") { // gtk is Signal, roo is signal??
+ // when we add properties, they are actually listeners attached to signals
+ // was a listener overrident?? why?
+ var r = new JsRender.NodeProp.listener(this.name, this.sig);
+ r.propertyof = this.propertyof;
+ if (this.name == "notify" && pal.name == "Gtk") {
+ this.nodePropAddNotify(r, par_xtype, pal);
+ }
+
+ return r;
+ }
+
+ // does not handle Enums... - no need to handle anything else.
+ var def = this.type.contains(".") ? "" : Gir.guessDefaultValueForType(this.type);
+ if (this.type.contains(".") || this.type.contains("|") || this.type.contains("/")) {
+ var ret = new JsRender.NodeProp.prop(this.name, this.type, def); ///< was raw..?
+ ret.propertyof = this.propertyof;
+ this.nodePropAddChildren(ret, this.type, pal);
+ if (ret.childstore.n_items == 1) {
+ var np = (JsRender.NodeProp) ret.childstore.get_item(0);
+ ret.add_node = np.add_node;
+ ret.childstore.remove_all();
+ }
+
+
+ return ret;
+ }
+ if (this.type.down() == "function" ) {
+ var r = new JsRender.NodeProp.raw(this.name, this.type, "function()\n{\n\n}");
+ r.propertyof = this.propertyof;
+ return r;
+ }
+ if (this.type.down() == "array" ) {
+ var r = new JsRender.NodeProp.raw(this.name, this.type, "[\n\n]");
+ r.propertyof = this.propertyof;
+ return r;
+ }
+ if (this.type.down() == "object" ) {
+ var r = new JsRender.NodeProp.raw(this.name, this.type, "{\n\n}");
+ r.propertyof = this.propertyof;
+ return r;
+ }
+ // plain property.. no children..
+ var r = new JsRender.NodeProp.prop(this.name, this.type, def); // signature?
+ r.propertyof = this.propertyof;
+ return r;
+
+ }
+ public void nodePropAddChildren(JsRender.NodeProp par, string str, Palete pal)
+ {
+
- /* return Gir.fqtypeLookup(this.type, this.ns); */
- //}
+ if (str.contains("|")) {
+ var ar = str.split("|");
+ for(var i = 0; i < ar.length; i++) {
+ this.nodePropAddChildren(par, ar[i], pal);
+ }
+ return;
+ }
+ if (str.contains("/")) {
+ var ar = str.split("/");
+ for(var i = 0; i < ar.length; i++) {
+ this.nodePropAddChildren(par, ar[i], pal);
+ }
+ return;
+ }
+ var cls = pal.getClass(str);
+ // it's an object..
+ // if node does not have any children and the object type only has 1 type.. then we dont add anything...
+ // note all classes are expected to have '.' seperators
+ if (cls == null || !str.contains(".")) {
+ GLib.debug("nodepropaddchildren: check class %s - not found in classes", str);
+ par.childstore.append( new JsRender.NodeProp.prop(this.name, str, Gir.guessDefaultValueForType(str)));
+ return;
+ }
+ GLib.debug("nodepropaddchildren: check class %s - type = %s", str, cls.nodetype);
+ if (cls.nodetype.down() == "enum") {
+ var add = new JsRender.NodeProp.raw(this.name, str, "");
+ par.childstore.append( add);
+ return ;
+ }
+
+
+ if (cls.nodetype.down() == "class") {
+ var add = new JsRender.NodeProp.raw(this.name, str, "");
+ // no propertyof ?
+
+
+ add.add_node = pal.fqnToNode(str);
+ add.add_node.add_prop(new JsRender.NodeProp.special("prop", this.name));
+ par.childstore.append( add);
+ }
+
+
+
+ if (cls.implementations.size < 1) {
+ GLib.debug("nodepropaddchildren: check class %s - no implementations", str);
+ return;
+ }
+
+ GLib.debug("nodepropaddchildren: check class %s", str);
+
+ foreach (var cname in cls.implementations) {
+
+
+ var subcls = pal.getClass(cname);
+
+ GLib.debug("nodepropaddchildren: check class %s add %s type %s", str, cname, subcls == null ? "NO?" :subcls.nodetype );
+ if (subcls.nodetype.down() != "class") {
+
+ continue;
+ }
+
+ var add = new JsRender.NodeProp.raw(this.name, cname, "");
+ // no propertyof ?
+ add.add_node = pal.fqnToNode(cname);
+ add.add_node.add_prop(new JsRender.NodeProp.special("prop", this.name));
+ par.childstore.append( add);
+
+
+ }
+
+
+
+
+ }
+ public void nodePropAddNotify(JsRender.NodeProp par, string par_xtype, Palete pal)
+ {
+ var els = pal.getPropertiesFor( par_xtype, JsRender.NodePropType.PROP);
+ foreach(var elname in els.keys) {
+ var add = new JsRender.NodeProp.listener("notify[\"" + elname +"\"]" , "() => {\n }");
+ add.propertyof = par.propertyof;
+ par.childstore.append( add);
+ }
+
+ }
+
+
+
}
}