AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
PluginAPI.h File Reference

C API for AeonGUI native plugins. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AeonGUI_PluginContext
 Plugin context passed to OnLoad and OnUnload. More...

Macros

#define AEONGUI_PLUGIN_EXPORT   __attribute__((visibility("default")))
 Export macro for plugin entry points.

Typedefs

typedef struct AeonGUI_Document_s AeonGUI_Document
 Opaque handle to a Document.
typedef struct AeonGUI_Element_s AeonGUI_Element
 Opaque handle to an Element.
typedef struct AeonGUI_Event_s AeonGUI_Event
 Opaque handle to an Event.
typedef void(* AeonGUI_EventCallback) (AeonGUI_Event *event, void *userData)
 Callback type for event listeners.
typedef struct AeonGUI_PluginContext AeonGUI_PluginContext
 Plugin context passed to OnLoad and OnUnload.
typedef void(* AeonGUI_OnLoadFunc) (AeonGUI_PluginContext *ctx)
 Plugin entry point — called after the document is loaded.
typedef void(* AeonGUI_OnUnloadFunc) (AeonGUI_PluginContext *ctx)
 Plugin cleanup — called before the document is unloaded.

Detailed Description

C API for AeonGUI native plugins.

Native plugins are shared libraries loaded via the SVG <script type="native" href="name"/> element.

A plugin must export at least AeonGUI_OnLoad. Optionally it may also export AeonGUI_OnUnload for cleanup.

static AeonGUI_PluginContext* gCtx = NULL;
static void OnButtonClick(AeonGUI_Event* event, void* userData)
{
// Handle click
}
{
gCtx = ctx;
AeonGUI_Element* btn = ctx->getElementById(ctx->document, "myButton");
if (btn)
{
ctx->addEventListener(btn, "click", OnButtonClick, NULL);
}
}
AEONGUI_PLUGIN_EXPORT void AeonGUI_OnUnload(AeonGUI_PluginContext* ctx)
{
// Cleanup
}
C API for AeonGUI native plugins.
struct AeonGUI_Element_s AeonGUI_Element
Opaque handle to an Element.
Definition PluginAPI.h:69
struct AeonGUI_Event_s AeonGUI_Event
Opaque handle to an Event.
Definition PluginAPI.h:71
#define AEONGUI_PLUGIN_EXPORT
Export macro for plugin entry points.
Definition PluginAPI.h:63
Plugin context passed to OnLoad and OnUnload.
Definition PluginAPI.h:87
AeonGUI_Element *(* getElementById)(AeonGUI_Document *doc, const char *id)
Find an element by its id attribute.
Definition PluginAPI.h:96
AeonGUI_Document * document
The document that loaded this plugin.
Definition PluginAPI.h:89
void(* addEventListener)(AeonGUI_Element *element, const char *type, AeonGUI_EventCallback callback, void *userData)
Register an event listener on an element.
Definition PluginAPI.h:104

Typedef Documentation

◆ AeonGUI_EventCallback

typedef void(* AeonGUI_EventCallback) (AeonGUI_Event *event, void *userData)

Callback type for event listeners.

Parameters
eventThe event that was dispatched.
userDataOpaque pointer passed during registration.

◆ AeonGUI_OnLoadFunc

typedef void(* AeonGUI_OnLoadFunc) (AeonGUI_PluginContext *ctx)

Plugin entry point — called after the document is loaded.

The plugin must export this symbol. Use the context to find elements and register event listeners.

Parameters
ctxPlugin context (owned by AeonGUI, do not free).

◆ AeonGUI_OnUnloadFunc

typedef void(* AeonGUI_OnUnloadFunc) (AeonGUI_PluginContext *ctx)

Plugin cleanup — called before the document is unloaded.

Optional. If exported, AeonGUI calls it to let the plugin release resources before listeners are removed.

Parameters
ctxSame context that was passed to OnLoad.

◆ AeonGUI_PluginContext

typedef struct AeonGUI_PluginContext AeonGUI_PluginContext

Plugin context passed to OnLoad and OnUnload.

Contains the document handle and function pointers for interacting with the DOM. The plugin does not need to link against AeonGUI — all calls go through these pointers.