JSDOC/Introspect/Signal.js
[gnome.introspection-doc-generator] / JSDOC / Introspect / Signal.js
1 //<script type="text/javascript">
2 //Gtk = imports.gi.Gtk;
3 GI      = imports.gi.GIRepository;
4
5 XObject     = imports.XObject.XObject;
6 console     = imports.console.console;
7 NameSpace   = imports.NameSpace.NameSpace;
8
9 Basic        = imports.Basic.Basic;
10
11
12 imports['Object.js'].load(Object);
13
14 console = imports['console.js'].console;
15
16
17
18 Introspect = imports['JSDOC/Introspect.js'].Introspect;
19 Basic = imports['JSDOC/Introspect/Basic.js'].Basic;
20
21
22
23 Signal = XObject.define(
24     function(sig, memberOf, saveto, keylist) {
25
26         this.propertyType  = 'Signal';
27         
28         var params = this.argsToArrays(sig);
29         // add a reference to self...
30         params.unshift({
31             name : 'self',
32             type : memberOf.alias,
33             direction : 'in',
34             be_null :  false
35                 
36         });
37         var n_original  = GI.base_info_get_name(sig);
38         
39         Object.extend(this,{
40             name : n_original.replace(/-/g,'_'),
41             params : params,
42             memberOf : memberOf.alias,
43             exceptions : [],
44             returns :   [ { type :  this.typeToName(GI.callable_info_get_return_type(sig)) } ],
45             desc : Introspect.doc(memberOf.alias + '.signal.' + n_original)
46         });
47         memberOf[saveto].push(this);
48         keylist.push(this.name);
49         
50         var addedto = [ memberOf.alias ]; // do not add to self...
51        
52         for(var i =1; i < params.length;i++) {
53             var ty = params[i].type;
54             if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
55                 continue;
56             }
57             if (addedto.indexOf(ty) > -1) {
58                 continue;
59             }
60             
61             
62             
63             Introspect.references[ty] = Introspect.references[ty] || [];
64             Introspect.references[ty].push(this);
65             addedto.push(ty);
66         }
67         
68         
69         
70         
71         
72     },
73     Basic
74 );
75
76
77