2015-08-16 16:14:46 -05:00
|
|
|
// 6 april 2015
|
|
|
|
|
2019-04-08 19:55:06 -05:00
|
|
|
#ifndef uiprivIncludeGuard_ui_h
|
|
|
|
#define uiprivIncludeGuard_ui_h
|
2015-08-16 16:14:46 -05:00
|
|
|
|
2019-05-12 12:41:43 -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
|
|
|
|
|
2019-04-08 19:55:06 -05:00
|
|
|
#ifdef uiprivBuildingLibui
|
2019-04-12 09:56:09 -05:00
|
|
|
#if defined(_WIN32) && !defined(uiStatic)
|
2019-04-08 19:55:06 -05:00
|
|
|
#define uiprivExtern __declspec(dllexport) extern
|
2019-04-20 20:38:26 -05:00
|
|
|
#elif defined(_WIN32)
|
2019-04-12 09:56:09 -05:00
|
|
|
#define uiprivExtern extern
|
2016-06-03 21:19:33 -05:00
|
|
|
#else
|
2019-04-08 19:55:06 -05:00
|
|
|
#define uiprivExtern __attribute__((visibility("default"))) extern
|
2016-06-03 21:19:33 -05:00
|
|
|
#endif
|
|
|
|
#else
|
2019-04-12 09:56:09 -05:00
|
|
|
#if defined(_WIN32) && !defined(uiStatic)
|
|
|
|
#define uiprivExtern __declspec(dllimport) extern
|
|
|
|
#else
|
|
|
|
#define uiprivExtern extern
|
|
|
|
#endif
|
2015-08-16 16:14:46 -05:00
|
|
|
#endif
|
|
|
|
|
2016-04-23 20:38:51 -05:00
|
|
|
// 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...
|
2019-04-08 19:55:06 -05:00
|
|
|
#define uiprivEnum(s) typedef unsigned int s; enum
|
2016-11-27 16:44:52 -06:00
|
|
|
|
2019-04-12 20:44:39 -05:00
|
|
|
typedef struct uiInitError uiInitError;
|
|
|
|
|
|
|
|
struct uiInitError {
|
|
|
|
size_t Size;
|
|
|
|
char Message[256];
|
|
|
|
};
|
|
|
|
|
2019-05-29 20:10:44 -05:00
|
|
|
uiprivExtern bool uiInit(void *options, uiInitError *err);
|
2019-04-27 20:48:51 -05:00
|
|
|
uiprivExtern void uiMain(void);
|
|
|
|
uiprivExtern void uiQuit(void);
|
|
|
|
uiprivExtern void uiQueueMain(void (*f)(void *data), void *data);
|
2019-04-12 20:44:39 -05:00
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2019-05-16 11:27:04 -05:00
|
|
|
uiprivExtern uiEvent *uiNewEvent(const uiEventOptions *options);
|
2019-06-02 21:04:25 -05:00
|
|
|
uiprivExtern void uiEventFree(uiEvent *e);
|
2019-05-15 21:40:06 -05:00
|
|
|
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);
|
2019-06-06 21:51:37 -05:00
|
|
|
uiprivExtern void uiEventInvalidateSender(uiEvent *e, void *sender);
|
2019-05-15 21:40:06 -05:00
|
|
|
|
2019-06-02 17:49:16 -05:00
|
|
|
typedef struct uiControl uiControl;
|
2019-06-02 19:47:27 -05:00
|
|
|
typedef struct uiControlVtable uiControlVtable;
|
2019-06-05 22:20:53 -05:00
|
|
|
typedef struct uiControlOSVtable uiControlOSVtable;
|
2019-06-02 17:49:16 -05:00
|
|
|
|
|
|
|
uiprivExtern uint32_t uiControlType(void);
|
|
|
|
#define uiControl(obj) ((uiControl *) uiCheckControlType((obj), uiControlType()))
|
|
|
|
|
2019-06-02 19:47:27 -05:00
|
|
|
struct uiControlVtable {
|
2019-06-08 08:58:25 -05:00
|
|
|
size_t Size;
|
2019-06-04 19:33:29 -05:00
|
|
|
bool (*Init)(uiControl *c, void *implData, void *initData);
|
2019-06-02 19:47:27 -05:00
|
|
|
void (*Free)(uiControl *c, void *implData);
|
|
|
|
};
|
|
|
|
|
2019-06-08 12:00:30 -05:00
|
|
|
uiprivExtern uint32_t uiRegisterControlType(const char *nane, uiControlVtable *vtable, uiControlOSVtable *osVtable, size_t implDataSize);
|
2019-06-05 22:20:53 -05:00
|
|
|
uiprivExtern void *uiCheckControlType(void *c, uint32_t type);
|
|
|
|
|
2019-06-04 19:33:29 -05:00
|
|
|
uiprivExtern uiControl *uiNewControl(uint32_t type, void *initData);
|
2019-06-02 19:47:27 -05:00
|
|
|
uiprivExtern void uiControlFree(uiControl *c);
|
2019-06-06 21:51:37 -05:00
|
|
|
uiprivExtern void *uiControlImplData(uiControl *c);
|
|
|
|
uiprivExtern uiEvent *uiControlOnFree(void);
|
2019-06-02 19:47:27 -05:00
|
|
|
|
2015-11-16 09:55:44 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-08-16 16:14:46 -05:00
|
|
|
#endif
|