brutal/brutal.glfw/Brutal.Glfw/Generated/Libraries/Glfw.Native.Cocoa.gen.cs
2026-10-15 14:12:02 +13:00

89 lines
4.7 KiB
C#

// <auto-generated/>
// Generated by Brutal.Glfw.Generate; do not edit by hand.
#nullable enable
namespace Brutal.GlfwApi.Cocoa
{
/// <summary>
/// Native handle accessors for the Cocoa (macOS) and NSGL backends. Add <c>using Brutal.GlfwApi.Cocoa;</c> to
/// call these extension methods on <see cref="GlfwWindow"/> / <see cref="GlfwMonitor"/>.
/// </summary>
public static class CocoaExtensions
{
extension(GlfwMonitor monitor)
{
/// <summary>
/// Returns the <c>CGDirectDisplayID</c> of the specified monitor.
/// </summary>
/// <returns>The <c>CGDirectDisplayID</c> of the specified monitor, or <c>kCGNullDirectDisplay</c>
/// (0) if an error occurred.</returns>
/// <remarks>
/// This function is only available on the macOS native build. Calling it on any other platform will
/// result in an <see cref="EntryPointNotFoundException"/>.
/// </remarks>
/// <possibleErrors>
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
/// </possibleErrors>
/// <threadSafety>
/// This function may be called from any thread. Access is not synchronized.
/// </threadSafety>
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetCocoaMonitor</seealso>
public uint GetCocoaMonitor() => Glfw.PInvoke.GetCocoaMonitor(monitor);
}
extension(GlfwWindow window)
{
/// <summary>
/// Returns the <c>NSWindow</c> of the specified window.
/// </summary>
/// <returns>The <c>NSWindow</c> handle of the specified window, or <c>0</c> if an error occurred.</returns>
/// <remarks>
/// This function is only available on the macOS native build. Calling it on any other platform will
/// result in an <see cref="EntryPointNotFoundException"/>.
/// </remarks>
/// <possibleErrors>
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
/// </possibleErrors>
/// <threadSafety>
/// This function may be called from any thread. Access is not synchronized.
/// </threadSafety>
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetCocoaWindow</seealso>
public nint GetCocoaWindow() => Glfw.PInvoke.GetCocoaWindow(window);
/// <summary>
/// Returns the <c>NSView</c> of the specified window.
/// </summary>
/// <returns>The <c>NSView</c> handle of the specified window, or <c>0</c> if an error occurred.</returns>
/// <remarks>
/// This function is only available on the macOS native build. Calling it on any other platform will
/// result in an <see cref="EntryPointNotFoundException"/>.
/// </remarks>
/// <possibleErrors>
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
/// </possibleErrors>
/// <threadSafety>
/// This function may be called from any thread. Access is not synchronized.
/// </threadSafety>
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetCocoaView</seealso>
public nint GetCocoaView() => Glfw.PInvoke.GetCocoaView(window);
/// <summary>
/// Returns the <c>NSOpenGLContext</c> of the specified window.
/// </summary>
/// <returns>The <c>NSOpenGLContext</c> handle of the specified window, or <c>0</c> if an error
/// occurred.</returns>
/// <remarks>
/// This function is only available on the macOS native build with NSGL context support. Calling it on any
/// other platform will result in an <see cref="EntryPointNotFoundException"/>.
/// </remarks>
/// <possibleErrors>
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>,
/// <see cref="GlfwErrorCode.NoWindowContext"/>
/// </possibleErrors>
/// <threadSafety>
/// This function may be called from any thread. Access is not synchronized.
/// </threadSafety>
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetNSGLContext</seealso>
public nint GetNSGLContext() => Glfw.PInvoke.GetNSGLContext(window);
}
}
}