ref: 81aebc21df6ba0bcf0e5e6bcbb615199e97e9ac9
dir: /microui/microui.h/
#pragma lib "libmicroui.a" typedef unsigned mu_Id; typedef struct mu_Command mu_Command; typedef struct mu_Container mu_Container; typedef struct mu_Context mu_Context; typedef struct mu_Layout mu_Layout; typedef struct mu_Style mu_Style; typedef struct mu_Rect mu_Rect; enum { MU_MAX_WIDTHS = 16, MU_MAX_FMT = 127, }; enum { MU_CLIP_NONE, MU_CLIP_PART, MU_CLIP_ALL, }; enum { MU_COMMAND_JUMP, MU_COMMAND_CLIP, MU_COMMAND_RECT, MU_COMMAND_TEXT, MU_COMMAND_ICON, MU_COMMAND_MAX, }; enum { MU_COLOR_BG, MU_COLOR_TEXT, MU_COLOR_BORDER, MU_COLOR_WINDOWBG, MU_COLOR_TITLEBG, MU_COLOR_TITLETEXT, MU_COLOR_PANELBG, MU_COLOR_BUTTON, MU_COLOR_BUTTONHOVER, MU_COLOR_BUTTONFOCUS, MU_COLOR_BASE, MU_COLOR_BASEHOVER, MU_COLOR_BASEFOCUS, MU_COLOR_SCROLLBASE, MU_COLOR_SCROLLTHUMB, MU_COLOR_MAX, }; enum { MU_ICON_CHECK, MU_ICON_CLOSE, MU_ICON_COLLAPSED, MU_ICON_EXPANDED, MU_ICON_RESIZE, ATLAS_DIMENSIONS, }; enum { MU_RES_ACTIVE = 1<<0, MU_RES_SUBMIT = 1<<1, MU_RES_CHANGE = 1<<2 }; enum { MU_OPT_ALIGNCENTER = 1<<0, MU_OPT_ALIGNRIGHT = 1<<1, MU_OPT_NOINTERACT = 1<<2, MU_OPT_NOFRAME = 1<<3, MU_OPT_NORESIZE = 1<<4, MU_OPT_NOSCROLL = 1<<5, MU_OPT_NOCLOSE = 1<<6, MU_OPT_NOTITLE = 1<<7, MU_OPT_HOLDFOCUS = 1<<8, MU_OPT_AUTOSIZE_W = 1<<9, MU_OPT_AUTOSIZE_H = 1<<10, MU_OPT_AUTOSIZE = (MU_OPT_AUTOSIZE_W|MU_OPT_AUTOSIZE_H), MU_OPT_POPUP = 1<<10, MU_OPT_CLOSED = 1<<11, }; enum { MU_MOUSE_LEFT = 1<<0, MU_MOUSE_RIGHT = 1<<1, MU_MOUSE_MIDDLE = 1<<2, }; enum { MU_KEY_SHIFT = 1<<0, MU_KEY_CTRL = 1<<1, MU_KEY_ALT = 1<<2, MU_KEY_BACKSPACE = 1<<3, MU_KEY_RETURN = 1<<4, MU_KEY_NACK = 1<<5, MU_KEY_LEFT = 1<<6, MU_KEY_RIGHT = 1<<7, }; struct mu_Rect { int x; int y; int w; int h; }; struct mu_Command { int type; union { struct { int dst; }jump; struct { mu_Rect rect; }clip; struct { Image *color; mu_Rect rect; }rect; struct { Font *font; Image *color; int s; Point pos; }text; struct { mu_Rect rect; int id; }icon; }; }; struct mu_Layout { mu_Rect body; mu_Rect next; Point position; Point size; Point max; int widths[MU_MAX_WIDTHS]; int items; int row_index; int next_row; int next_type; int indent; }; struct mu_Container { int head, tail; mu_Rect rect; mu_Rect body; Point content_size; Point scroll; int inited; int zindex; int open; }; struct mu_Style { Font *font; Point size; int padding; int spacing; int indent; int title_height; int scrollbar_size; int thumb_size; Image *colors[MU_COLOR_MAX]; }; struct mu_Context { /* core state */ mu_Id hover; mu_Id focus; mu_Id last_id; mu_Rect last_rect; int last_zindex; int updated_focus; mu_Container *hover_root; mu_Container *last_hover_root; mu_Container *scroll_target; char number_buf[MU_MAX_FMT]; mu_Id number_editing; Rectangle screen; int moving; /* buffers */ char *str, *oldstr; int strmax, strnum, oldstrmax, oldstrnum; mu_Container **root; int rootmax, rootnum; mu_Container **cnt; int cntmax, cntnum; mu_Rect *clip; int clipmax, clipnum; mu_Id *ids; int idsmax, idsnum; mu_Layout *layouts; int layoutsmax, layoutsnum; mu_Command *cmds, *oldcmds; int cmdsmax, cmdsnum, oldcmdsmax, oldcmdsnum; /* input state */ Point mouse_pos; Point last_mouse_pos; Point mouse_delta; Point scroll_delta; int mouse_down; int mouse_pressed; int key_down; int key_pressed; char text_input[64]; }; extern Image *atlasimage; extern mu_Rect *atlasicons; extern u8int defaultcolors[MU_COLOR_MAX][4]; extern mu_Context mu_ctx; extern mu_Style mu_style; mu_Rect mu_rect(int x, int y, int w, int h); Image *mu_color(u8int r, u8int g, u8int b, u8int a); void mu_init(void); int mu_render(void); void mu_begin(void); void mu_end(void); void mu_set_focus(mu_Id id); mu_Id mu_get_id(const void *data, int size); void mu_push_id(const void *data, int size); void mu_pop_id(void); void mu_push_clip_rect(mu_Rect rect); void mu_pop_clip_rect(void); mu_Rect mu_get_clip_rect(void); int mu_check_clip(mu_Rect r); mu_Container *mu_get_container(void); void mu_init_window(mu_Container *cnt, int opt); void mu_bring_to_front(mu_Container *cnt); void mu_input_mousemove(int x, int y); void mu_input_mousedown(int x, int y, int btn); void mu_input_mouseup(int x, int y, int btn); void mu_input_scroll(int x, int y); void mu_input_keydown(int key); void mu_input_keyup(int key); void mu_input_text(const char *text); mu_Command *mu_push_command(int type); void mu_set_clip(mu_Rect rect); void mu_draw_rect(mu_Rect rect, Image *color); void mu_draw_box(mu_Rect rect, Image *color); void mu_draw_text(Font *font, const char *str, int len, Point pos, Image *color); void mu_draw_icon(int id, mu_Rect rect); void mu_layout_row(int items, const int *widths, int height); void mu_layout_width(int width); void mu_layout_height(int height); void mu_layout_begin_column(void); void mu_layout_end_column(void); void mu_layout_set_next(mu_Rect r, int relative); mu_Rect mu_layout_next(void); void mu_draw_control_frame(mu_Id id, mu_Rect rect, int colorid, int opt); void mu_draw_control_text(const char *str, mu_Rect rect, int colorid, int opt); int mu_mouse_over(mu_Rect rect); void mu_update_control(mu_Id id, mu_Rect rect, int opt); void mu_text(const char *text); void mu_label(const char *text); int mu_button_ex(const char *label, int icon, int opt); int mu_button(const char *label); int mu_checkbox(int *state, const char *label); int mu_textbox_raw(char *buf, int bufsz, mu_Id id, mu_Rect r, int opt); int mu_textbox_ex(char *buf, int bufsz, int opt); int mu_textbox(char *buf, int bufsz); int mu_slider_ex(double *value, double low, double high, double step, const char *fmt, int opt); int mu_slider(double *value, double low, double high); int mu_number_ex(double *value, double step, const char *fmt, int opt); int mu_number(double *value, double step); int mu_header(int *state, const char *label); int mu_begin_treenode(int *state, const char *label); void mu_end_treenode(void); int mu_begin_window_ex(mu_Container *cnt, const char *title, int opt); int mu_begin_window(mu_Container *cnt, const char *title); void mu_end_window(void); void mu_open_popup(mu_Container *cnt); int mu_begin_popup(mu_Container *cnt); void mu_end_popup(void); void mu_begin_panel_ex(mu_Container *cnt, int opt); void mu_begin_panel(mu_Container *cnt); void mu_end_panel(void);