From 781a4117a7f29620eacc4a1440a2fba61aade2ec Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 12 May 2019 13:59:31 -0400 Subject: [PATCH] Slightly more documentation. Now to figure out error handling. --- doc/events.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/events.md b/doc/events.md index c7c6dd77..d48031de 100644 --- a/doc/events.md +++ b/doc/events.md @@ -22,18 +22,22 @@ typedef void (*uiEventHandler)(void *sender, void *args, void *data); `uiEventHandler` is the type of a pointer to an event handler function registered with `uiEventAddHandler()`. +`args` will be the respective argument passed to `uiEventFire()`, and `sender` and `data` will be the respective arguments passed to `uiEventAddHandler()`. + ### `uiEventOptions` ```c typedef struct uiEventOptions uiEventOptions; struct uiEventOptions { - // TODO size + size_t Size; bool Global; }; ``` `uiEventOptions` describes the properties of a `uiEvent`; you pass these to `uiNewEvent()`. +You are responsible for allocating and initializing this struct. To do so, you simply zero the memory for this struct and set its `Size` field to `sizeof (uiEventOptions)`. (TODO put this in a common place) + If `Global` is true, the event is "global" — there are no specific senders, and all registered handler functions are called when the event is fired. Otherwise, the event has specific senders, and only handlers registered with the sender that is currently firing the event will be called. ### `uiNewEvent()`