Fuck it, we're going with <stdbool.h>. I don't like it, but meh.

This commit is contained in:
Pietro Gagliardi 2019-05-12 13:41:43 -04:00
parent d7fa5e63be
commit 1a047da08c
2 changed files with 5 additions and 4 deletions

View File

@ -28,13 +28,13 @@ typedef void (*uiEventHandler)(void *sender, void *args, void *data);
typedef struct uiEventOptions uiEventOptions; typedef struct uiEventOptions uiEventOptions;
struct uiEventOptions { struct uiEventOptions {
// TODO size // TODO size
TODO_int_or_uiBool Global; bool Global;
}; };
``` ```
`uiEventOptions` describes the properties of a `uiEvent`; you pass these to `uiNewEvent()`. `uiEventOptions` describes the properties of a `uiEvent`; you pass these to `uiNewEvent()`.
If `Global` is TODO_nonzero_or_uiTrue, 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. 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()` ### `uiNewEvent()`
@ -81,7 +81,7 @@ Note that the order that handler functions are called in is unspecified.
### `uiEventHandlerBlocked()` ### `uiEventHandlerBlocked()`
```c ```c
TODO_int_or_uiBool uiEventHandlerBlocked(uiEvent *e, int which); bool uiEventHandlerBlocked(uiEvent *e, int which);
``` ```
`uiEventHandlerBlocked()` returns whether or not the given registered event handler is *blocked*. A blocked event handler will not be called by `uiEventFire()`, even if that handler matches the parameters passed to `uiEventFire()`. `which` should be the identifier of a previously registered event handler as returned by `uiEventAddHandler()`. `uiEventHandlerBlocked()` returns whether or not the given registered event handler is *blocked*. A blocked event handler will not be called by `uiEventFire()`, even if that handler matches the parameters passed to `uiEventFire()`. `which` should be the identifier of a previously registered event handler as returned by `uiEventAddHandler()`.
@ -89,7 +89,7 @@ TODO_int_or_uiBool uiEventHandlerBlocked(uiEvent *e, int which);
### `uiEventSetHandlerBlocked()` ### `uiEventSetHandlerBlocked()`
```c ```c
void uiEventSetHandlerBlocked(uiEvent *e, int which, TODO_int_or_uiBool blocked); void uiEventSetHandlerBlocked(uiEvent *e, int which, bool blocked);
``` ```
`uiEventSetHandlerBlocked()` changes whether or not the given registered event handler is bocked. `which` should be the identifier of a previously registered event handler as returned by `uiEventAddHandler()`. `uiEventSetHandlerBlocked()` changes whether or not the given registered event handler is bocked. `which` should be the identifier of a previously registered event handler as returned by `uiEventAddHandler()`.

1
ui.h
View File

@ -3,6 +3,7 @@
#ifndef uiprivIncludeGuard_ui_h #ifndef uiprivIncludeGuard_ui_h
#define uiprivIncludeGuard_ui_h #define uiprivIncludeGuard_ui_h
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>