[dotnet] AppKit pinvokes (#17644)
This commit is contained in:
Родитель
0a8170017b
Коммит
a6eb8cb586
|
@ -19,6 +19,10 @@ using ObjCRuntime;
|
|||
|
||||
#nullable enable
|
||||
|
||||
#if !NET
|
||||
using NativeHandle = System.IntPtr;
|
||||
#endif
|
||||
|
||||
namespace AppKit {
|
||||
public partial interface INSAccessibility { }
|
||||
|
||||
|
@ -35,11 +39,11 @@ namespace AppKit {
|
|||
[Mac (10, 10)]
|
||||
#endif
|
||||
[DllImport (Constants.AppKitLibrary)]
|
||||
static extern CGRect NSAccessibilityFrameInView (NSView parentView, CGRect frame);
|
||||
static extern CGRect NSAccessibilityFrameInView (NativeHandle parentView, CGRect frame);
|
||||
|
||||
public static CGRect GetFrameInView (NSView parentView, CGRect frame)
|
||||
{
|
||||
return NSAccessibilityFrameInView (parentView, frame);
|
||||
return NSAccessibilityFrameInView (parentView.GetHandle (), frame);
|
||||
}
|
||||
|
||||
#if NET
|
||||
|
@ -48,11 +52,11 @@ namespace AppKit {
|
|||
[Mac (10, 10)]
|
||||
#endif
|
||||
[DllImport (Constants.AppKitLibrary)]
|
||||
static extern CGPoint NSAccessibilityPointInView (NSView parentView, CGPoint point);
|
||||
static extern CGPoint NSAccessibilityPointInView (NativeHandle parentView, CGPoint point);
|
||||
|
||||
public static CGPoint GetPointInView (NSView parentView, CGPoint point)
|
||||
{
|
||||
return NSAccessibilityPointInView (parentView, point);
|
||||
return NSAccessibilityPointInView (parentView.GetHandle (), point);
|
||||
}
|
||||
|
||||
[DllImport (Constants.AppKitLibrary)]
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace AppKit {
|
|||
private static Thread? mainThread;
|
||||
|
||||
[DllImport (Constants.AppKitLibrary)]
|
||||
extern static int /* int */ NSApplicationMain (int /* int */ argc, string [] argv);
|
||||
extern static int /* int */ NSApplicationMain (int /* int */ argc, IntPtr argv);
|
||||
|
||||
static bool initialized;
|
||||
|
||||
|
@ -115,7 +115,10 @@ namespace AppKit {
|
|||
// with a call to Main, but this guarantees the right thread.
|
||||
NSApplication.mainThread = Thread.CurrentThread;
|
||||
|
||||
NSApplicationMain (args.Length, args);
|
||||
var argsPtr = TransientString.AllocStringArray (args);
|
||||
NSApplicationMain (args.Length, argsPtr);
|
||||
if (argsPtr != IntPtr.Zero)
|
||||
TransientString.FreeStringArray (argsPtr, args.Length);
|
||||
}
|
||||
|
||||
public static void EnsureUIThread ()
|
||||
|
|
|
@ -30,6 +30,10 @@ using ObjCRuntime;
|
|||
using Foundation;
|
||||
using CoreGraphics;
|
||||
|
||||
#if !NET
|
||||
using NativeHandle = System.IntPtr;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace AppKit {
|
||||
|
@ -152,11 +156,11 @@ namespace AppKit {
|
|||
}
|
||||
|
||||
[DllImport (Constants.AppKitLibrary, EntryPoint = "NSShowAnimationEffect")]
|
||||
extern static void NSShowAnimationEffect (nuint animationEffect, CGPoint centerLocation, CGSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo);
|
||||
extern static void NSShowAnimationEffect (nuint animationEffect, CGPoint centerLocation, CGSize size, NativeHandle animationDelegate, NativeHandle didEndSelector, IntPtr contextInfo);
|
||||
|
||||
public static void ShowAnimationEffect (NSAnimationEffect animationEffect, CGPoint centerLocation, CGSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo)
|
||||
{
|
||||
NSShowAnimationEffect ((nuint) (ulong) animationEffect, centerLocation, size, animationDelegate, didEndSelector, contextInfo);
|
||||
NSShowAnimationEffect ((nuint) (ulong) animationEffect, centerLocation, size, animationDelegate.GetHandle (), didEndSelector.Handle, contextInfo);
|
||||
}
|
||||
|
||||
public static void ShowAnimationEffect (NSAnimationEffect animationEffect, CGPoint centerLocation, CGSize size, Action endedCallback)
|
||||
|
|
Загрузка…
Ссылка в новой задаче