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

namespace GtkSource {

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

#region Autogenerated code
	public partial class MarkAttributes : GLib.Object {

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_source_mark_attributes_new();
		static d_gtk_source_mark_attributes_new gtk_source_mark_attributes_new = FuncLoader.LoadFunction<d_gtk_source_mark_attributes_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_mark_attributes_new"));

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

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

		[GLib.Property ("background")]
		public Gdk.RGBA Background {
			get {
				GLib.Value val = GetProperty ("background");
				Gdk.RGBA ret = (Gdk.RGBA) val;
				val.Dispose ();
				return ret;
			}
			set  {
				IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
				gtk_source_mark_attributes_set_background(Handle, native_value);
				Marshal.FreeHGlobal (native_value);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_mark_attributes_set_pixbuf(IntPtr raw, IntPtr pixbuf);
		static d_gtk_source_mark_attributes_set_pixbuf gtk_source_mark_attributes_set_pixbuf = FuncLoader.LoadFunction<d_gtk_source_mark_attributes_set_pixbuf>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_mark_attributes_set_pixbuf"));

		[GLib.Property ("pixbuf")]
		public Gdk.Pixbuf Pixbuf {
			get  {
				IntPtr raw_ret = gtk_source_mark_attributes_get_pixbuf(Handle);
				Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
				return ret;
			}
			set  {
				gtk_source_mark_attributes_set_pixbuf(Handle, value == null ? IntPtr.Zero : value.Handle);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_mark_attributes_set_icon_name(IntPtr raw, IntPtr icon_name);
		static d_gtk_source_mark_attributes_set_icon_name gtk_source_mark_attributes_set_icon_name = FuncLoader.LoadFunction<d_gtk_source_mark_attributes_set_icon_name>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_mark_attributes_set_icon_name"));

		[GLib.Property ("icon-name")]
		public string IconName {
			get  {
				IntPtr raw_ret = gtk_source_mark_attributes_get_icon_name(Handle);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				return ret;
			}
			set  {
				IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
				gtk_source_mark_attributes_set_icon_name(Handle, native_value);
				GLib.Marshaller.Free (native_value);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_mark_attributes_set_gicon(IntPtr raw, IntPtr gicon);
		static d_gtk_source_mark_attributes_set_gicon gtk_source_mark_attributes_set_gicon = FuncLoader.LoadFunction<d_gtk_source_mark_attributes_set_gicon>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_mark_attributes_set_gicon"));

		[GLib.Property ("gicon")]
		public GLib.IIcon Gicon {
			get  {
				IntPtr raw_ret = gtk_source_mark_attributes_get_gicon(Handle);
				GLib.IIcon ret = GLib.IconAdapter.GetObject (raw_ret, false);
				return ret;
			}
			set  {
				gtk_source_mark_attributes_set_gicon(Handle, value == null ? IntPtr.Zero : ((value is GLib.Object) ? (value as GLib.Object).Handle : (value as GLib.IconAdapter).Handle));
			}
		}

		[GLib.Signal("query-tooltip-text")]
		public event GtkSource.QueryTooltipTextHandler QueryTooltipText {
			add {
				this.AddSignalHandler ("query-tooltip-text", value, typeof (GtkSource.QueryTooltipTextArgs));
			}
			remove {
				this.RemoveSignalHandler ("query-tooltip-text", value);
			}
		}

		[GLib.Signal("query-tooltip-markup")]
		public event GtkSource.QueryTooltipMarkupHandler QueryTooltipMarkup {
			add {
				this.AddSignalHandler ("query-tooltip-markup", value, typeof (GtkSource.QueryTooltipMarkupArgs));
			}
			remove {
				this.RemoveSignalHandler ("query-tooltip-markup", value);
			}
		}

		static QueryTooltipTextNativeDelegate QueryTooltipText_cb_delegate;
		static QueryTooltipTextNativeDelegate QueryTooltipTextVMCallback {
			get {
				if (QueryTooltipText_cb_delegate == null)
					QueryTooltipText_cb_delegate = new QueryTooltipTextNativeDelegate (QueryTooltipText_cb);
				return QueryTooltipText_cb_delegate;
			}
		}

		static void OverrideQueryTooltipText (GLib.GType gtype)
		{
			OverrideQueryTooltipText (gtype, QueryTooltipTextVMCallback);
		}

		static void OverrideQueryTooltipText (GLib.GType gtype, QueryTooltipTextNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "query-tooltip-text", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr QueryTooltipTextNativeDelegate (IntPtr inst, IntPtr p0);

		static IntPtr QueryTooltipText_cb (IntPtr inst, IntPtr p0)
		{
			try {
				MarkAttributes __obj = GLib.Object.GetObject (inst, false) as MarkAttributes;
				string __result;
				__result = __obj.OnQueryTooltipText (GLib.Object.GetObject(p0) as GtkSource.Mark);
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GtkSource.MarkAttributes), ConnectionMethod="OverrideQueryTooltipText")]
		protected virtual string OnQueryTooltipText (GtkSource.Mark p0)
		{
			return InternalQueryTooltipText (p0);
		}

		private string InternalQueryTooltipText (GtkSource.Mark p0)
		{
			GLib.Value ret = new GLib.Value (GLib.GType.String);
			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
			GLib.Value[] vals = new GLib.Value [2];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (p0);
			inst_and_params.Append (vals [1]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
			string result = (string) ret;
			ret.Dispose ();
			return result;
		}

		static QueryTooltipMarkupNativeDelegate QueryTooltipMarkup_cb_delegate;
		static QueryTooltipMarkupNativeDelegate QueryTooltipMarkupVMCallback {
			get {
				if (QueryTooltipMarkup_cb_delegate == null)
					QueryTooltipMarkup_cb_delegate = new QueryTooltipMarkupNativeDelegate (QueryTooltipMarkup_cb);
				return QueryTooltipMarkup_cb_delegate;
			}
		}

		static void OverrideQueryTooltipMarkup (GLib.GType gtype)
		{
			OverrideQueryTooltipMarkup (gtype, QueryTooltipMarkupVMCallback);
		}

		static void OverrideQueryTooltipMarkup (GLib.GType gtype, QueryTooltipMarkupNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "query-tooltip-markup", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr QueryTooltipMarkupNativeDelegate (IntPtr inst, IntPtr p0);

		static IntPtr QueryTooltipMarkup_cb (IntPtr inst, IntPtr p0)
		{
			try {
				MarkAttributes __obj = GLib.Object.GetObject (inst, false) as MarkAttributes;
				string __result;
				__result = __obj.OnQueryTooltipMarkup (GLib.Object.GetObject(p0) as GtkSource.Mark);
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GtkSource.MarkAttributes), ConnectionMethod="OverrideQueryTooltipMarkup")]
		protected virtual string OnQueryTooltipMarkup (GtkSource.Mark p0)
		{
			return InternalQueryTooltipMarkup (p0);
		}

		private string InternalQueryTooltipMarkup (GtkSource.Mark p0)
		{
			GLib.Value ret = new GLib.Value (GLib.GType.String);
			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
			GLib.Value[] vals = new GLib.Value [2];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (p0);
			inst_and_params.Append (vals [1]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
			string result = (string) ret;
			ret.Dispose ();
			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("padding"
							, GLib.Object.class_abi.Fields
							, (uint) sizeof( IntPtr ) * 10 // padding
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_source_mark_attributes_get_background(IntPtr raw, IntPtr background);
		static d_gtk_source_mark_attributes_get_background gtk_source_mark_attributes_get_background = FuncLoader.LoadFunction<d_gtk_source_mark_attributes_get_background>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_mark_attributes_get_background"));

		public bool GetBackground(Gdk.RGBA background) {
			IntPtr native_background = GLib.Marshaller.StructureToPtrAlloc (background);
			bool raw_ret = gtk_source_mark_attributes_get_background(Handle, native_background);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_background);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_source_mark_attributes_get_tooltip_markup(IntPtr raw, IntPtr mark);
		static d_gtk_source_mark_attributes_get_tooltip_markup gtk_source_mark_attributes_get_tooltip_markup = FuncLoader.LoadFunction<d_gtk_source_mark_attributes_get_tooltip_markup>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_mark_attributes_get_tooltip_markup"));

		public string GetTooltipMarkup(GtkSource.Mark mark) {
			IntPtr raw_ret = gtk_source_mark_attributes_get_tooltip_markup(Handle, mark == null ? IntPtr.Zero : mark.Handle);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_source_mark_attributes_get_tooltip_text(IntPtr raw, IntPtr mark);
		static d_gtk_source_mark_attributes_get_tooltip_text gtk_source_mark_attributes_get_tooltip_text = FuncLoader.LoadFunction<d_gtk_source_mark_attributes_get_tooltip_text>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_mark_attributes_get_tooltip_text"));

		public string GetTooltipText(GtkSource.Mark mark) {
			IntPtr raw_ret = gtk_source_mark_attributes_get_tooltip_text(Handle, mark == null ? IntPtr.Zero : mark.Handle);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_source_mark_attributes_get_type();
		static d_gtk_source_mark_attributes_get_type gtk_source_mark_attributes_get_type = FuncLoader.LoadFunction<d_gtk_source_mark_attributes_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_mark_attributes_get_type"));

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_source_mark_attributes_render_icon(IntPtr raw, IntPtr widget, int size);
		static d_gtk_source_mark_attributes_render_icon gtk_source_mark_attributes_render_icon = FuncLoader.LoadFunction<d_gtk_source_mark_attributes_render_icon>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_mark_attributes_render_icon"));

		public Gdk.Pixbuf RenderIcon(Gtk.Widget widget, int size) {
			IntPtr raw_ret = gtk_source_mark_attributes_render_icon(Handle, widget == null ? IntPtr.Zero : widget.Handle, size);
			Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
			return ret;
		}


		static MarkAttributes ()
		{
			GtkSharp.GtkSourceSharp.ObjectManager.Initialize ();
		}

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

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
