CFRunLoop.pas 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. { CFRunLoop.h
  2. Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
  3. }
  4. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, September 2005 }
  5. {
  6. Modified for use with Free Pascal
  7. Version 200
  8. Please report any bugs to <[email protected]>
  9. }
  10. {$mode macpas}
  11. {$packenum 1}
  12. {$macro on}
  13. {$inline on}
  14. {$CALLING MWPASCAL}
  15. unit CFRunLoop;
  16. interface
  17. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  18. {$setc GAP_INTERFACES_VERSION := $0200}
  19. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  20. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  21. {$endc}
  22. {$ifc defined CPUPOWERPC and defined CPUI386}
  23. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  24. {$endc}
  25. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  26. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  27. {$endc}
  28. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  29. {$setc __ppc__ := 1}
  30. {$elsec}
  31. {$setc __ppc__ := 0}
  32. {$endc}
  33. {$ifc not defined __i386__ and defined CPUI386}
  34. {$setc __i386__ := 1}
  35. {$elsec}
  36. {$setc __i386__ := 0}
  37. {$endc}
  38. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  39. {$error Conflicting definitions for __ppc__ and __i386__}
  40. {$endc}
  41. {$ifc defined __ppc__ and __ppc__}
  42. {$setc TARGET_CPU_PPC := TRUE}
  43. {$setc TARGET_CPU_X86 := FALSE}
  44. {$elifc defined __i386__ and __i386__}
  45. {$setc TARGET_CPU_PPC := FALSE}
  46. {$setc TARGET_CPU_X86 := TRUE}
  47. {$elsec}
  48. {$error Neither __ppc__ nor __i386__ is defined.}
  49. {$endc}
  50. {$setc TARGET_CPU_PPC_64 := FALSE}
  51. {$ifc defined FPC_BIG_ENDIAN}
  52. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  53. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  54. {$elifc defined FPC_LITTLE_ENDIAN}
  55. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  56. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  57. {$elsec}
  58. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  59. {$endc}
  60. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  61. {$setc CALL_NOT_IN_CARBON := FALSE}
  62. {$setc OLDROUTINENAMES := FALSE}
  63. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  64. {$setc OPAQUE_UPP_TYPES := TRUE}
  65. {$setc OTCARBONAPPLICATION := TRUE}
  66. {$setc OTKERNEL := FALSE}
  67. {$setc PM_USE_SESSION_APIS := TRUE}
  68. {$setc TARGET_API_MAC_CARBON := TRUE}
  69. {$setc TARGET_API_MAC_OS8 := FALSE}
  70. {$setc TARGET_API_MAC_OSX := TRUE}
  71. {$setc TARGET_CARBON := TRUE}
  72. {$setc TARGET_CPU_68K := FALSE}
  73. {$setc TARGET_CPU_MIPS := FALSE}
  74. {$setc TARGET_CPU_SPARC := FALSE}
  75. {$setc TARGET_OS_MAC := TRUE}
  76. {$setc TARGET_OS_UNIX := FALSE}
  77. {$setc TARGET_OS_WIN32 := FALSE}
  78. {$setc TARGET_RT_MAC_68881 := FALSE}
  79. {$setc TARGET_RT_MAC_CFM := FALSE}
  80. {$setc TARGET_RT_MAC_MACHO := TRUE}
  81. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  82. {$setc TYPE_BOOL := FALSE}
  83. {$setc TYPE_EXTENDED := FALSE}
  84. {$setc TYPE_LONGLONG := TRUE}
  85. uses MacTypes,CFBase,CFArray,CFDate,CFString,MacOSXPosix;
  86. {$ALIGN POWER}
  87. {!
  88. @header CFRunLoop
  89. CFRunLoops monitor sources of input to a task and dispatch control
  90. when sources become ready for processing. Examples of input sources
  91. might include user input devices, network connections, periodic
  92. or time-delayed events, and asynchronous callbacks. Input sources
  93. are registered with a run loop, and when a run loop is "run",
  94. callback functions associated with each source are called when
  95. the sources have some activity.
  96. There is one run loop per thread. Each run loop has different
  97. sets of input sources, called modes, which are named with strings.
  98. A run loop is run -- in a named mode -- to have it monitor the
  99. sources that have been registered in that mode, and the run loop
  100. blocks there until something happens. Examples of modes include
  101. the default mode, which a process would normally spend most of
  102. its time in, and a modal panel mode, which might be run when
  103. a modal panel is up, to restrict the set of input sources that
  104. are allowed to "fire". This is not to the granularity of, for
  105. example, what type of user input events are interesting, however.
  106. That sort of finer-grained granularity is given by UI-level
  107. frameworks with "get next event matching mask" or similar
  108. functionality.
  109. The CFRunLoopSource type is an abstraction of input sources that
  110. can be put in a run loop. An input source type would normally
  111. define an API for creating and operating on instances of the type,
  112. as if it were a separate entity from the run loop, then provide a
  113. function to create a CFRunLoopSource for an instance. The
  114. CFRunLoopSource can then be registered with the run loop,
  115. represents the input source to the run loop, and acts as
  116. intermediary between the run loop and the actual input source
  117. type instance. Examples include CFMachPort and CFSocket.
  118. A CFRunLoopTimer is a specialization of run loop sources, a way
  119. to generate either a one-shot delayed action, or a recurrent
  120. action.
  121. While being run, a run loop goes through a cycle of activities.
  122. Input sources are checked, timers which need firing are fired,
  123. and then the run loop blocks, waiting for something to happen
  124. (or in the case of timers, waiting for it to be time for
  125. something to happen). When something does happen, the run loop
  126. wakes up, processes the activity (usually by calling a callback
  127. function for an input source), checks other sources, fires timers,
  128. and goes back to sleep. And so on. CFRunLoopObservers can be
  129. used to do processing at special points in this cycle.
  130. }
  131. {!
  132. @typedef CFRunLoopRef
  133. This is the type of a reference to a run loop.
  134. }
  135. type
  136. CFRunLoopRef = ^SInt32; { an opaque 32-bit type }
  137. {!
  138. @typedef CFRunLoopSourceRef
  139. This is the type of a reference to general run loop input sources.
  140. }
  141. type
  142. CFRunLoopSourceRef = ^SInt32; { an opaque 32-bit type }
  143. {!
  144. @typedef CFRunLoopObserverRef
  145. This is the type of a reference to a run loop observer.
  146. }
  147. type
  148. CFRunLoopObserverRef = ^SInt32; { an opaque 32-bit type }
  149. {!
  150. @typedef CFRunLoopTimerRef
  151. This is the type of a reference to a run loop timer.
  152. }
  153. type
  154. CFRunLoopTimerRef = ^SInt32; { an opaque 32-bit type }
  155. { Reasons for CFRunLoopRunInMode() to Return }
  156. const
  157. kCFRunLoopRunFinished = 1;
  158. kCFRunLoopRunStopped = 2;
  159. kCFRunLoopRunTimedOut = 3;
  160. kCFRunLoopRunHandledSource = 4;
  161. { Run Loop Observer Activities }
  162. type
  163. CFRunLoopActivity = UInt32;
  164. const
  165. kCFRunLoopEntry = 1 shl 0;
  166. kCFRunLoopBeforeTimers = 1 shl 1;
  167. kCFRunLoopBeforeSources = 1 shl 2;
  168. kCFRunLoopBeforeWaiting = 1 shl 5;
  169. kCFRunLoopAfterWaiting = 1 shl 6;
  170. kCFRunLoopExit = 1 shl 7;
  171. kCFRunLoopAllActivities = $0FFFFFFF;
  172. var kCFRunLoopDefaultMode: CFStringRef; external name '_kCFRunLoopDefaultMode'; (* attribute const *)
  173. var kCFRunLoopCommonModes: CFStringRef; external name '_kCFRunLoopCommonModes'; (* attribute const *)
  174. {!
  175. @function CFRunLoopGetTypeID
  176. Returns the type identifier of all CFRunLoop instances.
  177. }
  178. function CFRunLoopGetTypeID: CFTypeID; external name '_CFRunLoopGetTypeID';
  179. {!
  180. @function CFRunLoopGetCurrent
  181. Returns the run loop for the current thread. There is exactly
  182. one run loop per thread.
  183. }
  184. function CFRunLoopGetCurrent: CFRunLoopRef; external name '_CFRunLoopGetCurrent';
  185. {!
  186. @function CFRunLoopCopyCurrentMode
  187. Returns the name of the mode in which the run loop is running.
  188. NULL is returned if the run loop is not running.
  189. @param rl The run loop for which the current mode should be
  190. reported.
  191. }
  192. function CFRunLoopCopyCurrentMode( rl: CFRunLoopRef ): CFStringRef; external name '_CFRunLoopCopyCurrentMode';
  193. {!
  194. @function CFRunLoopCopyAllModes
  195. Returns an array of all the names of the modes known to the run
  196. loop.
  197. @param rl The run loop for which the mode list should be returned.
  198. }
  199. function CFRunLoopCopyAllModes( rl: CFRunLoopRef ): CFArrayRef; external name '_CFRunLoopCopyAllModes';
  200. {!
  201. @function CFRunLoopAddCommonMode
  202. Makes the named mode a "common mode" for the run loop. The set of
  203. common modes are collectively accessed with the global constant
  204. kCFRunLoopCommonModes. Input sources previously added to the
  205. common modes are added to the new common mode.
  206. @param rl The run loop for which the mode should be made common.
  207. @param mode The name of the mode to mark as a common mode.
  208. }
  209. procedure CFRunLoopAddCommonMode( rl: CFRunLoopRef; mode: CFStringRef ); external name '_CFRunLoopAddCommonMode';
  210. {!
  211. @function CFRunLoopGetNextTimerFireDate
  212. Returns the time at which the next timer will fire.
  213. @param rl The run loop for which the next timer fire date should
  214. be reported.
  215. @param mode The name of the mode to query.
  216. }
  217. function CFRunLoopGetNextTimerFireDate( rl: CFRunLoopRef; mode: CFStringRef ): CFAbsoluteTime; external name '_CFRunLoopGetNextTimerFireDate';
  218. procedure CFRunLoopRun; external name '_CFRunLoopRun';
  219. function CFRunLoopRunInMode( mode: CFStringRef; seconds: CFTimeInterval; returnAfterSourceHandled: Boolean ): SInt32; external name '_CFRunLoopRunInMode';
  220. function CFRunLoopIsWaiting( rl: CFRunLoopRef ): Boolean; external name '_CFRunLoopIsWaiting';
  221. procedure CFRunLoopWakeUp( rl: CFRunLoopRef ); external name '_CFRunLoopWakeUp';
  222. procedure CFRunLoopStop( rl: CFRunLoopRef ); external name '_CFRunLoopStop';
  223. function CFRunLoopContainsSource( rl: CFRunLoopRef; source: CFRunLoopSourceRef; mode: CFStringRef ): Boolean; external name '_CFRunLoopContainsSource';
  224. procedure CFRunLoopAddSource( rl: CFRunLoopRef; source: CFRunLoopSourceRef; mode: CFStringRef ); external name '_CFRunLoopAddSource';
  225. procedure CFRunLoopRemoveSource( rl: CFRunLoopRef; source: CFRunLoopSourceRef; mode: CFStringRef ); external name '_CFRunLoopRemoveSource';
  226. function CFRunLoopContainsObserver( rl: CFRunLoopRef; observer: CFRunLoopObserverRef; mode: CFStringRef ): Boolean; external name '_CFRunLoopContainsObserver';
  227. procedure CFRunLoopAddObserver( rl: CFRunLoopRef; observer: CFRunLoopObserverRef; mode: CFStringRef ); external name '_CFRunLoopAddObserver';
  228. procedure CFRunLoopRemoveObserver( rl: CFRunLoopRef; observer: CFRunLoopObserverRef; mode: CFStringRef ); external name '_CFRunLoopRemoveObserver';
  229. function CFRunLoopContainsTimer( rl: CFRunLoopRef; timer: CFRunLoopTimerRef; mode: CFStringRef ): Boolean; external name '_CFRunLoopContainsTimer';
  230. procedure CFRunLoopAddTimer( rl: CFRunLoopRef; timer: CFRunLoopTimerRef; mode: CFStringRef ); external name '_CFRunLoopAddTimer';
  231. procedure CFRunLoopRemoveTimer( rl: CFRunLoopRef; timer: CFRunLoopTimerRef; mode: CFStringRef ); external name '_CFRunLoopRemoveTimer';
  232. {!
  233. @typedef CFRunLoopSourceContext
  234. Structure containing the callbacks of a CFRunLoopSource.
  235. @field version The version number of the structure type being
  236. passed in as a parameter to the CFArray creation
  237. functions. Valid version numbers are currently 0 and 1.
  238. Version 0 sources are fairly generic, but may require a
  239. bit more implementation, or may require a separate
  240. thread as part of the implementation, for a complex
  241. source. Version 1 sources are available on Mach and Windows,
  242. and have performance advantages when the source type can
  243. be described with this style.
  244. @field info An arbitrary pointer to client-defined data, which
  245. can be associated with the source at creation time, and
  246. is passed to the callbacks.
  247. @field retain The callback used to add a retain for the source on
  248. the info pointer for the life of the source, and may be
  249. used for temporary references the source needs to take.
  250. This callback returns the actual info pointer to store in
  251. the source, almost always just the pointer passed as the
  252. parameter.
  253. @field release The callback used to remove a retain previously
  254. added for the source on the info pointer.
  255. @field copyDescription The callback used to create a descriptive
  256. string representation of the info pointer (or the data
  257. pointed to by the info pointer) for debugging purposes.
  258. This is used by the CFCopyDescription() function.
  259. @field equal The callback used to compare the info pointers of
  260. two sources, to determine equality of sources.
  261. @field hash The callback used to compute a hash code for the info
  262. pointer for the source. The source uses this hash code
  263. information to produce its own hash code.
  264. @field schedule For a version 0 source, this callback is called
  265. whenever the source is added to a run loop mode. This
  266. information is often needed to implement complex sources.
  267. @field cancel For a version 0 source, this callback is called
  268. whenever the source is removed from a run loop mode. This
  269. information is often needed to implement complex sources.
  270. @field getPort Defined in version 1 sources, this function returns
  271. the Mach port or Windows HANDLE of a kernel object to
  272. represent the source to the run loop. This function
  273. must return the same result every time it is called, for the
  274. lifetime of the source, and should be quick.
  275. @field perform This callback is the workhorse of a run loop source.
  276. It is called when the source needs to be "handled" or
  277. processing is needed for input or conditions relating to
  278. the source. For version 0 sources, this function is called
  279. when the source has been marked "signaled" with the
  280. CFRunLoopSourceSignal() function, and should do whatever
  281. handling is required for the source. For a version 1 source
  282. on Mach, this function is called when a Mach message arrives
  283. on the source's Mach port, with the message, its
  284. length, an allocator, and the source's info pointer. A
  285. version 1 source performs whatever processing is required
  286. on the Mach message, then can return a pointer to a Mach
  287. message (or NULL if none) to be sent (usually this is a
  288. "reply" message), which should be allocated with the
  289. allocator (and will be deallocated by the run loop after
  290. sending). For a version 1 source on Windows the function
  291. is called when the kernel object is in the signaled state.
  292. }
  293. type
  294. CFRunLoopSourceContext = record
  295. version: CFIndex;
  296. info: UnivPtr;
  297. retain: function( info: {const} UnivPtr ): UnivPtr;
  298. release: procedure( info: {const} UnivPtr );
  299. copyDescription: function( info: {const} UnivPtr ): CFStringRef;
  300. equal: function( info1: {const} UnivPtr; info2: {const} UnivPtr ): Boolean;
  301. hash: function( info: {const} UnivPtr ): CFHashCode;
  302. schedule: function( info: {const} UnivPtr; rl: CFRunLoopRef; mode: CFStringRef ): CFHashCode;
  303. cancel: function( info: {const} UnivPtr; rl: CFRunLoopRef; mode: CFStringRef ): CFHashCode;
  304. perform: procedure( info: {const} UnivPtr );
  305. end;
  306. type
  307. CFRunLoopSourceContext1 = record
  308. version: CFIndex;
  309. info: UnivPtr;
  310. retain: function( info: {const} UnivPtr ): UnivPtr;
  311. release: procedure( info: {const} UnivPtr );
  312. copyDescription: function( info: {const} UnivPtr ): CFStringRef;
  313. equal: function( info1: {const} UnivPtr; info2: {const} UnivPtr ): Boolean;
  314. hash: function( info: {const} UnivPtr ): CFHashCode;
  315. getPort: function( info: {const} UnivPtr ): mach_port_t;
  316. perform: function( msg: UnivPtr; size: CFIndex; allocator: CFAllocatorRef; info: UnivPtr ): UnivPtr;
  317. end;
  318. {!
  319. @function CFRunLoopSourceGetTypeID
  320. Returns the type identifier of all CFRunLoopSource instances.
  321. }
  322. function CFRunLoopSourceGetTypeID: CFTypeID; external name '_CFRunLoopSourceGetTypeID';
  323. {!
  324. @function CFRunLoopSourceCreate
  325. Creates a new run loop source with the given context.
  326. @param allocator The CFAllocator which should be used to allocate
  327. memory for the array and its storage for values. If this
  328. reference is not a valid CFAllocator, the behavior is
  329. undefined.
  330. @param order On platforms which support it, for source versions
  331. which support it, this parameter determines the order in
  332. which the sources which are ready to be processed are
  333. handled. A lower order number causes processing before
  334. higher order number sources. It is inadvisable to depend
  335. on the order number for any architectural or design aspect
  336. of code. In the absence of any reason to do otherwise,
  337. zero should be used.
  338. @param context A pointer to the context structure for the source.
  339. }
  340. function CFRunLoopSourceCreate( allocator: CFAllocatorRef; order: CFIndex; var context: CFRunLoopSourceContext ): CFRunLoopSourceRef; external name '_CFRunLoopSourceCreate';
  341. {!
  342. @function CFRunLoopSourceGetOrder
  343. Returns the ordering parameter of the run loop source.
  344. @param source The run loop source for which the order number
  345. should be returned.
  346. }
  347. function CFRunLoopSourceGetOrder( source: CFRunLoopSourceRef ): CFIndex; external name '_CFRunLoopSourceGetOrder';
  348. {!
  349. @function CFRunLoopSourceInvalidate
  350. Invalidates the run loop source. The run loop source is never
  351. performed again after it becomes invalid, and will automatically
  352. be removed from any run loops and modes which contain it. The
  353. source is not destroyed by this operation, however -- the memory
  354. is still valid; only the release of all references on the source
  355. through the reference counting system can do that. But note, that
  356. if the only retains on the source were held by run loops, those
  357. retains may all be released by the time this function returns,
  358. and the source may actually be destroyed through that process.
  359. @param source The run loop source which should be invalidated.
  360. }
  361. procedure CFRunLoopSourceInvalidate( source: CFRunLoopSourceRef ); external name '_CFRunLoopSourceInvalidate';
  362. {!
  363. @function CFRunLoopSourceIsValid
  364. Reports whether or not the source is valid.
  365. @param source The run loop source for which the validity should
  366. be returned.
  367. }
  368. function CFRunLoopSourceIsValid( source: CFRunLoopSourceRef ): Boolean; external name '_CFRunLoopSourceIsValid';
  369. {!
  370. @function CFRunLoopSourceGetContext
  371. Fills the memory pointed to by the context parameter with the
  372. context structure of the source.
  373. @param source The run loop source for which the context structure
  374. should be returned.
  375. @param context A pointer to a context structure to be filled.
  376. }
  377. procedure CFRunLoopSourceGetContext( source: CFRunLoopSourceRef; var context: CFRunLoopSourceContext ); external name '_CFRunLoopSourceGetContext';
  378. {!
  379. @function CFRunLoopSourceSignal
  380. Marks the source as signalled, ready for handling by the run loop.
  381. Has no effect on version 1 sources, which are automatically
  382. handled when Mach messages for them come in.
  383. @param source The run loop source which should be signalled.
  384. }
  385. procedure CFRunLoopSourceSignal( source: CFRunLoopSourceRef ); external name '_CFRunLoopSourceSignal';
  386. type
  387. CFRunLoopObserverContext = record
  388. version: CFIndex;
  389. info: UnivPtr;
  390. retain: function( info: {const} UnivPtr ): UnivPtr;
  391. release: procedure( info: {const} UnivPtr );
  392. copyDescription: function( info: {const} UnivPtr ): CFStringRef;
  393. end;
  394. type
  395. CFRunLoopObserverCallBack = procedure( observer: CFRunLoopObserverRef; activity: CFRunLoopActivity; info: UnivPtr );
  396. {!
  397. @function CFRunLoopObserverGetTypeID
  398. Returns the type identifier of all CFRunLoopObserver instances.
  399. }
  400. function CFRunLoopObserverGetTypeID: CFTypeID; external name '_CFRunLoopObserverGetTypeID';
  401. function CFRunLoopObserverCreate( allocator: CFAllocatorRef; activities: CFOptionFlags; repeats: Boolean; order: CFIndex; callout: CFRunLoopObserverCallBack; var context: CFRunLoopObserverContext ): CFRunLoopObserverRef; external name '_CFRunLoopObserverCreate';
  402. function CFRunLoopObserverGetActivities( observer: CFRunLoopObserverRef ): CFOptionFlags; external name '_CFRunLoopObserverGetActivities';
  403. function CFRunLoopObserverDoesRepeat( observer: CFRunLoopObserverRef ): Boolean; external name '_CFRunLoopObserverDoesRepeat';
  404. function CFRunLoopObserverGetOrder( observer: CFRunLoopObserverRef ): CFIndex; external name '_CFRunLoopObserverGetOrder';
  405. procedure CFRunLoopObserverInvalidate( observer: CFRunLoopObserverRef ); external name '_CFRunLoopObserverInvalidate';
  406. function CFRunLoopObserverIsValid( observer: CFRunLoopObserverRef ): Boolean; external name '_CFRunLoopObserverIsValid';
  407. procedure CFRunLoopObserverGetContext( observer: CFRunLoopObserverRef; var context: CFRunLoopObserverContext ); external name '_CFRunLoopObserverGetContext';
  408. type
  409. CFRunLoopTimerContext = record
  410. version: CFIndex;
  411. info: UnivPtr;
  412. retain: function( info: {const} UnivPtr ): UnivPtr;
  413. release: procedure( info: {const} UnivPtr );
  414. copyDescription: function( info: {const} UnivPtr ): CFStringRef;
  415. end;
  416. type
  417. CFRunLoopTimerCallBack = procedure( timer: CFRunLoopTimerRef; info: UnivPtr );
  418. {!
  419. @function CFRunLoopTimerGetTypeID
  420. Returns the type identifier of all CFRunLoopTimer instances.
  421. }
  422. function CFRunLoopTimerGetTypeID: CFTypeID; external name '_CFRunLoopTimerGetTypeID';
  423. function CFRunLoopTimerCreate( allocator: CFAllocatorRef; fireDate: CFAbsoluteTime; interval: CFTimeInterval; flags: CFOptionFlags; order: CFIndex; callout: CFRunLoopTimerCallBack; var context: CFRunLoopTimerContext ): CFRunLoopTimerRef; external name '_CFRunLoopTimerCreate';
  424. function CFRunLoopTimerGetNextFireDate( timer: CFRunLoopTimerRef ): CFAbsoluteTime; external name '_CFRunLoopTimerGetNextFireDate';
  425. procedure CFRunLoopTimerSetNextFireDate( timer: CFRunLoopTimerRef; fireDate: CFAbsoluteTime ); external name '_CFRunLoopTimerSetNextFireDate';
  426. function CFRunLoopTimerGetInterval( timer: CFRunLoopTimerRef ): CFTimeInterval; external name '_CFRunLoopTimerGetInterval';
  427. function CFRunLoopTimerDoesRepeat( timer: CFRunLoopTimerRef ): Boolean; external name '_CFRunLoopTimerDoesRepeat';
  428. function CFRunLoopTimerGetOrder( timer: CFRunLoopTimerRef ): CFIndex; external name '_CFRunLoopTimerGetOrder';
  429. procedure CFRunLoopTimerInvalidate( timer: CFRunLoopTimerRef ); external name '_CFRunLoopTimerInvalidate';
  430. function CFRunLoopTimerIsValid( timer: CFRunLoopTimerRef ): Boolean; external name '_CFRunLoopTimerIsValid';
  431. procedure CFRunLoopTimerGetContext( timer: CFRunLoopTimerRef; var context: CFRunLoopTimerContext ); external name '_CFRunLoopTimerGetContext';
  432. end.