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;
20 NameSpace = imports.NameSpace.NameSpace;
21 Basic = imports.Basic.Basic;
33 Class = XObject.define(
35 Base.call(this, ns, name);
37 this.loadImplements();
38 //console.log("CREATED(Class) " + this.alias);
44 loadExtends : function()
46 var bi = this.getBI();
48 var pi = GI.object_info_get_parent(bi);
49 this.extendsClasses = [];
53 this.parent = Introspect.factory(
55 GI.base_info_get_namespace(pi),
56 GI.base_info_get_name(pi)
59 this.extendsClasses = [ this.parent ];
62 this.parent.extendsClasses.map(function(p) {
63 this.extendsClasses.push(p);
69 loadImplements : function()
71 var bb = this.getBI();
72 this.implementInterfaces = [];
75 for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
77 var prop = GI.object_info_get_interface(bb,i);
80 var iface = Introspect.factory(
82 GI.base_info_get_namespace(prop) , GI.base_info_get_name(prop)
86 if (iflist.indexOf(iface.alias) < 0) {
87 //console.log("ADDING IFACE " + iface.alias);
88 iflist.push(iface.alias);
89 this.implementInterfaces.push(iface);
92 // ask the first of the parents.. - which will have it loaded already
93 if (this.extendsClasses.length) {
95 //this.extendsClasses[0].loadImplements();
97 this.extendsClasses[0].implementInterfaces.map( function(si) {
99 if (iflist.indexOf(si.alias) < 0) {
100 //console.log("From extends ("+ si.alias + ") IFACE " + si.alias);
101 iflist.push(si.alias);
102 this.implementInterfaces.push(si);
107 //console.dump(iflist);
108 if (this.alias == 'Atk.NoOpObject') {
111 // console.dump(this.implementInterfaces);
120 return; // already loaded..
123 if (this.parent) { // load up parents first
126 this.implementInterfaces.map(function(iface) {
131 //console.log("load(Class) " + this.alias);
134 this.genericBuildList('object', 'property', props, 'properties');
135 this.genericBuildList('object', 'field', props, 'properties');
137 this.genericExtends( props, 'properties');
138 this.genericImplements( props, 'properties');
141 this.genericBuildList('object', 'signal', signals, 'signals');
142 this.genericExtends( signals, 'signals');
143 this.genericImplements( signals, 'signals');
146 Introspect.references[this.alias] = Introspect.references[this.alias] || [];
147 if (this.alias == 'GObject.Object') {
153 this.constructors.push({
154 name : '', // not really...
155 params: this.properties.length ? [ { type : 'Object', be_null : true, name : 'properties' } ] : [],
157 isConstructor : true,
159 memberOf : this.alias,
167 this.genericBuildList('object', 'method', methods, 'methods');
168 // dont inherit functiosn or consturctors...
170 this.genericExtends( methods, 'methods');
171 this.genericImplements( methods, 'methods');
175 //console.log("loaded(Class) " + this.alias);