libui/ui.h

69 lines
1.8 KiB
C
Raw Normal View History

2015-08-16 16:14:46 -05:00
// 6 april 2015
#ifndef uiprivIncludeGuard_ui_h
#define uiprivIncludeGuard_ui_h
2015-08-16 16:14:46 -05:00
#include <stdbool.h>
2015-08-16 16:14:46 -05:00
#include <stddef.h>
#include <stdint.h>
2015-11-16 09:55:44 -06:00
#ifdef __cplusplus
extern "C" {
#endif
#ifdef uiprivBuildingLibui
#if defined(_WIN32) && !defined(uiStatic)
#define uiprivExtern __declspec(dllexport) extern
#elif defined(_WIN32)
#define uiprivExtern extern
#else
#define uiprivExtern __attribute__((visibility("default"))) extern
#endif
#else
#if defined(_WIN32) && !defined(uiStatic)
#define uiprivExtern __declspec(dllimport) extern
#else
#define uiprivExtern extern
#endif
2015-08-16 16:14:46 -05:00
#endif
// C++ is really really really really really really dumb about enums, so screw that and just make them anonymous
// This has the advantage of being ABI-able should we ever need an ABI...
#define uiprivEnum(s) typedef unsigned int s; enum
2016-11-27 16:44:52 -06:00
typedef struct uiInitError uiInitError;
struct uiInitError {
size_t Size;
char Message[256];
};
uiprivExtern int uiInit(void *options, uiInitError *err);
uiprivExtern void uiMain(void);
uiprivExtern void uiQuit(void);
uiprivExtern void uiQueueMain(void (*f)(void *data), void *data);
2019-05-15 21:40:06 -05:00
typedef struct uiEvent uiEvent;
typedef struct uiEventOptions uiEventOptions;
typedef void (*uiEventHandler)(void *sender, void *args, void *data);
struct uiEventOptions {
size_t Size;
bool Global;
};
uiprivExtern uiEvent *uiNewEvent(uiEventOptions *options);
// TODO uiFreeEvent()
uiprivExtern int uiEventAddHandler(uiEvent *e, uiEventHandler handler, void *sender, void *data);
uiprivExtern void uiEventDeleteHandler(uiEvent *e, int id);
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);
2015-11-16 09:55:44 -06:00
#ifdef __cplusplus
}
#endif
2015-08-16 16:14:46 -05:00
#endif