Re-arrange files, add support for classic JS Documentor, and packer
[gnome.introspection-doc-generator] / Introspect / Enum.js
diff --git a/Introspect/Enum.js b/Introspect/Enum.js
new file mode 100644 (file)
index 0000000..1dddc21
--- /dev/null
@@ -0,0 +1,59 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+
+
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Base        = imports.Base.Base;
+
+  
+
+
+
+
+Enum = XObject.define(
+    function(ns, name) {
+        Base.call(this, ns, name);
+    },
+    Base, 
+    {
+        titleType: 'Enum',
+         _loaded : false,
+        load : function()
+        {
+            if (this._loaded) {
+                return; // already loaded..
+            }
+            
+            this.desc = NameSpace.doc(this.alias);
+            var bi = this.getBI();
+                 
+            for(var i =0; i < GI.enum_info_get_n_values(bi); i++) {
+               
+                var prop = GI.enum_info_get_value(bi,i);
+                 
+              
+                this.values.push({
+                    name :  GI.base_info_get_name(prop).toUpperCase() ,
+                    type :   GI.type_tag_to_string(GI.enum_info_get_storage_type(bi)),
+                    value:   GI.value_info_get_value(prop) ,
+                    memberOf : this.alias
+                });
+            }
+            
+            this._loaded = true;
+             
+             
+            
+            
+        }
+});
+
\ No newline at end of file