6 /* A hook is a function to call with the supplied hook data, and with
7 call site specific data (e.g., hooks for events are called with a
8 pointer to the current event). */
10 typedef void (*lttv_hook
)(void *hook_data
, void *call_data
);
13 /* A list of hooks allows registering hooks to be called later. */
15 typedef GArray _lttv_hooks
;
16 typedef _lttv_hooks lttv_hooks
;
18 lttv_hooks
*lttv_hooks_new();
20 void lttv_hooks_destroy(lttv_hooks
*h
);
22 void lttv_hooks_add(lttv_hooks
*h
, lttv_hook f
, void *hook_data
);
24 void lttv_hooks_call(lttv_hooks
*h
, void *call_data
);
27 /* Sometimes different hooks need to be called based on the case. The
28 case is represented by an unsigned integer id and may represent different
29 event types, for instance. */
31 typedef GPtrArray _lttv_hooks_by_id
;
32 typedef _lttv_hooks_by_id lttv_hooks_by_id
;
34 lttv_hooks_by_id
*lttv_hooks_by_id_new();
36 void lttv_hooks_by_id_destroy(lttv_hooks_by_id
*h
);
38 void lttv_hooks_by_id_add(lttv_hooks_by_id
*h
, lttv_hook f
, void *hook_data
,
41 void lttv_hooks_by_id_call(lttv_hooks_by_id
*h
, void *call_data
, unsigned int id
);