event.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef MC__EVENT_H
  2. #define MC__EVENT_H
  3. #include "event-types.h"
  4. /*** typedefs(not structures) and defined constants **********************************************/
  5. struct event_info_t;
  6. typedef gboolean (*mc_event_callback_func_t) (struct event_info_t *, gpointer, GError **);
  7. /*** enums ***************************************************************************************/
  8. /*** structures declarations (and typedefs of structures)*****************************************/
  9. typedef union
  10. {
  11. gboolean b;
  12. int i;
  13. char *s;
  14. void *p;
  15. } event_return_t;
  16. typedef struct event_info_t
  17. {
  18. const char *group_name;
  19. const char *name;
  20. gpointer init_data;
  21. event_return_t *ret;
  22. } event_info_t;
  23. typedef struct
  24. {
  25. const char *name;
  26. mc_event_callback_func_t cb;
  27. gpointer init_data;
  28. } event_init_group_t;
  29. typedef struct
  30. {
  31. const char *group_name;
  32. event_init_group_t *events;
  33. } event_init_t;
  34. /*** global variables defined in .c file *********************************************************/
  35. /*** declarations of public functions ************************************************************/
  36. /* event.c: */
  37. gboolean mc_event_init (GError **);
  38. gboolean mc_event_deinit (GError **);
  39. /* manage.c: */
  40. gboolean mc_event_add (const gchar *, const gchar *, mc_event_callback_func_t, gpointer, GError **);
  41. void mc_event_del (const gchar *, const gchar *, mc_event_callback_func_t, gpointer);
  42. void mc_event_destroy (const gchar *, const gchar *);
  43. void mc_event_group_del (const gchar *);
  44. gboolean mc_event_present (const gchar *, const gchar *);
  45. gboolean mc_event_mass_add (event_init_t *, GError **);
  46. /* raise.c: */
  47. gboolean
  48. mc_event_dispatch (const gchar * event_group_name, const gchar * event_name, gpointer event_data,
  49. event_return_t * ret, GError ** error);
  50. /*** inline functions ****************************************************************************/
  51. #endif /* MC__EVENT_H */