File: Windows.Win32.IOleInPlaceObject.g.cs
Project: src\src\System.Windows.Forms.Primitives\src\System.Windows.Forms.Primitives.csproj (System.Windows.Forms.Primitives)
// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{
	namespace System.Ole
	{
		[Guid("00000113-0000-0000-C000-000000000046")]
		[SupportedOSPlatform("windows5.0")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IOleInPlaceObject
			:IVTable<IOleInPlaceObject,IOleInPlaceObject.Vtbl>,IComIID		{
			/// <inheritdoc cref="QueryInterface(global::System.Guid*, void**)"/>
			internal unsafe winmdroot.Foundation.HRESULT QueryInterface(in global::System.Guid riid, out void* ppvObject)
			{
				fixed (void** ppvObjectLocal = &ppvObject)
				{
					fixed (global::System.Guid* riidLocal = &riid)
					{
						winmdroot.Foundation.HRESULT __result = this.QueryInterface(riidLocal, ppvObjectLocal);
						return __result;
					}
				}
			}

			public unsafe winmdroot.Foundation.HRESULT QueryInterface(global::System.Guid* riid, void** ppvObject)
			{
				return ((delegate *unmanaged [Stdcall]<IOleInPlaceObject*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IOleInPlaceObject*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

			public uint AddRef()
			{
				return ((delegate *unmanaged [Stdcall]<IOleInPlaceObject*,uint>)lpVtbl[1])((IOleInPlaceObject*)Unsafe.AsPointer(ref this));
			}

			public uint Release()
			{
				return ((delegate *unmanaged [Stdcall]<IOleInPlaceObject*,uint>)lpVtbl[2])((IOleInPlaceObject*)Unsafe.AsPointer(ref this));
			}

			/// <inheritdoc cref="GetWindow(winmdroot.Foundation.HWND*)"/>
			internal unsafe winmdroot.Foundation.HRESULT GetWindow(out winmdroot.Foundation.HWND phwnd)
			{
				fixed (winmdroot.Foundation.HWND* phwndLocal = &phwnd)
				{
					winmdroot.Foundation.HRESULT __result = this.GetWindow(phwndLocal);
					return __result;
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT GetWindow(IOleInPlaceObject* pThis, winmdroot.Foundation.HWND* phwnd)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.GetWindow(phwnd);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			public unsafe winmdroot.Foundation.HRESULT GetWindow(winmdroot.Foundation.HWND* phwnd)
			{
				return ((delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.HWND* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IOleInPlaceObject*)Unsafe.AsPointer(ref this), phwnd);
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT ContextSensitiveHelp(IOleInPlaceObject* pThis, winmdroot.Foundation.BOOL fEnterMode)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.ContextSensitiveHelp(fEnterMode);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			public void ContextSensitiveHelp(winmdroot.Foundation.BOOL fEnterMode)
			{
				((delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.BOOL ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IOleInPlaceObject*)Unsafe.AsPointer(ref this), fEnterMode).ThrowOnFailure();
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT InPlaceDeactivate(IOleInPlaceObject* pThis)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.InPlaceDeactivate();
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Deactivates an active in-place object and discards the object's undo state.</summary>
			/// <returns>
			/// <para>This method returns S_OK on success. Other possible return values include the following. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para><h3><a id="Notes_to_Callers"></a><a id="notes_to_callers"></a><a id="NOTES_TO_CALLERS"></a>Notes to Callers</h3> This method is called by an active object's immediate container to deactivate the active object and discard its undo state.</para>
			/// <para><h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> On return from <b>IOleInPlaceObject::InPlaceDeactivate</b>, the object discards its undo state. The object application should not shut down immediately after this call. Instead, it should wait for an explicit call to <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleobject-close">IOleObject::Close</a> or for the object's reference count to reach zero. Before deactivating, the object application should give the container a chance to put its user interface back on the frame window by calling <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleinplacesite-onuideactivate">IOleInPlaceSite::OnUIDeactivate</a>. If the in-place user interface is still visible during the call to <b>IOleInPlaceObject::InPlaceDeactivate</b>, the object application should call its own <b>IOleInPlaceObject::InPlaceDeactivate</b> method to hide the user interface. The in-place user interface can be optionally destroyed during calls to <b>IOleInPlaceObject::InPlaceDeactivate</b> and <b>IOleInPlaceObject::InPlaceDeactivate</b>. But if the user interface has not already been destroyed when the container calls <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleobject-close">IOleObject::Close</a>, then it must be destroyed during the call to <b>IOleObject::Close</b>. During the call to <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleobject-close">IOleObject::Close</a>, the object should check to see whether it is still active in place. If so, it should call <b>IOleInPlaceObject::InPlaceDeactivate</b>.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/oleidl/nf-oleidl-ioleinplaceobject-inplacedeactivate#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public winmdroot.Foundation.HRESULT InPlaceDeactivate()
			{
				return ((delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.HRESULT>)lpVtbl[5])((IOleInPlaceObject*)Unsafe.AsPointer(ref this));
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT UIDeactivate(IOleInPlaceObject* pThis)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.UIDeactivate();
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Deactivates and removes the user interface of an active in-place object.</summary>
			/// <returns>
			/// <para>This method returns S_OK on success. Other possible return values include the following. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para><h3><a id="Notes_to_Callers"></a><a id="notes_to_callers"></a><a id="NOTES_TO_CALLERS"></a>Notes to Callers</h3> This method is called by the object's immediate container when, for example, the user has clicked in the client area outside the object. If the container has called <b>IOleInPlaceObject::UIDeactivate</b>, it should later call <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleinplaceobject-inplacedeactivate">IOleInPlaceObject::InPlaceDeactivate</a> to properly clean up resources. The container can assume that stopping or releasing the object cleans up resources if necessary. The object must be prepared to do so if <b>IOleInPlaceObject::InPlaceDeactivate</b> has not been called. but either <b>IOleInPlaceObject::UIDeactivate</b> or <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleobject-close">IOleObject::Close</a> has been called. <h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> Resources such as menus and windows can be either cleaned up or kept in a hidden state until your object is completely deactivated by calls to either <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleinplaceobject-inplacedeactivate">IOleInPlaceObject::InPlaceDeactivate</a> or <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleobject-close">IOleObject::Close</a>. The object application must call <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleinplacesite-onuideactivate">IOleInPlaceSite::OnUIDeactivate</a> before doing anything with the composite menus so that the container can first be detached from the frame window. On deactivating the in-place object's user interface, the object is left in a ready state so it can be quickly reactivated. The object stays in this state until the undo state of the document changes. The container should then call <b>IOleInPlaceObject::InPlaceDeactivate</b> to tell the object to discard its undo state.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/oleidl/nf-oleidl-ioleinplaceobject-uideactivate#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public winmdroot.Foundation.HRESULT UIDeactivate()
			{
				return ((delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.HRESULT>)lpVtbl[6])((IOleInPlaceObject*)Unsafe.AsPointer(ref this));
			}

			/// <inheritdoc cref="SetObjectRects(winmdroot.Foundation.RECT*, winmdroot.Foundation.RECT*)"/>
			internal unsafe winmdroot.Foundation.HRESULT SetObjectRects(in winmdroot.Foundation.RECT lprcPosRect, in winmdroot.Foundation.RECT lprcClipRect)
			{
				fixed (winmdroot.Foundation.RECT* lprcClipRectLocal = &lprcClipRect)
				{
					fixed (winmdroot.Foundation.RECT* lprcPosRectLocal = &lprcPosRect)
					{
						winmdroot.Foundation.HRESULT __result = this.SetObjectRects(lprcPosRectLocal, lprcClipRectLocal);
						return __result;
					}
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT SetObjectRects(IOleInPlaceObject* pThis, winmdroot.Foundation.RECT* lprcPosRect, winmdroot.Foundation.RECT* lprcClipRect)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.SetObjectRects(lprcPosRect, lprcClipRect);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Specifies how much of the in-place object is to be visible.</summary>
			/// <param name="lprcPosRect">A pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/windef/ns-windef-rect">RECT</a> structure containing the position of the in-place object using the client coordinates of its parent window.</param>
			/// <param name="lprcClipRect">A pointer to the outer rectangle containing the in-place object's position rectangle (<i>lprcPosRect</i>). This rectangle is relative to the client area of the object's parent window.</param>
			/// <returns>
			/// <para>This method returns S_OK on success. Other possible return values include the following. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para>It is possible for <i>lprcClipRect</i> to change without <i>lprcPosRect</i> changing. The size of an in-place object's rectangle is always calculated in pixels. This is different from other OLE object's visualizations, which are in <b>HIMETRIC</b>. <div class="alert"><b>Note</b>  While executing <b>IOleInPlaceObject::SetObjectRects</b>, do not make calls to the <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-peekmessagea">PeekMessage</a> or <a href="https://docs.microsoft.com/previous-versions/windows/desktop/fax/-mfax-faxaccountincomingarchive-getmessage-vb">GetMessage</a> functions, or a dialog box. Doing so may cause the system to deadlock. There are further restrictions on which OLE interface methods and functions can be called from within <b>IOleInPlaceObject::SetObjectRects</b>.</div> <div> </div> <h3><a id="Notes_to_Callers"></a><a id="notes_to_callers"></a><a id="NOTES_TO_CALLERS"></a>Notes to Callers</h3> The container should call <b>IOleInPlaceObject::SetObjectRects</b> whenever the window position of the in-place object and/or the visible part of the in-place object changes. <h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> The object must size its in-place window to match the intersection of <i>lprcPosRect</i> and <i>lprcClipRect</i>. The object must also draw its contents into the object's in-place window so that proper clipping takes place. The object should compare its width and height with those provided by its container (conveyed through <i>lprcPosRect</i>). If the comparison does not result in a match, the container is applying scaling to the object. The object must then decide whether it should continue the in-place editing in the scale/zoom mode or deactivate.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/oleidl/nf-oleidl-ioleinplaceobject-setobjectrects#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT SetObjectRects(winmdroot.Foundation.RECT* lprcPosRect, winmdroot.Foundation.RECT* lprcClipRect)
			{
				return ((delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.RECT* ,winmdroot.Foundation.RECT* ,winmdroot.Foundation.HRESULT>)lpVtbl[7])((IOleInPlaceObject*)Unsafe.AsPointer(ref this), lprcPosRect, lprcClipRect);
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT ReactivateAndUndo(IOleInPlaceObject* pThis)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.ReactivateAndUndo();
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Reactivates a previously deactivated object, undoing the last state of the object.</summary>
			/// <returns>
			/// <para>This method returns S_OK on success. Other possible return values include the following. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>If the user chooses the <b>Undo</b> command before the undo state of the object is lost, the object's immediate container calls <b>IOleInPlaceObject::ReactivateAndUndo</b> to activate the user interface, carry out the undo operation, and return the object to the active state.</remarks>
			public void ReactivateAndUndo()
			{
				((delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.HRESULT>)lpVtbl[8])((IOleInPlaceObject*)Unsafe.AsPointer(ref this)).ThrowOnFailure();
			}

			internal unsafe global::Windows.Win32.Foundation.HRESULT QueryInterface<T>(out T* ppv)
where T : unmanaged

			{
				var hr = this.QueryInterface(typeof(T).GUID, out void* pv);
				if (hr.Succeeded)

				{
					ppv = (T*)pv;
				}
				else

				{
					ppv = null;
				}

				return hr;
			}

			internal struct Vtbl
			{
				internal delegate *unmanaged [Stdcall]<IOleInPlaceObject*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;

				internal delegate *unmanaged [Stdcall]<IOleInPlaceObject*,uint> AddRef_2;

				internal delegate *unmanaged [Stdcall]<IOleInPlaceObject*,uint> Release_3;

				internal delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.HWND* ,winmdroot.Foundation.HRESULT> GetWindow_4;

				internal delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.BOOL ,winmdroot.Foundation.HRESULT> ContextSensitiveHelp_5;

				internal delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.HRESULT> InPlaceDeactivate_6;

				internal delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.HRESULT> UIDeactivate_7;

				internal delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.RECT* ,winmdroot.Foundation.RECT* ,winmdroot.Foundation.HRESULT> SetObjectRects_8;

				internal delegate *unmanaged [Stdcall]<IOleInPlaceObject*,winmdroot.Foundation.HRESULT> ReactivateAndUndo_9;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->GetWindow_4 = &GetWindow;
				vtable->ContextSensitiveHelp_5 = &ContextSensitiveHelp;
				vtable->InPlaceDeactivate_6 = &InPlaceDeactivate;
				vtable->UIDeactivate_7 = &UIDeactivate;
				vtable->SetObjectRects_8 = &SetObjectRects;
				vtable->ReactivateAndUndo_9 = &ReactivateAndUndo;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{00000113-0000-0000-c000-000000000046}</value>
			internal static readonly Guid IID_Guid = new Guid(0x00000113, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0x13,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("00000113-0000-0000-C000-000000000046"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			[SupportedOSPlatform("windows5.0")]
			internal interface Interface
				:winmdroot.System.Ole.IOleWindow.Interface			{
				[PreserveSig()]
				unsafe new winmdroot.Foundation.HRESULT GetWindow(winmdroot.Foundation.HWND* phwnd);

				[PreserveSig()]
				new winmdroot.Foundation.HRESULT ContextSensitiveHelp(winmdroot.Foundation.BOOL fEnterMode);

								[PreserveSig()]
winmdroot.Foundation.HRESULT InPlaceDeactivate();

								[PreserveSig()]
winmdroot.Foundation.HRESULT UIDeactivate();

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT SetObjectRects(winmdroot.Foundation.RECT* lprcPosRect, winmdroot.Foundation.RECT* lprcClipRect);

								[PreserveSig()]
winmdroot.Foundation.HRESULT ReactivateAndUndo();
			}
		}
	}
}