ABActions.pas 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //
  2. // ABActionsC.h
  3. // AddressBook Framework
  4. //
  5. // Copyright (c) 2003 Apple Computer. All rights reserved.
  6. //
  7. { Pascal Translation: Peter N Lewis, <[email protected]>, 2004 }
  8. {
  9. Modified for use with Free Pascal
  10. Version 200
  11. Please report any bugs to <[email protected]>
  12. }
  13. {$mode macpas}
  14. {$packenum 1}
  15. {$macro on}
  16. {$inline on}
  17. {$CALLING MWPASCAL}
  18. unit ABActions;
  19. interface
  20. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  21. {$setc GAP_INTERFACES_VERSION := $0200}
  22. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  23. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  24. {$endc}
  25. {$ifc defined CPUPOWERPC and defined CPUI386}
  26. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  27. {$endc}
  28. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  29. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  30. {$endc}
  31. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  32. {$setc __ppc__ := 1}
  33. {$elsec}
  34. {$setc __ppc__ := 0}
  35. {$endc}
  36. {$ifc not defined __i386__ and defined CPUI386}
  37. {$setc __i386__ := 1}
  38. {$elsec}
  39. {$setc __i386__ := 0}
  40. {$endc}
  41. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  42. {$error Conflicting definitions for __ppc__ and __i386__}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__}
  45. {$setc TARGET_CPU_PPC := TRUE}
  46. {$setc TARGET_CPU_X86 := FALSE}
  47. {$elifc defined __i386__ and __i386__}
  48. {$setc TARGET_CPU_PPC := FALSE}
  49. {$setc TARGET_CPU_X86 := TRUE}
  50. {$elsec}
  51. {$error Neither __ppc__ nor __i386__ is defined.}
  52. {$endc}
  53. {$setc TARGET_CPU_PPC_64 := FALSE}
  54. {$ifc defined FPC_BIG_ENDIAN}
  55. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  56. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  57. {$elifc defined FPC_LITTLE_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  60. {$elsec}
  61. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  62. {$endc}
  63. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  64. {$setc CALL_NOT_IN_CARBON := FALSE}
  65. {$setc OLDROUTINENAMES := FALSE}
  66. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  67. {$setc OPAQUE_UPP_TYPES := TRUE}
  68. {$setc OTCARBONAPPLICATION := TRUE}
  69. {$setc OTKERNEL := FALSE}
  70. {$setc PM_USE_SESSION_APIS := TRUE}
  71. {$setc TARGET_API_MAC_CARBON := TRUE}
  72. {$setc TARGET_API_MAC_OS8 := FALSE}
  73. {$setc TARGET_API_MAC_OSX := TRUE}
  74. {$setc TARGET_CARBON := TRUE}
  75. {$setc TARGET_CPU_68K := FALSE}
  76. {$setc TARGET_CPU_MIPS := FALSE}
  77. {$setc TARGET_CPU_SPARC := FALSE}
  78. {$setc TARGET_OS_MAC := TRUE}
  79. {$setc TARGET_OS_UNIX := FALSE}
  80. {$setc TARGET_OS_WIN32 := FALSE}
  81. {$setc TARGET_RT_MAC_68881 := FALSE}
  82. {$setc TARGET_RT_MAC_CFM := FALSE}
  83. {$setc TARGET_RT_MAC_MACHO := TRUE}
  84. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  85. {$setc TYPE_BOOL := FALSE}
  86. {$setc TYPE_EXTENDED := FALSE}
  87. {$setc TYPE_LONGLONG := TRUE}
  88. uses MacTypes,ABAddressBook,CFBase;
  89. {$ALIGN MAC68K}
  90. // --------------------------------------------------------------------------------
  91. // Action Support
  92. // --------------------------------------------------------------------------------
  93. // This API allows developers to populate AddressBook.app's roll-over menus with custom
  94. // entries. Your CFBundle must implement a function named ABActionRegisterCallbacks which
  95. // will return a pointer to an ABActionCallbacks struct. This struct should be filled out
  96. // as follows:
  97. //
  98. // version: The version of this structure is 0.
  99. //
  100. // proprty: A pointer to a function that returns the AddressBook property this action applies
  101. // to. Only items with labels may have actions at this time. (emails, phones, birthdays, etc)
  102. //
  103. // title: A pointer to a function which returns a copy of the title to be displayed. This function
  104. // takes two parameters, the selected person and item identifier. The item identifier will be NULL
  105. // for single value properties. AddressBook will release this string when it's done with it.
  106. //
  107. // enabled: A pointer to a function which returns YES if the action should be enabled for the
  108. // passed ABPersonRef and item identifier. The item identifier will be NULL for single value
  109. // properties. This field may be NULL. Actions with NULL enabled callbacks will always be enabled.
  110. //
  111. // selected. A pointer to a function which will be called when the user selects this action.
  112. // It's passed an ABPersonRef and item identifier. The item identifier will be NULL for single
  113. // value properties.
  114. //
  115. // Action plugins are stored in ~/Library/Address Book Plug-Ins or /Library/Address Book Plug-Ins
  116. //
  117. // There can be only 1 Action plug in per bundle.
  118. type ABActionGetPropertyCallback = function: CFStringRef;
  119. type ABActionCopyTitleCallback = function( person: ABPersonRef; identifier: CFStringRef ): CFStringRef;
  120. type ABActionEnabledCallback = function( person: ABPersonRef; identifier: CFStringRef ): Boolean;
  121. type ABActionSelectedCallback = procedure( person: ABPersonRef; identifier: CFStringRef );
  122. type ABActionCallbacks = record
  123. version: CFIndex;
  124. proprty: ABActionGetPropertyCallback;
  125. title: ABActionCopyTitleCallback;
  126. enabled: ABActionEnabledCallback;
  127. selected: ABActionSelectedCallback;
  128. end;
  129. // Your CFBundle MUST include a function named ABActionRegisterCallbacks which returns a pointer
  130. // to a filled out ABActionCallbacks struct:
  131. //
  132. // ABActionCallbacks* ABActionRegisterCallbacks(void);
  133. end.