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);
29 this.loadImplements();
30 //console.log("CREATED(Class) " + this.alias);
36 loadExtends : function()
38 var bi = this.getBI();
40 var pi = GI.object_info_get_parent(bi);
41 this.extendsClasses = [];
45 this.parent = NameSpace.factory(
47 GI.base_info_get_namespace(pi),
48 GI.base_info_get_name(pi)
51 this.extendsClasses = [ this.parent ];
54 this.parent.extendsClasses.map(function(p) {
55 this.extendsClasses.push(p);
61 loadImplements : function()
63 var bb = this.getBI();
64 this.implementInterfaces = [];
67 for(var i =0; i < GI.object_info_get_n_interfaces(bb); i++) {
69 var prop = GI.object_info_get_interface(bb,i);
72 var iface = NameSpace.factory(
74 GI.base_info_get_namespace(prop) , GI.base_info_get_name(prop)
78 if (iflist.indexOf(iface.alias) < 0) {
79 //console.log("ADDING IFACE " + iface.alias);
80 iflist.push(iface.alias);
81 this.implementInterfaces.push(iface);
84 // ask the first of the parents.. - which will have it loaded already
85 if (this.extendsClasses.length) {
87 //this.extendsClasses[0].loadImplements();
89 this.extendsClasses[0].implementInterfaces.map( function(si) {
91 if (iflist.indexOf(si.alias) < 0) {
92 //console.log("From extends ("+ si.alias + ") IFACE " + si.alias);
93 iflist.push(si.alias);
94 this.implementInterfaces.push(si);
99 //console.dump(iflist);
100 if (this.alias == 'Atk.NoOpObject') {
103 // console.dump(this.implementInterfaces);
112 return; // already loaded..
115 if (this.parent) { // load up parents first
118 this.implementInterfaces.map(function(iface) {
123 //console.log("load(Class) " + this.alias);
126 this.genericBuildList('object', 'property', props, 'properties');
127 this.genericBuildList('object', 'field', props, 'properties');
129 this.genericExtends( props, 'properties');
130 this.genericImplements( props, 'properties');
133 this.genericBuildList('object', 'signal', signals, 'signals');
134 this.genericExtends( signals, 'signals');
135 this.genericImplements( signals, 'signals');
138 NameSpace.references[this.alias] = NameSpace.references[this.alias] || [];
139 if (this.alias == 'GObject.Object') {
145 this.constructors.push({
146 name : '', // not really...
147 params: this.properties.length ? [ { type : 'Object', be_null : true, name : 'properties' } ] : [],
149 isConstructor : true,
151 memberOf : this.alias,
159 this.genericBuildList('object', 'method', methods, 'methods');
160 // dont inherit functiosn or consturctors...
162 this.genericExtends( methods, 'methods');
163 this.genericImplements( methods, 'methods');
167 //console.log("loaded(Class) " + this.alias);