Gooey GUI Library
|
Go to the source code of this file.
Classes | |
struct | GooeySignal_Slot |
A slot representing a linked callback in the signal system. More... | |
struct | GooeySignal |
A signal that can emit events to all linked slots. More... | |
Typedefs | |
typedef void(* | GooeySignal_CallbackFunction) (void *context, void *data) |
Callback function type for signal events. | |
typedef struct GooeySignal_Slot | GooeySignal_Slot |
A slot representing a linked callback in the signal system. | |
Functions | |
GooeySignal | GooeySignal_Create (void) |
Creates a new signal object. | |
void | GooeySignal_Link (GooeySignal *signal, GooeySignal_CallbackFunction callback, void *context) |
Links a callback function to a signal. | |
void | GooeySignal_Emit (GooeySignal *signal, void *data) |
Emits a signal. | |
void | GooeySignal_UnLinkAll (GooeySignal *signal) |
Unlinks all callbacks from a signal. | |
typedef void(* GooeySignal_CallbackFunction) (void *context, void *data) |
Callback function type for signal events.
This function type is used for the callback that is executed when a signal is emitted. The callback receives a context and data passed from the emitter.
context | The user-defined context passed when linking the callback. |
data | The data passed when emitting the signal. |
typedef struct GooeySignal_Slot GooeySignal_Slot |
A slot representing a linked callback in the signal system.
A slot contains a callback function, its associated context, and a link to the next slot in a potentially linked list of callbacks.
GooeySignal GooeySignal_Create | ( | void | ) |
Creates a new signal object.
Signals are used to manage event handling and callbacks. This function initializes a new signal object with no slots.
void GooeySignal_Emit | ( | GooeySignal * | signal, |
void * | data | ||
) |
Emits a signal.
This function triggers the signal, invoking all linked callbacks in the order they were added. Each callback receives the specified data.
signal | A pointer to the signal to emit. |
data | A void pointer to the data passed to all linked callbacks. |
void GooeySignal_Link | ( | GooeySignal * | signal, |
GooeySignal_CallbackFunction | callback, | ||
void * | context | ||
) |
Links a callback function to a signal.
This function connects a signal to a specific callback function. When the signal is emitted, the callback function will be executed. The callback is linked to the signal and can be triggered when the signal is emitted.
signal | A pointer to the signal to which the callback is linked. |
callback | The callback function to execute when the signal is emitted. |
context | A user-defined context pointer passed to the callback. |
void GooeySignal_UnLinkAll | ( | GooeySignal * | signal | ) |
Unlinks all callbacks from a signal.
Removes all callback functions linked to the specified signal, effectively clearing its event listeners.
signal | A pointer to the signal from which callbacks should be unlinked. |