// 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 TableCellAdapter : GLib.GInterfaceAdapter, Atk.ITableCell {

		[StructLayout (LayoutKind.Sequential)]
		struct AtkTableCellIface {
			public GetColumnSpanNativeDelegate GetColumnSpan;
			public GetColumnHeaderCellsNativeDelegate GetColumnHeaderCells;
			public GetPositionNativeDelegate GetPosition;
			public GetRowSpanNativeDelegate GetRowSpan;
			public GetRowHeaderCellsNativeDelegate GetRowHeaderCells;
			public GetRowColumnSpanNativeDelegate GetRowColumnSpan;
			public GetTableNativeDelegate GetTable;
		}

		static AtkTableCellIface iface;

		static TableCellAdapter ()
		{
			GLib.GType.Register (_gtype, typeof (TableCellAdapter));
			iface.GetColumnSpan = new GetColumnSpanNativeDelegate (GetColumnSpan_cb);
			iface.GetColumnHeaderCells = new GetColumnHeaderCellsNativeDelegate (GetColumnHeaderCells_cb);
			iface.GetPosition = new GetPositionNativeDelegate (GetPosition_cb);
			iface.GetRowSpan = new GetRowSpanNativeDelegate (GetRowSpan_cb);
			iface.GetRowHeaderCells = new GetRowHeaderCellsNativeDelegate (GetRowHeaderCells_cb);
			iface.GetRowColumnSpan = new GetRowColumnSpanNativeDelegate (GetRowColumnSpan_cb);
			iface.GetTable = new GetTableNativeDelegate (GetTable_cb);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetColumnSpanNativeDelegate (IntPtr inst);

		static int GetColumnSpan_cb (IntPtr inst)
		{
			try {
				ITableCellImplementor __obj = GLib.Object.GetObject (inst, false) as ITableCellImplementor;
				int __result;
				__result = __obj.ColumnSpan;
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetColumnHeaderCellsNativeDelegate (IntPtr inst);

		static IntPtr GetColumnHeaderCells_cb (IntPtr inst)
		{
			try {
				ITableCellImplementor __obj = GLib.Object.GetObject (inst, false) as ITableCellImplementor;
				GLib.PtrArray __result;
				__result = __obj.ColumnHeaderCells;
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GetPositionNativeDelegate (IntPtr inst, out int row, out int column);

		static bool GetPosition_cb (IntPtr inst, out int row, out int column)
		{
			try {
				ITableCellImplementor __obj = GLib.Object.GetObject (inst, false) as ITableCellImplementor;
				bool __result;
				__result = __obj.GetPosition (out row, out column);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetRowSpanNativeDelegate (IntPtr inst);

		static int GetRowSpan_cb (IntPtr inst)
		{
			try {
				ITableCellImplementor __obj = GLib.Object.GetObject (inst, false) as ITableCellImplementor;
				int __result;
				__result = __obj.RowSpan;
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetRowHeaderCellsNativeDelegate (IntPtr inst);

		static IntPtr GetRowHeaderCells_cb (IntPtr inst)
		{
			try {
				ITableCellImplementor __obj = GLib.Object.GetObject (inst, false) as ITableCellImplementor;
				GLib.PtrArray __result;
				__result = __obj.RowHeaderCells;
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GetRowColumnSpanNativeDelegate (IntPtr inst, out int row, out int column, out int row_span, out int column_span);

		static bool GetRowColumnSpan_cb (IntPtr inst, out int row, out int column, out int row_span, out int column_span)
		{
			try {
				ITableCellImplementor __obj = GLib.Object.GetObject (inst, false) as ITableCellImplementor;
				bool __result;
				__result = __obj.GetRowColumnSpan (out row, out column, out row_span, out column_span);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetTableNativeDelegate (IntPtr inst);

		static IntPtr GetTable_cb (IntPtr inst)
		{
			try {
				ITableCellImplementor __obj = GLib.Object.GetObject (inst, false) as ITableCellImplementor;
				Atk.Object __result;
				__result = __obj.Table;
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		static int class_offset = 2 * IntPtr.Size;

		static void Initialize (IntPtr ptr, IntPtr data)
		{
			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
			AtkTableCellIface native_iface = (AtkTableCellIface) Marshal.PtrToStructure (ifaceptr, typeof (AtkTableCellIface));
			native_iface.GetColumnSpan = iface.GetColumnSpan;
			native_iface.GetColumnHeaderCells = iface.GetColumnHeaderCells;
			native_iface.GetPosition = iface.GetPosition;
			native_iface.GetRowSpan = iface.GetRowSpan;
			native_iface.GetRowHeaderCells = iface.GetRowHeaderCells;
			native_iface.GetRowColumnSpan = iface.GetRowColumnSpan;
			native_iface.GetTable = iface.GetTable;
			Marshal.StructureToPtr (native_iface, ifaceptr, false);
		}

		GLib.Object implementor;

		public TableCellAdapter ()
		{
			InitHandler = new GLib.GInterfaceInitHandler (Initialize);
		}

		public TableCellAdapter (ITableCellImplementor 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 TableCellAdapter (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);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_atk_table_cell_get_type();
		static d_atk_table_cell_get_type atk_table_cell_get_type = FuncLoader.LoadFunction<d_atk_table_cell_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_table_cell_get_type"));

		private static GLib.GType _gtype = new GLib.GType (atk_table_cell_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 ITableCell GetObject (IntPtr handle, bool owned)
		{
			GLib.Object obj = GLib.Object.GetObject (handle, owned);
			return GetObject (obj);
		}

		public static ITableCell GetObject (GLib.Object obj)
		{
			if (obj == null)
				return null;
			else if (obj is ITableCellImplementor)
				return new TableCellAdapter (obj as ITableCellImplementor);
			else if (obj as ITableCell == null)
				return new TableCellAdapter (obj.Handle);
			else
				return obj as ITableCell;
		}

		public ITableCellImplementor Implementor {
			get {
				return implementor as ITableCellImplementor;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_atk_table_cell_get_column_header_cells(IntPtr raw);
		static d_atk_table_cell_get_column_header_cells atk_table_cell_get_column_header_cells = FuncLoader.LoadFunction<d_atk_table_cell_get_column_header_cells>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_table_cell_get_column_header_cells"));

		public GLib.PtrArray ColumnHeaderCells { 
			get {
				IntPtr raw_ret = atk_table_cell_get_column_header_cells(Handle);
				GLib.PtrArray ret = new GLib.PtrArray(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_atk_table_cell_get_column_span(IntPtr raw);
		static d_atk_table_cell_get_column_span atk_table_cell_get_column_span = FuncLoader.LoadFunction<d_atk_table_cell_get_column_span>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_table_cell_get_column_span"));

		public int ColumnSpan { 
			get {
				int raw_ret = atk_table_cell_get_column_span(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_atk_table_cell_get_position(IntPtr raw, out int row, out int column);
		static d_atk_table_cell_get_position atk_table_cell_get_position = FuncLoader.LoadFunction<d_atk_table_cell_get_position>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_table_cell_get_position"));

		public bool GetPosition(out int row, out int column) {
			bool raw_ret = atk_table_cell_get_position(Handle, out row, out column);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_atk_table_cell_get_row_column_span(IntPtr raw, out int row, out int column, out int row_span, out int column_span);
		static d_atk_table_cell_get_row_column_span atk_table_cell_get_row_column_span = FuncLoader.LoadFunction<d_atk_table_cell_get_row_column_span>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_table_cell_get_row_column_span"));

		public bool GetRowColumnSpan(out int row, out int column, out int row_span, out int column_span) {
			bool raw_ret = atk_table_cell_get_row_column_span(Handle, out row, out column, out row_span, out column_span);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_atk_table_cell_get_row_header_cells(IntPtr raw);
		static d_atk_table_cell_get_row_header_cells atk_table_cell_get_row_header_cells = FuncLoader.LoadFunction<d_atk_table_cell_get_row_header_cells>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_table_cell_get_row_header_cells"));

		public GLib.PtrArray RowHeaderCells { 
			get {
				IntPtr raw_ret = atk_table_cell_get_row_header_cells(Handle);
				GLib.PtrArray ret = new GLib.PtrArray(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_atk_table_cell_get_row_span(IntPtr raw);
		static d_atk_table_cell_get_row_span atk_table_cell_get_row_span = FuncLoader.LoadFunction<d_atk_table_cell_get_row_span>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_table_cell_get_row_span"));

		public int RowSpan { 
			get {
				int raw_ret = atk_table_cell_get_row_span(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_atk_table_cell_get_table(IntPtr raw);
		static d_atk_table_cell_get_table atk_table_cell_get_table = FuncLoader.LoadFunction<d_atk_table_cell_get_table>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_table_cell_get_table"));

		public Atk.Object Table { 
			get {
				IntPtr raw_ret = atk_table_cell_get_table(Handle);
				Atk.Object ret = GLib.Object.GetObject(raw_ret) as Atk.Object;
				return ret;
			}
		}

#endregion
	}
}
