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

namespace Gtk {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class ToolShellAdapter : GLib.GInterfaceAdapter, Gtk.IToolShell {

		[StructLayout (LayoutKind.Sequential)]
		struct GtkToolShellIface {
			public GetIconSizeNativeDelegate GetIconSize;
			public GetOrientationNativeDelegate GetOrientation;
			public GetStyleNativeDelegate GetStyle;
			public GetReliefStyleNativeDelegate GetReliefStyle;
			public RebuildMenuNativeDelegate RebuildMenu;
			public GetTextOrientationNativeDelegate GetTextOrientation;
			public GetTextAlignmentNativeDelegate GetTextAlignment;
			public GetEllipsizeModeNativeDelegate GetEllipsizeMode;
			public GetTextSizeGroupNativeDelegate GetTextSizeGroup;
		}

		static GtkToolShellIface iface;

		static ToolShellAdapter ()
		{
			GLib.GType.Register (_gtype, typeof (ToolShellAdapter));
			iface.GetIconSize = new GetIconSizeNativeDelegate (GetIconSize_cb);
			iface.GetOrientation = new GetOrientationNativeDelegate (GetOrientation_cb);
			iface.GetStyle = new GetStyleNativeDelegate (GetStyle_cb);
			iface.GetReliefStyle = new GetReliefStyleNativeDelegate (GetReliefStyle_cb);
			iface.RebuildMenu = new RebuildMenuNativeDelegate (RebuildMenu_cb);
			iface.GetTextOrientation = new GetTextOrientationNativeDelegate (GetTextOrientation_cb);
			iface.GetTextAlignment = new GetTextAlignmentNativeDelegate (GetTextAlignment_cb);
			iface.GetEllipsizeMode = new GetEllipsizeModeNativeDelegate (GetEllipsizeMode_cb);
			iface.GetTextSizeGroup = new GetTextSizeGroupNativeDelegate (GetTextSizeGroup_cb);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetIconSizeNativeDelegate (IntPtr inst);

		static int GetIconSize_cb (IntPtr inst)
		{
			try {
				IToolShellImplementor __obj = GLib.Object.GetObject (inst, false) as IToolShellImplementor;
				Gtk.IconSize __result;
				__result = __obj.IconSize;
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetOrientationNativeDelegate (IntPtr inst);

		static int GetOrientation_cb (IntPtr inst)
		{
			try {
				IToolShellImplementor __obj = GLib.Object.GetObject (inst, false) as IToolShellImplementor;
				Gtk.Orientation __result;
				__result = __obj.Orientation;
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetStyleNativeDelegate (IntPtr inst);

		static int GetStyle_cb (IntPtr inst)
		{
			try {
				IToolShellImplementor __obj = GLib.Object.GetObject (inst, false) as IToolShellImplementor;
				Gtk.ToolbarStyle __result;
				__result = __obj.Style;
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetReliefStyleNativeDelegate (IntPtr inst);

		static int GetReliefStyle_cb (IntPtr inst)
		{
			try {
				IToolShellImplementor __obj = GLib.Object.GetObject (inst, false) as IToolShellImplementor;
				Gtk.ReliefStyle __result;
				__result = __obj.ReliefStyle;
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetTextOrientationNativeDelegate (IntPtr inst);

		static int GetTextOrientation_cb (IntPtr inst)
		{
			try {
				IToolShellImplementor __obj = GLib.Object.GetObject (inst, false) as IToolShellImplementor;
				Gtk.Orientation __result;
				__result = __obj.TextOrientation;
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate float GetTextAlignmentNativeDelegate (IntPtr inst);

		static float GetTextAlignment_cb (IntPtr inst)
		{
			try {
				IToolShellImplementor __obj = GLib.Object.GetObject (inst, false) as IToolShellImplementor;
				float __result;
				__result = __obj.TextAlignment;
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetEllipsizeModeNativeDelegate (IntPtr inst);

		static int GetEllipsizeMode_cb (IntPtr inst)
		{
			try {
				IToolShellImplementor __obj = GLib.Object.GetObject (inst, false) as IToolShellImplementor;
				Pango.EllipsizeMode __result;
				__result = __obj.EllipsizeMode;
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

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

		static IntPtr GetTextSizeGroup_cb (IntPtr inst)
		{
			try {
				IToolShellImplementor __obj = GLib.Object.GetObject (inst, false) as IToolShellImplementor;
				Gtk.SizeGroup __result;
				__result = __obj.TextSizeGroup;
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		static int class_offset = 2 * IntPtr.Size;

		static void Initialize (IntPtr ptr, IntPtr data)
		{
			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
			GtkToolShellIface native_iface = (GtkToolShellIface) Marshal.PtrToStructure (ifaceptr, typeof (GtkToolShellIface));
			native_iface.GetIconSize = iface.GetIconSize;
			native_iface.GetOrientation = iface.GetOrientation;
			native_iface.GetStyle = iface.GetStyle;
			native_iface.GetReliefStyle = iface.GetReliefStyle;
			native_iface.RebuildMenu = iface.RebuildMenu;
			native_iface.GetTextOrientation = iface.GetTextOrientation;
			native_iface.GetTextAlignment = iface.GetTextAlignment;
			native_iface.GetEllipsizeMode = iface.GetEllipsizeMode;
			native_iface.GetTextSizeGroup = iface.GetTextSizeGroup;
			Marshal.StructureToPtr (native_iface, ifaceptr, false);
		}

		GLib.Object implementor;

		public ToolShellAdapter ()
		{
			InitHandler = new GLib.GInterfaceInitHandler (Initialize);
		}

		public ToolShellAdapter (IToolShellImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}

		public ToolShellAdapter (IntPtr handle)
		{
			if (!_gtype.IsInstance (handle))
				throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
			implementor = GLib.Object.GetObject (handle);
		}

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

		private static GLib.GType _gtype = new GLib.GType (gtk_tool_shell_get_type ());

		public static GLib.GType GType {
			get {
				return _gtype;
			}
		}

		public override GLib.GType GInterfaceGType {
			get {
				return _gtype;
			}
		}

		public override IntPtr Handle {
			get {
				return implementor.Handle;
			}
		}

		public IntPtr OwnedHandle {
			get {
				return implementor.OwnedHandle;
			}
		}

		public static IToolShell GetObject (IntPtr handle, bool owned)
		{
			GLib.Object obj = GLib.Object.GetObject (handle, owned);
			return GetObject (obj);
		}

		public static IToolShell GetObject (GLib.Object obj)
		{
			if (obj == null)
				return null;
			else if (obj is IToolShellImplementor)
				return new ToolShellAdapter (obj as IToolShellImplementor);
			else if (obj as IToolShell == null)
				return new ToolShellAdapter (obj.Handle);
			else
				return obj as IToolShell;
		}

		public IToolShellImplementor Implementor {
			get {
				return implementor as IToolShellImplementor;
			}
		}

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

		public Pango.EllipsizeMode EllipsizeMode { 
			get {
				int raw_ret = gtk_tool_shell_get_ellipsize_mode(Handle);
				Pango.EllipsizeMode ret = (Pango.EllipsizeMode) raw_ret;
				return ret;
			}
		}

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

		public Gtk.IconSize IconSize { 
			get {
				int raw_ret = gtk_tool_shell_get_icon_size(Handle);
				Gtk.IconSize ret = (Gtk.IconSize) raw_ret;
				return ret;
			}
		}

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

		public Gtk.Orientation Orientation { 
			get {
				int raw_ret = gtk_tool_shell_get_orientation(Handle);
				Gtk.Orientation ret = (Gtk.Orientation) raw_ret;
				return ret;
			}
		}

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

		public Gtk.ReliefStyle ReliefStyle { 
			get {
				int raw_ret = gtk_tool_shell_get_relief_style(Handle);
				Gtk.ReliefStyle ret = (Gtk.ReliefStyle) raw_ret;
				return ret;
			}
		}

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

		public Gtk.ToolbarStyle Style { 
			get {
				int raw_ret = gtk_tool_shell_get_style(Handle);
				Gtk.ToolbarStyle ret = (Gtk.ToolbarStyle) raw_ret;
				return ret;
			}
		}

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

		public float TextAlignment { 
			get {
				float raw_ret = gtk_tool_shell_get_text_alignment(Handle);
				float ret = raw_ret;
				return ret;
			}
		}

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

		public Gtk.Orientation TextOrientation { 
			get {
				int raw_ret = gtk_tool_shell_get_text_orientation(Handle);
				Gtk.Orientation ret = (Gtk.Orientation) raw_ret;
				return ret;
			}
		}

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

		public Gtk.SizeGroup TextSizeGroup { 
			get {
				IntPtr raw_ret = gtk_tool_shell_get_text_size_group(Handle);
				Gtk.SizeGroup ret = GLib.Object.GetObject(raw_ret) as Gtk.SizeGroup;
				return ret;
			}
		}

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

		public void RebuildMenu() {
			gtk_tool_shell_rebuild_menu(Handle);
		}

#endregion
	}
}
