Audacious
$Id:Doxyfile42802007-03-2104:39:00Znenolod$
|
00001 /* 00002 * hook.h 00003 * Copyright 2011 John Lindgren 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions, and the following disclaimer. 00010 * 00011 * 2. Redistributions in binary form must reproduce the above copyright notice, 00012 * this list of conditions, and the following disclaimer in the documentation 00013 * provided with the distribution. 00014 * 00015 * This software is provided "as is" and without any warranty, express or 00016 * implied. In no event shall the authors be liable for any damages arising from 00017 * the use of this software. 00018 */ 00019 00020 #ifndef LIBAUDCORE_HOOK_H 00021 #define LIBAUDCORE_HOOK_H 00022 00023 typedef void (* HookFunction) (void * data, void * user); 00024 00025 /* Adds <func> to the list of functions to be called when the hook <name> is 00026 * triggered. */ 00027 void hook_associate (const char * name, HookFunction func, void * user); 00028 00029 /* Removes all instances matching <func> and <user> from the list of functions 00030 * to be called when the hook <name> is triggered. If <user> is NULL, all 00031 * instances matching <func> are removed. */ 00032 void hook_dissociate_full (const char * name, HookFunction func, void * user); 00033 00034 #define hook_dissociate(n, f) hook_dissociate_full (n, f, NULL) 00035 00036 /* Triggers the hook <name>. */ 00037 void hook_call (const char * name, void * data); 00038 00039 /* Schedules a call of the hook <name> from the program's main loop, to be 00040 * executed in <time> milliseconds. If <destroy> is not NULL, it will be called 00041 * on <data> after the hook is called. */ 00042 void event_queue_full (int time, const char * name, void * data, void (* destroy) (void *)); 00043 00044 #define event_queue(n, d) event_queue_full (0, n, d, NULL) 00045 00046 /* Cancels pending hook calls matching <name> and <data>. If <data> is NULL, 00047 * all hook calls matching <name> are canceled. */ 00048 void event_queue_cancel (const char * name, void * data); 00049 00050 #endif /* LIBAUDCORE_HOOK_H */