V2.0.0
This commit is contained in:
1 parent
7f7fcd545d
commit
4d9a339421
114 files changed
+11383
-1837
No files matched your search
@@ -0,0 +1,50 @@
|
||||
/* Bus de eventos sencillo. Las llamadas a los suscriptores son SÍNCRONAS,
|
||||
* en el mismo hilo que provocó el cambio. Un suscriptor no debe
|
||||
* suscribirse/desuscribirse ni modificar el documento dentro de su
|
||||
* callback. */
|
||||
#ifndef TAHGIBU_EVENTS_H
|
||||
#define TAHGIBU_EVENTS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "tahgibu/canvas.h"
|
||||
#include "tahgibu/error.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct tgb_context tgb_context;
|
||||
typedef struct tgb_document tgb_document;
|
||||
|
||||
typedef enum tgb_event_type {
|
||||
TGB_EVENT_DOCUMENT_CHANGED = 1, /* cualquier cambio del documento */
|
||||
TGB_EVENT_PIXELS_CHANGED, /* cambian píxeles (rect, frame_id, layer_id) */
|
||||
TGB_EVENT_FRAMES_CHANGED, /* altas/bajas/orden/duración de fotogramas */
|
||||
TGB_EVENT_LAYERS_CHANGED, /* altas/bajas/propiedades de capas */
|
||||
TGB_EVENT_HISTORY_CHANGED, /* undo/redo disponible o modificado */
|
||||
TGB_EVENT_HISTORY_TRUNCATED, /* se descartó historial por límites */
|
||||
TGB_EVENT_RECOVERY_POINTS_CHANGED,
|
||||
TGB_EVENT_DOCUMENT_SAVED,
|
||||
TGB_EVENT_AUTOSAVED,
|
||||
TGB_EVENT_PLUGIN_LOADED,
|
||||
TGB_EVENT_PLUGIN_UNLOADED
|
||||
} tgb_event_type;
|
||||
|
||||
typedef struct tgb_event {
|
||||
tgb_event_type type;
|
||||
tgb_document *document; /* puede ser NULL (eventos globales) */
|
||||
uint32_t frame_id, layer_id;
|
||||
tgb_rect rect;
|
||||
const char *text; /* nombre/etiqueta; válido solo durante el callback */
|
||||
} tgb_event;
|
||||
|
||||
typedef void (*tgb_event_fn)(const tgb_event *event, void *user);
|
||||
|
||||
/* Devuelve un identificador >0 en *out_id. Máximo 64 suscriptores. */
|
||||
tgb_status tgb_events_subscribe(tgb_context *ctx, tgb_event_fn fn, void *user, uint32_t *out_id);
|
||||
tgb_status tgb_events_unsubscribe(tgb_context *ctx, uint32_t id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in new issue
Block a user