[appkit] Use generated bindings for NS[Open|Save].[Open|Save]Panel. Fixes #5336 (#5341)

Also add [Advice] to help people using writing applications that runs
inside the sandbox.

reference: https://github.com/xamarin/xamarin-macios/issues/5336
This commit is contained in:
Sebastien Pouliot 2019-01-03 19:26:21 -05:00 коммит произвёл GitHub
Родитель b9de5926f4
Коммит fbd63db027
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 20 добавлений и 46 удалений

Просмотреть файл

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using Foundation;
using ObjCRuntime;
namespace AppKit
{
public partial class NSOpenPanel
{
[Export ("openPanel")]
public static NSOpenPanel OpenPanel {
get {
// [NSOpenPanel openPanel] will always create a new instance, so there's no need to check if there already is
// a managed object with the same pointer.
IntPtr ptr = Messaging.IntPtr_objc_msgSend (Class.GetHandle ("NSOpenPanel"), Selector.GetHandle ("openPanel"));
return new NSOpenPanel (ptr);
}
}
}
}

Просмотреть файл

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using Foundation;
using ObjCRuntime;
namespace AppKit
{
public partial class NSSavePanel
{
[Export ("savePanel")]
public static NSSavePanel SavePanel {
get {
// [NSSavePanel savePanel] will always create a new instance, so there's no need to check if there already is
// a managed object with the same pointer.
IntPtr ptr = Messaging.IntPtr_objc_msgSend (Class.GetHandle ("NSSavePanel"), Selector.GetHandle ("savePanel"));
return new NSSavePanel (ptr);
}
}
}
}

Просмотреть файл

@ -8643,7 +8643,17 @@ namespace AppKit {
}
[BaseType (typeof (NSSavePanel))]
[DisableDefaultCtor]
interface NSOpenPanel {
[Static]
[Export ("openPanel")]
[ForcedType] // different type used inside a sandbox
NSOpenPanel OpenPanel { get; }
[Advice ("You must use 'OpenPanel' method if the application is sandboxed.")]
[Export ("init")]
IntPtr Constructor ();
[Export ("URLs")]
NSUrl [] Urls { get; }
@ -12896,7 +12906,17 @@ namespace AppKit {
delegate void NSSavePanelComplete (nint result);
[BaseType (typeof (NSPanel), Delegates=new string [] { "Delegate" }, Events=new Type [] { typeof (NSOpenSavePanelDelegate)})]
[DisableDefaultCtor]
interface NSSavePanel {
[Static]
[Export ("savePanel")]
[ForcedType] // different type used inside a sandbox
NSSavePanel SavePanel { get; }
[Advice ("You must use 'SavePanel' method if the application is sandboxed.")]
[Export ("init")]
IntPtr Constructor ();
[Export ("URL")]
NSUrl Url { get; }

Просмотреть файл

@ -138,8 +138,6 @@ APPKIT_SOURCES = \
AppKit/NSTouch.cs \
AppKit/NSTreeController.cs \
AppKit/NSWindow.cs \
AppKit/NSOpenPanel.cs \
AppKit/NSSavePanel.cs \
AppKit/NSWorkspace.cs \
AppKit/NSCollectionView.cs \
AppKit/NSCollectionViewDelegate.cs \

Просмотреть файл

@ -1128,9 +1128,7 @@
!missing-selector! +NSBezierPath::bezierPath not bound
!missing-selector! +NSCursor::pop not bound
!missing-selector! +NSInputManager::currentInputManager not bound
!missing-selector! +NSOpenPanel::openPanel not bound
!missing-selector! +NSPDFPanel::panel not bound
!missing-selector! +NSSavePanel::savePanel not bound
!missing-selector! +NSSound::soundUnfilteredFileTypes not bound
!missing-selector! +NSSound::soundUnfilteredPasteboardTypes not bound
!missing-selector! NSBezierPath::cachesBezierPath not bound