shithub: neindaw

ref: 0da73060a5e334ea86b0ad4641c6144d97d813e7
dir: /uiglue.h/

View raw version
typedef struct UIGlue UIGlue;
typedef struct MetaGlue MetaGlue;

struct File;

typedef struct Meta Meta;
typedef struct UI UI;

struct Meta {
	const char *k;
	const char *v;
};

struct UI {
	int type;
	const char *label;
	float *zone;
	float init;
	float min;
	float max;
	float step;
	char *(*readstr)(UI *ui, int auxtype, char *s, int sz);
	int (*writestr)(UI *ui, int auxtype, char *s);

	void *userdata;
	Meta *meta;
	int nummeta;
};

struct UIGlue {
	union {
		void *uiInterface;
		struct File *f;
	};
	void (*openTabBox)(void *uiInterface, const char *label);
	void (*openHorizontalBox)(void *uiInterface, const char *label);
	void (*openVerticalBox)(void *uiInterface, const char *label);
	void (*closeBox)(void *uiInterface);
	void (*addButton)(void *uiInterface, const char *label, float *zone);
	void (*addCheckButton)(void *uiInterface, const char *label, float *zone);
	void (*addVerticalSlider)(void *uiInterface, const char *label, float *zone, float init, float min, float max, float step);
	void (*addHorizontalSlider)(void *uiInterface, const char *label, float *zone, float init, float min, float max, float step);
	void (*addNumEntry)(void *uiInterface, const char *label, float *zone, float init, float min, float max, float step);
	void (*addHorizontalBargraph)(void *uiInterface, const char *label, float *zone, float min, float max);
	void (*addVerticalBargraph)(void *uiInterface, const char *label, float *zone, float min, float max);
	void (*declare)(void *uiInterface, float *zone, const char *key, const char *value);

	char *(*readstr)(UI *ui, int auxtype, char *s, int sz);
	int (*writestr)(UI *ui, int auxtype, char *s);

	void *userdata;
};

struct MetaGlue {
	void *metaInterface;
	void (*declare)(void *metaInterface, const char *key, const char *value);
};

extern UIGlue uiglue;

char *ui_readstr(UI *ui, int auxtype, char *s, int sz);
int ui_writestr(UI *ui, int auxtype, char *s);