// 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 Switch : Gtk.Widget, Gtk.IActionable, Gtk.IActivatable {

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

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

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

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

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

		[GLib.Property ("active")]
		public bool Active {
			get  {
				bool raw_ret = gtk_switch_get_active(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gtk_switch_set_active(Handle, value);
			}
		}

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

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

		[GLib.Property ("state")]
		public bool State {
			get  {
				bool raw_ret = gtk_switch_get_state(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gtk_switch_set_state(Handle, value);
			}
		}

		[Obsolete]
		public int SliderWidth {
			get {
				var val = (int)StyleGetProperty("slider-width");
				return val;
			}
		}

		[Obsolete]
		public int SliderHeight {
			get {
				var val = (int)StyleGetProperty("slider-height");
				return val;
			}
		}

		[GLib.Signal("state-set")]
		public event Gtk.StateSetHandler StateSet {
			add {
				this.AddSignalHandler ("state-set", value, typeof (Gtk.StateSetArgs));
			}
			remove {
				this.RemoveSignalHandler ("state-set", value);
			}
		}

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

		static ActivateNativeDelegate Activate_cb_delegate;
		static ActivateNativeDelegate ActivateVMCallback {
			get {
				if (Activate_cb_delegate == null)
					Activate_cb_delegate = new ActivateNativeDelegate (Activate_cb);
				return Activate_cb_delegate;
			}
		}

		static void OverrideActivate (GLib.GType gtype)
		{
			OverrideActivate (gtype, ActivateVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.Switch), ConnectionMethod="OverrideActivate")]
		protected virtual void OnActivate ()
		{
			InternalActivate ();
		}

		private void InternalActivate ()
		{
			ActivateNativeDelegate unmanaged = class_abi.BaseOverride<ActivateNativeDelegate>(this.LookupGType(), "activate");
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}

		static StateSetNativeDelegate StateSet_cb_delegate;
		static StateSetNativeDelegate StateSetVMCallback {
			get {
				if (StateSet_cb_delegate == null)
					StateSet_cb_delegate = new StateSetNativeDelegate (StateSet_cb);
				return StateSet_cb_delegate;
			}
		}

		static void OverrideStateSet (GLib.GType gtype)
		{
			OverrideStateSet (gtype, StateSetVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool StateSetNativeDelegate (IntPtr inst, bool state);

		static bool StateSet_cb (IntPtr inst, bool state)
		{
			try {
				Switch __obj = GLib.Object.GetObject (inst, false) as Switch;
				bool __result;
				__result = __obj.OnStateSet (state);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.Switch), ConnectionMethod="OverrideStateSet")]
		protected virtual bool OnStateSet (bool state)
		{
			return InternalStateSet (state);
		}

		private bool InternalStateSet (bool state)
		{
			StateSetNativeDelegate unmanaged = class_abi.BaseOverride<StateSetNativeDelegate>(this.LookupGType(), "state_set");
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle, state);
			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("activate"
							, Gtk.Widget.class_abi.Fields
							, (uint) sizeof( IntPtr ) // activate
							, null
							, "state_set"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("state_set"
							, -1
							, (uint) sizeof( IntPtr ) // state_set
							, "activate"
							, "_switch_padding_1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_switch_padding_1"
							, -1
							, (uint) sizeof( IntPtr ) // _switch_padding_1
							, "state_set"
							, "_switch_padding_2"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_switch_padding_2"
							, -1
							, (uint) sizeof( IntPtr ) // _switch_padding_2
							, "_switch_padding_1"
							, "_switch_padding_3"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_switch_padding_3"
							, -1
							, (uint) sizeof( IntPtr ) // _switch_padding_3
							, "_switch_padding_2"
							, "_switch_padding_4"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_switch_padding_4"
							, -1
							, (uint) sizeof( IntPtr ) // _switch_padding_4
							, "_switch_padding_3"
							, "_switch_padding_5"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_switch_padding_5"
							, -1
							, (uint) sizeof( IntPtr ) // _switch_padding_5
							, "_switch_padding_4"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

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

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

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

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

		public string ActionName { 
			get {
				IntPtr raw_ret = gtk_actionable_get_action_name(Handle);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				return ret;
			}
			set {
				IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
				gtk_actionable_set_action_name(Handle, native_value);
				GLib.Marshaller.Free (native_value);
			}
		}

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

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

		public GLib.Variant ActionTargetValue { 
			get {
				IntPtr raw_ret = gtk_actionable_get_action_target_value(Handle);
				GLib.Variant ret = new GLib.Variant(raw_ret);
				return ret;
			}
			set {
				gtk_actionable_set_action_target_value(Handle, value == null ? IntPtr.Zero : value.Handle);
			}
		}

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

		public string DetailedActionName { 
			set {
				IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
				gtk_actionable_set_detailed_action_name(Handle, native_value);
				GLib.Marshaller.Free (native_value);
			}
		}

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

		[Obsolete]
		public void DoSetRelatedAction(Gtk.Action action) {
			gtk_activatable_do_set_related_action(Handle, action == null ? IntPtr.Zero : action.Handle);
		}

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

		[Obsolete]
		public void SyncActionProperties(Gtk.Action action) {
			gtk_activatable_sync_action_properties(Handle, action == null ? IntPtr.Zero : action.Handle);
		}

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

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

		[Obsolete]
		[GLib.Property ("related-action")]
		public Gtk.Action RelatedAction {
			get  {
				IntPtr raw_ret = gtk_activatable_get_related_action(Handle);
				Gtk.Action ret = GLib.Object.GetObject(raw_ret) as Gtk.Action;
				return ret;
			}
			set  {
				gtk_activatable_set_related_action(Handle, value == null ? IntPtr.Zero : value.Handle);
			}
		}

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

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

		[Obsolete]
		[GLib.Property ("use-action-appearance")]
		public bool UseActionAppearance {
			get  {
				bool raw_ret = gtk_activatable_get_use_action_appearance(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gtk_activatable_set_use_action_appearance(Handle, value);
			}
		}


		// 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.Widget.abi_info.Fields
							, (uint) sizeof( IntPtr ) // priv
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
