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;
8 console = imports['console.js'].console;
9 JSDOC = imports['JSDOC.js'].JSDOC;
10 Roo = imports['Roo.js'].Roo;
13 Introspect = imports['JSDOC/Introspect.js'].Introspect;
18 * Base class for Properties, functions, methods etc.
25 Roo.apply(Basic.prototype, {
27 typeToName : function (type_info) {
28 var ty = GI.type_tag_to_string( GI.type_info_get_tag(type_info));
30 if ((ty == 'void') && GI.type_info_is_pointer(type_info)) {
31 return 'void*'; // it's a fake string?!?!!? - slightly naughty...
35 var param_type = GI.type_info_get_param_type (type_info, 0);
36 var atype = GI.type_info_get_tag(param_type);
37 if (atype == GI.ITypeTag.UINT8) {
44 if (ty != 'interface') {
47 var interface_info = GI.type_info_get_interface (type_info);
48 var interface_type = GI.base_info_get_type (interface_info);
49 if (interface_type == GI.IInfoType.CALLBACK) {
51 var Callback = Introspect.Callback ;
52 var ret= new Callback(interface_info, this, false, false);
53 ret.alias = GI.base_info_get_namespace(interface_info) + '.' + GI.base_info_get_name(interface_info);
59 return GI.base_info_get_namespace(interface_info) + '.' + GI.base_info_get_name(interface_info);
63 directions : [ "in", "out"," inout"],
65 argsToArrays : function(m, returnArray)
68 var outIntoReturn = false;
69 if (returnArray && returnArray.length == 1 && returnArray[0].type == 'void') {
78 be_null : true, // in theory..
79 desc : "Return Object, use an empty Object, and the properties will get set as follows",
85 for(var a_i =0; a_i < GI.callable_info_get_n_args(m); a_i++) {
86 var arg = GI.callable_info_get_arg(m, a_i);
88 var direction = this.directions[GI.arg_info_get_direction(arg)];
91 name : GI.base_info_get_name(arg),
92 ns : GI.base_info_get_namespace(arg),
93 type : this.typeToName(GI.arg_info_get_type(arg)),
94 direction : direction,
95 be_null : GI.arg_info_may_be_null(arg) || GI.arg_info_is_optional(arg),
96 desc : GI.base_info_get_attribute(arg, 'doc') || ''
100 add.alias = add.ns + '.' + add.name;
102 if (direction == 'out') {
103 firstOut = firstOut > -1 ? firstOut : a_i;
105 returnArray.push(add);
107 outArg.properties.push(add);
115 // drop all the 'out args from the end of args..
122 var l = args.pop(); // drop!
123 if (l.direction == 'out') {
127 args.push(l); // put it back in (it's not a out).
132 if (outArg.properties.length) {
133 // put the out arg in there...
134 if (firstOut >= args.length) {
137 args[firstOut] = outArg;
142 // remove void return....
144 if (returnArray && returnArray.length > 1 && returnArray[0].type == 'void') {