// 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 Buffer : Gtk.TextBuffer {

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

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

		public Buffer (Gtk.TextTagTable table) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Buffer)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = gtk_source_buffer_new(table == null ? IntPtr.Zero : table.Handle);
		}

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

		public Buffer (GtkSource.Language language) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Buffer)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (language != null) {
					names.Add ("language");
					vals.Add (new GLib.Value (language));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = gtk_source_buffer_new_with_language(language == null ? IntPtr.Zero : language.Handle);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_buffer_set_highlight_syntax(IntPtr raw, bool highlight);
		static d_gtk_source_buffer_set_highlight_syntax gtk_source_buffer_set_highlight_syntax = FuncLoader.LoadFunction<d_gtk_source_buffer_set_highlight_syntax>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_set_highlight_syntax"));

		[GLib.Property ("highlight-syntax")]
		public bool HighlightSyntax {
			get  {
				bool raw_ret = gtk_source_buffer_get_highlight_syntax(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gtk_source_buffer_set_highlight_syntax(Handle, value);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_buffer_set_highlight_matching_brackets(IntPtr raw, bool highlight);
		static d_gtk_source_buffer_set_highlight_matching_brackets gtk_source_buffer_set_highlight_matching_brackets = FuncLoader.LoadFunction<d_gtk_source_buffer_set_highlight_matching_brackets>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_set_highlight_matching_brackets"));

		[GLib.Property ("highlight-matching-brackets")]
		public bool HighlightMatchingBrackets {
			get  {
				bool raw_ret = gtk_source_buffer_get_highlight_matching_brackets(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gtk_source_buffer_set_highlight_matching_brackets(Handle, value);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_buffer_set_max_undo_levels(IntPtr raw, int max_undo_levels);
		static d_gtk_source_buffer_set_max_undo_levels gtk_source_buffer_set_max_undo_levels = FuncLoader.LoadFunction<d_gtk_source_buffer_set_max_undo_levels>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_set_max_undo_levels"));

		[GLib.Property ("max-undo-levels")]
		public int MaxUndoLevels {
			get  {
				int raw_ret = gtk_source_buffer_get_max_undo_levels(Handle);
				int ret = raw_ret;
				return ret;
			}
			set  {
				gtk_source_buffer_set_max_undo_levels(Handle, value);
			}
		}

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

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

		[GLib.Property ("language")]
		public GtkSource.Language Language {
			get  {
				IntPtr raw_ret = gtk_source_buffer_get_language(Handle);
				GtkSource.Language ret = GLib.Object.GetObject(raw_ret) as GtkSource.Language;
				return ret;
			}
			set  {
				gtk_source_buffer_set_language(Handle, value == null ? IntPtr.Zero : value.Handle);
			}
		}

		[GLib.Property ("can-undo")]
		public bool CanUndo {
			get {
				GLib.Value val = GetProperty ("can-undo");
				bool ret = (bool) val;
				val.Dispose ();
				return ret;
			}
		}

		[GLib.Property ("can-redo")]
		public bool CanRedo {
			get {
				GLib.Value val = GetProperty ("can-redo");
				bool ret = (bool) val;
				val.Dispose ();
				return ret;
			}
		}

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

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

		[GLib.Property ("style-scheme")]
		public GtkSource.StyleScheme StyleScheme {
			get  {
				IntPtr raw_ret = gtk_source_buffer_get_style_scheme(Handle);
				GtkSource.StyleScheme ret = GLib.Object.GetObject(raw_ret) as GtkSource.StyleScheme;
				return ret;
			}
			set  {
				gtk_source_buffer_set_style_scheme(Handle, value == null ? IntPtr.Zero : value.Handle);
			}
		}

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

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

		[GLib.Property ("undo-manager")]
		public GtkSource.IUndoManager UndoManager {
			get  {
				IntPtr raw_ret = gtk_source_buffer_get_undo_manager(Handle);
				GtkSource.IUndoManager ret = GtkSource.UndoManagerAdapter.GetObject (raw_ret, false);
				return ret;
			}
			set  {
				gtk_source_buffer_set_undo_manager(Handle, value == null ? IntPtr.Zero : ((value is GLib.Object) ? (value as GLib.Object).Handle : (value as GtkSource.UndoManagerAdapter).Handle));
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_buffer_set_implicit_trailing_newline(IntPtr raw, bool implicit_trailing_newline);
		static d_gtk_source_buffer_set_implicit_trailing_newline gtk_source_buffer_set_implicit_trailing_newline = FuncLoader.LoadFunction<d_gtk_source_buffer_set_implicit_trailing_newline>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_set_implicit_trailing_newline"));

		[GLib.Property ("implicit-trailing-newline")]
		public bool ImplicitTrailingNewline {
			get  {
				bool raw_ret = gtk_source_buffer_get_implicit_trailing_newline(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gtk_source_buffer_set_implicit_trailing_newline(Handle, value);
			}
		}

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

		[GLib.Signal("bracket-matched")]
		public event GtkSource.BracketMatchedHandler BracketMatched {
			add {
				this.AddSignalHandler ("bracket-matched", value, typeof (GtkSource.BracketMatchedArgs));
			}
			remove {
				this.RemoveSignalHandler ("bracket-matched", value);
			}
		}

		[GLib.Signal("source-mark-updated")]
		public event GtkSource.SourceMarkUpdatedHandler SourceMarkUpdated {
			add {
				this.AddSignalHandler ("source-mark-updated", value, typeof (GtkSource.SourceMarkUpdatedArgs));
			}
			remove {
				this.RemoveSignalHandler ("source-mark-updated", value);
			}
		}

		[GLib.Signal("highlight-updated")]
		public event GtkSource.HighlightUpdatedHandler HighlightUpdated {
			add {
				this.AddSignalHandler ("highlight-updated", value, typeof (GtkSource.HighlightUpdatedArgs));
			}
			remove {
				this.RemoveSignalHandler ("highlight-updated", value);
			}
		}

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

		static HighlightUpdatedNativeDelegate HighlightUpdated_cb_delegate;
		static HighlightUpdatedNativeDelegate HighlightUpdatedVMCallback {
			get {
				if (HighlightUpdated_cb_delegate == null)
					HighlightUpdated_cb_delegate = new HighlightUpdatedNativeDelegate (HighlightUpdated_cb);
				return HighlightUpdated_cb_delegate;
			}
		}

		static void OverrideHighlightUpdated (GLib.GType gtype)
		{
			OverrideHighlightUpdated (gtype, HighlightUpdatedVMCallback);
		}

		static void OverrideHighlightUpdated (GLib.GType gtype, HighlightUpdatedNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "highlight-updated", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void HighlightUpdatedNativeDelegate (IntPtr inst, IntPtr p0, IntPtr p1);

		static void HighlightUpdated_cb (IntPtr inst, IntPtr p0, IntPtr p1)
		{
			try {
				Buffer __obj = GLib.Object.GetObject (inst, false) as Buffer;
				__obj.OnHighlightUpdated (Gtk.TextIter.New (p0), Gtk.TextIter.New (p1));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GtkSource.Buffer), ConnectionMethod="OverrideHighlightUpdated")]
		protected virtual void OnHighlightUpdated (Gtk.TextIter p0, Gtk.TextIter p1)
		{
			InternalHighlightUpdated (p0, p1);
		}

		private void InternalHighlightUpdated (Gtk.TextIter p0, Gtk.TextIter p1)
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (3);
			GLib.Value[] vals = new GLib.Value [3];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (p0);
			inst_and_params.Append (vals [1]);
			vals [2] = new GLib.Value (p1);
			inst_and_params.Append (vals [2]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}

		static SourceMarkUpdatedNativeDelegate SourceMarkUpdated_cb_delegate;
		static SourceMarkUpdatedNativeDelegate SourceMarkUpdatedVMCallback {
			get {
				if (SourceMarkUpdated_cb_delegate == null)
					SourceMarkUpdated_cb_delegate = new SourceMarkUpdatedNativeDelegate (SourceMarkUpdated_cb);
				return SourceMarkUpdated_cb_delegate;
			}
		}

		static void OverrideSourceMarkUpdated (GLib.GType gtype)
		{
			OverrideSourceMarkUpdated (gtype, SourceMarkUpdatedVMCallback);
		}

		static void OverrideSourceMarkUpdated (GLib.GType gtype, SourceMarkUpdatedNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "source-mark-updated", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SourceMarkUpdatedNativeDelegate (IntPtr inst, IntPtr p0);

		static void SourceMarkUpdated_cb (IntPtr inst, IntPtr p0)
		{
			try {
				Buffer __obj = GLib.Object.GetObject (inst, false) as Buffer;
				__obj.OnSourceMarkUpdated (GLib.Object.GetObject(p0) as Gtk.TextMark);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GtkSource.Buffer), ConnectionMethod="OverrideSourceMarkUpdated")]
		protected virtual void OnSourceMarkUpdated (Gtk.TextMark p0)
		{
			InternalSourceMarkUpdated (p0);
		}

		private void InternalSourceMarkUpdated (Gtk.TextMark p0)
		{
			GLib.Value ret = GLib.Value.Empty;
			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 ();
		}

		static UndoFiredNativeDelegate UndoFired_cb_delegate;
		static UndoFiredNativeDelegate UndoFiredVMCallback {
			get {
				if (UndoFired_cb_delegate == null)
					UndoFired_cb_delegate = new UndoFiredNativeDelegate (UndoFired_cb);
				return UndoFired_cb_delegate;
			}
		}

		static void OverrideUndoFired (GLib.GType gtype)
		{
			OverrideUndoFired (gtype, UndoFiredVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(GtkSource.Buffer), ConnectionMethod="OverrideUndoFired")]
		protected virtual void OnUndoFired ()
		{
			InternalUndoFired ();
		}

		private void InternalUndoFired ()
		{
			UndoFiredNativeDelegate unmanaged = class_abi.BaseOverride<UndoFiredNativeDelegate>(this.LookupGType(), "undo");
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}

		static RedoFiredNativeDelegate RedoFired_cb_delegate;
		static RedoFiredNativeDelegate RedoFiredVMCallback {
			get {
				if (RedoFired_cb_delegate == null)
					RedoFired_cb_delegate = new RedoFiredNativeDelegate (RedoFired_cb);
				return RedoFired_cb_delegate;
			}
		}

		static void OverrideRedoFired (GLib.GType gtype)
		{
			OverrideRedoFired (gtype, RedoFiredVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(GtkSource.Buffer), ConnectionMethod="OverrideRedoFired")]
		protected virtual void OnRedoFired ()
		{
			InternalRedoFired ();
		}

		private void InternalRedoFired ()
		{
			RedoFiredNativeDelegate unmanaged = class_abi.BaseOverride<RedoFiredNativeDelegate>(this.LookupGType(), "redo");
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}

		static BracketMatchedNativeDelegate BracketMatched_cb_delegate;
		static BracketMatchedNativeDelegate BracketMatchedVMCallback {
			get {
				if (BracketMatched_cb_delegate == null)
					BracketMatched_cb_delegate = new BracketMatchedNativeDelegate (BracketMatched_cb);
				return BracketMatched_cb_delegate;
			}
		}

		static void OverrideBracketMatched (GLib.GType gtype)
		{
			OverrideBracketMatched (gtype, BracketMatchedVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void BracketMatchedNativeDelegate (IntPtr inst, IntPtr iter, int state);

		static void BracketMatched_cb (IntPtr inst, IntPtr iter, int state)
		{
			try {
				Buffer __obj = GLib.Object.GetObject (inst, false) as Buffer;
				__obj.OnBracketMatched (Gtk.TextIter.New (iter), (GtkSource.BracketMatchType) state);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GtkSource.Buffer), ConnectionMethod="OverrideBracketMatched")]
		protected virtual void OnBracketMatched (Gtk.TextIter iter, GtkSource.BracketMatchType state)
		{
			InternalBracketMatched (iter, state);
		}

		private void InternalBracketMatched (Gtk.TextIter iter, GtkSource.BracketMatchType state)
		{
			BracketMatchedNativeDelegate unmanaged = class_abi.BaseOverride<BracketMatchedNativeDelegate>(this.LookupGType(), "bracket_matched");
			if (unmanaged == null) return;

			IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
			unmanaged (this.Handle, native_iter, (int) state);
			Marshal.FreeHGlobal (native_iter);
		}


		// 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("undo"
							, Gtk.TextBuffer.class_abi.Fields
							, (uint) sizeof( IntPtr ) // undo
							, null
							, "redo"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("redo"
							, -1
							, (uint) sizeof( IntPtr ) // redo
							, "undo"
							, "bracket_matched"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("bracket_matched"
							, -1
							, (uint) sizeof( IntPtr ) // bracket_matched
							, "redo"
							, "padding"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("padding"
							, -1
							, (uint) sizeof( IntPtr ) * 20 // padding
							, "bracket_matched"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_source_buffer_backward_iter_to_source_mark(IntPtr raw, IntPtr iter, IntPtr category);
		static d_gtk_source_buffer_backward_iter_to_source_mark gtk_source_buffer_backward_iter_to_source_mark = FuncLoader.LoadFunction<d_gtk_source_buffer_backward_iter_to_source_mark>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_backward_iter_to_source_mark"));

		public bool BackwardIterToSourceMark(Gtk.TextIter iter, string category) {
			IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
			IntPtr native_category = GLib.Marshaller.StringToPtrGStrdup (category);
			bool raw_ret = gtk_source_buffer_backward_iter_to_source_mark(Handle, native_iter, native_category);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_iter);
			GLib.Marshaller.Free (native_category);
			return ret;
		}

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

		public void BeginNotUndoableAction() {
			gtk_source_buffer_begin_not_undoable_action(Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_buffer_change_case(IntPtr raw, int case_type, IntPtr start, IntPtr end);
		static d_gtk_source_buffer_change_case gtk_source_buffer_change_case = FuncLoader.LoadFunction<d_gtk_source_buffer_change_case>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_change_case"));

		public void ChangeCase(GtkSource.ChangeCaseType case_type, Gtk.TextIter start, Gtk.TextIter end) {
			IntPtr native_start = GLib.Marshaller.StructureToPtrAlloc (start);
			IntPtr native_end = GLib.Marshaller.StructureToPtrAlloc (end);
			gtk_source_buffer_change_case(Handle, (int) case_type, native_start, native_end);
			Marshal.FreeHGlobal (native_start);
			Marshal.FreeHGlobal (native_end);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_source_buffer_create_source_mark(IntPtr raw, IntPtr name, IntPtr category, IntPtr wh3r3);
		static d_gtk_source_buffer_create_source_mark gtk_source_buffer_create_source_mark = FuncLoader.LoadFunction<d_gtk_source_buffer_create_source_mark>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_create_source_mark"));

		public GtkSource.Mark CreateSourceMark(string name, string category, Gtk.TextIter wh3r3) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			IntPtr native_category = GLib.Marshaller.StringToPtrGStrdup (category);
			IntPtr native_wh3r3 = GLib.Marshaller.StructureToPtrAlloc (wh3r3);
			IntPtr raw_ret = gtk_source_buffer_create_source_mark(Handle, native_name, native_category, native_wh3r3);
			GtkSource.Mark ret = GLib.Object.GetObject(raw_ret) as GtkSource.Mark;
			GLib.Marshaller.Free (native_name);
			GLib.Marshaller.Free (native_category);
			Marshal.FreeHGlobal (native_wh3r3);
			return ret;
		}

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

		public void EndNotUndoableAction() {
			gtk_source_buffer_end_not_undoable_action(Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_buffer_ensure_highlight(IntPtr raw, IntPtr start, IntPtr end);
		static d_gtk_source_buffer_ensure_highlight gtk_source_buffer_ensure_highlight = FuncLoader.LoadFunction<d_gtk_source_buffer_ensure_highlight>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_ensure_highlight"));

		public void EnsureHighlight(Gtk.TextIter start, Gtk.TextIter end) {
			IntPtr native_start = GLib.Marshaller.StructureToPtrAlloc (start);
			IntPtr native_end = GLib.Marshaller.StructureToPtrAlloc (end);
			gtk_source_buffer_ensure_highlight(Handle, native_start, native_end);
			Marshal.FreeHGlobal (native_start);
			Marshal.FreeHGlobal (native_end);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_source_buffer_forward_iter_to_source_mark(IntPtr raw, IntPtr iter, IntPtr category);
		static d_gtk_source_buffer_forward_iter_to_source_mark gtk_source_buffer_forward_iter_to_source_mark = FuncLoader.LoadFunction<d_gtk_source_buffer_forward_iter_to_source_mark>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_forward_iter_to_source_mark"));

		public bool ForwardIterToSourceMark(Gtk.TextIter iter, string category) {
			IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
			IntPtr native_category = GLib.Marshaller.StringToPtrGStrdup (category);
			bool raw_ret = gtk_source_buffer_forward_iter_to_source_mark(Handle, native_iter, native_category);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_iter);
			GLib.Marshaller.Free (native_category);
			return ret;
		}

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

		public string GetContextClassesAtIter(Gtk.TextIter iter) {
			IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
			IntPtr raw_ret = gtk_source_buffer_get_context_classes_at_iter(Handle, native_iter);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			Marshal.FreeHGlobal (native_iter);
			return ret;
		}

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

		public GtkSource.Mark[] GetSourceMarksAtIter(Gtk.TextIter iter, string category) {
			IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
			IntPtr native_category = GLib.Marshaller.StringToPtrGStrdup (category);
			IntPtr raw_ret = gtk_source_buffer_get_source_marks_at_iter(Handle, native_iter, native_category);
			GtkSource.Mark[] ret = GLib.Marshaller.SListPtrToArray<GtkSource.Mark, GtkSource.Mark> (raw_ret, true, false);
			Marshal.FreeHGlobal (native_iter);
			GLib.Marshaller.Free (native_category);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_source_buffer_get_source_marks_at_line(IntPtr raw, int line, IntPtr category);
		static d_gtk_source_buffer_get_source_marks_at_line gtk_source_buffer_get_source_marks_at_line = FuncLoader.LoadFunction<d_gtk_source_buffer_get_source_marks_at_line>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_get_source_marks_at_line"));

		public GtkSource.Mark[] GetSourceMarksAtLine(int line, string category) {
			IntPtr native_category = GLib.Marshaller.StringToPtrGStrdup (category);
			IntPtr raw_ret = gtk_source_buffer_get_source_marks_at_line(Handle, line, native_category);
			GtkSource.Mark[] ret = GLib.Marshaller.SListPtrToArray<GtkSource.Mark, GtkSource.Mark> (raw_ret, true, false);
			GLib.Marshaller.Free (native_category);
			return ret;
		}

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_source_buffer_iter_backward_to_context_class_toggle(IntPtr raw, IntPtr iter, IntPtr context_class);
		static d_gtk_source_buffer_iter_backward_to_context_class_toggle gtk_source_buffer_iter_backward_to_context_class_toggle = FuncLoader.LoadFunction<d_gtk_source_buffer_iter_backward_to_context_class_toggle>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_iter_backward_to_context_class_toggle"));

		public bool IterBackwardToContextClassToggle(Gtk.TextIter iter, string context_class) {
			IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
			IntPtr native_context_class = GLib.Marshaller.StringToPtrGStrdup (context_class);
			bool raw_ret = gtk_source_buffer_iter_backward_to_context_class_toggle(Handle, native_iter, native_context_class);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_iter);
			GLib.Marshaller.Free (native_context_class);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_source_buffer_iter_forward_to_context_class_toggle(IntPtr raw, IntPtr iter, IntPtr context_class);
		static d_gtk_source_buffer_iter_forward_to_context_class_toggle gtk_source_buffer_iter_forward_to_context_class_toggle = FuncLoader.LoadFunction<d_gtk_source_buffer_iter_forward_to_context_class_toggle>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_iter_forward_to_context_class_toggle"));

		public bool IterForwardToContextClassToggle(Gtk.TextIter iter, string context_class) {
			IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
			IntPtr native_context_class = GLib.Marshaller.StringToPtrGStrdup (context_class);
			bool raw_ret = gtk_source_buffer_iter_forward_to_context_class_toggle(Handle, native_iter, native_context_class);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_iter);
			GLib.Marshaller.Free (native_context_class);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_source_buffer_iter_has_context_class(IntPtr raw, IntPtr iter, IntPtr context_class);
		static d_gtk_source_buffer_iter_has_context_class gtk_source_buffer_iter_has_context_class = FuncLoader.LoadFunction<d_gtk_source_buffer_iter_has_context_class>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_iter_has_context_class"));

		public bool IterHasContextClass(Gtk.TextIter iter, string context_class) {
			IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
			IntPtr native_context_class = GLib.Marshaller.StringToPtrGStrdup (context_class);
			bool raw_ret = gtk_source_buffer_iter_has_context_class(Handle, native_iter, native_context_class);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_iter);
			GLib.Marshaller.Free (native_context_class);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_buffer_join_lines(IntPtr raw, IntPtr start, IntPtr end);
		static d_gtk_source_buffer_join_lines gtk_source_buffer_join_lines = FuncLoader.LoadFunction<d_gtk_source_buffer_join_lines>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_join_lines"));

		public void JoinLines(Gtk.TextIter start, Gtk.TextIter end) {
			IntPtr native_start = GLib.Marshaller.StructureToPtrAlloc (start);
			IntPtr native_end = GLib.Marshaller.StructureToPtrAlloc (end);
			gtk_source_buffer_join_lines(Handle, native_start, native_end);
			Marshal.FreeHGlobal (native_start);
			Marshal.FreeHGlobal (native_end);
		}

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

		public void Redo() {
			gtk_source_buffer_redo(Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_buffer_remove_source_marks(IntPtr raw, IntPtr start, IntPtr end, IntPtr category);
		static d_gtk_source_buffer_remove_source_marks gtk_source_buffer_remove_source_marks = FuncLoader.LoadFunction<d_gtk_source_buffer_remove_source_marks>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_remove_source_marks"));

		public void RemoveSourceMarks(Gtk.TextIter start, Gtk.TextIter end, string category) {
			IntPtr native_start = GLib.Marshaller.StructureToPtrAlloc (start);
			IntPtr native_end = GLib.Marshaller.StructureToPtrAlloc (end);
			IntPtr native_category = GLib.Marshaller.StringToPtrGStrdup (category);
			gtk_source_buffer_remove_source_marks(Handle, native_start, native_end, native_category);
			Marshal.FreeHGlobal (native_start);
			Marshal.FreeHGlobal (native_end);
			GLib.Marshaller.Free (native_category);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_source_buffer_sort_lines(IntPtr raw, IntPtr start, IntPtr end, int flags, int column);
		static d_gtk_source_buffer_sort_lines gtk_source_buffer_sort_lines = FuncLoader.LoadFunction<d_gtk_source_buffer_sort_lines>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_buffer_sort_lines"));

		public void SortLines(Gtk.TextIter start, Gtk.TextIter end, GtkSource.SortFlags flags, int column) {
			IntPtr native_start = GLib.Marshaller.StructureToPtrAlloc (start);
			IntPtr native_end = GLib.Marshaller.StructureToPtrAlloc (end);
			gtk_source_buffer_sort_lines(Handle, native_start, native_end, (int) flags, column);
			Marshal.FreeHGlobal (native_start);
			Marshal.FreeHGlobal (native_end);
		}

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

		public void Undo() {
			gtk_source_buffer_undo(Handle);
		}


		static Buffer ()
		{
			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"
							, Gtk.TextBuffer.abi_info.Fields
							, (uint) sizeof( IntPtr ) // priv
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
