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;
9 XObject = imports.XObject.XObject;
10 console = imports.console.console;
11 NameSpace = imports.NameSpace.NameSpace;
13 Base = imports.Base.Base;
25 Class = XObject.define(
27 Base.call(this, ns, name);
28 print("Class ctr - parent called");
30 this.loadImplements();
31 //console.log("CREATED(Class) " + this.alias);
37 loadExtends : function()
39 var bi = this.getBI();
41 var pi = GI.object_info_get_parent(bi);
42 this.extendsClasses = [];
46 this.parent = NameSpace.factory(
52 this.extendsClasses = [ this.parent ];
55 this.parent.extendsClasses.map(function(p) {
56 this.extendsClasses.push(p);
62 loadImplements : function()
64 var bb = this.getBI();
65 this.implementInterfaces = [];
68 for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
70 var prop = GI.object_info_get_interface(bb,i);
73 var iface = NameSpace.factory(
75 prop.get_namespace() , prop.get_name()
79 if (iflist.indexOf(iface.alias) < 0) {
80 //console.log("ADDING IFACE " + iface.alias);
81 iflist.push(iface.alias);
82 this.implementInterfaces.push(iface);
85 // ask the first of the parents.. - which will have it loaded already
86 if (this.extendsClasses.length) {
88 //this.extendsClasses[0].loadImplements();
90 this.extendsClasses[0].implementInterfaces.map( function(si) {
92 if (iflist.indexOf(si.alias) < 0) {
93 //console.log("From extends ("+ si.alias + ") IFACE " + si.alias);
94 iflist.push(si.alias);
95 this.implementInterfaces.push(si);
100 //console.dump(iflist);
101 if (this.alias == 'Atk.NoOpObject') {
104 // console.dump(this.implementInterfaces);
113 return; // already loaded..
116 if (this.parent) { // load up parents first
119 this.implementInterfaces.map(function(iface) {
124 //console.log("load(Class) " + this.alias);
127 this.genericBuildList('object', 'property', props, 'properties');
128 this.genericBuildList('object', 'field', props, 'properties');
130 this.genericExtends( props, 'properties');
131 this.genericImplements( props, 'properties');
134 this.genericBuildList('object', 'signal', signals, 'signals');
135 this.genericExtends( signals, 'signals');
136 this.genericImplements( signals, 'signals');
139 NameSpace.references[this.alias] = NameSpace.references[this.alias] || [];
140 if (this.alias == 'GObject.Object') {
146 this.constructors.push({
147 name : '', // not really...
148 params: this.properties.length ? [ { type : 'Object', be_null : true, name : 'properties' } ] : [],
150 isConstructor : true,
152 memberOf : this.alias,
160 this.genericBuildList('object', 'method', methods, 'methods');
161 // dont inherit functiosn or consturctors...
163 this.genericExtends( methods, 'methods');
164 this.genericImplements( methods, 'methods');
168 //console.log("loaded(Class) " + this.alias);