forked from FMXExpress/ios-object-pascal-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iOSapi.EventKitUI.pas
197 lines (161 loc) · 6.01 KB
/
iOSapi.EventKitUI.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
{ *********************************************************** }
{ }
{ CodeGear Delphi Runtime Library }
{ }
{ Copyright(c) 2012-2014 Embarcadero Technologies, Inc. }
{ }
{ *********************************************************** }
//
// Delphi-Objective-C Bridge
// Interfaces for Cocoa framework EventKitUI
//
unit iOSapi.EventKitUI;
interface
uses
Macapi.CoreFoundation,
Macapi.CoreServices,
Macapi.Dispatch,
Macapi.Foundation,
Macapi.Mach,
Macapi.ObjCRuntime,
Macapi.ObjectiveC,
Macapi.QuartzCore,
iOSapi.CocoaTypes,
iOSapi.EventKit,
iOSapi.Foundation,
iOSapi.UIKit;
const
EKCalendarChooserSelectionStyleSingle = 0;
EKCalendarChooserSelectionStyleMultiple = 1;
EKCalendarChooserDisplayAllCalendars = 0;
EKCalendarChooserDisplayWritableCalendarsOnly = 1;
EKEventEditViewActionCanceled = 0;
EKEventEditViewActionSaved = 1;
EKEventEditViewActionDeleted = 2;
EKEventEditViewActionCancelled = EKEventEditViewActionCanceled;
EKEventViewActionDone = 0;
EKEventViewActionResponded = 1;
EKEventViewActionDeleted = 2;
type
// ===== Forward declarations =====
{$M+}
EKCalendarChooserDelegate = interface;
EKCalendarChooser = interface;
EKEventEditViewDelegate = interface;
EKEventEditViewController = interface;
EKEventViewDelegate = interface;
EKEventViewController = interface;
// ===== Framework typedefs =====
{$M+}
NSInteger = Integer;
EKCalendarChooserSelectionStyle = NSInteger;
EKCalendarChooserDisplayStyle = NSInteger;
NSUInteger = Cardinal;
EKEntityType = NSUInteger;
EKEventEditViewAction = NSInteger;
EKEventViewAction = NSInteger;
// ===== Interface declarations =====
EKCalendarChooserClass = interface(UIViewControllerClass)
['{F34345CE-A042-4BB2-BF48-1BCA82CDEEBD}']
end;
EKCalendarChooser = interface(UIViewController)
['{87530007-958C-472A-B688-860063B6BA5B}']
[MethodName('initWithSelectionStyle:displayStyle:eventStore:')]
function initWithSelectionStyleDisplayStyleEventStore(selectionStyle
: EKCalendarChooserSelectionStyle;
displayStyle: EKCalendarChooserDisplayStyle; eventStore: EKEventStore)
: Pointer; cdecl;
[MethodName('initWithSelectionStyle:displayStyle:entityType:eventStore:')]
function initWithSelectionStyleDisplayStyleEntityTypeEventStore
(style: EKCalendarChooserSelectionStyle;
displayStyle: EKCalendarChooserDisplayStyle; entityType: EKEntityType;
eventStore: EKEventStore): Pointer; cdecl;
function selectionStyle: EKCalendarChooserSelectionStyle; cdecl;
procedure setDelegate(delegate: Pointer); cdecl;
function delegate: Pointer; cdecl;
procedure setShowsDoneButton(showsDoneButton: Boolean); cdecl;
function showsDoneButton: Boolean; cdecl;
procedure setShowsCancelButton(showsCancelButton: Boolean); cdecl;
function showsCancelButton: Boolean; cdecl;
procedure setSelectedCalendars(selectedCalendars: NSSet); cdecl;
function selectedCalendars: NSSet; cdecl;
end;
TEKCalendarChooser = class(TOCGenericImport<EKCalendarChooserClass,
EKCalendarChooser>)
end;
PEKCalendarChooser = Pointer;
EKEventEditViewControllerClass = interface(UINavigationControllerClass)
['{3F086835-BAA8-4370-9928-2A91EE1593A8}']
end;
EKEventEditViewController = interface(UINavigationController)
['{B2D32269-6251-4F90-9FB0-1FC4584920ED}']
procedure setEditViewDelegate(editViewDelegate: Pointer); cdecl;
function editViewDelegate: Pointer; cdecl;
procedure setEventStore(eventStore: EKEventStore); cdecl;
function eventStore: EKEventStore; cdecl;
procedure setEvent(event: EKEvent); cdecl;
function event: EKEvent; cdecl;
procedure cancelEditing; cdecl;
end;
TEKEventEditViewController = class
(TOCGenericImport<EKEventEditViewControllerClass,
EKEventEditViewController>)
end;
PEKEventEditViewController = Pointer;
EKEventViewControllerClass = interface(UIViewControllerClass)
['{9811AC4F-112B-4E0F-AB8A-2640D310A034}']
end;
EKEventViewController = interface(UIViewController)
['{3734E069-E1A0-4CAA-A41C-CE0C89E4FA12}']
procedure setDelegate(delegate: Pointer); cdecl;
function delegate: Pointer; cdecl;
procedure setEvent(event: EKEvent); cdecl;
function event: EKEvent; cdecl;
procedure setAllowsEditing(allowsEditing: Boolean); cdecl;
function allowsEditing: Boolean; cdecl;
procedure setAllowsCalendarPreview(allowsCalendarPreview: Boolean); cdecl;
function allowsCalendarPreview: Boolean; cdecl;
end;
TEKEventViewController = class(TOCGenericImport<EKEventViewControllerClass,
EKEventViewController>)
end;
PEKEventViewController = Pointer;
// ===== Protocol declarations =====
EKCalendarChooserDelegate = interface(IObjectiveC)
['{209FA6BF-F6C9-4FF4-95F9-B1523079F491}']
procedure calendarChooserSelectionDidChange(calendarChooser
: EKCalendarChooser); cdecl;
procedure calendarChooserDidFinish(calendarChooser
: EKCalendarChooser); cdecl;
procedure calendarChooserDidCancel(calendarChooser
: EKCalendarChooser); cdecl;
end;
EKEventEditViewDelegate = interface(IObjectiveC)
['{636FD9A4-D2ED-4155-8FA3-0B4DD1A1980D}']
procedure eventEditViewController(controller: EKEventEditViewController;
didCompleteWithAction: EKEventEditViewAction); cdecl;
function eventEditViewControllerDefaultCalendarForNewEvents
(controller: EKEventEditViewController): EKCalendar; cdecl;
end;
EKEventViewDelegate = interface(IObjectiveC)
['{97EE893A-41D6-45A4-BF4C-8E0B0D1F0E17}']
procedure eventViewController(controller: EKEventViewController;
didCompleteWithAction: EKEventViewAction); cdecl;
end;
// ===== External functions =====
const
libEventKitUI = '/System/Library/Frameworks/EventKitUI.framework/EventKitUI';
implementation
{$IF defined(IOS) and NOT defined(CPUARM)}
uses
Posix.Dlfcn;
var
EventKitUIModule: THandle;
{$ENDIF IOS}
{$IF defined(IOS) and NOT defined(CPUARM)}
initialization
EventKitUIModule := dlopen(MarshaledAString(libEventKitUI), RTLD_LAZY);
finalization
dlclose(EventKitUIModule);
{$ENDIF IOS}
end.