shithub: neindaw

ref: 709abb0906f7cb1ecde0e86fb701979edfd772f9
dir: /ui.h/

View raw version
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;

	Meta *meta;
	int nummeta;

	int autovoice;

	/* optional */
	char *(*readstr)(UI *ui, int auxtype, char *s, int sz);
	int (*writestr)(UI *ui, int auxtype, char *s);
	void *userdata;
};

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

void ui_tgroup(const char *label);
void ui_hgroup(const char *label);
void ui_vgroup(const char *label);
void ui_endgroup(void);
UI *ui_button(const char *label, float *zone);
UI *ui_checkbox(const char *label, float *zone);
UI *ui_vslider(const char *label, float *zone, float init, float min, float max, float step);
UI *ui_hslider(const char *label, float *zone, float init, float min, float max, float step);
UI *ui_nentry(const char *label, float *zone, float init, float min, float max, float step);
UI *ui_hbargraph(const char *label, float *zone, float min, float max);
UI *ui_vbargraph(const char *label, float *zone, float min, float max);
void ui_declare(float *zone, const char *key, const char *value);