File: Windows.Win32.ISelectionItemProvider.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 UI.Accessibility
	{
		[Guid("2ACAD808-B2D4-452D-A407-91FF1AD167B2")]
		[SupportedOSPlatform("windows5.1.2600")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct ISelectionItemProvider
			:IVTable<ISelectionItemProvider,ISelectionItemProvider.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]<ISelectionItemProvider*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((ISelectionItemProvider*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

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

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

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

			/// <summary>Deselects any selected items and then selects the current element.</summary>
			/// <returns>
			/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/WinProg/windows-data-types">HRESULT</a></b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
			/// </returns>
			/// <remarks>If the current element isn’t selected, this method deselects any selected items and then selects the current element.  If the current element is already selected, this method does nothing.</remarks>
			public void Select()
			{
				((delegate *unmanaged [Stdcall]<ISelectionItemProvider*,winmdroot.Foundation.HRESULT>)lpVtbl[3])((ISelectionItemProvider*)Unsafe.AsPointer(ref this)).ThrowOnFailure();
			}

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

			/// <summary>Adds the current element to the collection of selected items. (ISelectionItemProvider.AddToSelection)</summary>
			/// <returns>
			/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/WinProg/windows-data-types">HRESULT</a></b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
			/// </returns>
			/// <remarks>
			/// <para>If the result of a call to <b>ISelectionItemProvider::AddToSelection</b> is that a single item is selected, then send an <a href="https://docs.microsoft.com/windows/desktop/WinAuto/uiauto-event-ids">UIA_SelectionItem_ElementSelectedEventId</a> event for that element; otherwise send an <a href="https://docs.microsoft.com/windows/desktop/WinAuto/uiauto-event-ids">UIA_SelectionItem_ElementAddedToSelectionEventId</a> or <a href="https://docs.microsoft.com/windows/desktop/WinAuto/uiauto-event-ids">UIA_SelectionItem_ElementRemovedFromSelectionEventId</a> event as appropriate. <div class="alert"><b>Note</b>  This rule does not depend on whether the container allows single or multiple selection, or on what method was used to change the selection. Only the result matters.</div> <div> </div></para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionitemprovider-addtoselection#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public void AddToSelection()
			{
				((delegate *unmanaged [Stdcall]<ISelectionItemProvider*,winmdroot.Foundation.HRESULT>)lpVtbl[4])((ISelectionItemProvider*)Unsafe.AsPointer(ref this)).ThrowOnFailure();
			}

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

			/// <summary>Removes the current element from the collection of selected items.</summary>
			/// <returns>
			/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/WinProg/windows-data-types">HRESULT</a></b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
			/// </returns>
			/// <remarks>
			/// <para>Send an <a href="https://docs.microsoft.com/windows/desktop/WinAuto/uiauto-event-ids">UIA_SelectionItem_ElementRemovedFromSelectionEventId</a> event as appropriate. <div class="alert"><b>Note</b>  This rule does not depend on whether the container allows single or multiple selection, or on what method was used to change the selection. Only the result matters.</div> <div> </div></para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionitemprovider-removefromselection#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public void RemoveFromSelection()
			{
				((delegate *unmanaged [Stdcall]<ISelectionItemProvider*,winmdroot.Foundation.HRESULT>)lpVtbl[5])((ISelectionItemProvider*)Unsafe.AsPointer(ref this)).ThrowOnFailure();
			}

			/// <inheritdoc cref="get_IsSelected(winmdroot.Foundation.BOOL*)"/>
			internal unsafe winmdroot.Foundation.HRESULT get_IsSelected(out winmdroot.Foundation.BOOL pRetVal)
			{
				fixed (winmdroot.Foundation.BOOL* pRetValLocal = &pRetVal)
				{
					winmdroot.Foundation.HRESULT __result = this.get_IsSelected(pRetValLocal);
					return __result;
				}
			}

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

			/// <summary>Indicates whether an item is selected.</summary>
			/// <remarks>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionitemprovider-get_isselected">Learn more about this API from docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT get_IsSelected(winmdroot.Foundation.BOOL* pRetVal)
			{
				return ((delegate *unmanaged [Stdcall]<ISelectionItemProvider*,winmdroot.Foundation.BOOL* ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((ISelectionItemProvider*)Unsafe.AsPointer(ref this), pRetVal);
			}

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

			/// <summary>Specifies the provider that implements ISelectionProvider and acts as the container for the calling object.</summary>
			/// <remarks>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionitemprovider-get_selectioncontainer">Learn more about this API from docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT get_SelectionContainer(winmdroot.UI.Accessibility.IRawElementProviderSimple** pRetVal)
			{
				return ((delegate *unmanaged [Stdcall]<ISelectionItemProvider*,winmdroot.UI.Accessibility.IRawElementProviderSimple** ,winmdroot.Foundation.HRESULT>)lpVtbl[7])((ISelectionItemProvider*)Unsafe.AsPointer(ref this), pRetVal);
			}

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

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

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

				internal delegate *unmanaged [Stdcall]<ISelectionItemProvider*,winmdroot.Foundation.HRESULT> Select_4;

				internal delegate *unmanaged [Stdcall]<ISelectionItemProvider*,winmdroot.Foundation.HRESULT> AddToSelection_5;

				internal delegate *unmanaged [Stdcall]<ISelectionItemProvider*,winmdroot.Foundation.HRESULT> RemoveFromSelection_6;

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

				internal delegate *unmanaged [Stdcall]<ISelectionItemProvider*,winmdroot.UI.Accessibility.IRawElementProviderSimple** ,winmdroot.Foundation.HRESULT> get_SelectionContainer_8;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->Select_4 = &Select;
				vtable->AddToSelection_5 = &AddToSelection;
				vtable->RemoveFromSelection_6 = &RemoveFromSelection;
				vtable->get_IsSelected_7 = &get_IsSelected;
				vtable->get_SelectionContainer_8 = &get_SelectionContainer;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{2acad808-b2d4-452d-a407-91ff1ad167b2}</value>
			internal static readonly Guid IID_Guid = new Guid(0x2ACAD808, 0xB2D4, 0x452D, 0xA4, 0x07, 0x91, 0xFF, 0x1A, 0xD1, 0x67, 0xB2);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0x08,0xD8,0xCA,0x2A,0xD4,0xB2,0x2D,0x45,0xA4,0x07,0x91,0xFF,0x1A,0xD1,0x67,0xB2					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("2ACAD808-B2D4-452D-A407-91FF1AD167B2"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			[SupportedOSPlatform("windows5.1.2600")]
			internal interface Interface
			{
								[PreserveSig()]
winmdroot.Foundation.HRESULT Select();

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

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

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT get_IsSelected(winmdroot.Foundation.BOOL* pRetVal);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT get_SelectionContainer(winmdroot.UI.Accessibility.IRawElementProviderSimple** pRetVal);
			}
		}
	}
}