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 = [];
43 if (!pi || (pi.get_namespace() == this.ns && pi.get_name() == this.name )) {
46 this.parent = NameSpace.factory(
52 this.extendsClasses = [ this.parent ];
55 this.parent.extendsClasses.map(function(p) {
56 this.extendsClasses.push(p);
60 this.parent.addChildClass(this.alias);
66 addChildClass : function (n) {
67 this.childClasses.push(n);
69 this.parent.addChildClass(n);
74 loadImplements : function()
76 var bb = this.getBI();
77 this.implementInterfaces = [];
80 for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
82 var prop = GI.object_info_get_interface(bb,i);
85 var iface = NameSpace.factory(
87 prop.get_namespace() , prop.get_name()
91 if (iflist.indexOf(iface.alias) < 0) {
92 //console.log("ADDING IFACE " + iface.alias);
93 iflist.push(iface.alias);
94 this.implementInterfaces.push(iface);
97 // ask the first of the parents.. - which will have it loaded already
98 if (this.extendsClasses.length) {
100 //this.extendsClasses[0].loadImplements();
102 this.extendsClasses[0].implementInterfaces.map( function(si) {
104 if (iflist.indexOf(si.alias) < 0) {
105 //console.log("From extends ("+ si.alias + ") IFACE " + si.alias);
106 iflist.push(si.alias);
107 this.implementInterfaces.push(si);
112 //console.dump(iflist);
113 if (this.alias == 'Atk.NoOpObject') {
116 // console.dump(this.implementInterfaces);
125 return; // already loaded..
128 if (this.parent) { // load up parents first
131 this.implementInterfaces.map(function(iface) {
136 //console.log("load(Class) " + this.alias);
139 this.genericBuildList('object', 'property', props, 'properties');
140 this.genericBuildList('object', 'field', props, 'properties');
142 this.genericExtends( props, 'properties');
143 this.genericImplements( props, 'properties');
146 this.genericBuildList('object', 'signal', signals, 'signals');
147 this.genericExtends( signals, 'signals');
148 this.genericImplements( signals, 'signals');
151 NameSpace.references[this.alias] = NameSpace.references[this.alias] || [];
152 if (this.alias == 'GObject.Object') {
158 this.constructors.push({
159 name : '', // not really...
160 params: this.properties.length ? [ { type : 'Object', be_null : true, name : 'properties' } ] : [],
162 isConstructor : true,
164 memberOf : this.alias,
172 this.genericBuildList('object', 'method', methods, 'methods');
173 // dont inherit functiosn or consturctors...
175 this.genericExtends( methods, 'methods');
176 this.genericImplements( methods, 'methods');
180 //console.log("loaded(Class) " + this.alias);