[PhotosUI] Move macOS photosui bindings out of photos.cs into photosui.cs (#2358)
This commit is contained in:
Родитель
b7cd04ed28
Коммит
3606b9f179
|
@ -129,5 +129,6 @@ namespace MonoMac {
|
|||
// macOS 10.13
|
||||
public const string CoreMLLibrary = "/System/Library/Frameworks/CoreML.framework/CoreML";
|
||||
public const string VisionLibrary = "/System/Library/Frameworks/Vision.framework/Vision";
|
||||
public const string PhotosUILibrary = "/System/Library/Frameworks/Photos.framework/PhotosUI";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
|||
using XamCore.ObjCRuntime;
|
||||
|
||||
namespace XamCore.PhotosUI {
|
||||
|
||||
#if !MONOMAC
|
||||
[TV (10,0)]
|
||||
[iOS (9,1)]
|
||||
[Native]
|
||||
|
@ -22,4 +22,5 @@ namespace XamCore.PhotosUI {
|
|||
OverContent = 1 << 0,
|
||||
LiveOff = 1 << 1,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1605,6 +1605,7 @@ MAC_FRAMEWORKS = \
|
|||
OpenGL \
|
||||
PdfKit \
|
||||
Photos \
|
||||
PhotosUI \
|
||||
PrintCore \
|
||||
QTKit \
|
||||
QuartzComposer \
|
||||
|
|
228
src/photos.cs
228
src/photos.cs
|
@ -39,6 +39,9 @@ namespace XamCore.Photos
|
|||
[iOS (8,0)]
|
||||
[TV (10,0)]
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
#if MONOMAC
|
||||
[DisableDefaultCtor] // Crashes mac introspection test
|
||||
#endif
|
||||
[BaseType (typeof (PHObject))]
|
||||
interface PHAsset {
|
||||
|
||||
|
@ -123,7 +126,7 @@ namespace XamCore.Photos
|
|||
[Export ("sourceType", ArgumentSemantic.Assign)]
|
||||
PHAssetSourceType SourceType { get; }
|
||||
|
||||
[TV (11,0), iOS (11,0)]
|
||||
[TV (11,0), iOS (11,0), NoMac]
|
||||
[Export ("playbackStyle", ArgumentSemantic.Assign)]
|
||||
PHAssetPlaybackStyle PlaybackStyle { get; }
|
||||
|
||||
|
@ -1242,14 +1245,6 @@ namespace XamCore.Photos
|
|||
NSData ProjectExtensionData { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[Static]
|
||||
interface PHProjectType {
|
||||
[Field ("PHProjectTypeUndefined")]
|
||||
NSString Undefined { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
|
@ -1268,225 +1263,10 @@ namespace XamCore.Photos
|
|||
void SetKeyAsset ([NullAllowed] PHAsset keyAsset);
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (PHProjectElement))]
|
||||
interface PHProjectTextElement : NSSecureCoding {
|
||||
|
||||
[Export ("text")]
|
||||
string Text { get; }
|
||||
|
||||
[NullAllowed, Export ("attributedText")]
|
||||
NSAttributedString AttributedText { get; }
|
||||
|
||||
[Export ("textElementType")]
|
||||
PHProjectTextElementType TextElementType { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (PHProjectElement))]
|
||||
interface PHProjectJournalEntryElement : NSSecureCoding {
|
||||
|
||||
[Export ("date")]
|
||||
NSDate Date { get; }
|
||||
|
||||
[NullAllowed, Export ("assetElement")]
|
||||
PHProjectAssetElement AssetElement { get; }
|
||||
|
||||
[NullAllowed, Export ("textElement")]
|
||||
PHProjectTextElement TextElement { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectTypeDescription : NSSecureCoding {
|
||||
|
||||
[Export ("projectType")]
|
||||
NSString ProjectType { get; }
|
||||
|
||||
[Export ("localizedTitle")]
|
||||
string LocalizedTitle { get; }
|
||||
|
||||
[NullAllowed, Export ("localizedDescription")]
|
||||
string LocalizedDescription { get; }
|
||||
|
||||
[NullAllowed, Export ("image", ArgumentSemantic.Copy)]
|
||||
NSImage Image { get; }
|
||||
|
||||
[Export ("subtypeDescriptions", ArgumentSemantic.Copy)]
|
||||
PHProjectTypeDescription[] SubtypeDescriptions { get; }
|
||||
|
||||
[Export ("initWithProjectType:title:description:image:subtypeDescriptions:")]
|
||||
[DesignatedInitializer]
|
||||
IntPtr Constructor (NSString projectType, string localizedTitle, [NullAllowed] string localizedDescription, [NullAllowed] NSImage image, PHProjectTypeDescription[] subtypeDescriptions);
|
||||
|
||||
[Export ("initWithProjectType:title:description:image:")]
|
||||
IntPtr Constructor (NSString projectType, string localizedTitle, [NullAllowed] string localizedDescription, [NullAllowed] NSImage image);
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectRegionOfInterest : NSSecureCoding {
|
||||
|
||||
[Export ("rect")]
|
||||
CGRect Rect { get; }
|
||||
|
||||
[Export ("weight")]
|
||||
double Weight { get; }
|
||||
|
||||
[Export ("identifier")]
|
||||
string Identifier { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectElement : NSSecureCoding {
|
||||
|
||||
[Export ("weight")]
|
||||
double Weight { get; }
|
||||
|
||||
[Export ("placement")]
|
||||
CGRect Placement { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (PHProjectElement))]
|
||||
interface PHProjectAssetElement : NSSecureCoding {
|
||||
|
||||
[Export ("cloudAssetIdentifier")]
|
||||
PHCloudIdentifier CloudAssetIdentifier { get; }
|
||||
|
||||
[Export ("annotation")]
|
||||
string Annotation { get; }
|
||||
|
||||
[Export ("cropRect")]
|
||||
CGRect CropRect { get; }
|
||||
|
||||
[Export ("regionsOfInterest")]
|
||||
PHProjectRegionOfInterest[] RegionsOfInterest { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSExtensionContext))]
|
||||
interface PHProjectExtensionContext {
|
||||
|
||||
[Export ("photoLibrary")]
|
||||
PHPhotoLibrary PhotoLibrary { get; }
|
||||
|
||||
[Export ("project")]
|
||||
PHProject Project { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectInfo : NSSecureCoding {
|
||||
|
||||
[Export ("creationSource")]
|
||||
PHProjectCreationSource CreationSource { get; }
|
||||
|
||||
[Export ("projectType")]
|
||||
NSString ProjectType { get; }
|
||||
|
||||
[Export ("sections")]
|
||||
PHProjectSection[] Sections { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectSection : NSSecureCoding {
|
||||
|
||||
[Export ("sectionContents")]
|
||||
PHProjectSectionContent[] SectionContents { get; }
|
||||
|
||||
[Export ("sectionType")]
|
||||
PHProjectSectionType SectionType { get; }
|
||||
|
||||
[Export ("title")]
|
||||
string Title { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectSectionContent : NSSecureCoding {
|
||||
|
||||
[Export ("elements")]
|
||||
PHProjectElement[] Elements { get; }
|
||||
|
||||
[Export ("numberOfColumns")]
|
||||
nint NumberOfColumns { get; }
|
||||
|
||||
[Export ("aspectRatio")]
|
||||
double AspectRatio { get; }
|
||||
|
||||
[Export ("cloudAssetIdentifiers")]
|
||||
PHCloudIdentifier[] CloudAssetIdentifiers { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[Protocol]
|
||||
interface PHProjectExtensionController {
|
||||
|
||||
[Export ("supportedProjectTypes", ArgumentSemantic.Copy)]
|
||||
PHProjectTypeDescription[] SupportedProjectTypes { get; }
|
||||
|
||||
[Abstract]
|
||||
[Export ("beginProjectWithExtensionContext:projectInfo:completion:")]
|
||||
void BeginProject (PHProjectExtensionContext extensionContext, PHProjectInfo projectInfo, Action<NSError> completion);
|
||||
|
||||
[Abstract]
|
||||
[Export ("resumeProjectWithExtensionContext:completion:")]
|
||||
void ResumeProject (PHProjectExtensionContext extensionContext, Action<NSError> completion);
|
||||
|
||||
[Abstract]
|
||||
[Export ("finishProjectWithCompletionHandler:")]
|
||||
void FinishProject (Action completion);
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[Protocol]
|
||||
interface PHContentEditingController {
|
||||
|
||||
[Abstract]
|
||||
[Export ("canHandleAdjustmentData:")]
|
||||
bool CanHandleAdjustmentData (PHAdjustmentData adjustmentData);
|
||||
|
||||
[Abstract]
|
||||
[Export ("startContentEditingWithInput:placeholderImage:")]
|
||||
void StartContentEditing (PHContentEditingInput contentEditingInput, NSImage placeholderImage);
|
||||
|
||||
[Abstract]
|
||||
[Export ("finishContentEditingWithCompletionHandler:")]
|
||||
void FinishContentEditing (Action<PHContentEditingOutput> completionHandler);
|
||||
|
||||
[Abstract]
|
||||
[Export ("cancelContentEditing")]
|
||||
void CancelContentEditing ();
|
||||
|
||||
[Abstract]
|
||||
[Export ("shouldShowCancelConfirmation")]
|
||||
bool ShouldShowCancelConfirmation { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
interface PHCloudIdentifier : NSSecureCoding {
|
||||
|
||||
[Static]
|
||||
|
|
218
src/photosui.cs
218
src/photosui.cs
|
@ -1,16 +1,21 @@
|
|||
using XamCore.CoreGraphics;
|
||||
using XamCore.ObjCRuntime;
|
||||
using XamCore.Foundation;
|
||||
#if !MONOMAC
|
||||
using XamCore.UIKit;
|
||||
#else
|
||||
using XamCore.AppKit;
|
||||
using UIImage = XamCore.AppKit.NSImage;
|
||||
#endif
|
||||
using XamCore.Photos;
|
||||
using System;
|
||||
|
||||
namespace XamCore.PhotosUI
|
||||
{
|
||||
namespace XamCore.PhotosUI {
|
||||
[NoTV]
|
||||
[iOS (8,0)]
|
||||
[iOS (8, 0)]
|
||||
[Mac (10, 13, onlyOn64: true)]
|
||||
[Protocol]
|
||||
#if !XAMCORE_4_0 && !TVOS
|
||||
#if !XAMCORE_4_0 && !TVOS && !MONOMAC
|
||||
// According to documentation you're supposed to implement this protocol in a UIViewController subclass,
|
||||
// which means a model (which does not inherit from UIViewController) is not useful.
|
||||
[Model]
|
||||
|
@ -39,6 +44,7 @@ namespace XamCore.PhotosUI
|
|||
bool ShouldShowCancelConfirmation { get; }
|
||||
}
|
||||
|
||||
#if !MONOMAC
|
||||
[TV (10,0)]
|
||||
[iOS (9,1)]
|
||||
[BaseType (typeof (UIView))]
|
||||
|
@ -77,7 +83,7 @@ namespace XamCore.PhotosUI
|
|||
}
|
||||
|
||||
[TV (10,0)]
|
||||
[iOS (9,1)]
|
||||
[iOS (9,1)][NoMac]
|
||||
[Protocol, Model]
|
||||
[BaseType (typeof (NSObject))]
|
||||
interface PHLivePhotoViewDelegate {
|
||||
|
@ -87,4 +93,206 @@ namespace XamCore.PhotosUI
|
|||
[Export ("livePhotoView:didEndPlaybackWithStyle:")]
|
||||
void DidEndPlayback (PHLivePhotoView livePhotoView, PHLivePhotoViewPlaybackStyle playbackStyle);
|
||||
}
|
||||
#endif
|
||||
|
||||
[Mac (10,13, onlyOn64: true)][NoiOS][NoTV][NoWatch]
|
||||
[Static]
|
||||
interface PHProjectType {
|
||||
[Field ("PHProjectTypeUndefined")]
|
||||
NSString Undefined { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[DisableDefaultCtor]
|
||||
[BaseType (typeof (NSExtensionContext))]
|
||||
interface PHProjectExtensionContext : NSSecureCoding, NSCopying {
|
||||
|
||||
[Export ("photoLibrary")]
|
||||
PHPhotoLibrary PhotoLibrary { get; }
|
||||
|
||||
[Export ("project")]
|
||||
PHProject Project { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[DisableDefaultCtor]
|
||||
[BaseType (typeof (PHProjectElement))]
|
||||
interface PHProjectJournalEntryElement : NSSecureCoding {
|
||||
|
||||
[Export ("date")]
|
||||
NSDate Date { get; }
|
||||
|
||||
[NullAllowed, Export ("assetElement")]
|
||||
PHProjectAssetElement AssetElement { get; }
|
||||
|
||||
[NullAllowed, Export ("textElement")]
|
||||
PHProjectTextElement TextElement { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[DisableDefaultCtor]
|
||||
[BaseType (typeof (PHProjectElement))]
|
||||
interface PHProjectTextElement : NSSecureCoding {
|
||||
|
||||
[Export ("text")]
|
||||
string Text { get; }
|
||||
|
||||
[NullAllowed, Export ("attributedText")]
|
||||
NSAttributedString AttributedText { get; }
|
||||
|
||||
[Export ("textElementType")]
|
||||
PHProjectTextElementType TextElementType { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[Protocol]
|
||||
interface PHProjectExtensionController {
|
||||
|
||||
[Export ("supportedProjectTypes", ArgumentSemantic.Copy)]
|
||||
PHProjectTypeDescription [] GetSupportedProjectTypes ();
|
||||
|
||||
[Abstract]
|
||||
[Export ("beginProjectWithExtensionContext:projectInfo:completion:")]
|
||||
void BeginProject (PHProjectExtensionContext extensionContext, PHProjectInfo projectInfo, Action<NSError> completion);
|
||||
|
||||
[Abstract]
|
||||
[Export ("resumeProjectWithExtensionContext:completion:")]
|
||||
void ResumeProject (PHProjectExtensionContext extensionContext, Action<NSError> completion);
|
||||
|
||||
[Abstract]
|
||||
[Export ("finishProjectWithCompletionHandler:")]
|
||||
void FinishProject (Action completion);
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectTypeDescription : NSSecureCoding {
|
||||
|
||||
[Export ("projectType")]
|
||||
NSString ProjectType { get; }
|
||||
|
||||
[Export ("localizedTitle")]
|
||||
string LocalizedTitle { get; }
|
||||
|
||||
[NullAllowed, Export ("localizedDescription")]
|
||||
string LocalizedDescription { get; }
|
||||
|
||||
[NullAllowed, Export ("image", ArgumentSemantic.Copy)]
|
||||
UIImage Image { get; }
|
||||
|
||||
[Export ("subtypeDescriptions", ArgumentSemantic.Copy)]
|
||||
PHProjectTypeDescription[] SubtypeDescriptions { get; }
|
||||
|
||||
[Export ("initWithProjectType:title:description:image:subtypeDescriptions:")]
|
||||
[DesignatedInitializer]
|
||||
IntPtr Constructor (NSString projectType, string localizedTitle, [NullAllowed] string localizedDescription, [NullAllowed] UIImage image, PHProjectTypeDescription[] subtypeDescriptions);
|
||||
|
||||
[Export ("initWithProjectType:title:description:image:")]
|
||||
IntPtr Constructor (NSString projectType, string localizedTitle, [NullAllowed] string localizedDescription, [NullAllowed] UIImage image);
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectRegionOfInterest : NSSecureCoding {
|
||||
|
||||
[Export ("rect")]
|
||||
CGRect Rect { get; }
|
||||
|
||||
[Export ("weight")]
|
||||
double Weight { get; }
|
||||
|
||||
[Export ("identifier")]
|
||||
string Identifier { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectElement : NSSecureCoding {
|
||||
|
||||
[Export ("weight")]
|
||||
double Weight { get; }
|
||||
|
||||
[Export ("placement")]
|
||||
CGRect Placement { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[DisableDefaultCtor]
|
||||
[BaseType (typeof (PHProjectElement))]
|
||||
interface PHProjectAssetElement : NSSecureCoding {
|
||||
|
||||
[Export ("cloudAssetIdentifier")]
|
||||
PHCloudIdentifier CloudAssetIdentifier { get; }
|
||||
|
||||
[Export ("annotation")]
|
||||
string Annotation { get; }
|
||||
|
||||
[Export ("cropRect")]
|
||||
CGRect CropRect { get; }
|
||||
|
||||
[Export ("regionsOfInterest")]
|
||||
PHProjectRegionOfInterest[] RegionsOfInterest { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectInfo : NSSecureCoding {
|
||||
|
||||
[Export ("creationSource")]
|
||||
PHProjectCreationSource CreationSource { get; }
|
||||
|
||||
[Export ("projectType")]
|
||||
NSString ProjectType { get; }
|
||||
|
||||
[Export ("sections")]
|
||||
PHProjectSection[] Sections { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectSection : NSSecureCoding {
|
||||
|
||||
[Export ("sectionContents")]
|
||||
PHProjectSectionContent[] SectionContents { get; }
|
||||
|
||||
[Export ("sectionType")]
|
||||
PHProjectSectionType SectionType { get; }
|
||||
|
||||
[Export ("title")]
|
||||
string Title { get; }
|
||||
}
|
||||
|
||||
[Mac (10,13, onlyOn64 : true)]
|
||||
[NoiOS][NoTV]
|
||||
[BaseType (typeof (NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface PHProjectSectionContent : NSSecureCoding {
|
||||
|
||||
[Export ("elements")]
|
||||
PHProjectElement[] Elements { get; }
|
||||
|
||||
[Export ("numberOfColumns")]
|
||||
nint NumberOfColumns { get; }
|
||||
|
||||
[Export ("aspectRatio")]
|
||||
double AspectRatio { get; }
|
||||
|
||||
[Export ("cloudAssetIdentifiers")]
|
||||
PHCloudIdentifier[] CloudAssetIdentifiers { get; }
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче