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);
64 addChildClass : function (n) {
65 this.childClasses.push(n);
67 this.parent.addChildClass(n);
72 loadImplements : function()
74 var bb = this.getBI();
75 this.implementInterfaces = [];
78 for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
80 var prop = GI.object_info_get_interface(bb,i);
83 var iface = NameSpace.factory(
85 prop.get_namespace() , prop.get_name()
89 if (iflist.indexOf(iface.alias) < 0) {
90 //console.log("ADDING IFACE " + iface.alias);
91 iflist.push(iface.alias);
92 this.implementInterfaces.push(iface);
95 // ask the first of the parents.. - which will have it loaded already
96 if (this.extendsClasses.length) {
98 //this.extendsClasses[0].loadImplements();
100 this.extendsClasses[0].implementInterfaces.map( function(si) {
102 if (iflist.indexOf(si.alias) < 0) {
103 //console.log("From extends ("+ si.alias + ") IFACE " + si.alias);
104 iflist.push(si.alias);
105 this.implementInterfaces.push(si);
110 //console.dump(iflist);
111 if (this.alias == 'Atk.NoOpObject') {
114 // console.dump(this.implementInterfaces);
123 return; // already loaded..
126 if (this.parent) { // load up parents first
129 this.implementInterfaces.map(function(iface) {
134 //console.log("load(Class) " + this.alias);
137 this.genericBuildList('object', 'property', props, 'properties');
138 this.genericBuildList('object', 'field', props, 'properties');
140 this.genericExtends( props, 'properties');
141 this.genericImplements( props, 'properties');
144 this.genericBuildList('object', 'signal', signals, 'signals');
145 this.genericExtends( signals, 'signals');
146 this.genericImplements( signals, 'signals');
149 NameSpace.references[this.alias] = NameSpace.references[this.alias] || [];
150 if (this.alias == 'GObject.Object') {
156 this.constructors.push({
157 name : '', // not really...
158 params: this.properties.length ? [ { type : 'Object', be_null : true, name : 'properties' } ] : [],
160 isConstructor : true,
162 memberOf : this.alias,
170 this.genericBuildList('object', 'method', methods, 'methods');
171 // dont inherit functiosn or consturctors...
173 this.genericExtends( methods, 'methods');
174 this.genericImplements( methods, 'methods');
178 //console.log("loaded(Class) " + this.alias);