File: Windows.Win32.IOleControlSite.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("B196B289-BAB4-101A-B69C-00AA00341D07")]
		[SupportedOSPlatform("windows5.0")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IOleControlSite
			:IVTable<IOleControlSite,IOleControlSite.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]<IOleControlSite*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IOleControlSite*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

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

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

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

			/// <summary>Informs the container that the control's CONTROLINFO structure has changed and that the container should call the control's IOleControl::GetControlInfo for an update.</summary>
			/// <returns>This method returns S_OK in all cases.</returns>
			/// <remarks>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/ocidl/nf-ocidl-iolecontrolsite-oncontrolinfochanged">Learn more about this API from docs.microsoft.com</see>.</para>
			/// </remarks>
			public winmdroot.Foundation.HRESULT OnControlInfoChanged()
			{
				return ((delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IOleControlSite*)Unsafe.AsPointer(ref this));
			}

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

			/// <summary>Indicates whether a control should remain in-place active. Calls to this method typically nest an event to ensure that the object's activation state remains stable throughout the processing of the event.</summary>
			/// <param name="fLock">Indicates whether to ensure the in-place active state (<b>TRUE</b>) or to allow activation to change (<b>FALSE</b>). When <b>TRUE</b>, a supporting container must not deactivate the in-place object until this method is called again with <b>FALSE</b>.</param>
			/// <returns>
			/// <para>This method can return the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>This method affects the control's in-place active state but not its UI-active state.</remarks>
			public winmdroot.Foundation.HRESULT LockInPlaceActive(winmdroot.Foundation.BOOL fLock)
			{
				return ((delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.Foundation.BOOL ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IOleControlSite*)Unsafe.AsPointer(ref this), fLock);
			}

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

			/// <summary>Retrieves an IDispatch pointer to the extended control that the container uses to wrap the real control.</summary>
			/// <param name="ppDisp">A pointer to an <b>IDispatch</b> pointer variable that receives the interface pointer to the extended control. If an error occurs, the implementation must set *<i>ppDisp</i> to <b>NULL</b>. On success, the caller is responsible for calling <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-release">Release</a> when *<i>ppDisp</i> is no longer needed.</param>
			/// <returns>
			/// <para>This method can return the standard return values E_OUTOFMEMORY and E_UNEXPECTED, as well as the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para>This method gives the real control access to whatever properties and methods the container maintains in the extended control. These properties and methods would otherwise be inaccessible to the control.</para>
			/// <para><h3><a id="Notes_to_Callers"></a><a id="notes_to_callers"></a><a id="NOTES_TO_CALLERS"></a>Notes to Callers</h3> The returned pointer is the responsibility of the caller, which must release it when it is no longer needed.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/ocidl/nf-ocidl-iolecontrolsite-getextendedcontrol#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT GetExtendedControl(winmdroot.System.Com.IDispatch** ppDisp)
			{
				return ((delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.System.Com.IDispatch** ,winmdroot.Foundation.HRESULT>)lpVtbl[5])((IOleControlSite*)Unsafe.AsPointer(ref this), ppDisp);
			}

			/// <inheritdoc cref="TransformCoords(winmdroot.Foundation.POINTL*, global::System.Drawing.PointF*, uint)"/>
			internal unsafe winmdroot.Foundation.HRESULT TransformCoords(ref winmdroot.Foundation.POINTL pPtlHimetric, ref global::System.Drawing.PointF pPtfContainer, uint dwFlags)
			{
				fixed (global::System.Drawing.PointF* pPtfContainerLocal = &pPtfContainer)
				{
					fixed (winmdroot.Foundation.POINTL* pPtlHimetricLocal = &pPtlHimetric)
					{
						winmdroot.Foundation.HRESULT __result = this.TransformCoords(pPtlHimetricLocal, pPtfContainerLocal, dwFlags);
						return __result;
					}
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT TransformCoords(IOleControlSite* pThis, winmdroot.Foundation.POINTL* pPtlHimetric, global::System.Drawing.PointF* pPtfContainer, uint dwFlags)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.TransformCoords(pPtlHimetric, pPtfContainer, dwFlags);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Converts coordinates expressed in HIMETRIC units (as is standard in OLE) to the units specified by the container.</summary>
			/// <param name="pPtlHimetric">Address of a <a href="https://docs.microsoft.com/windows/win32/api/windef/ns-windef-pointl">POINTL</a> structure containing coordinates expressed in <b>HIMETRIC</b> units. This is an [in] parameter when <i>dwFlags</i> contains XFORMCOORDS_HIMETRICTOCONTAINER; it is an [out] parameter with XFORMCOORDS_CONTAINERTOHIMETRIC. In the latter case, the contents are undefined on error.</param>
			/// <param name="pPtfContainer">Address of a caller-allocated <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/ns-ocidl-pointf">POINTF</a> structure that receives the converted coordinates. This is an [in] parameter when <i>dwFlags</i> contains XFORMCOORDS_CONTAINERTOHIMETRIC; it is an [out] parameter with XFORMCOORDS_HIMETRICTOCONTAINER. In the latter case, the contents are undefined on error.</param>
			/// <param name="dwFlags"></param>
			/// <returns>
			/// <para>This method can return the standard return values E_INVALIDARG and E_UNEXPECTED, as well as the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>A control uses this method when it has to send coordinates to a container within an event or some other custom call or when the control has container coordinates that it needs to convert into <b>HIMETRIC</b> units.</remarks>
			public unsafe winmdroot.Foundation.HRESULT TransformCoords(winmdroot.Foundation.POINTL* pPtlHimetric, global::System.Drawing.PointF* pPtfContainer, uint dwFlags)
			{
				return ((delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.Foundation.POINTL* ,global::System.Drawing.PointF* ,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((IOleControlSite*)Unsafe.AsPointer(ref this), pPtlHimetric, pPtfContainer, dwFlags);
			}

			/// <inheritdoc cref="TranslateAccelerator(winmdroot.UI.WindowsAndMessaging.MSG*, winmdroot.System.Ole.KEYMODIFIERS)"/>
			internal unsafe winmdroot.Foundation.HRESULT TranslateAccelerator(in winmdroot.UI.WindowsAndMessaging.MSG pMsg, winmdroot.System.Ole.KEYMODIFIERS grfModifiers)
			{
				fixed (winmdroot.UI.WindowsAndMessaging.MSG* pMsgLocal = &pMsg)
				{
					winmdroot.Foundation.HRESULT __result = this.TranslateAccelerator(pMsgLocal, grfModifiers);
					return __result;
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT TranslateAccelerator(IOleControlSite* pThis, winmdroot.UI.WindowsAndMessaging.MSG* pMsg, winmdroot.System.Ole.KEYMODIFIERS grfModifiers)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.TranslateAccelerator(pMsg, grfModifiers);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Passes a keystroke to the control site for processing.</summary>
			/// <param name="pMsg">A pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/winuser/ns-winuser-msg">MSG</a> structure describing the keystroke to be processed.</param>
			/// <param name="grfModifiers">Flags describing the state of the Control, Alt, and Shift keys. The value of the flag can be any valid <a href="https://docs.microsoft.com/previous-versions/windows/desktop/legacy/ms683763(v=vs.85)">KEYMODIFIERS</a> enumeration values.</param>
			/// <returns>
			/// <para>This method can return the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>This method is called by a control that can be UI-active. In such cases, a control can process all keystrokes first through <a href="https://docs.microsoft.com/windows/desktop/api/oleidl/nf-oleidl-ioleinplaceactiveobject-translateaccelerator">IOleInPlaceActiveObject::TranslateAccelerator</a>, according to normal OLE Compound Document rules. Inside that method, the control can give the container certain messages to process first by calling <b>IOleControlSite::TranslateAccelerator</b> and using the return value to determine if any processing took place. Otherwise, the control always processes the message first. If the control does not use the keystroke as an accelerator, it passes the keystroke to the container through this method.</remarks>
			public unsafe winmdroot.Foundation.HRESULT TranslateAccelerator(winmdroot.UI.WindowsAndMessaging.MSG* pMsg, winmdroot.System.Ole.KEYMODIFIERS grfModifiers)
			{
				return ((delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.UI.WindowsAndMessaging.MSG* ,winmdroot.System.Ole.KEYMODIFIERS ,winmdroot.Foundation.HRESULT>)lpVtbl[7])((IOleControlSite*)Unsafe.AsPointer(ref this), pMsg, grfModifiers);
			}

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

			/// <summary>Indicates whether the control managed by this control site has gained or lost the focus.</summary>
			/// <param name="fGotFocus">Indicates whether the control gained (TRUE) or lost the focus (FALSE).</param>
			/// <returns>This method returns S_OK in all cases.</returns>
			/// <remarks>The container uses this information to update the state of <b>Default</b> and <b>Cancel</b> buttons according to how the control with the focus processes Return or Esc keys. A control's behavior regarding the Return and Esc keys is specified in the control's <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/ns-ocidl-controlinfo">CONTROLINFO</a> structure. See <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iolecontrol-getcontrolinfo">IOleControl::GetControlInfo</a> for more information.</remarks>
			public winmdroot.Foundation.HRESULT OnFocus(winmdroot.Foundation.BOOL fGotFocus)
			{
				return ((delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.Foundation.BOOL ,winmdroot.Foundation.HRESULT>)lpVtbl[8])((IOleControlSite*)Unsafe.AsPointer(ref this), fGotFocus);
			}

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

			/// <summary>Instructs a container to display a property sheet for the control embedded in this site.</summary>
			/// <returns>
			/// <para>This method can return the standard return value E_OUTOFMEMORY, as well as the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>A control must always call this method in the container first when it intends to show its own property pages. Calling this method gives the container a chance to have those property pages work with the container's extended controls. The container may include its own property pages as well in such cases, which doesn't affect the control at all. If the container does not implement this method or if it returns a failure of any kind, the control can show its property pages directly. Otherwise, the container has shown the pages.</remarks>
			public winmdroot.Foundation.HRESULT ShowPropertyFrame()
			{
				return ((delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.Foundation.HRESULT>)lpVtbl[9])((IOleControlSite*)Unsafe.AsPointer(ref this));
			}

			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]<IOleControlSite*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;

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

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

				internal delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.Foundation.HRESULT> OnControlInfoChanged_4;

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

				internal delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.System.Com.IDispatch** ,winmdroot.Foundation.HRESULT> GetExtendedControl_6;

				internal delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.Foundation.POINTL* ,global::System.Drawing.PointF* ,uint ,winmdroot.Foundation.HRESULT> TransformCoords_7;

				internal delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.UI.WindowsAndMessaging.MSG* ,winmdroot.System.Ole.KEYMODIFIERS ,winmdroot.Foundation.HRESULT> TranslateAccelerator_8;

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

				internal delegate *unmanaged [Stdcall]<IOleControlSite*,winmdroot.Foundation.HRESULT> ShowPropertyFrame_10;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->OnControlInfoChanged_4 = &OnControlInfoChanged;
				vtable->LockInPlaceActive_5 = &LockInPlaceActive;
				vtable->GetExtendedControl_6 = &GetExtendedControl;
				vtable->TransformCoords_7 = &TransformCoords;
				vtable->TranslateAccelerator_8 = &TranslateAccelerator;
				vtable->OnFocus_9 = &OnFocus;
				vtable->ShowPropertyFrame_10 = &ShowPropertyFrame;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{b196b289-bab4-101a-b69c-00aa00341d07}</value>
			internal static readonly Guid IID_Guid = new Guid(0xB196B289, 0xBAB4, 0x101A, 0xB6, 0x9C, 0x00, 0xAA, 0x00, 0x34, 0x1D, 0x07);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0x89,0xB2,0x96,0xB1,0xB4,0xBA,0x1A,0x10,0xB6,0x9C,0x00,0xAA,0x00,0x34,0x1D,0x07					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("B196B289-BAB4-101A-B69C-00AA00341D07"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			[SupportedOSPlatform("windows5.0")]
			internal interface Interface
			{
								[PreserveSig()]
winmdroot.Foundation.HRESULT OnControlInfoChanged();

								[PreserveSig()]
winmdroot.Foundation.HRESULT LockInPlaceActive(winmdroot.Foundation.BOOL fLock);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT GetExtendedControl(winmdroot.System.Com.IDispatch** ppDisp);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT TransformCoords(winmdroot.Foundation.POINTL* pPtlHimetric, global::System.Drawing.PointF* pPtfContainer, uint dwFlags);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT TranslateAccelerator(winmdroot.UI.WindowsAndMessaging.MSG* pMsg, winmdroot.System.Ole.KEYMODIFIERS grfModifiers);

								[PreserveSig()]
winmdroot.Foundation.HRESULT OnFocus(winmdroot.Foundation.BOOL fGotFocus);

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