1 //<script type="text/javascript">
2 //Gtk = imports.gi.Gtk;
3 GI = imports.gi.GIRepository;
4 GLib = imports.gi.GLib;
6 //GObject = imports.gi.GObject;
8 console = imports['console.js'].console;
9 JSDOC = imports['JSDOC.js'].JSDOC;
10 Roo = imports['Roo.js'].Roo;
13 Introspect = imports['JSDOC/Introspect.js'].Introspect;
14 Basic = imports['JSDOC/Introspect/Basic.js'].Basic;
16 * Methods, functiosn or consturctors
22 Method = function(m, memberOf, saveto, keylist) {
23 this.propertyType = 'Method';
25 var flags = GI.function_info_get_flags (m);
26 var n = GI.base_info_get_name(m);
27 var n_original = n + '';
29 if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
30 return false; // skip these!
40 type : this.typeToName(GI.callable_info_get_return_type(m)),
41 desc : Introspect.doc(memberOf.alias + '.' + n_original + '.return-value')
46 var args = this.argsToArrays(m, retval);
49 if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
51 memberOf.constructors[0].doc = Introspect.doc(memberOf.alias + '.' + n_original);
53 return false; // skip.
60 //console.log(GI.base_info_get_name(m));
61 // console.dump(GI.base_info_get_attribute(m, 'doc') );
63 // this is a bit messy, as we probably loose the doc's on new..
70 isConstructor : flags & GI.IFunctionInfoFlags.IS_CONSTRUCTOR,
71 isStatic : !(flags & GI.IFunctionInfoFlags.IS_METHOD),
72 memberOf : memberOf.alias,
74 desc : Introspect.doc(memberOf.alias + '.' + n_original)
76 // add descriptions to the arguments..
77 Roo.each(this.params, function(p) {
80 p.desc = Introspect.doc(memberOf.alias + '.' + n_original + '.' + p.name);
81 //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' + p.desc);
86 // collect references...
87 var addedto = [ memberOf.alias ]; // do not add to self...
89 for(var i =0; i < args.length;i++) {
90 var ty = args[i].type;
91 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
94 if (addedto.indexOf(ty) > -1) {
100 Introspect.references[ty] = Introspect.references[ty] || [];
101 Introspect.references[ty].push(this);
106 // decide what to add to...
108 if (this.isConstructor) {
110 if (this.name.match(/^new_/)) {
111 this.name = this.name.substring(4);
115 memberOf.constructors.push(this);
118 // return values = only applicable to non-constructors..
119 for(var i =0; i < retval.length;i++) {
120 var ty = retval[i].type;
121 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
124 if (addedto.indexOf(ty) > -1) {
130 Introspect.references[ty] = Introspect.references[ty] || [];
131 Introspect.references[ty].push(this);
138 memberOf.functions.push(this);
143 memberOf.methods.push(this);
144 keylist.push(this.name);
151 Roo.extend(Method,Basic);