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);
59 this.parent.childClasses.push(this.alias);
63 loadImplements : function()
65 var bb = this.getBI();
66 this.implementInterfaces = [];
69 for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
71 var prop = GI.object_info_get_interface(bb,i);
74 var iface = NameSpace.factory(
76 prop.get_namespace() , prop.get_name()
80 if (iflist.indexOf(iface.alias) < 0) {
81 //console.log("ADDING IFACE " + iface.alias);
82 iflist.push(iface.alias);
83 this.implementInterfaces.push(iface);
86 // ask the first of the parents.. - which will have it loaded already
87 if (this.extendsClasses.length) {
89 //this.extendsClasses[0].loadImplements();
91 this.extendsClasses[0].implementInterfaces.map( function(si) {
93 if (iflist.indexOf(si.alias) < 0) {
94 //console.log("From extends ("+ si.alias + ") IFACE " + si.alias);
95 iflist.push(si.alias);
96 this.implementInterfaces.push(si);
101 //console.dump(iflist);
102 if (this.alias == 'Atk.NoOpObject') {
105 // console.dump(this.implementInterfaces);
114 return; // already loaded..
117 if (this.parent) { // load up parents first
120 this.implementInterfaces.map(function(iface) {
125 //console.log("load(Class) " + this.alias);
128 this.genericBuildList('object', 'property', props, 'properties');
129 this.genericBuildList('object', 'field', props, 'properties');
131 this.genericExtends( props, 'properties');
132 this.genericImplements( props, 'properties');
135 this.genericBuildList('object', 'signal', signals, 'signals');
136 this.genericExtends( signals, 'signals');
137 this.genericImplements( signals, 'signals');
140 NameSpace.references[this.alias] = NameSpace.references[this.alias] || [];
141 if (this.alias == 'GObject.Object') {
147 this.constructors.push({
148 name : '', // not really...
149 params: this.properties.length ? [ { type : 'Object', be_null : true, name : 'properties' } ] : [],
151 isConstructor : true,
153 memberOf : this.alias,
161 this.genericBuildList('object', 'method', methods, 'methods');
162 // dont inherit functiosn or consturctors...
164 this.genericExtends( methods, 'methods');
165 this.genericImplements( methods, 'methods');
169 //console.log("loaded(Class) " + this.alias);