2015-03-03 19:24:02 +03:00
|
|
|
/*
|
|
|
|
Copyright (c) 2015
|
|
|
|
vurtun <polygone@gmx.net>
|
|
|
|
MIT licence
|
|
|
|
*/
|
2015-03-09 22:04:45 +03:00
|
|
|
#ifndef GUI_H_
|
|
|
|
#define GUI_H_
|
2015-03-20 12:58:11 +03:00
|
|
|
|
2015-04-10 19:35:17 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-03-03 19:24:02 +03:00
|
|
|
#define GUI_UTF_SIZE 4
|
2015-03-07 19:02:37 +03:00
|
|
|
#define GUI_INPUT_MAX 16
|
2015-04-10 19:35:17 +03:00
|
|
|
|
|
|
|
#ifdef GUI_USE_FIXED_TYPES
|
|
|
|
#include <stdint.h>
|
|
|
|
typedef int32_t gui_int;
|
|
|
|
typedef int32_t gui_bool;
|
|
|
|
typedef int16_t gui_short;
|
|
|
|
typedef int64_t gui_long;
|
|
|
|
typedef float gui_float;
|
|
|
|
typedef uint32_t gui_uint;
|
|
|
|
typedef uint64_t gui_ulong;
|
|
|
|
typedef uint32_t gui_flags;
|
|
|
|
typedef uint8_t gui_char;
|
|
|
|
typedef uint8_t gui_byte;
|
|
|
|
typedef uint32_t gui_flag;
|
|
|
|
typedef uint64_t gui_size;
|
|
|
|
#else
|
2015-03-03 19:24:02 +03:00
|
|
|
typedef int gui_int;
|
2015-04-10 19:35:17 +03:00
|
|
|
typedef int gui_bool;
|
2015-03-05 21:50:56 +03:00
|
|
|
typedef short gui_short;
|
|
|
|
typedef long gui_long;
|
2015-04-10 19:35:17 +03:00
|
|
|
typedef float gui_float;
|
|
|
|
typedef unsigned int gui_uint;
|
2015-03-20 12:58:11 +03:00
|
|
|
typedef unsigned long gui_ulong;
|
2015-03-05 17:37:11 +03:00
|
|
|
typedef unsigned int gui_flags;
|
2015-03-03 19:24:02 +03:00
|
|
|
typedef unsigned char gui_char;
|
|
|
|
typedef unsigned char gui_byte;
|
2015-03-07 19:02:37 +03:00
|
|
|
typedef unsigned int gui_flag;
|
2015-03-03 19:24:02 +03:00
|
|
|
typedef unsigned long gui_size;
|
2015-04-10 19:35:17 +03:00
|
|
|
#endif
|
|
|
|
|
2015-04-03 14:21:45 +03:00
|
|
|
typedef struct gui_panel gui_tab;
|
|
|
|
typedef struct gui_panel gui_group;
|
|
|
|
typedef struct gui_panel gui_shelf;
|
2015-04-15 15:37:19 +03:00
|
|
|
typedef gui_char gui_glyph[GUI_UTF_SIZE];
|
|
|
|
typedef union {void* handle; gui_uint id;} gui_texture;
|
|
|
|
typedef gui_size(*gui_text_width_f)(void*,const gui_char*, gui_size);
|
2015-03-03 19:24:02 +03:00
|
|
|
|
|
|
|
enum {gui_false, gui_true};
|
2015-03-17 16:42:49 +03:00
|
|
|
enum gui_heading {GUI_UP, GUI_RIGHT, GUI_DOWN, GUI_LEFT};
|
2015-03-03 19:24:02 +03:00
|
|
|
struct gui_color {gui_byte r,g,b,a;};
|
2015-03-13 00:53:28 +03:00
|
|
|
struct gui_colorf {gui_float r,g,b,a;};
|
2015-03-03 19:24:02 +03:00
|
|
|
struct gui_texCoord {gui_float u,v;};
|
|
|
|
struct gui_vec2 {gui_float x,y;};
|
|
|
|
struct gui_rect {gui_float x,y,w,h;};
|
2015-04-04 19:26:22 +03:00
|
|
|
struct gui_key {gui_bool down, clicked;};
|
2015-03-03 19:24:02 +03:00
|
|
|
|
2015-03-23 19:18:18 +03:00
|
|
|
struct gui_font {
|
2015-04-15 15:37:19 +03:00
|
|
|
void *user;
|
2015-03-23 19:18:18 +03:00
|
|
|
gui_float height;
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_text_width_f width;
|
2015-04-03 18:40:47 +03:00
|
|
|
};
|
|
|
|
|
2015-03-23 19:18:18 +03:00
|
|
|
enum gui_keys {
|
|
|
|
GUI_KEY_SHIFT,
|
|
|
|
GUI_KEY_CTRL,
|
|
|
|
GUI_KEY_DEL,
|
|
|
|
GUI_KEY_ENTER,
|
|
|
|
GUI_KEY_BACKSPACE,
|
|
|
|
GUI_KEY_ESCAPE,
|
|
|
|
GUI_KEY_SPACE,
|
|
|
|
GUI_KEY_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_input {
|
|
|
|
struct gui_key keys[GUI_KEY_MAX];
|
|
|
|
gui_char text[GUI_INPUT_MAX];
|
|
|
|
gui_size text_len;
|
|
|
|
struct gui_vec2 mouse_pos;
|
|
|
|
struct gui_vec2 mouse_prev;
|
|
|
|
struct gui_vec2 mouse_delta;
|
|
|
|
gui_bool mouse_down;
|
|
|
|
gui_uint mouse_clicked;
|
|
|
|
struct gui_vec2 mouse_clicked_pos;
|
|
|
|
};
|
|
|
|
|
2015-04-15 15:37:19 +03:00
|
|
|
struct gui_memory {
|
|
|
|
void *memory;
|
|
|
|
gui_size size;
|
|
|
|
gui_size max_panels;
|
|
|
|
gui_size max_depth;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_memory_status {
|
|
|
|
gui_size allocated;
|
|
|
|
gui_size needed;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum gui_command_type {
|
|
|
|
GUI_COMMAND_NOP = 0,
|
|
|
|
GUI_COMMAND_CLIP,
|
|
|
|
GUI_COMMAND_LINE,
|
|
|
|
GUI_COMMAND_RECT,
|
|
|
|
GUI_COMMAND_CIRCLE,
|
|
|
|
GUI_COMMAND_BITMAP,
|
|
|
|
GUI_COMMAND_TRIANGLE,
|
|
|
|
GUI_COMMAND_TEXT,
|
|
|
|
GUI_COMMAND_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_command {
|
|
|
|
enum gui_command_type type;
|
|
|
|
struct gui_command *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_command_clip {
|
|
|
|
struct gui_command header;
|
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_command_line {
|
|
|
|
struct gui_command header;
|
|
|
|
struct gui_color color;
|
|
|
|
struct gui_vec2 from;
|
|
|
|
struct gui_vec2 to;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_command_rect {
|
|
|
|
struct gui_command header;
|
|
|
|
struct gui_color color;
|
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_command_circle {
|
|
|
|
struct gui_command header;
|
2015-03-23 19:18:18 +03:00
|
|
|
struct gui_color color;
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_float radius;
|
|
|
|
gui_float x, y;
|
2015-03-23 19:18:18 +03:00
|
|
|
};
|
|
|
|
|
2015-04-15 15:37:19 +03:00
|
|
|
struct gui_command_bitmap {
|
|
|
|
struct gui_command header;
|
2015-03-23 19:18:18 +03:00
|
|
|
gui_texture texture;
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
2015-03-23 19:18:18 +03:00
|
|
|
};
|
|
|
|
|
2015-04-15 15:37:19 +03:00
|
|
|
struct gui_command_triangle {
|
|
|
|
struct gui_command header;
|
|
|
|
struct gui_vec2 pnt[3];
|
|
|
|
struct gui_color color;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_command_text {
|
|
|
|
struct gui_command header;
|
|
|
|
struct gui_color background;
|
|
|
|
struct gui_color foreground;
|
|
|
|
void *font;
|
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_size length;
|
|
|
|
gui_byte string[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_command_list{
|
|
|
|
struct gui_command *begin;
|
|
|
|
struct gui_command *end;
|
|
|
|
gui_size count;
|
|
|
|
gui_size capacity;
|
|
|
|
gui_size needed;
|
|
|
|
gui_size size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_command_buffer {
|
|
|
|
struct gui_command_list cmds;
|
2015-03-16 11:51:33 +03:00
|
|
|
struct gui_rect *clips;
|
|
|
|
gui_size clip_capacity;
|
|
|
|
gui_size clip_size;
|
|
|
|
};
|
|
|
|
|
2015-03-23 19:18:18 +03:00
|
|
|
struct gui_output {
|
2015-04-15 15:37:19 +03:00
|
|
|
struct gui_command_list **list;
|
2015-03-23 19:18:18 +03:00
|
|
|
gui_size list_size;
|
2015-03-05 17:37:11 +03:00
|
|
|
};
|
|
|
|
|
2015-04-08 12:54:33 +03:00
|
|
|
enum gui_text_align {
|
|
|
|
GUI_TEXT_LEFT,
|
|
|
|
GUI_TEXT_CENTERED,
|
|
|
|
GUI_TEXT_RIGHT
|
|
|
|
};
|
|
|
|
|
2015-03-13 00:53:28 +03:00
|
|
|
struct gui_text {
|
2015-04-15 15:37:19 +03:00
|
|
|
void *font;
|
2015-03-13 00:53:28 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_float pad_x, pad_y;
|
2015-04-15 15:37:19 +03:00
|
|
|
const char *string;
|
2015-03-13 00:53:28 +03:00
|
|
|
gui_size length;
|
2015-04-08 12:54:33 +03:00
|
|
|
enum gui_text_align align;
|
2015-04-15 15:37:19 +03:00
|
|
|
struct gui_color foreground;
|
2015-03-13 00:53:28 +03:00
|
|
|
struct gui_color background;
|
2015-03-13 22:01:31 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_image {
|
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_float pad_x, pad_y;
|
2015-03-27 03:57:45 +03:00
|
|
|
struct gui_color color;
|
2015-03-13 22:01:31 +03:00
|
|
|
struct gui_texCoord uv[2];
|
|
|
|
gui_texture texture;
|
|
|
|
struct gui_color background;
|
2015-03-13 00:53:28 +03:00
|
|
|
};
|
|
|
|
|
2015-03-14 19:05:30 +03:00
|
|
|
enum gui_button_behavior {
|
2015-04-10 19:35:17 +03:00
|
|
|
GUI_BUTTON_DEFAULT,
|
2015-03-14 19:05:30 +03:00
|
|
|
GUI_BUTTON_REPEATER
|
|
|
|
};
|
|
|
|
|
2015-03-09 22:04:45 +03:00
|
|
|
struct gui_button {
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_float pad_x, pad_y;
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_float border;
|
2015-03-14 19:05:30 +03:00
|
|
|
enum gui_button_behavior behavior;
|
2015-03-09 22:04:45 +03:00
|
|
|
struct gui_color background;
|
|
|
|
struct gui_color foreground;
|
2015-03-20 12:58:11 +03:00
|
|
|
struct gui_color content;
|
2015-03-17 16:42:49 +03:00
|
|
|
struct gui_color highlight;
|
2015-03-20 12:58:11 +03:00
|
|
|
struct gui_color highlight_content;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum gui_toggle_type {
|
|
|
|
GUI_TOGGLE_CHECK,
|
|
|
|
GUI_TOGGLE_OPTION
|
2015-03-09 22:04:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_toggle {
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_float pad_x, pad_y;
|
2015-03-13 22:01:31 +03:00
|
|
|
const gui_char *text;
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_size length;
|
2015-03-20 12:58:11 +03:00
|
|
|
enum gui_toggle_type type;
|
2015-03-09 22:04:45 +03:00
|
|
|
struct gui_color font;
|
|
|
|
struct gui_color background;
|
|
|
|
struct gui_color foreground;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_slider {
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_float pad_x, pad_y;
|
2015-03-09 22:04:45 +03:00
|
|
|
gui_float min, max;
|
|
|
|
gui_float value;
|
|
|
|
gui_float step;
|
|
|
|
struct gui_color background;
|
|
|
|
struct gui_color foreground;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_progress {
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_float pad_x, pad_y;
|
2015-03-09 22:04:45 +03:00
|
|
|
gui_size current;
|
|
|
|
gui_size max;
|
|
|
|
gui_bool modifyable;
|
|
|
|
struct gui_color background;
|
|
|
|
struct gui_color foreground;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_scroll {
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
2015-03-16 16:02:47 +03:00
|
|
|
gui_float offset;
|
|
|
|
gui_float target;
|
|
|
|
gui_float step;
|
2015-03-09 22:04:45 +03:00
|
|
|
struct gui_color background;
|
|
|
|
struct gui_color foreground;
|
2015-03-16 16:02:47 +03:00
|
|
|
struct gui_color border;
|
2015-03-09 22:04:45 +03:00
|
|
|
};
|
|
|
|
|
2015-03-14 19:05:30 +03:00
|
|
|
enum gui_input_filter {
|
|
|
|
GUI_INPUT_DEFAULT,
|
|
|
|
GUI_INPUT_FLOAT,
|
|
|
|
GUI_INPUT_DEC,
|
|
|
|
GUI_INPUT_HEX,
|
|
|
|
GUI_INPUT_OCT,
|
2015-03-20 12:58:11 +03:00
|
|
|
GUI_INPUT_BIN
|
2015-03-13 22:01:31 +03:00
|
|
|
};
|
|
|
|
|
2015-03-09 22:04:45 +03:00
|
|
|
struct gui_input_field {
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_float pad_x, pad_y;
|
|
|
|
gui_size max;
|
2015-03-09 22:04:45 +03:00
|
|
|
gui_bool active;
|
2015-03-16 11:51:33 +03:00
|
|
|
gui_bool show_cursor;
|
2015-03-14 19:05:30 +03:00
|
|
|
enum gui_input_filter filter;
|
2015-03-13 22:01:31 +03:00
|
|
|
gui_bool password;
|
|
|
|
struct gui_color background;
|
|
|
|
struct gui_color foreground;
|
|
|
|
struct gui_color font;
|
|
|
|
};
|
|
|
|
|
2015-03-09 22:04:45 +03:00
|
|
|
struct gui_plot {
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_float pad_x;
|
|
|
|
gui_float pad_y;
|
|
|
|
gui_size value_count;
|
2015-03-09 22:04:45 +03:00
|
|
|
const gui_float *values;
|
|
|
|
struct gui_color background;
|
|
|
|
struct gui_color foreground;
|
2015-03-11 20:17:37 +03:00
|
|
|
struct gui_color highlight;
|
2015-03-09 22:04:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_histo {
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float w, h;
|
|
|
|
gui_float pad_x, pad_y;
|
|
|
|
gui_size value_count;
|
2015-03-09 22:04:45 +03:00
|
|
|
const gui_float *values;
|
|
|
|
struct gui_color background;
|
|
|
|
struct gui_color foreground;
|
|
|
|
struct gui_color negative;
|
|
|
|
struct gui_color highlight;
|
|
|
|
};
|
|
|
|
|
2015-03-23 19:18:18 +03:00
|
|
|
enum gui_panel_colors {
|
2015-03-08 21:19:07 +03:00
|
|
|
GUI_COLOR_TEXT,
|
|
|
|
GUI_COLOR_PANEL,
|
|
|
|
GUI_COLOR_BORDER,
|
|
|
|
GUI_COLOR_TITLEBAR,
|
|
|
|
GUI_COLOR_BUTTON,
|
|
|
|
GUI_COLOR_BUTTON_BORDER,
|
2015-03-17 16:42:49 +03:00
|
|
|
GUI_COLOR_BUTTON_HOVER,
|
|
|
|
GUI_COLOR_BUTTON_HOVER_FONT,
|
2015-03-20 12:58:11 +03:00
|
|
|
GUI_COLOR_CHECK,
|
|
|
|
GUI_COLOR_CHECK_ACTIVE,
|
|
|
|
GUI_COLOR_OPTION,
|
|
|
|
GUI_COLOR_OPTION_ACTIVE,
|
2015-03-08 21:19:07 +03:00
|
|
|
GUI_COLOR_SCROLL,
|
|
|
|
GUI_COLOR_SCROLL_CURSOR,
|
|
|
|
GUI_COLOR_SLIDER,
|
|
|
|
GUI_COLOR_SLIDER_CURSOR,
|
|
|
|
GUI_COLOR_PROGRESS,
|
|
|
|
GUI_COLOR_PROGRESS_CURSOR,
|
2015-03-10 15:50:27 +03:00
|
|
|
GUI_COLOR_INPUT,
|
|
|
|
GUI_COLOR_INPUT_BORDER,
|
2015-03-14 19:05:30 +03:00
|
|
|
GUI_COLOR_SPINNER,
|
|
|
|
GUI_COLOR_SPINNER_BORDER,
|
2015-03-20 12:58:11 +03:00
|
|
|
GUI_COLOR_SELECTOR,
|
|
|
|
GUI_COLOR_SELECTOR_BORDER,
|
2015-03-10 15:50:27 +03:00
|
|
|
GUI_COLOR_HISTO,
|
|
|
|
GUI_COLOR_HISTO_BARS,
|
|
|
|
GUI_COLOR_HISTO_NEGATIVE,
|
|
|
|
GUI_COLOR_HISTO_HIGHLIGHT,
|
|
|
|
GUI_COLOR_PLOT,
|
|
|
|
GUI_COLOR_PLOT_LINES,
|
2015-03-11 20:17:37 +03:00
|
|
|
GUI_COLOR_PLOT_HIGHLIGHT,
|
2015-03-16 11:51:33 +03:00
|
|
|
GUI_COLOR_SCROLLBAR,
|
|
|
|
GUI_COLOR_SCROLLBAR_CURSOR,
|
2015-03-16 16:02:47 +03:00
|
|
|
GUI_COLOR_SCROLLBAR_BORDER,
|
2015-04-07 19:20:28 +03:00
|
|
|
GUI_COLOR_SCALER,
|
2015-03-08 21:19:07 +03:00
|
|
|
GUI_COLOR_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_config {
|
2015-03-10 15:50:27 +03:00
|
|
|
struct gui_vec2 panel_padding;
|
|
|
|
struct gui_vec2 panel_min_size;
|
2015-03-08 21:19:07 +03:00
|
|
|
struct gui_vec2 item_spacing;
|
|
|
|
struct gui_vec2 item_padding;
|
2015-03-25 16:15:42 +03:00
|
|
|
struct gui_vec2 scaler_size;
|
2015-03-16 11:51:33 +03:00
|
|
|
gui_float scrollbar_width;
|
2015-03-08 21:19:07 +03:00
|
|
|
struct gui_color colors[GUI_COLOR_COUNT];
|
2015-03-05 17:37:11 +03:00
|
|
|
};
|
|
|
|
|
2015-03-10 15:50:27 +03:00
|
|
|
enum gui_panel_flags {
|
2015-04-07 19:47:32 +03:00
|
|
|
GUI_PANEL_HIDDEN = 0x01,
|
2015-04-03 19:59:24 +03:00
|
|
|
GUI_PANEL_BORDER = 0x02,
|
|
|
|
GUI_PANEL_MINIMIZABLE = 0x4,
|
|
|
|
GUI_PANEL_CLOSEABLE = 0x8,
|
2015-04-07 19:47:32 +03:00
|
|
|
GUI_PANEL_MOVEABLE = 0x10,
|
|
|
|
GUI_PANEL_SCALEABLE = 0x20,
|
2015-04-07 04:24:31 +03:00
|
|
|
/* internal */
|
2015-04-07 19:47:32 +03:00
|
|
|
GUI_PANEL_SCROLLBAR = 0x40,
|
|
|
|
GUI_PANEL_TAB = 0x80
|
2015-03-23 19:18:18 +03:00
|
|
|
};
|
|
|
|
|
2015-03-05 17:37:11 +03:00
|
|
|
struct gui_panel {
|
|
|
|
gui_flags flags;
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float x, y;
|
|
|
|
gui_float at_y;
|
|
|
|
gui_float width, height;
|
|
|
|
gui_size index;
|
2015-03-16 11:51:33 +03:00
|
|
|
gui_float header_height;
|
2015-03-11 16:00:59 +03:00
|
|
|
gui_float row_height;
|
|
|
|
gui_size row_columns;
|
2015-03-16 11:51:33 +03:00
|
|
|
gui_float offset;
|
2015-03-20 12:58:11 +03:00
|
|
|
gui_bool minimized;
|
2015-04-15 15:37:19 +03:00
|
|
|
struct gui_command_buffer *out;
|
|
|
|
struct gui_font font;
|
2015-03-11 16:00:59 +03:00
|
|
|
const struct gui_input *in;
|
2015-03-09 22:04:45 +03:00
|
|
|
const struct gui_config *config;
|
2015-03-03 19:24:02 +03:00
|
|
|
};
|
|
|
|
|
2015-03-09 22:04:45 +03:00
|
|
|
/* Input */
|
2015-04-02 21:09:03 +03:00
|
|
|
void gui_input_begin(struct gui_input*);
|
|
|
|
void gui_input_motion(struct gui_input*, gui_int x, gui_int y);
|
2015-04-04 19:26:22 +03:00
|
|
|
void gui_input_key(struct gui_input*, enum gui_keys, gui_bool down);
|
2015-04-02 21:09:03 +03:00
|
|
|
void gui_input_button(struct gui_input*, gui_int x, gui_int y, gui_bool down);
|
|
|
|
void gui_input_char(struct gui_input*, const gui_glyph);
|
|
|
|
void gui_input_end(struct gui_input*);
|
2015-03-03 19:24:02 +03:00
|
|
|
|
2015-03-09 22:04:45 +03:00
|
|
|
/* Output */
|
2015-04-15 15:37:19 +03:00
|
|
|
void gui_output_begin(struct gui_command_buffer*, const struct gui_memory*);
|
|
|
|
void gui_output_end(struct gui_command_buffer*, struct gui_command_list*,
|
2015-04-02 21:09:03 +03:00
|
|
|
struct gui_memory_status*);
|
2015-03-04 16:54:48 +03:00
|
|
|
|
2015-03-09 22:04:45 +03:00
|
|
|
/* Widgets */
|
2015-04-15 15:37:19 +03:00
|
|
|
void gui_widget_text(struct gui_command_buffer*, const struct gui_text*,
|
2015-03-23 19:18:18 +03:00
|
|
|
const struct gui_font*);
|
2015-04-15 15:37:19 +03:00
|
|
|
void gui_widget_image(struct gui_command_buffer*, const struct gui_image*);
|
|
|
|
gui_bool gui_widget_button_text(struct gui_command_buffer*, const struct gui_button*,
|
2015-03-23 19:18:18 +03:00
|
|
|
const char *text, gui_size len, const struct gui_font*,
|
|
|
|
const struct gui_input*);
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_bool gui_widget_button_triangle(struct gui_command_buffer*, struct gui_button*,
|
2015-03-23 19:18:18 +03:00
|
|
|
enum gui_heading, const struct gui_input*);
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_bool gui_widget_button_icon(struct gui_command_buffer*, struct gui_button*,
|
2015-03-23 19:18:18 +03:00
|
|
|
gui_texture, struct gui_texCoord from, struct gui_texCoord to,
|
|
|
|
const struct gui_input*);
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_bool gui_widget_toggle(struct gui_command_buffer*, const struct gui_toggle*,
|
|
|
|
gui_bool active, const struct gui_font*, const struct gui_input*);
|
|
|
|
gui_float gui_widget_slider(struct gui_command_buffer*, const struct gui_slider*,
|
2015-03-23 19:18:18 +03:00
|
|
|
const struct gui_input*);
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_size gui_widget_progress(struct gui_command_buffer*, const struct gui_progress*,
|
2015-03-23 19:18:18 +03:00
|
|
|
const struct gui_input*);
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_bool gui_widget_input(struct gui_command_buffer*, gui_char*, gui_size*,
|
2015-03-23 19:18:18 +03:00
|
|
|
const struct gui_input_field*, const struct gui_font*,
|
|
|
|
const struct gui_input*);
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_float gui_widget_scroll(struct gui_command_buffer*, const struct gui_scroll*,
|
2015-03-23 19:18:18 +03:00
|
|
|
const struct gui_input*);
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_int gui_widget_histo(struct gui_command_buffer*, const struct gui_histo*,
|
2015-03-23 19:18:18 +03:00
|
|
|
const struct gui_input*);
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_int gui_widget_plot(struct gui_command_buffer*, const struct gui_plot*,
|
2015-03-23 19:18:18 +03:00
|
|
|
const struct gui_input*);
|
2015-03-09 22:04:45 +03:00
|
|
|
|
|
|
|
/* Panel */
|
2015-03-23 19:18:18 +03:00
|
|
|
void gui_default_config(struct gui_config*);
|
2015-04-07 19:20:28 +03:00
|
|
|
void gui_panel_show(struct gui_panel*);
|
|
|
|
void gui_panel_hide(struct gui_panel*);
|
2015-04-10 19:35:17 +03:00
|
|
|
void gui_panel_init(struct gui_panel*, const struct gui_config*, const struct gui_font*);
|
2015-04-07 19:47:32 +03:00
|
|
|
gui_bool gui_panel_is_hidden(const struct gui_panel*);
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_bool gui_panel_begin(struct gui_panel*, struct gui_command_buffer*,
|
2015-03-23 19:18:18 +03:00
|
|
|
const struct gui_input*, const char*,
|
|
|
|
gui_float x, gui_float y, gui_float w, gui_float h, gui_flags);
|
2015-04-10 19:35:17 +03:00
|
|
|
void gui_panel_end(struct gui_panel*);
|
2015-03-23 19:18:18 +03:00
|
|
|
void gui_panel_layout(struct gui_panel*, gui_float height, gui_size cols);
|
|
|
|
void gui_panel_seperator(struct gui_panel*, gui_size cols);
|
2015-04-08 12:54:33 +03:00
|
|
|
void gui_panel_text(struct gui_panel*, const char *str, gui_size len, enum gui_text_align);
|
2015-03-30 01:51:07 +03:00
|
|
|
gui_bool gui_panel_check(struct gui_panel*, const char*, gui_bool active);
|
|
|
|
gui_bool gui_panel_option(struct gui_panel*, const char*, gui_bool active);
|
|
|
|
gui_bool gui_panel_button_text(struct gui_panel*, const char*, enum gui_button_behavior);
|
|
|
|
gui_bool gui_panel_button_color(struct gui_panel*, const struct gui_color, enum gui_button_behavior);
|
|
|
|
gui_bool gui_panel_button_triangle(struct gui_panel*, enum gui_heading, enum gui_button_behavior);
|
|
|
|
gui_bool gui_panel_button_toggle(struct gui_panel*, const char*, gui_bool value);
|
2015-04-04 19:26:22 +03:00
|
|
|
gui_bool gui_panel_button_icon(struct gui_panel*, gui_texture, struct gui_texCoord from,
|
|
|
|
struct gui_texCoord to, enum gui_button_behavior);
|
2015-03-23 19:18:18 +03:00
|
|
|
gui_float gui_panel_slider(struct gui_panel*, gui_float min, gui_float val,
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_float max, gui_float step);
|
2015-03-23 19:18:18 +03:00
|
|
|
gui_size gui_panel_progress(struct gui_panel*, gui_size cur, gui_size max,
|
2015-04-15 15:37:19 +03:00
|
|
|
gui_bool modifyable);
|
2015-03-23 19:18:18 +03:00
|
|
|
gui_bool gui_panel_input(struct gui_panel*, gui_char *buffer, gui_size *len,
|
|
|
|
gui_size max, enum gui_input_filter, gui_bool active);
|
2015-03-27 21:07:22 +03:00
|
|
|
gui_size gui_panel_shell(struct gui_panel*, gui_char *buffer, gui_size *length,
|
2015-03-23 19:18:18 +03:00
|
|
|
gui_size max, gui_bool *active);
|
|
|
|
gui_bool gui_panel_spinner(struct gui_panel*, gui_int min, gui_int *value,
|
|
|
|
gui_int max, gui_int step, gui_bool active);
|
|
|
|
gui_size gui_panel_selector(struct gui_panel*, const char *items[],
|
|
|
|
gui_size item_count, gui_size item_current);
|
2015-04-07 04:24:31 +03:00
|
|
|
gui_int gui_panel_plot(struct gui_panel*, const gui_float *values, gui_size value_count);
|
|
|
|
gui_int gui_panel_histo(struct gui_panel*, const gui_float *values, gui_size value_count);
|
|
|
|
gui_bool gui_panel_tab_begin(gui_tab*, gui_tab*, const char *title);
|
|
|
|
void gui_panel_tab_end(gui_tab*, gui_tab *tab);
|
|
|
|
void gui_panel_group_begin(gui_group*, gui_group*, const char *title);
|
|
|
|
void gui_panel_group_end(gui_group*, gui_group* tab);
|
|
|
|
gui_size gui_panel_shelf_begin(gui_shelf*, gui_shelf *shelf, const char *tabs[],
|
|
|
|
gui_size size, gui_size active);
|
|
|
|
void gui_panel_shelf_end(gui_shelf*, gui_shelf *shelf);
|
2015-03-23 19:18:18 +03:00
|
|
|
|
|
|
|
/* Context */
|
|
|
|
struct gui_context;
|
|
|
|
struct gui_context *gui_new(const struct gui_memory*, const struct gui_input*);
|
|
|
|
void gui_begin(struct gui_context*, gui_float width, gui_float height);
|
|
|
|
void gui_end(struct gui_context*, struct gui_output*, struct gui_memory_status*);
|
2015-04-15 15:37:19 +03:00
|
|
|
struct gui_panel *gui_new_panel(struct gui_context*, gui_float x, gui_float y, gui_float w,
|
2015-03-24 19:12:42 +03:00
|
|
|
gui_float h, const struct gui_config* , const struct gui_font*);
|
2015-04-15 15:37:19 +03:00
|
|
|
void gui_del_panel(struct gui_context*, struct gui_panel*);
|
2015-04-07 19:47:32 +03:00
|
|
|
struct gui_vec2 gui_get_panel_position(const struct gui_context*, const struct gui_panel*);
|
|
|
|
struct gui_vec2 gui_get_panel_size(const struct gui_context*, const struct gui_panel*);
|
2015-03-23 19:18:18 +03:00
|
|
|
gui_bool gui_begin_panel(struct gui_context*, struct gui_panel*, const char *title, gui_flags flags);
|
|
|
|
void gui_end_panel(struct gui_context*, struct gui_panel*, struct gui_memory_status*);
|
2015-03-20 12:58:11 +03:00
|
|
|
|
2015-04-10 19:35:17 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-03-03 19:24:02 +03:00
|
|
|
#endif
|