-
Notifications
You must be signed in to change notification settings - Fork 12
/
iOSapi.PhotosUI.pas
136 lines (109 loc) · 3.69 KB
/
iOSapi.PhotosUI.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{ *********************************************************** }
{ }
{ CodeGear Delphi Runtime Library }
{ }
{ Copyright(c) 2012-2014 Embarcadero Technologies, Inc. }
{ }
{ *********************************************************** }
//
// Delphi-Objective-C Bridge
// Interfaces for Cocoa framework PhotosUI
//
unit iOSapi.PhotosUI;
interface
uses
Macapi.CoreFoundation,
Macapi.CoreServices,
Macapi.Dispatch,
Macapi.Foundation,
Macapi.Mach,
Macapi.ObjCRuntime,
Macapi.ObjectiveC,
Macapi.QuartzCore,
iOSapi.CocoaTypes,
iOSapi.Foundation,
iOSapi.Photos,
iOSapi.UIKit;
const
PHLivePhotoBadgeOptionsOverContent = 1 shl 0;
PHLivePhotoBadgeOptionsLiveOff = 1 shl 1;
PHLivePhotoViewPlaybackStyleUndefined = 0;
PHLivePhotoViewPlaybackStyleFull = 1;
PHLivePhotoViewPlaybackStyleHint = 2;
type
// ===== Forward declarations =====
{$M+}
PHContentEditingController = interface;
PHLivePhotoViewDelegate = interface;
PHLivePhotoView = interface;
// ===== Framework typedefs =====
{$M+}
TPhotosUICompletionHandler = procedure(param1: PHContentEditingOutput)
of object;
NSUInteger = Cardinal;
PHLivePhotoBadgeOptions = NSUInteger;
NSInteger = Integer;
PHLivePhotoViewPlaybackStyle = NSInteger;
// ===== Interface declarations =====
PHLivePhotoViewClass = interface(UIViewClass)
['{27503C3A-CCFF-4050-94CE-43E5D90C90D0}']
{ class } function livePhotoBadgeImageWithOptions
(badgeOptions: PHLivePhotoBadgeOptions): UIImage; cdecl;
end;
PHLivePhotoView = interface(UIView)
['{91F057A9-55FA-46CE-9B0C-91C33B3A8858}']
procedure setDelegate(delegate: Pointer); cdecl;
function delegate: Pointer; cdecl;
procedure setLivePhoto(livePhoto: PHLivePhoto); cdecl;
function livePhoto: PHLivePhoto; cdecl;
procedure setMuted(muted: Boolean); cdecl;
function isMuted: Boolean; cdecl;
function playbackGestureRecognizer: UIGestureRecognizer; cdecl;
procedure startPlaybackWithStyle(playbackStyle
: PHLivePhotoViewPlaybackStyle); cdecl;
procedure stopPlayback; cdecl;
end;
TPHLivePhotoView = class(TOCGenericImport<PHLivePhotoViewClass,
PHLivePhotoView>)
end;
PPHLivePhotoView = Pointer;
// ===== Protocol declarations =====
PHContentEditingController = interface(IObjectiveC)
['{1E07EA30-0E2F-4FEE-873F-7FFC65DDB3F3}']
function canHandleAdjustmentData(adjustmentData: PHAdjustmentData)
: Boolean; cdecl;
procedure startContentEditingWithInput(contentEditingInput
: PHContentEditingInput; placeholderImage: UIImage); cdecl;
procedure finishContentEditingWithCompletionHandler(completionHandler
: TPhotosUICompletionHandler); cdecl;
procedure cancelContentEditing; cdecl;
function shouldShowCancelConfirmation: Boolean; cdecl;
end;
PHLivePhotoViewDelegate = interface(IObjectiveC)
['{55CB9CA4-0D09-4C93-B9E1-76F0469AACC2}']
[MethodName('livePhotoView:willBeginPlaybackWithStyle:')]
procedure livePhotoViewWillBeginPlaybackWithStyle(livePhotoView
: PHLivePhotoView; willBeginPlaybackWithStyle
: PHLivePhotoViewPlaybackStyle); cdecl;
[MethodName('livePhotoView:didEndPlaybackWithStyle:')]
procedure livePhotoViewDidEndPlaybackWithStyle(livePhotoView
: PHLivePhotoView; didEndPlaybackWithStyle
: PHLivePhotoViewPlaybackStyle); cdecl;
end;
// ===== External functions =====
const
libPhotosUI = '/System/Library/Frameworks/PhotosUI.framework/PhotosUI';
implementation
{$IF defined(IOS) and NOT defined(CPUARM)}
uses
Posix.Dlfcn;
var
PhotosUIModule: THandle;
{$ENDIF IOS}
{$IF defined(IOS) and NOT defined(CPUARM)}
initialization
PhotosUIModule := dlopen(MarshaledAString(libPhotosUI), RTLD_LAZY);
finalization
dlclose(PhotosUIModule);
{$ENDIF IOS}
end.