context: // This file was generated by the Gtk# code generator.
  // Any changes made will be lost if regenerated.
  
  namespace Atk {
  
  	using System;
  	using System.Runtime.InteropServices;
  
  #region Autogenerated code
  	public partial class DocumentAdapter : GLib.GInterfaceAdapter, Atk.IDocument {
  
  		[StructLayout (LayoutKind.Sequential)]
  		struct AtkDocumentIface {
  			public GetDocumentTypeNativeDelegate GetDocumentType;
  			public GetTheDocumentNativeDelegate GetTheDocument;
  			public GetLocaleNativeDelegate GetLocale;
  			public GetAttributesNativeDelegate GetAttributes;
  			public GetAttributeValueNativeDelegate GetAttributeValue;
  			public SetAttributeValueNativeDelegate SetAttributeValue;
  		}
  
  		static AtkDocumentIface iface;
  
  		static DocumentAdapter ()
  		{
  			GLib.GType.Register (_gtype, typeof (DocumentAdapter));
  			iface.GetDocumentType = new GetDocumentTypeNativeDelegate (GetDocumentType_cb);
  			iface.GetTheDocument = new GetTheDocumentNativeDelegate (GetTheDocument_cb);
  			iface.GetLocale = new GetLocaleNativeDelegate (GetLocale_cb);
  			iface.GetAttributes = new GetAttributesNativeDelegate (GetAttributes_cb);
  			iface.GetAttributeValue = new GetAttributeValueNativeDelegate (GetAttributeValue_cb);
  			iface.SetAttributeValue = new SetAttributeValueNativeDelegate (SetAttributeValue_cb);
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate IntPtr GetDocumentTypeNativeDelegate (IntPtr inst);
  
  		static IntPtr GetDocumentType_cb (IntPtr inst)
  		{
  			try {
  				IDocumentImplementor __obj = GLib.Object.GetObject (inst, false) as IDocumentImplementor;
  				string __result;
  				__result = __obj.DocumentType;
  				return GLib.Marshaller.StringToPtrGStrdup (__result);
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate IntPtr GetTheDocumentNativeDelegate (IntPtr inst);
  
  		static IntPtr GetTheDocument_cb (IntPtr inst)
  		{
  			try {
  				IDocumentImplementor __obj = GLib.Object.GetObject (inst, false) as IDocumentImplementor;
  				IntPtr __result;
  				__result = __obj.TheDocument;
  				return __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate IntPtr GetLocaleNativeDelegate (IntPtr inst);
  
  		static IntPtr GetLocale_cb (IntPtr inst)
  		{
  			try {
  				IDocumentImplementor __obj = GLib.Object.GetObject (inst, false) as IDocumentImplementor;
  				string __result;
  				__result = __obj.Locale;
  				return GLib.Marshaller.StringToPtrGStrdup (__result);
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate IntPtr GetAttributesNativeDelegate (IntPtr inst);
  
  		static IntPtr GetAttributes_cb (IntPtr inst)
  		{
  			try {
  				IDocumentImplementor __obj = GLib.Object.GetObject (inst, false) as IDocumentImplementor;
  				Atk.Attribute[] __result;
  				__result = __obj.Attributes;
  				return new GLib.SList(__result, typeof (Atk.Attribute), false, false) == null ? IntPtr.Zero : new GLib.SList(__result, typeof (Atk.Attribute), false, false).Handle;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate IntPtr GetAttributeValueNativeDelegate (IntPtr inst, IntPtr attribute_name);
  
  		static IntPtr GetAttributeValue_cb (IntPtr inst, IntPtr attribute_name)
  		{
  			try {
  				IDocumentImplementor __obj = GLib.Object.GetObject (inst, false) as IDocumentImplementor;
  				string __result;
  				__result = __obj.GetAttributeValue (GLib.Marshaller.Utf8PtrToString (attribute_name));
  				return GLib.Marshaller.StringToPtrGStrdup (__result);
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate bool SetAttributeValueNativeDelegate (IntPtr inst, IntPtr attribute_name, IntPtr attribute_value);
  
  		static bool SetAttributeValue_cb (IntPtr inst, IntPtr attribute_name, IntPtr attribute_value)
  		{
  			try {
  				IDocumentImplementor __obj = GLib.Object.GetObject (inst, false) as IDocumentImplementor;
  				bool __result;
  				__result = __obj.SetAttributeValue (GLib.Marshaller.Utf8PtrToString (attribute_name), GLib.Marshaller.Utf8PtrToString (attribute_value));
  				return __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		static int class_offset = 2 * IntPtr.Size;
  
  		static void Initialize (IntPtr ptr, IntPtr data)
  		{
  			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
  			AtkDocumentIface native_iface = (AtkDocumentIface) Marshal.PtrToStructure (ifaceptr, typeof (AtkDocumentIface));
  			native_iface.GetDocumentType = iface.GetDocumentType;
  			native_iface.GetTheDocument = iface.GetTheDocument;
  			native_iface.GetLocale = iface.GetLocale;
  			native_iface.GetAttributes = iface.GetAttributes;
  			native_iface.GetAttributeValue = iface.GetAttributeValue;
  			native_iface.SetAttributeValue = iface.SetAttributeValue;
  			Marshal.StructureToPtr (native_iface, ifaceptr, false);
  		}
  
  		GLib.Object implementor;
  
  		public DocumentAdapter ()
  		{
  			InitHandler = new GLib.GInterfaceInitHandler (Initialize);
  		}
  
  		public DocumentAdapter (IDocumentImplementor implementor)
  		{
  			if (implementor == null)
  				throw new ArgumentNullException ("implementor");
  			else if (!(implementor is GLib.Object))
  				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
  			this.implementor = implementor as GLib.Object;
  		}
  
  		public DocumentAdapter (IntPtr handle)
  		{
  			if (!_gtype.IsInstance (handle))
  				throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
  			implementor = GLib.Object.GetObject (handle);
  		}
  
  		[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr atk_document_get_type();
  
  		private static GLib.GType _gtype = new GLib.GType (atk_document_get_type ());
  
  		public static GLib.GType GType {
  			get {
  				return _gtype;
  			}
  		}
  
  		public override GLib.GType GInterfaceGType {
  			get {
  				return _gtype;
  			}
  		}
  
  		public override IntPtr Handle {
  			get {
  				return implementor.Handle;
  			}
  		}
  
  		public IntPtr OwnedHandle {
  			get {
  				return implementor.OwnedHandle;
  			}
  		}
  
  		public static IDocument GetObject (IntPtr handle, bool owned)
  		{
  
gt: 			GLib.Object obj = GLib.Object.GetObject (handle, owned);