-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathiOSapi.EventKit.pas
More file actions
663 lines (585 loc) · 22.8 KB
/
iOSapi.EventKit.pas
File metadata and controls
663 lines (585 loc) · 22.8 KB
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
{ *********************************************************** }
{ }
{ CodeGear Delphi Runtime Library }
{ }
{ Copyright(c) 2012-2014 Embarcadero Technologies, Inc. }
{ }
{ *********************************************************** }
//
// Delphi-Objective-C Bridge
// Interfaces for Cocoa framework EventKit
//
unit iOSapi.EventKit;
interface
uses
Macapi.CoreFoundation,
Macapi.CoreServices,
Macapi.Dispatch,
Macapi.Foundation,
Macapi.Mach,
Macapi.ObjCRuntime,
Macapi.ObjectiveC,
Macapi.QuartzCore,
iOSapi.AddressBook,
iOSapi.CocoaTypes,
iOSapi.CoreGraphics,
iOSapi.CoreLocation,
iOSapi.Foundation;
const
EKAuthorizationStatusNotDetermined = 0;
EKAuthorizationStatusRestricted = 1;
EKAuthorizationStatusDenied = 2;
EKAuthorizationStatusAuthorized = 3;
EKWeekdaySunday = 1;
EKWeekdayMonday = 2;
EKWeekdayTuesday = 3;
EKWeekdayWednesday = 4;
EKWeekdayThursday = 5;
EKWeekdayFriday = 6;
EKWeekdaySaturday = 7;
EKSunday = EKWeekdaySunday;
EKMonday = EKWeekdayMonday;
EKTuesday = EKWeekdayTuesday;
EKWednesday = EKWeekdayWednesday;
EKThursday = EKWeekdayThursday;
EKFriday = EKWeekdayFriday;
EKSaturday = EKWeekdaySaturday;
EKRecurrenceFrequencyDaily = 0;
EKRecurrenceFrequencyWeekly = 1;
EKRecurrenceFrequencyMonthly = 2;
EKRecurrenceFrequencyYearly = 3;
EKParticipantTypeUnknown = 0;
EKParticipantTypePerson = 1;
EKParticipantTypeRoom = 2;
EKParticipantTypeResource = 3;
EKParticipantTypeGroup = 4;
EKParticipantRoleUnknown = 0;
EKParticipantRoleRequired = 1;
EKParticipantRoleOptional = 2;
EKParticipantRoleChair = 3;
EKParticipantRoleNonParticipant = 4;
EKParticipantScheduleStatusNone = 0;
EKParticipantScheduleStatusPending = 1;
EKParticipantScheduleStatusSent = 2;
EKParticipantScheduleStatusDelivered = 3;
EKParticipantScheduleStatusRecipientNotRecognized = 4;
EKParticipantScheduleStatusNoPrivileges = 5;
EKParticipantScheduleStatusDeliveryFailed = 6;
EKParticipantScheduleStatusCannotDeliver = 7;
EKParticipantScheduleStatusRecipientNotAllowed = 8;
EKParticipantStatusUnknown = 0;
EKParticipantStatusPending = 1;
EKParticipantStatusAccepted = 2;
EKParticipantStatusDeclined = 3;
EKParticipantStatusTentative = 4;
EKParticipantStatusDelegated = 5;
EKParticipantStatusCompleted = 6;
EKParticipantStatusInProcess = 7;
EKCalendarTypeLocal = 0;
EKCalendarTypeCalDAV = 1;
EKCalendarTypeExchange = 2;
EKCalendarTypeSubscription = 3;
EKCalendarTypeBirthday = 4;
EKCalendarEventAvailabilityNone = 0;
EKCalendarEventAvailabilityBusy = (1 shl 0);
EKCalendarEventAvailabilityFree = (1 shl 1);
EKCalendarEventAvailabilityTentative = (1 shl 2);
EKCalendarEventAvailabilityUnavailable = (1 shl 3);
EKSourceTypeLocal = 0;
EKSourceTypeExchange = 1;
EKSourceTypeCalDAV = 2;
EKSourceTypeMobileMe = 3;
EKSourceTypeSubscribed = 4;
EKSourceTypeBirthdays = 5;
EKEntityTypeEvent = 0;
EKEntityTypeReminder = 1;
EKEntityMaskEvent = (1 shl EKEntityTypeEvent);
EKEntityMaskReminder = (1 shl EKEntityTypeReminder);
EKAlarmProximityNone = 0;
EKAlarmProximityEnter = 1;
EKAlarmProximityLeave = 2;
EKAlarmTypeDisplay = 0;
EKAlarmTypeAudio = 1;
EKAlarmTypeProcedure = 2;
EKAlarmTypeEmail = 3;
EKReminderPriorityNone = 0;
EKReminderPriorityHigh = 1;
EKReminderPriorityMedium = 5;
EKReminderPriorityLow = 9;
EKErrorEventNotMutable = 0;
EKErrorNoCalendar = 1;
EKErrorNoStartDate = 2;
EKErrorNoEndDate = 3;
EKErrorDatesInverted = 4;
EKErrorInternalFailure = 5;
EKErrorCalendarReadOnly = 6;
EKErrorDurationGreaterThanRecurrence = 7;
EKErrorAlarmGreaterThanRecurrence = 8;
EKErrorStartDateTooFarInFuture = 9;
EKErrorStartDateCollidesWithOtherOccurrence = 10;
EKErrorObjectBelongsToDifferentStore = 11;
EKErrorInvitesCannotBeMoved = 12;
EKErrorInvalidSpan = 13;
EKErrorCalendarHasNoSource = 14;
EKErrorCalendarSourceCannotBeModified = 15;
EKErrorCalendarIsImmutable = 16;
EKErrorSourceDoesNotAllowCalendarAddDelete = 17;
EKErrorRecurringReminderRequiresDueDate = 18;
EKErrorStructuredLocationsNotSupported = 19;
EKErrorReminderLocationsNotSupported = 20;
EKErrorAlarmProximityNotSupported = 21;
EKErrorCalendarDoesNotAllowEvents = 22;
EKErrorCalendarDoesNotAllowReminders = 23;
EKErrorSourceDoesNotAllowReminders = 24;
EKErrorSourceDoesNotAllowEvents = 25;
EKErrorPriorityIsInvalid = 26;
EKErrorInvalidEntityType = 27;
EKErrorProcedureAlarmsNotMutable = 28;
EKErrorEventStoreNotAuthorized = 29;
EKErrorOSNotSupported = 30;
EKErrorLast = 31;
EKEventAvailabilityNotSupported = -1;
EKEventAvailabilityBusy = 0;
EKEventAvailabilityFree = 1;
EKEventAvailabilityTentative = 2;
EKEventAvailabilityUnavailable = 3;
EKEventStatusNone = 0;
EKEventStatusConfirmed = 1;
EKEventStatusTentative = 2;
EKEventStatusCanceled = 3;
EKSpanThisEvent = 0;
EKSpanFutureEvents = 1;
type
// ===== Forward declarations =====
{$M+}
EKObject = interface;
EKCalendarItem = interface;
EKStructuredLocation = interface;
EKAlarm = interface;
EKEventStore = interface;
EKSource = interface;
EKCalendar = interface;
EKRecurrenceRule = interface;
EKParticipant = interface;
EKEvent = interface;
EKReminder = interface;
EKRecurrenceDayOfWeek = interface;
EKRecurrenceEnd = interface;
// ===== Framework typedefs =====
{$M+}
NSInteger = Integer;
EKAuthorizationStatus = NSInteger;
EKWeekday = NSInteger;
EKRecurrenceFrequency = NSInteger;
EKParticipantType = NSInteger;
EKParticipantRole = NSInteger;
EKParticipantScheduleStatus = NSInteger;
EKParticipantStatus = NSInteger;
EKCalendarType = NSInteger;
NSUInteger = Cardinal;
EKCalendarEventAvailabilityMask = NSUInteger;
EKSourceType = NSInteger;
EKEntityType = NSUInteger;
EKEntityMask = NSUInteger;
EKAlarmProximity = NSInteger;
EKAlarmType = NSInteger;
EKReminderPriority = NSUInteger;
NSTimeInterval = Double;
CGColorRef = Pointer;
EKErrorCode = NSInteger;
EKEventAvailability = NSInteger;
EKEventStatus = NSInteger;
NSComparisonResult = NSInteger;
EKSpan = NSInteger;
EKEventSearchCallback = procedure(param1: EKEvent; param2: PBoolean)
of object;
EKEventStoreRequestAccessCompletionHandler = procedure(param1: Boolean;
param2: NSError) of object;
TEventKitCompletion = procedure(param1: NSArray) of object;
CFTypeRef = Pointer;
ABAddressBookRef = CFTypeRef;
ABRecordRef = CFTypeRef;
// ===== Interface declarations =====
EKObjectClass = interface(NSObjectClass)
['{A0F96108-28D1-4097-9BDC-DA2953681CCD}']
end;
EKObject = interface(NSObject)
['{57CFBD1A-B7C3-4FE1-8B7C-D1984F94A1D3}']
function hasChanges: Boolean; cdecl;
function isNew: Boolean; cdecl;
procedure reset; cdecl;
procedure rollback; cdecl;
function refresh: Boolean; cdecl;
end;
TEKObject = class(TOCGenericImport<EKObjectClass, EKObject>)
end;
PEKObject = Pointer;
EKCalendarItemClass = interface(EKObjectClass)
['{D5EAFBB2-2212-4E92-88E0-BA6287B452B5}']
end;
EKCalendarItem = interface(EKObject)
['{0EDF256C-2E0B-4FCA-ACD3-40FDE41D09C4}']
function UUID: NSString; cdecl;
procedure setCalendar(calendar: EKCalendar); cdecl;
function calendar: EKCalendar; cdecl;
function calendarItemIdentifier: NSString; cdecl;
function calendarItemExternalIdentifier: NSString; cdecl;
procedure setTitle(title: NSString); cdecl;
function title: NSString; cdecl;
procedure setLocation(location: NSString); cdecl;
function location: NSString; cdecl;
procedure setNotes(notes: NSString); cdecl;
function notes: NSString; cdecl;
procedure setURL(URL: NSURL); cdecl;
function URL: NSURL; cdecl;
function lastModifiedDate: NSDate; cdecl;
function creationDate: NSDate; cdecl;
procedure setTimeZone(timeZone: NSTimeZone); cdecl;
function timeZone: NSTimeZone; cdecl;
function hasAlarms: Boolean; cdecl;
function hasRecurrenceRules: Boolean; cdecl;
function hasAttendees: Boolean; cdecl;
function hasNotes: Boolean; cdecl;
function attendees: NSArray; cdecl;
procedure setAlarms(alarms: NSArray); cdecl;
function alarms: NSArray; cdecl;
procedure addAlarm(alarm: EKAlarm); cdecl;
procedure removeAlarm(alarm: EKAlarm); cdecl;
procedure setRecurrenceRules(recurrenceRules: NSArray); cdecl;
function recurrenceRules: NSArray; cdecl;
procedure addRecurrenceRule(rule: EKRecurrenceRule); cdecl;
procedure removeRecurrenceRule(rule: EKRecurrenceRule); cdecl;
end;
TEKCalendarItem = class(TOCGenericImport<EKCalendarItemClass, EKCalendarItem>)
end;
PEKCalendarItem = Pointer;
EKStructuredLocationClass = interface(EKObjectClass)
['{45033D8E-4F16-45C8-A2D8-8E99CB3953F0}']
{ class } function locationWithTitle(title: NSString)
: Pointer { instancetype }; cdecl;
{ class } function locationWithMapItem(mapItem: MKMapItem)
: Pointer { instancetype }; cdecl;
end;
EKStructuredLocation = interface(EKObject)
['{89E9A5C7-57FB-4ADC-B74F-973F5FF81274}']
procedure setTitle(title: NSString); cdecl;
function title: NSString; cdecl;
procedure setGeoLocation(geoLocation: CLLocation); cdecl;
function geoLocation: CLLocation; cdecl;
procedure setRadius(radius: Double); cdecl;
function radius: Double; cdecl;
end;
TEKStructuredLocation = class(TOCGenericImport<EKStructuredLocationClass,
EKStructuredLocation>)
end;
PEKStructuredLocation = Pointer;
EKAlarmClass = interface(EKObjectClass)
['{01B3E359-BBA3-4F69-AB3E-771EDBA9E313}']
{ class } function alarmWithAbsoluteDate(date: NSDate): EKAlarm; cdecl;
{ class } function alarmWithRelativeOffset(offset: NSTimeInterval)
: EKAlarm; cdecl;
end;
EKAlarm = interface(EKObject)
['{697D4684-532D-4F4C-A8BF-4FBFEFDD8DAE}']
procedure setRelativeOffset(relativeOffset: NSTimeInterval); cdecl;
function relativeOffset: NSTimeInterval; cdecl;
procedure setAbsoluteDate(absoluteDate: NSDate); cdecl;
function absoluteDate: NSDate; cdecl;
procedure setStructuredLocation(structuredLocation
: EKStructuredLocation); cdecl;
function structuredLocation: EKStructuredLocation; cdecl;
procedure setProximity(proximity: EKAlarmProximity); cdecl;
function proximity: EKAlarmProximity; cdecl;
function &type: EKAlarmType; cdecl;
procedure setEmailAddress(emailAddress: NSString); cdecl;
function emailAddress: NSString; cdecl;
procedure setSoundName(soundName: NSString); cdecl;
function soundName: NSString; cdecl;
procedure setURL(URL: NSURL); cdecl;
function URL: NSURL; cdecl;
end;
TEKAlarm = class(TOCGenericImport<EKAlarmClass, EKAlarm>)
end;
PEKAlarm = Pointer;
EKEventStoreClass = interface(NSObjectClass)
['{93E93764-8C35-427B-BE18-11C4AF66C321}']
{ class } function authorizationStatusForEntityType
(entityType: EKEntityType): EKAuthorizationStatus; cdecl;
end;
EKEventStore = interface(NSObject)
['{382A0517-2E3B-4C03-BE99-2A450B79C579}']
function initWithAccessToEntityTypes(entityTypes: EKEntityMask)
: Pointer; cdecl;
function init: Pointer; cdecl;
function initWithSources(sources: NSArray): Pointer { instancetype }; cdecl;
procedure requestAccessToEntityType(entityType: EKEntityType;
completion: EKEventStoreRequestAccessCompletionHandler); cdecl;
function eventStoreIdentifier: NSString; cdecl;
function delegateSources: NSArray; cdecl;
function sources: NSArray; cdecl;
function sourceWithIdentifier(identifier: NSString): EKSource; cdecl;
function calendars: NSArray; cdecl;
function calendarsForEntityType(entityType: EKEntityType): NSArray; cdecl;
function defaultCalendarForNewEvents: EKCalendar; cdecl;
function defaultCalendarForNewReminders: EKCalendar; cdecl;
function calendarWithIdentifier(identifier: NSString): EKCalendar; cdecl;
function saveCalendar(calendar: EKCalendar; commit: Boolean; error: NSError)
: Boolean; cdecl;
function removeCalendar(calendar: EKCalendar; commit: Boolean;
error: NSError): Boolean; cdecl;
function calendarItemWithIdentifier(identifier: NSString)
: EKCalendarItem; cdecl;
function calendarItemsWithExternalIdentifier(externalIdentifier: NSString)
: NSArray; cdecl;
[MethodName('saveEvent:span:error:')]
function saveEventSpanError(event: EKEvent; span: EKSpan; error: NSError)
: Boolean; cdecl;
[MethodName('removeEvent:span:error:')]
function removeEventSpanError(event: EKEvent; span: EKSpan; error: NSError)
: Boolean; cdecl;
[MethodName('saveEvent:span:commit:error:')]
function saveEventSpanCommitError(event: EKEvent; span: EKSpan;
commit: Boolean; error: NSError): Boolean; cdecl;
[MethodName('removeEvent:span:commit:error:')]
function removeEventSpanCommitError(event: EKEvent; span: EKSpan;
commit: Boolean; error: NSError): Boolean; cdecl;
function eventWithIdentifier(identifier: NSString): EKEvent; cdecl;
function eventsMatchingPredicate(predicate: NSPredicate): NSArray; cdecl;
procedure enumerateEventsMatchingPredicate(predicate: NSPredicate;
usingBlock: EKEventSearchCallback); cdecl;
function predicateForEventsWithStartDate(startDate: NSDate; endDate: NSDate;
calendars: NSArray): NSPredicate; cdecl;
function saveReminder(reminder: EKReminder; commit: Boolean; error: NSError)
: Boolean; cdecl;
function removeReminder(reminder: EKReminder; commit: Boolean;
error: NSError): Boolean; cdecl;
function fetchRemindersMatchingPredicate(predicate: NSPredicate;
completion: TEventKitCompletion): Pointer; cdecl;
procedure cancelFetchRequest(fetchIdentifier: Pointer); cdecl;
function predicateForRemindersInCalendars(calendars: NSArray)
: NSPredicate; cdecl;
function predicateForIncompleteRemindersWithDueDateStarting
(startDate: NSDate; ending: NSDate; calendars: NSArray)
: NSPredicate; cdecl;
function predicateForCompletedRemindersWithCompletionDateStarting
(startDate: NSDate; ending: NSDate; calendars: NSArray)
: NSPredicate; cdecl;
function commit(error: NSError): Boolean; cdecl;
procedure reset; cdecl;
procedure refreshSourcesIfNecessary; cdecl;
end;
TEKEventStore = class(TOCGenericImport<EKEventStoreClass, EKEventStore>)
end;
PEKEventStore = Pointer;
EKSourceClass = interface(EKObjectClass)
['{7BF5A4F7-01BD-4DEE-8E4D-8F936A1A419D}']
end;
EKSource = interface(EKObject)
['{A4CC3D8C-48F7-4934-940A-0C9C04BC8132}']
function sourceIdentifier: NSString; cdecl;
function sourceType: EKSourceType; cdecl;
function title: NSString; cdecl;
function calendars: NSSet; cdecl;
function calendarsForEntityType(entityType: EKEntityType): NSSet; cdecl;
end;
TEKSource = class(TOCGenericImport<EKSourceClass, EKSource>)
end;
PEKSource = Pointer;
EKCalendarClass = interface(EKObjectClass)
['{AF315EF6-4A7C-400E-BA71-DB17D8F51AFB}']
{ class } function calendarWithEventStore(eventStore: EKEventStore)
: EKCalendar; cdecl;
{ class } function calendarForEntityType(entityType: EKEntityType;
eventStore: EKEventStore): EKCalendar; cdecl;
end;
EKCalendar = interface(EKObject)
['{995FA6C2-C491-45F6-ADAA-39BB914DAF4E}']
procedure setSource(source: EKSource); cdecl;
function source: EKSource; cdecl;
function calendarIdentifier: NSString; cdecl;
procedure setTitle(title: NSString); cdecl;
function title: NSString; cdecl;
function &type: EKCalendarType; cdecl;
function allowsContentModifications: Boolean; cdecl;
function isSubscribed: Boolean; cdecl;
function isImmutable: Boolean; cdecl;
procedure setCGColor(CGColor: CGColorRef); cdecl;
function CGColor: CGColorRef; cdecl;
function supportedEventAvailabilities
: EKCalendarEventAvailabilityMask; cdecl;
function allowedEntityTypes: EKEntityMask; cdecl;
end;
TEKCalendar = class(TOCGenericImport<EKCalendarClass, EKCalendar>)
end;
PEKCalendar = Pointer;
EKRecurrenceRuleClass = interface(EKObjectClass)
['{807380C0-1794-4A05-A990-598E4100CE7C}']
end;
EKRecurrenceRule = interface(EKObject)
['{25E0D0B1-777C-4584-9EE9-44EDBD8593BA}']
[MethodName('initRecurrenceWithFrequency:interval:end:')]
function initRecurrenceWithFrequencyIntervalEnd
(&type: EKRecurrenceFrequency; interval: NSInteger; &end: EKRecurrenceEnd)
: Pointer { instancetype }; cdecl;
[MethodName
('initRecurrenceWithFrequency:interval:daysOfTheWeek:daysOfTheMonth:monthsOfTheYear:weeksOfTheYear:daysOfTheYear:setPositions:end:')
]
function initRecurrenceWithFrequencyIntervalDaysOfTheWeekDaysOfTheMonthMonthsOfTheYearWeeksOfTheYearDaysOfTheYearSetPositionsEnd
(&type: EKRecurrenceFrequency; interval: NSInteger;
daysOfTheWeek: NSArray; daysOfTheMonth: NSArray; monthsOfTheYear: NSArray;
weeksOfTheYear: NSArray; daysOfTheYear: NSArray; setPositions: NSArray;
&end: EKRecurrenceEnd): Pointer { instancetype }; cdecl;
function calendarIdentifier: NSString; cdecl;
procedure setRecurrenceEnd(recurrenceEnd: EKRecurrenceEnd); cdecl;
function recurrenceEnd: EKRecurrenceEnd; cdecl;
function frequency: EKRecurrenceFrequency; cdecl;
function interval: NSInteger; cdecl;
function firstDayOfTheWeek: NSInteger; cdecl;
function daysOfTheWeek: NSArray; cdecl;
function daysOfTheMonth: NSArray; cdecl;
function daysOfTheYear: NSArray; cdecl;
function weeksOfTheYear: NSArray; cdecl;
function monthsOfTheYear: NSArray; cdecl;
function setPositions: NSArray; cdecl;
end;
TEKRecurrenceRule = class(TOCGenericImport<EKRecurrenceRuleClass,
EKRecurrenceRule>)
end;
PEKRecurrenceRule = Pointer;
EKParticipantClass = interface(EKObjectClass)
['{D5D0DB3D-8240-460E-A85D-9539DB235C8A}']
end;
EKParticipant = interface(EKObject)
['{D633099A-960F-438C-9487-5E2A57CF291A}']
function URL: NSURL; cdecl;
function name: NSString; cdecl;
function participantStatus: EKParticipantStatus; cdecl;
function participantRole: EKParticipantRole; cdecl;
function participantType: EKParticipantType; cdecl;
function isCurrentUser: Boolean; cdecl;
function contactPredicate: NSPredicate; cdecl;
function ABRecordWithAddressBook(AddressBook: ABAddressBookRef)
: ABRecordRef; cdecl;
end;
TEKParticipant = class(TOCGenericImport<EKParticipantClass, EKParticipant>)
end;
PEKParticipant = Pointer;
EKEventClass = interface(EKCalendarItemClass)
['{ED3586B0-00AF-4225-A27C-42B82A31CE41}']
{ class } function eventWithEventStore(eventStore: EKEventStore)
: EKEvent; cdecl;
end;
EKEvent = interface(EKCalendarItem)
['{D04C33C0-5A5B-4084-A899-D830671DCBD7}']
function eventIdentifier: NSString; cdecl;
procedure setAllDay(allDay: Boolean); cdecl;
function isAllDay: Boolean; cdecl;
procedure setStartDate(startDate: NSDate); cdecl;
function startDate: NSDate; cdecl;
procedure setEndDate(endDate: NSDate); cdecl;
function endDate: NSDate; cdecl;
procedure setStructuredLocation(structuredLocation
: EKStructuredLocation); cdecl;
function structuredLocation: EKStructuredLocation; cdecl;
function compareStartDateWithEvent(other: EKEvent)
: NSComparisonResult; cdecl;
function organizer: EKParticipant; cdecl;
procedure setAvailability(availability: EKEventAvailability); cdecl;
function availability: EKEventAvailability; cdecl;
function status: EKEventStatus; cdecl;
function isDetached: Boolean; cdecl;
function occurrenceDate: NSDate; cdecl;
function refresh: Boolean; cdecl;
function birthdayContactIdentifier: NSString; cdecl;
function birthdayPersonID: NSInteger; cdecl;
function birthdayPersonUniqueID: NSString; cdecl;
end;
TEKEvent = class(TOCGenericImport<EKEventClass, EKEvent>)
end;
PEKEvent = Pointer;
EKReminderClass = interface(EKCalendarItemClass)
['{809408B1-138B-40D3-BF99-E66D73D41134}']
{ class } function reminderWithEventStore(eventStore: EKEventStore)
: EKReminder; cdecl;
end;
EKReminder = interface(EKCalendarItem)
['{F5CE7862-436E-4325-8AD6-3066AB940154}']
procedure setStartDateComponents(startDateComponents
: NSDateComponents); cdecl;
function startDateComponents: NSDateComponents; cdecl;
procedure setDueDateComponents(dueDateComponents: NSDateComponents); cdecl;
function dueDateComponents: NSDateComponents; cdecl;
procedure setCompleted(completed: Boolean); cdecl;
function isCompleted: Boolean; cdecl;
procedure setCompletionDate(completionDate: NSDate); cdecl;
function completionDate: NSDate; cdecl;
procedure setPriority(priority: NSUInteger); cdecl;
function priority: NSUInteger; cdecl;
end;
TEKReminder = class(TOCGenericImport<EKReminderClass, EKReminder>)
end;
PEKReminder = Pointer;
EKRecurrenceDayOfWeekClass = interface(NSObjectClass)
['{FF3DD0B4-6502-4537-AC22-E4D3515878F5}']
[MethodName('dayOfWeek:')]
{ class } function dayOfWeek(dayOfTheWeek: EKWeekday)
: Pointer { instancetype }; cdecl;
[MethodName('dayOfWeek:weekNumber:')]
{ class } function dayOfWeekWeekNumber(dayOfTheWeek: EKWeekday;
weekNumber: NSInteger): Pointer { instancetype }; cdecl;
end;
EKRecurrenceDayOfWeek = interface(NSObject)
['{E3EA3BE1-043A-4269-95FF-845D0294DFB3}']
function initWithDayOfTheWeek(dayOfTheWeek: EKWeekday;
weekNumber: NSInteger): Pointer; cdecl;
function dayOfTheWeek: EKWeekday; cdecl;
function weekNumber: NSInteger; cdecl;
end;
TEKRecurrenceDayOfWeek = class(TOCGenericImport<EKRecurrenceDayOfWeekClass,
EKRecurrenceDayOfWeek>)
end;
PEKRecurrenceDayOfWeek = Pointer;
EKRecurrenceEndClass = interface(NSObjectClass)
['{25778F06-60F5-4EC6-97E4-F682BF4BB94A}']
{ class } function recurrenceEndWithEndDate(endDate: NSDate)
: Pointer { instancetype }; cdecl;
{ class } function recurrenceEndWithOccurrenceCount(occurrenceCount
: NSUInteger): Pointer { instancetype }; cdecl;
end;
EKRecurrenceEnd = interface(NSObject)
['{75A0A693-5D43-404C-A6E6-2309540114E9}']
function endDate: NSDate; cdecl;
function occurrenceCount: NSUInteger; cdecl;
end;
TEKRecurrenceEnd = class(TOCGenericImport<EKRecurrenceEndClass,
EKRecurrenceEnd>)
end;
PEKRecurrenceEnd = Pointer;
// ===== Exported string consts =====
function EKErrorDomain: NSString;
function EKEventStoreChangedNotification: NSString;
// ===== External functions =====
const
libEventKit = '/System/Library/Frameworks/EventKit.framework/EventKit';
implementation
{$IF defined(IOS) and NOT defined(CPUARM)}
uses
Posix.Dlfcn;
var
EventKitModule: THandle;
{$ENDIF IOS}
function EKErrorDomain: NSString;
begin
Result := CocoaNSStringConst(libEventKit, 'EKErrorDomain');
end;
function EKEventStoreChangedNotification: NSString;
begin
Result := CocoaNSStringConst(libEventKit, 'EKEventStoreChangedNotification');
end;
{$IF defined(IOS) and NOT defined(CPUARM)}
initialization
EventKitModule := dlopen(MarshaledAString(libEventKit), RTLD_LAZY);
finalization
dlclose(EventKitModule);
{$ENDIF IOS}
end.