-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathiOSapi.AddressBookUI.pas
418 lines (350 loc) · 13.9 KB
/
iOSapi.AddressBookUI.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
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
{ *********************************************************** }
{ }
{ CodeGear Delphi Runtime Library }
{ }
{ Copyright(c) 2012-2014 Embarcadero Technologies, Inc. }
{ }
{ *********************************************************** }
//
// Delphi-Objective-C Bridge
// Interfaces for Cocoa framework AddressBookUI
//
unit iOSapi.AddressBookUI;
interface
uses
Macapi.CoreFoundation,
Macapi.CoreServices,
Macapi.Dispatch,
Macapi.Foundation,
Macapi.Mach,
Macapi.ObjCRuntime,
Macapi.ObjectiveC,
Macapi.QuartzCore,
iOSapi.AddressBook,
iOSapi.CocoaTypes,
iOSapi.Foundation,
iOSapi.QuartzCore,
iOSapi.UIKit;
type
// ===== Forward declarations =====
{$M+}
ABNewPersonViewControllerDelegate = interface;
ABNewPersonViewController = interface;
ABPeoplePickerNavigationControllerDelegate = interface;
ABPeoplePickerNavigationController = interface;
ABPersonViewControllerDelegate = interface;
ABPersonViewController = interface;
ABUnknownPersonViewControllerDelegate = interface;
ABUnknownPersonViewController = interface;
// ===== Framework typedefs =====
{$M+}
CFTypeRef = Pointer;
ABAddressBookRef = CFTypeRef;
ABRecordRef = CFTypeRef;
ABPropertyID = Int32;
ABMultiValueIdentifier = Int32;
// ===== Interface declarations =====
ABNewPersonViewControllerClass = interface(UIViewControllerClass)
['{4571460B-69EC-489F-BAE6-C7E432D360B7}']
end;
ABNewPersonViewController = interface(UIViewController)
['{BCE90F05-F212-4A2C-B757-98AA1C014FDE}']
procedure setNewPersonViewDelegate(newPersonViewDelegate: Pointer); cdecl;
function newPersonViewDelegate: Pointer; cdecl;
procedure setAddressBook(AddressBook: ABAddressBookRef); cdecl;
function AddressBook: ABAddressBookRef; cdecl;
procedure setDisplayedPerson(displayedPerson: ABRecordRef); cdecl;
function displayedPerson: ABRecordRef; cdecl;
procedure setParentGroup(parentGroup: ABRecordRef); cdecl;
function parentGroup: ABRecordRef; cdecl;
end;
TABNewPersonViewController = class
(TOCGenericImport<ABNewPersonViewControllerClass,
ABNewPersonViewController>)
end;
PABNewPersonViewController = Pointer;
ABPeoplePickerNavigationControllerClass = interface
(UINavigationControllerClass)
['{192F2AEB-B84C-445A-8E96-1E7A55082649}']
end;
ABPeoplePickerNavigationController = interface(UINavigationController)
['{2A306CAC-B549-4712-9830-16ADA399B323}']
procedure setPeoplePickerDelegate(peoplePickerDelegate: Pointer); cdecl;
function peoplePickerDelegate: Pointer; cdecl;
procedure setDisplayedProperties(displayedProperties: NSArray); cdecl;
function displayedProperties: NSArray; cdecl;
procedure setAddressBook(AddressBook: ABAddressBookRef); cdecl;
function AddressBook: ABAddressBookRef; cdecl;
procedure setPredicateForEnablingPerson(predicateForEnablingPerson
: NSPredicate); cdecl;
function predicateForEnablingPerson: NSPredicate; cdecl;
procedure setPredicateForSelectionOfPerson(predicateForSelectionOfPerson
: NSPredicate); cdecl;
function predicateForSelectionOfPerson: NSPredicate; cdecl;
procedure setPredicateForSelectionOfProperty(predicateForSelectionOfProperty
: NSPredicate); cdecl;
function predicateForSelectionOfProperty: NSPredicate; cdecl;
end;
TABPeoplePickerNavigationController = class
(TOCGenericImport<ABPeoplePickerNavigationControllerClass,
ABPeoplePickerNavigationController>)
end;
PABPeoplePickerNavigationController = Pointer;
ABPersonViewControllerClass = interface(UIViewControllerClass)
['{5E7F229A-B5B6-4A7B-AE3E-A8ABE0730AEB}']
end;
ABPersonViewController = interface(UIViewController)
['{A9A07ADA-BF64-4C43-9E43-2F1CE94E6FA9}']
procedure setPersonViewDelegate(personViewDelegate: Pointer); cdecl;
function personViewDelegate: Pointer; cdecl;
procedure setAddressBook(AddressBook: ABAddressBookRef); cdecl;
function AddressBook: ABAddressBookRef; cdecl;
procedure setDisplayedPerson(displayedPerson: ABRecordRef); cdecl;
function displayedPerson: ABRecordRef; cdecl;
procedure setDisplayedProperties(displayedProperties: NSArray); cdecl;
function displayedProperties: NSArray; cdecl;
procedure setAllowsEditing(allowsEditing: Boolean); cdecl;
function allowsEditing: Boolean; cdecl;
procedure setAllowsActions(allowsActions: Boolean); cdecl;
function allowsActions: Boolean; cdecl;
procedure setShouldShowLinkedPeople(shouldShowLinkedPeople: Boolean); cdecl;
function shouldShowLinkedPeople: Boolean; cdecl;
procedure setHighlightedItemForProperty(&property: ABPropertyID;
withIdentifier: ABMultiValueIdentifier); cdecl;
end;
TABPersonViewController = class(TOCGenericImport<ABPersonViewControllerClass,
ABPersonViewController>)
end;
PABPersonViewController = Pointer;
ABUnknownPersonViewControllerClass = interface(UIViewControllerClass)
['{A1E52885-B132-41E7-8CC2-CB36211C2C6D}']
end;
ABUnknownPersonViewController = interface(UIViewController)
['{075CEC2F-47F5-44E4-9445-ADD753BE18C3}']
procedure setUnknownPersonViewDelegate(unknownPersonViewDelegate
: Pointer); cdecl;
function unknownPersonViewDelegate: Pointer; cdecl;
procedure setAddressBook(AddressBook: ABAddressBookRef); cdecl;
function AddressBook: ABAddressBookRef; cdecl;
procedure setDisplayedPerson(displayedPerson: ABRecordRef); cdecl;
function displayedPerson: ABRecordRef; cdecl;
procedure setAlternateName(alternateName: NSString); cdecl;
function alternateName: NSString; cdecl;
procedure setMessage(message: NSString); cdecl;
function message: NSString; cdecl;
procedure setAllowsActions(allowsActions: Boolean); cdecl;
function allowsActions: Boolean; cdecl;
procedure setAllowsAddingToAddressBook(allowsAddingToAddressBook
: Boolean); cdecl;
function allowsAddingToAddressBook: Boolean; cdecl;
end;
TABUnknownPersonViewController = class
(TOCGenericImport<ABUnknownPersonViewControllerClass,
ABUnknownPersonViewController>)
end;
PABUnknownPersonViewController = Pointer;
// ===== Protocol declarations =====
ABNewPersonViewControllerDelegate = interface(IObjectiveC)
['{E4AE69F9-61EE-40C8-B50D-C65203E913B5}']
procedure newPersonViewController(newPersonView: ABNewPersonViewController;
didCompleteWithNewPerson: ABRecordRef); cdecl;
end;
ABPeoplePickerNavigationControllerDelegate = interface(IObjectiveC)
['{8B8ED31E-1D13-41A1-BE75-A03C103B60B1}']
[MethodName('peoplePickerNavigationController:didSelectPerson:')]
procedure peoplePickerNavigationControllerDidSelectPerson
(peoplePicker: ABPeoplePickerNavigationController;
didSelectPerson: ABRecordRef); cdecl;
[MethodName
('peoplePickerNavigationController:didSelectPerson:property:identifier:')]
procedure peoplePickerNavigationControllerDidSelectPersonPropertyIdentifier
(peoplePicker: ABPeoplePickerNavigationController;
didSelectPerson: ABRecordRef; &property: ABPropertyID;
identifier: ABMultiValueIdentifier); cdecl;
procedure peoplePickerNavigationControllerDidCancel
(peoplePicker: ABPeoplePickerNavigationController); cdecl;
[MethodName
('peoplePickerNavigationController:shouldContinueAfterSelectingPerson:')]
function peoplePickerNavigationControllerShouldContinueAfterSelectingPerson
(peoplePicker: ABPeoplePickerNavigationController;
shouldContinueAfterSelectingPerson: ABRecordRef): Boolean; cdecl;
[MethodName
('peoplePickerNavigationController:shouldContinueAfterSelectingPerson:property:identifier:')
]
function peoplePickerNavigationControllerShouldContinueAfterSelectingPersonPropertyIdentifier
(peoplePicker: ABPeoplePickerNavigationController;
shouldContinueAfterSelectingPerson: ABRecordRef; &property: ABPropertyID;
identifier: ABMultiValueIdentifier): Boolean; cdecl;
end;
ABPersonViewControllerDelegate = interface(IObjectiveC)
['{CD9E87CC-53A9-430D-A1BC-1D6662F4E2D4}']
function personViewController(personViewController: ABPersonViewController;
shouldPerformDefaultActionForPerson: ABRecordRef; &property: ABPropertyID;
identifier: ABMultiValueIdentifier): Boolean; cdecl;
end;
ABUnknownPersonViewControllerDelegate = interface(IObjectiveC)
['{BF851CF9-0A0E-4257-95B5-9FB52124A7F1}']
[MethodName('unknownPersonViewController:didResolveToPerson:')]
procedure unknownPersonViewControllerDidResolveToPerson
(unknownCardViewController: ABUnknownPersonViewController;
didResolveToPerson: ABRecordRef); cdecl;
[MethodName
('unknownPersonViewController:shouldPerformDefaultActionForPerson:property:identifier:')
]
function unknownPersonViewControllerShouldPerformDefaultActionForPersonPropertyIdentifier
(personViewController: ABUnknownPersonViewController;
shouldPerformDefaultActionForPerson: ABRecordRef; &property: ABPropertyID;
identifier: ABMultiValueIdentifier): Boolean; cdecl;
end;
// ===== Exported string consts =====
function NSString: Pointer;
function ABPersonNamePrefixProperty: NSString;
function ABPersonGivenNameProperty: NSString;
function ABPersonMiddleNameProperty: NSString;
function ABPersonFamilyNameProperty: NSString;
function ABPersonNameSuffixProperty: NSString;
function ABPersonPreviousFamilyNameProperty: NSString;
function ABPersonNicknameProperty: NSString;
function ABPersonPhoneticGivenNameProperty: NSString;
function ABPersonPhoneticMiddleNameProperty: NSString;
function ABPersonPhoneticFamilyNameProperty: NSString;
function ABPersonOrganizationNameProperty: NSString;
function ABPersonDepartmentNameProperty: NSString;
function ABPersonJobTitleProperty: NSString;
function ABPersonBirthdayProperty: NSString;
function ABPersonNoteProperty: NSString;
function ABPersonPhoneNumbersProperty: NSString;
function ABPersonEmailAddressesProperty: NSString;
function ABPersonUrlAddressesProperty: NSString;
function ABPersonDatesProperty: NSString;
function ABPersonInstantMessageAddressesProperty: NSString;
function ABPersonRelatedNamesProperty: NSString;
function ABPersonSocialProfilesProperty: NSString;
function ABPersonPostalAddressesProperty: NSString;
// ===== External functions =====
const
libAddressBookUI =
'/System/Library/Frameworks/AddressBookUI.framework/AddressBookUI';
implementation
{$IF defined(IOS) and NOT defined(CPUARM)}
uses
Posix.Dlfcn;
var
AddressBookUIModule: THandle;
{$ENDIF IOS}
function ABPersonNamePrefixProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonNamePrefixProperty');
end;
function ABPersonGivenNameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonGivenNameProperty');
end;
function ABPersonMiddleNameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonMiddleNameProperty');
end;
function ABPersonFamilyNameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonFamilyNameProperty');
end;
function ABPersonNameSuffixProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonNameSuffixProperty');
end;
function ABPersonPreviousFamilyNameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonPreviousFamilyNameProperty');
end;
function ABPersonNicknameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonNicknameProperty');
end;
function ABPersonPhoneticGivenNameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonPhoneticGivenNameProperty');
end;
function ABPersonPhoneticMiddleNameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonPhoneticMiddleNameProperty');
end;
function ABPersonPhoneticFamilyNameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonPhoneticFamilyNameProperty');
end;
function ABPersonOrganizationNameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonOrganizationNameProperty');
end;
function ABPersonDepartmentNameProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonDepartmentNameProperty');
end;
function ABPersonJobTitleProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonJobTitleProperty');
end;
function ABPersonBirthdayProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonBirthdayProperty');
end;
function ABPersonNoteProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonNoteProperty');
end;
function ABPersonPhoneNumbersProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonPhoneNumbersProperty');
end;
function ABPersonEmailAddressesProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonEmailAddressesProperty');
end;
function ABPersonUrlAddressesProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonUrlAddressesProperty');
end;
function ABPersonDatesProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI, 'ABPersonDatesProperty');
end;
function ABPersonInstantMessageAddressesProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonInstantMessageAddressesProperty');
end;
function ABPersonRelatedNamesProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonRelatedNamesProperty');
end;
function ABPersonSocialProfilesProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonSocialProfilesProperty');
end;
function ABPersonPostalAddressesProperty: NSString;
begin
Result := CocoaNSStringConst(libAddressBookUI,
'ABPersonPostalAddressesProperty');
end;
function NSString: Pointer;
begin
Result := CocoaPointerConst(libAddressBookUI, 'NSString');
end;
{$IF defined(IOS) and NOT defined(CPUARM)}
initialization
AddressBookUIModule := dlopen(MarshaledAString(libAddressBookUI), RTLD_LAZY);
finalization
dlclose(AddressBookUIModule);
{$ENDIF IOS}
end.