Skip to content

Commit

Permalink
[PhotosUI] Move macOS photosui bindings out of photos.cs into photosu…
Browse files Browse the repository at this point in the history
…i.cs (#2358)
  • Loading branch information
Timothy Risi committed Jul 27, 2017
1 parent b7cd04e commit 3606b9f
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 230 deletions.
1 change: 1 addition & 0 deletions src/Constants.mac.cs.in
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
3 changes: 2 additions & 1 deletion src/PhotosUI/PHEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using XamCore.ObjCRuntime;

namespace XamCore.PhotosUI {

#if !MONOMAC
[TV (10,0)]
[iOS (9,1)]
[Native]
Expand All @@ -22,4 +22,5 @@ public enum PHLivePhotoBadgeOptions : nuint {
OverContent = 1 << 0,
LiveOff = 1 << 1,
}
#endif
}
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,7 @@ MAC_FRAMEWORKS = \
OpenGL \
PdfKit \
Photos \
PhotosUI \
PrintCore \
QTKit \
QuartzComposer \
Expand Down
228 changes: 4 additions & 224 deletions src/photos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ interface PHAdjustmentData : NSCoding, NSSecureCoding {
[iOS (8,0)]
[TV (10,0)]
[Mac (10,13, onlyOn64 : true)]
#if MONOMAC
[DisableDefaultCtor] // Crashes mac introspection test
#endif
[BaseType (typeof (PHObject))]
interface PHAsset {

Expand Down Expand Up @@ -123,7 +126,7 @@ interface PHAsset {
[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; }

Expand Down Expand Up @@ -1242,14 +1245,6 @@ interface PHProject {
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))]
Expand All @@ -1268,225 +1263,10 @@ interface PHProjectChangeRequest {
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]
Expand Down
Loading

0 comments on commit 3606b9f

Please sign in to comment.