diff --git a/doc/controls.md b/doc/controls.md index 2ef5734b..7fbe19ce 100644 --- a/doc/controls.md +++ b/doc/controls.md @@ -8,10 +8,16 @@ TODO ## Reference -### `xxx` +### `uiControl` ```c -TODO +typedef struct uiControl uiControl; +uint32_t uiControlType(void); +#define uiControl(obj) ((uiControl *) uiCheckControlType((obj), uiControlType())) ``` -TODO +`uiControl` is an opaque type that describes a control. + +`uiControl()` is a conversion macro for casting a pointer of a specific control type (or a `void *`) to `uiControl` while also checking for errors. + +`uiControlType()` is the type identifier of a `uiControl` as passed to `uiControlCheckType()`. You rarely need to call this directly; the `uiControl()` conversion macro does this for you. diff --git a/ui.h b/ui.h index 23c02427..276dd358 100644 --- a/ui.h +++ b/ui.h @@ -61,6 +61,11 @@ uiprivExtern void uiEventFire(uiEvent *e, void *sender, void *args); uiprivExtern bool uiEventHandlerBlocked(const uiEvent *e, int id); uiprivExtern void uiEventSetHandlerBlocked(uiEvent *e, int id, bool blocked); +typedef struct uiControl uiControl; + +uiprivExtern uint32_t uiControlType(void); +#define uiControl(obj) ((uiControl *) uiCheckControlType((obj), uiControlType())) + #ifdef __cplusplus } #endif