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;
7 imports['Object.js'].load(Object);
9 console = imports['console.js'].console;
13 Introspect = imports['JSDOC/Introspect.js'].Introspect;
14 Base = imports['JSDOC/Introspect/Base.js'].Base;
16 XObject = imports.XObject.XObject;
17 console = imports.console.console;
18 NameSpace = imports.NameSpace.NameSpace;
20 Base = imports.Base.Base;
32 Class = XObject.define(
34 Base.call(this, ns, name);
36 this.loadImplements();
37 //console.log("CREATED(Class) " + this.alias);
43 loadExtends : function()
45 var bi = this.getBI();
47 var pi = GI.object_info_get_parent(bi);
48 this.extendsClasses = [];
52 this.parent = NameSpace.factory(
54 GI.base_info_get_namespace(pi),
55 GI.base_info_get_name(pi)
58 this.extendsClasses = [ this.parent ];
61 this.parent.extendsClasses.map(function(p) {
62 this.extendsClasses.push(p);
68 loadImplements : function()
70 var bb = this.getBI();
71 this.implementInterfaces = [];
74 for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
76 var prop = GI.object_info_get_interface(bb,i);
79 var iface = NameSpace.factory(
81 GI.base_info_get_namespace(prop) , GI.base_info_get_name(prop)
85 if (iflist.indexOf(iface.alias) < 0) {
86 //console.log("ADDING IFACE " + iface.alias);
87 iflist.push(iface.alias);
88 this.implementInterfaces.push(iface);
91 // ask the first of the parents.. - which will have it loaded already
92 if (this.extendsClasses.length) {
94 //this.extendsClasses[0].loadImplements();
96 this.extendsClasses[0].implementInterfaces.map( function(si) {
98 if (iflist.indexOf(si.alias) < 0) {
99 //console.log("From extends ("+ si.alias + ") IFACE " + si.alias);
100 iflist.push(si.alias);
101 this.implementInterfaces.push(si);
106 //console.dump(iflist);
107 if (this.alias == 'Atk.NoOpObject') {
110 // console.dump(this.implementInterfaces);
119 return; // already loaded..
122 if (this.parent) { // load up parents first
125 this.implementInterfaces.map(function(iface) {
130 //console.log("load(Class) " + this.alias);
133 this.genericBuildList('object', 'property', props, 'properties');
134 this.genericBuildList('object', 'field', props, 'properties');
136 this.genericExtends( props, 'properties');
137 this.genericImplements( props, 'properties');
140 this.genericBuildList('object', 'signal', signals, 'signals');
141 this.genericExtends( signals, 'signals');
142 this.genericImplements( signals, 'signals');
145 NameSpace.references[this.alias] = NameSpace.references[this.alias] || [];
146 if (this.alias == 'GObject.Object') {
152 this.constructors.push({
153 name : '', // not really...
154 params: this.properties.length ? [ { type : 'Object', be_null : true, name : 'properties' } ] : [],
156 isConstructor : true,
158 memberOf : this.alias,
166 this.genericBuildList('object', 'method', methods, 'methods');
167 // dont inherit functiosn or consturctors...
169 this.genericExtends( methods, 'methods');
170 this.genericImplements( methods, 'methods');
174 //console.log("loaded(Class) " + this.alias);