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

namespace Gdk {

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

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

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

		protected Monitor() : base(IntPtr.Zero)
		{
			CreateNativeObject (Array.Empty<string> (), Array.Empty<GLib.Value> ());
		}

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

		[GLib.Property ("display")]
		public Gdk.Display Display {
			get  {
				IntPtr raw_ret = gdk_monitor_get_display(Handle);
				Gdk.Display ret = GLib.Object.GetObject(raw_ret) as Gdk.Display;
				return ret;
			}
		}

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

		[GLib.Property ("manufacturer")]
		public string Manufacturer {
			get  {
				IntPtr raw_ret = gdk_monitor_get_manufacturer(Handle);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				return ret;
			}
		}

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

		[GLib.Property ("model")]
		public string Model {
			get  {
				IntPtr raw_ret = gdk_monitor_get_model(Handle);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				return ret;
			}
		}

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

		[GLib.Property ("scale-factor")]
		public int ScaleFactor {
			get  {
				int raw_ret = gdk_monitor_get_scale_factor(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gdk_monitor_get_geometry(IntPtr raw, IntPtr geometry);
		static d_gdk_monitor_get_geometry gdk_monitor_get_geometry = FuncLoader.LoadFunction<d_gdk_monitor_get_geometry>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_monitor_get_geometry"));

		[GLib.Property ("geometry")]
		public Gdk.Rectangle Geometry {
			get  {
				Gdk.Rectangle geometry;
				IntPtr native_geometry = Marshal.AllocHGlobal (Marshal.SizeOf<Gdk.Rectangle>());
				gdk_monitor_get_geometry(Handle, native_geometry);
				geometry = (Gdk.Rectangle) Marshal.PtrToStructure (native_geometry, typeof (Gdk.Rectangle));
				Marshal.FreeHGlobal (native_geometry);
				return geometry;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gdk_monitor_get_workarea(IntPtr raw, IntPtr workarea);
		static d_gdk_monitor_get_workarea gdk_monitor_get_workarea = FuncLoader.LoadFunction<d_gdk_monitor_get_workarea>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_monitor_get_workarea"));

		[GLib.Property ("workarea")]
		public Gdk.Rectangle Workarea {
			get  {
				Gdk.Rectangle workarea;
				IntPtr native_workarea = Marshal.AllocHGlobal (Marshal.SizeOf<Gdk.Rectangle>());
				gdk_monitor_get_workarea(Handle, native_workarea);
				workarea = (Gdk.Rectangle) Marshal.PtrToStructure (native_workarea, typeof (Gdk.Rectangle));
				Marshal.FreeHGlobal (native_workarea);
				return workarea;
			}
		}

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

		[GLib.Property ("width-mm")]
		public int WidthMm {
			get  {
				int raw_ret = gdk_monitor_get_width_mm(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

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

		[GLib.Property ("height-mm")]
		public int HeightMm {
			get  {
				int raw_ret = gdk_monitor_get_height_mm(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

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

		[GLib.Property ("refresh-rate")]
		public int RefreshRate {
			get  {
				int raw_ret = gdk_monitor_get_refresh_rate(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

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

		[GLib.Property ("subpixel-layout")]
		public Gdk.SubpixelLayout SubpixelLayout {
			get  {
				int raw_ret = gdk_monitor_get_subpixel_layout(Handle);
				Gdk.SubpixelLayout ret = (Gdk.SubpixelLayout) raw_ret;
				return ret;
			}
		}

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

		static InvalidateNativeDelegate Invalidate_cb_delegate;
		static InvalidateNativeDelegate InvalidateVMCallback {
			get {
				if (Invalidate_cb_delegate == null)
					Invalidate_cb_delegate = new InvalidateNativeDelegate (Invalidate_cb);
				return Invalidate_cb_delegate;
			}
		}

		static void OverrideInvalidate (GLib.GType gtype)
		{
			OverrideInvalidate (gtype, InvalidateVMCallback);
		}

		static void OverrideInvalidate (GLib.GType gtype, InvalidateNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "invalidate", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void InvalidateNativeDelegate (IntPtr inst);

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

		[GLib.DefaultSignalHandler(Type=typeof(Gdk.Monitor), ConnectionMethod="OverrideInvalidate")]
		protected virtual void OnInvalidate ()
		{
			InternalInvalidate ();
		}

		private void InternalInvalidate ()
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
			GLib.Value[] vals = new GLib.Value [1];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}

		static GetWorkareaNativeDelegate GetWorkarea_cb_delegate;
		static GetWorkareaNativeDelegate GetWorkareaVMCallback {
			get {
				if (GetWorkarea_cb_delegate == null)
					GetWorkarea_cb_delegate = new GetWorkareaNativeDelegate (GetWorkarea_cb);
				return GetWorkarea_cb_delegate;
			}
		}

		static void OverrideGetWorkarea (GLib.GType gtype)
		{
			OverrideGetWorkarea (gtype, GetWorkareaVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void GetWorkareaNativeDelegate (IntPtr inst, IntPtr geometry);

		static void GetWorkarea_cb (IntPtr inst, IntPtr geometry)
		{
			try {
				Monitor __obj = GLib.Object.GetObject (inst, false) as Monitor;
				__obj.OnGetWorkarea ((Gdk.Rectangle) Marshal.PtrToStructure (geometry, typeof (Gdk.Rectangle)));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gdk.Monitor), ConnectionMethod="OverrideGetWorkarea")]
		protected virtual void OnGetWorkarea (Gdk.Rectangle geometry)
		{
			InternalGetWorkarea (geometry);
		}

		private void InternalGetWorkarea (Gdk.Rectangle geometry)
		{
			GetWorkareaNativeDelegate unmanaged = class_abi.BaseOverride<GetWorkareaNativeDelegate>(this.LookupGType(), "get_workarea");
			if (unmanaged == null) return;

			IntPtr native_geometry = GLib.Marshaller.StructureToPtrAlloc (geometry);
			unmanaged (this.Handle, native_geometry);
			Marshal.FreeHGlobal (native_geometry);
		}


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

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gdk_monitor_get_type();
		static d_gdk_monitor_get_type gdk_monitor_get_type = FuncLoader.LoadFunction<d_gdk_monitor_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_monitor_get_type"));

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

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

		public bool IsPrimary { 
			get {
				bool raw_ret = gdk_monitor_is_primary(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}


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