// 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 Popover : Gtk.Bin {

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

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

		public Popover (Gtk.Widget relative_to) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Popover)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (relative_to != null) {
					names.Add ("relative_to");
					vals.Add (new GLib.Value (relative_to));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = gtk_popover_new(relative_to == null ? IntPtr.Zero : relative_to.Handle);
		}

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

		public Popover (Gtk.Widget relative_to, GLib.MenuModel model) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Popover)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (relative_to != null) {
					names.Add ("relative_to");
					vals.Add (new GLib.Value (relative_to));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = gtk_popover_new_from_model(relative_to == null ? IntPtr.Zero : relative_to.Handle, model == null ? IntPtr.Zero : model.Handle);
		}

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

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

		[GLib.Property ("relative-to")]
		public Gtk.Widget RelativeTo {
			get  {
				IntPtr raw_ret = gtk_popover_get_relative_to(Handle);
				Gtk.Widget ret = GLib.Object.GetObject(raw_ret) as Gtk.Widget;
				return ret;
			}
			set  {
				gtk_popover_set_relative_to(Handle, value == null ? IntPtr.Zero : value.Handle);
			}
		}

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

		[GLib.Property ("pointing-to")]
		public Gdk.Rectangle PointingTo {
			get {
				GLib.Value val = GetProperty ("pointing-to");
				Gdk.Rectangle ret = (Gdk.Rectangle) val;
				val.Dispose ();
				return ret;
			}
			set  {
				IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
				gtk_popover_set_pointing_to(Handle, native_value);
				Marshal.FreeHGlobal (native_value);
			}
		}

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

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

		[GLib.Property ("position")]
		public Gtk.PositionType Position {
			get  {
				int raw_ret = gtk_popover_get_position(Handle);
				Gtk.PositionType ret = (Gtk.PositionType) raw_ret;
				return ret;
			}
			set  {
				gtk_popover_set_position(Handle, (int) value);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_popover_set_modal(IntPtr raw, bool modal);
		static d_gtk_popover_set_modal gtk_popover_set_modal = FuncLoader.LoadFunction<d_gtk_popover_set_modal>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_popover_set_modal"));

		[GLib.Property ("modal")]
		public bool Modal {
			get  {
				bool raw_ret = gtk_popover_get_modal(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gtk_popover_set_modal(Handle, value);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_popover_set_transitions_enabled(IntPtr raw, bool transitions_enabled);
		static d_gtk_popover_set_transitions_enabled gtk_popover_set_transitions_enabled = FuncLoader.LoadFunction<d_gtk_popover_set_transitions_enabled>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_popover_set_transitions_enabled"));

		[Obsolete]
		[GLib.Property ("transitions-enabled")]
		public bool TransitionsEnabled {
			get  {
				bool raw_ret = gtk_popover_get_transitions_enabled(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gtk_popover_set_transitions_enabled(Handle, value);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_popover_set_constrain_to(IntPtr raw, int constraint);
		static d_gtk_popover_set_constrain_to gtk_popover_set_constrain_to = FuncLoader.LoadFunction<d_gtk_popover_set_constrain_to>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_popover_set_constrain_to"));

		[GLib.Property ("constrain-to")]
		public Gtk.PopoverConstraint ConstrainTo {
			get  {
				int raw_ret = gtk_popover_get_constrain_to(Handle);
				Gtk.PopoverConstraint ret = (Gtk.PopoverConstraint) raw_ret;
				return ret;
			}
			set  {
				gtk_popover_set_constrain_to(Handle, (int) value);
			}
		}

		[GLib.Signal("closed")]
		public event System.EventHandler Closed {
			add {
				this.AddSignalHandler ("closed", value);
			}
			remove {
				this.RemoveSignalHandler ("closed", value);
			}
		}

		static ClosedNativeDelegate Closed_cb_delegate;
		static ClosedNativeDelegate ClosedVMCallback {
			get {
				if (Closed_cb_delegate == null)
					Closed_cb_delegate = new ClosedNativeDelegate (Closed_cb);
				return Closed_cb_delegate;
			}
		}

		static void OverrideClosed (GLib.GType gtype)
		{
			OverrideClosed (gtype, ClosedVMCallback);
		}

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

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

		static void Closed_cb (IntPtr inst)
		{
			try {
				Popover __obj = GLib.Object.GetObject (inst, false) as Popover;
				__obj.OnClosed ();
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.Popover), ConnectionMethod="OverrideClosed")]
		protected virtual void OnClosed ()
		{
			InternalClosed ();
		}

		private void InternalClosed ()
		{
			ClosedNativeDelegate unmanaged = class_abi.BaseOverride<ClosedNativeDelegate>(this.LookupGType(), "closed");
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}


		// 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("closed"
							, Gtk.Bin.class_abi.Fields
							, (uint) sizeof( IntPtr ) // closed
							, null
							, "reserved"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("reserved"
							, -1
							, (uint) sizeof( IntPtr ) * 10 // reserved
							, "closed"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_popover_bind_model(IntPtr raw, IntPtr model, IntPtr action_namespace);
		static d_gtk_popover_bind_model gtk_popover_bind_model = FuncLoader.LoadFunction<d_gtk_popover_bind_model>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_popover_bind_model"));

		public void BindModel(GLib.MenuModel model, string action_namespace) {
			IntPtr native_action_namespace = GLib.Marshaller.StringToPtrGStrdup (action_namespace);
			gtk_popover_bind_model(Handle, model == null ? IntPtr.Zero : model.Handle, native_action_namespace);
			GLib.Marshaller.Free (native_action_namespace);
		}

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

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

		public Gtk.Widget DefaultWidget { 
			get {
				IntPtr raw_ret = gtk_popover_get_default_widget(Handle);
				Gtk.Widget ret = GLib.Object.GetObject(raw_ret) as Gtk.Widget;
				return ret;
			}
			set {
				gtk_popover_set_default_widget(Handle, value == null ? IntPtr.Zero : value.Handle);
			}
		}

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

		public bool GetPointingTo(Gdk.Rectangle rect) {
			IntPtr native_rect = GLib.Marshaller.StructureToPtrAlloc (rect);
			bool raw_ret = gtk_popover_get_pointing_to(Handle, native_rect);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_rect);
			return ret;
		}

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

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

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

		public void Popdown() {
			gtk_popover_popdown(Handle);
		}

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

		public void Popup() {
			gtk_popover_popup(Handle);
		}


		// 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
	}
}
