| git.druid.rocks | index | militantprogrammer | astral_canvas | src/ | api/ | apiInternal.h |
src/api/apiInternal.h
#ifndef API_INTERNAL_H
#define API_INTERNAL_H
#include "api/canvas.h"
/*
* Job payloads + worker functions (internal).
*
* A_Create* / A_SetStyle / … on the API thread allocate one of these,
* fill it, and libPushToWorker(job*, payload, own=1). The worker runs
* the job, mutates the node tree, then jobFree frees the payload.
*
* Not included by apps.
*/
/* A_Create* → new node, then attach to parentId (0 = window page). */
typedef struct {
unsigned short id; /* already allocated with libAllocId */
unsigned short parentId; /* 0 = root until A_SetParent exists */
WidgetType widgetType;
Position2D position;
Size size;
int fontSize;
void *callback; /* button / CANVAS_CLOSE */
char text[256]; /* label, button caption, image path */
} CreateWidgetPayload;
/* Legacy form helper (not in the public header). Flexible array of child ids. */
typedef struct {
unsigned short id;
int childCount;
void *data;
bool *isSubmitted;
int format;
unsigned short childIds[];
} FormPayload;
/* A_SetStyle: copy style onto node id (0 = window page). */
typedef struct {
unsigned short id;
Style style;
} SetStylePayload;
/* A_ApplyShader: copy shader path onto node id. */
typedef struct {
unsigned short id;
char shader[256];
} ApplyShaderPayload;
/* A_DestroyWidget: destroy node id (not 0). */
typedef struct {
unsigned short id;
} IdPayload;
void jobCreateWidget(void *data);
void jobCreateForm(void *data);
void jobDestroyWidget(void *data);
void jobSetStyle(void *data);
void jobApplyShader(void *data);
void jobSetOption(void *data);
#endif