// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Gtk {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;
	using static GLib.AbiStructExtension;

#region Autogenerated code
	public partial class Overlay : Gtk.Bin {

		public Overlay (IntPtr raw) : base(raw) {}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_overlay_new();
		static d_gtk_overlay_new gtk_overlay_new = FuncLoader.LoadFunction<d_gtk_overlay_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_overlay_new"));

		public Overlay () : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Overlay)) {
				CreateNativeObject (Array.Empty<string> (), Array.Empty<GLib.Value> ());
				return;
			}
			Raw = gtk_overlay_new();
		}

		public class OverlayChild : Gtk.Container.ContainerChild {
			protected internal OverlayChild (Gtk.Container parent, Gtk.Widget child) : base (parent, child) {}

			[Gtk.ChildProperty ("pass-through")]
			public bool PassThrough {
				get {
					GLib.Value val = parent.ChildGetProperty (child, "pass-through");
					bool ret = (bool) val;
					val.Dispose ();
					return ret;
				}
				set {
					GLib.Value val = new GLib.Value(value);
					parent.ChildSetProperty(child, "pass-through", val);
					val.Dispose ();
				}
			}

			[Gtk.ChildProperty ("index")]
			public int Index {
				get {
					GLib.Value val = parent.ChildGetProperty (child, "index");
					int ret = (int) val;
					val.Dispose ();
					return ret;
				}
				set {
					GLib.Value val = new GLib.Value(value);
					parent.ChildSetProperty(child, "index", val);
					val.Dispose ();
				}
			}

		}

		public override Gtk.Container.ContainerChild this [Gtk.Widget child] {
			get {
				return new OverlayChild (this, child);
			}
		}

		[GLib.Signal("get-child-position")]
		public event Gtk.GetChildPositionHandler GetChildPosition {
			add {
				this.AddSignalHandler ("get-child-position", value, typeof (Gtk.GetChildPositionArgs));
			}
			remove {
				this.RemoveSignalHandler ("get-child-position", value);
			}
		}

		static GetChildPositionNativeDelegate GetChildPosition_cb_delegate;
		static GetChildPositionNativeDelegate GetChildPositionVMCallback {
			get {
				if (GetChildPosition_cb_delegate == null)
					GetChildPosition_cb_delegate = new GetChildPositionNativeDelegate (GetChildPosition_cb);
				return GetChildPosition_cb_delegate;
			}
		}

		static void OverrideGetChildPosition (GLib.GType gtype)
		{
			OverrideGetChildPosition (gtype, GetChildPositionVMCallback);
		}

		static void OverrideGetChildPosition (GLib.GType gtype, GetChildPositionNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_child_position"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GetChildPositionNativeDelegate (IntPtr inst, IntPtr widget, IntPtr allocation);

		static bool GetChildPosition_cb (IntPtr inst, IntPtr widget, IntPtr allocation)
		{
			try {
				Overlay __obj = GLib.Object.GetObject (inst, false) as Overlay;
				bool __result;
				__result = __obj.OnGetChildPosition (GLib.Object.GetObject(widget) as Gtk.Widget, (Gdk.Rectangle) Marshal.PtrToStructure (allocation, typeof (Gdk.Rectangle)));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.Overlay), ConnectionMethod="OverrideGetChildPosition")]
		protected virtual bool OnGetChildPosition (Gtk.Widget widget, Gdk.Rectangle allocation)
		{
			return InternalGetChildPosition (widget, allocation);
		}

		private bool InternalGetChildPosition (Gtk.Widget widget, Gdk.Rectangle allocation)
		{
			GetChildPositionNativeDelegate unmanaged = class_abi.BaseOverride<GetChildPositionNativeDelegate>(this.LookupGType(), "get_child_position");
			if (unmanaged == null) return false;

			IntPtr native_allocation = GLib.Marshaller.StructureToPtrAlloc (allocation);
			bool __result = unmanaged (this.Handle, widget == null ? IntPtr.Zero : widget.Handle, native_allocation);
			Marshal.FreeHGlobal (native_allocation);
			return __result;
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public unsafe new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("get_child_position"
							, Gtk.Bin.class_abi.Fields
							, (uint) sizeof( IntPtr ) // get_child_position
							, null
							, "_gtk_reserved1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved1"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved1
							, "get_child_position"
							, "_gtk_reserved2"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved2"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved2
							, "_gtk_reserved1"
							, "_gtk_reserved3"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved3"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved3
							, "_gtk_reserved2"
							, "_gtk_reserved4"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved4"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved4
							, "_gtk_reserved3"
							, "_gtk_reserved5"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved5"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved5
							, "_gtk_reserved4"
							, "_gtk_reserved6"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved6"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved6
							, "_gtk_reserved5"
							, "_gtk_reserved7"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved7"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved7
							, "_gtk_reserved6"
							, "_gtk_reserved8"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved8"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved8
							, "_gtk_reserved7"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_overlay_add_overlay(IntPtr raw, IntPtr widget);
		static d_gtk_overlay_add_overlay gtk_overlay_add_overlay = FuncLoader.LoadFunction<d_gtk_overlay_add_overlay>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_overlay_add_overlay"));

		public void AddOverlay(Gtk.Widget widget) {
			gtk_overlay_add_overlay(Handle, widget == null ? IntPtr.Zero : widget.Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_overlay_get_overlay_pass_through(IntPtr raw, IntPtr widget);
		static d_gtk_overlay_get_overlay_pass_through gtk_overlay_get_overlay_pass_through = FuncLoader.LoadFunction<d_gtk_overlay_get_overlay_pass_through>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_overlay_get_overlay_pass_through"));

		public bool GetOverlayPassThrough(Gtk.Widget widget) {
			bool raw_ret = gtk_overlay_get_overlay_pass_through(Handle, widget == null ? IntPtr.Zero : widget.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_overlay_get_type();
		static d_gtk_overlay_get_type gtk_overlay_get_type = FuncLoader.LoadFunction<d_gtk_overlay_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_overlay_get_type"));

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = gtk_overlay_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_overlay_reorder_overlay(IntPtr raw, IntPtr child, int position);
		static d_gtk_overlay_reorder_overlay gtk_overlay_reorder_overlay = FuncLoader.LoadFunction<d_gtk_overlay_reorder_overlay>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_overlay_reorder_overlay"));

		public void ReorderOverlay(Gtk.Widget child, int position) {
			gtk_overlay_reorder_overlay(Handle, child == null ? IntPtr.Zero : child.Handle, position);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_overlay_set_overlay_pass_through(IntPtr raw, IntPtr widget, bool pass_through);
		static d_gtk_overlay_set_overlay_pass_through gtk_overlay_set_overlay_pass_through = FuncLoader.LoadFunction<d_gtk_overlay_set_overlay_pass_through>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_overlay_set_overlay_pass_through"));

		public void SetOverlayPassThrough(Gtk.Widget widget, bool pass_through) {
			gtk_overlay_set_overlay_pass_through(Handle, widget == null ? IntPtr.Zero : widget.Handle, pass_through);
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public unsafe new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("priv"
							, Gtk.Bin.abi_info.Fields
							, (uint) sizeof( IntPtr ) // priv
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
