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

namespace GLib {

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

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_filename_completer_new();
		static d_g_filename_completer_new g_filename_completer_new = FuncLoader.LoadFunction<d_g_filename_completer_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_filename_completer_new"));

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

		[GLib.Signal("got-completion-data")]
		public event System.EventHandler GotCompletionData {
			add {
				this.AddSignalHandler ("got-completion-data", value);
			}
			remove {
				this.RemoveSignalHandler ("got-completion-data", value);
			}
		}

		static GotCompletionDataNativeDelegate GotCompletionData_cb_delegate;
		static GotCompletionDataNativeDelegate GotCompletionDataVMCallback {
			get {
				if (GotCompletionData_cb_delegate == null)
					GotCompletionData_cb_delegate = new GotCompletionDataNativeDelegate (GotCompletionData_cb);
				return GotCompletionData_cb_delegate;
			}
		}

		static void OverrideGotCompletionData (GLib.GType gtype)
		{
			OverrideGotCompletionData (gtype, GotCompletionDataVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(GLib.FilenameCompleter), ConnectionMethod="OverrideGotCompletionData")]
		protected virtual void OnGotCompletionData ()
		{
			InternalGotCompletionData ();
		}

		private void InternalGotCompletionData ()
		{
			GotCompletionDataNativeDelegate unmanaged = class_abi.BaseOverride<GotCompletionDataNativeDelegate>(this.LookupGType(), "got_completion_data");
			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("got_completion_data"
							, GLib.Object.class_abi.Fields
							, (uint) sizeof( IntPtr ) // got_completion_data
							, null
							, "_g_reserved1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved1"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved1
							, "got_completion_data"
							, "_g_reserved2"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved2"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved2
							, "_g_reserved1"
							, "_g_reserved3"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_g_reserved3"
							, -1
							, (uint) sizeof( IntPtr ) // _g_reserved3
							, "_g_reserved2"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_filename_completer_get_completion_suffix(IntPtr raw, IntPtr initial_text);
		static d_g_filename_completer_get_completion_suffix g_filename_completer_get_completion_suffix = FuncLoader.LoadFunction<d_g_filename_completer_get_completion_suffix>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_filename_completer_get_completion_suffix"));

		public string GetCompletionSuffix(string initial_text) {
			IntPtr native_initial_text = GLib.Marshaller.StringToPtrGStrdup (initial_text);
			IntPtr raw_ret = g_filename_completer_get_completion_suffix(Handle, native_initial_text);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			GLib.Marshaller.Free (native_initial_text);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_filename_completer_get_completions(IntPtr raw, IntPtr initial_text);
		static d_g_filename_completer_get_completions g_filename_completer_get_completions = FuncLoader.LoadFunction<d_g_filename_completer_get_completions>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_filename_completer_get_completions"));

		public string GetCompletions(string initial_text) {
			IntPtr native_initial_text = GLib.Marshaller.StringToPtrGStrdup (initial_text);
			IntPtr raw_ret = g_filename_completer_get_completions(Handle, native_initial_text);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			GLib.Marshaller.Free (native_initial_text);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_filename_completer_get_type();
		static d_g_filename_completer_get_type g_filename_completer_get_type = FuncLoader.LoadFunction<d_g_filename_completer_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_filename_completer_get_type"));

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_filename_completer_set_dirs_only(IntPtr raw, bool dirs_only);
		static d_g_filename_completer_set_dirs_only g_filename_completer_set_dirs_only = FuncLoader.LoadFunction<d_g_filename_completer_set_dirs_only>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_filename_completer_set_dirs_only"));

		public bool DirsOnly { 
			set {
				g_filename_completer_set_dirs_only(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 (GLib.Object.abi_info.Fields);

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
