NSView.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Runtime.InteropServices;
  3. using static Veldrid.MetalBindings.ObjectiveCRuntime;
  4. namespace Veldrid.MetalBindings
  5. {
  6. public unsafe struct NSView
  7. {
  8. public readonly IntPtr NativePtr;
  9. public static implicit operator IntPtr(NSView nsView) => nsView.NativePtr;
  10. public NSView(IntPtr ptr) => NativePtr = ptr;
  11. public Bool8 wantsLayer
  12. {
  13. get => bool8_objc_msgSend(NativePtr, "wantsLayer");
  14. set => objc_msgSend(NativePtr, "setWantsLayer:", value);
  15. }
  16. public IntPtr layer
  17. {
  18. get => IntPtr_objc_msgSend(NativePtr, "layer");
  19. set => objc_msgSend(NativePtr, "setLayer:", value);
  20. }
  21. public CGRect frame
  22. {
  23. get
  24. {
  25. return RuntimeInformation.ProcessArchitecture == Architecture.Arm64
  26. ? CGRect_objc_msgSend(NativePtr, "frame")
  27. : objc_msgSend_stret<CGRect>(NativePtr, "frame");
  28. }
  29. }
  30. }
  31. }