Blame src-nuklear/nuklear_style.c

Ivan Mahonin b53a5c
#include "nuklear.h"
Ivan Mahonin b53a5c
#include "nuklear_internal.h"
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ===============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                              STYLE
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================*/
Ivan Mahonin b53a5c
NK_API void nk_style_default(struct nk_context *ctx){nk_style_from_table(ctx, 0);}
Ivan Mahonin b53a5c
#define NK_COLOR_MAP(NK_COLOR)\
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_TEXT,                     175,175,175,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_WINDOW,                   45, 45, 45, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_HEADER,                   40, 40, 40, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_BORDER,                   65, 65, 65, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_BUTTON,                   50, 50, 50, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_BUTTON_HOVER,             40, 40, 40, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_BUTTON_ACTIVE,            35, 35, 35, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_TOGGLE,                   100,100,100,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_TOGGLE_HOVER,             120,120,120,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_TOGGLE_CURSOR,            45, 45, 45, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SELECT,                   45, 45, 45, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SELECT_ACTIVE,            35, 35, 35,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SLIDER,                   38, 38, 38, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SLIDER_CURSOR,            100,100,100,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SLIDER_CURSOR_HOVER,      120,120,120,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SLIDER_CURSOR_ACTIVE,     150,150,150,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_PROPERTY,                 38, 38, 38, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_EDIT,                     38, 38, 38, 255)  \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_EDIT_CURSOR,              175,175,175,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_COMBO,                    45, 45, 45, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_CHART,                    120,120,120,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_CHART_COLOR,              45, 45, 45, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_CHART_COLOR_HIGHLIGHT,    255, 0,  0, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SCROLLBAR,                40, 40, 40, 255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SCROLLBAR_CURSOR,         100,100,100,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SCROLLBAR_CURSOR_HOVER,   120,120,120,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_SCROLLBAR_CURSOR_ACTIVE,  150,150,150,255) \
Ivan Mahonin b53a5c
    NK_COLOR(NK_COLOR_TAB_HEADER,               40, 40, 40,255)
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_GLOBAL const struct nk_color
Ivan Mahonin b53a5c
nk_default_color_style[NK_COLOR_COUNT] = {
Ivan Mahonin b53a5c
#define NK_COLOR(a,b,c,d,e) {b,c,d,e},
Ivan Mahonin b53a5c
    NK_COLOR_MAP(NK_COLOR)
Ivan Mahonin b53a5c
#undef NK_COLOR
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
NK_GLOBAL const char *nk_color_names[NK_COLOR_COUNT] = {
Ivan Mahonin b53a5c
#define NK_COLOR(a,b,c,d,e) #a,
Ivan Mahonin b53a5c
    NK_COLOR_MAP(NK_COLOR)
Ivan Mahonin b53a5c
#undef NK_COLOR
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API const char*
Ivan Mahonin b53a5c
nk_style_get_color_by_name(enum nk_style_colors c)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    return nk_color_names[c];
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API struct nk_style_item
Ivan Mahonin b53a5c
nk_style_item_color(struct nk_color col)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_style_item i;
Ivan Mahonin b53a5c
    i.type = NK_STYLE_ITEM_COLOR;
Ivan Mahonin b53a5c
    i.data.color = col;
Ivan Mahonin b53a5c
    return i;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API struct nk_style_item
Ivan Mahonin b53a5c
nk_style_item_image(struct nk_image img)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_style_item i;
Ivan Mahonin b53a5c
    i.type = NK_STYLE_ITEM_IMAGE;
Ivan Mahonin b53a5c
    i.data.image = img;
Ivan Mahonin b53a5c
    return i;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API struct nk_style_item
Ivan Mahonin b53a5c
nk_style_item_nine_slice(struct nk_nine_slice slice)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_style_item i;
Ivan Mahonin b53a5c
    i.type = NK_STYLE_ITEM_NINE_SLICE;
Ivan Mahonin b53a5c
    i.data.slice = slice;
Ivan Mahonin b53a5c
    return i;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API struct nk_style_item
Ivan Mahonin b53a5c
nk_style_item_hide(void)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_style_item i;
Ivan Mahonin b53a5c
    i.type = NK_STYLE_ITEM_COLOR;
Ivan Mahonin b53a5c
    i.data.color = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    return i;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API void
Ivan Mahonin b53a5c
nk_style_from_table(struct nk_context *ctx, const struct nk_color *table)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_style *style;
Ivan Mahonin b53a5c
    struct nk_style_text *text;
Ivan Mahonin b53a5c
    struct nk_style_button *button;
Ivan Mahonin b53a5c
    struct nk_style_toggle *toggle;
Ivan Mahonin b53a5c
    struct nk_style_selectable *select;
Ivan Mahonin b53a5c
    struct nk_style_slider *slider;
Ivan Mahonin b53a5c
    struct nk_style_progress *prog;
Ivan Mahonin b53a5c
    struct nk_style_scrollbar *scroll;
Ivan Mahonin b53a5c
    struct nk_style_edit *edit;
Ivan Mahonin b53a5c
    struct nk_style_property *property;
Ivan Mahonin b53a5c
    struct nk_style_combo *combo;
Ivan Mahonin b53a5c
    struct nk_style_chart *chart;
Ivan Mahonin b53a5c
    struct nk_style_tab *tab;
Ivan Mahonin b53a5c
    struct nk_style_window *win;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    NK_ASSERT(ctx);
Ivan Mahonin b53a5c
    if (!ctx) return;
Ivan Mahonin b53a5c
    style = &ctx->style;
Ivan Mahonin b53a5c
    table = (!table) ? nk_default_color_style: table;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* default text */
Ivan Mahonin b53a5c
    text = &style->text;
Ivan Mahonin b53a5c
    text->color = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    text->padding = nk_vec2(0,0);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* default button */
Ivan Mahonin b53a5c
    button = &style->button;
Ivan Mahonin b53a5c
    nk_zero_struct(*button);
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(table[NK_COLOR_BUTTON]);
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(table[NK_COLOR_BUTTON_HOVER]);
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(table[NK_COLOR_BUTTON_ACTIVE]);
Ivan Mahonin b53a5c
    button->border_color    = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    button->text_background = table[NK_COLOR_BUTTON];
Ivan Mahonin b53a5c
    button->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(2.0f,2.0f);
Ivan Mahonin b53a5c
    button->image_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f, 0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 1.0f;
Ivan Mahonin b53a5c
    button->rounding        = 4.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* contextual button */
Ivan Mahonin b53a5c
    button = &style->contextual_button;
Ivan Mahonin b53a5c
    nk_zero_struct(*button);
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(table[NK_COLOR_WINDOW]);
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(table[NK_COLOR_BUTTON_HOVER]);
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(table[NK_COLOR_BUTTON_ACTIVE]);
Ivan Mahonin b53a5c
    button->border_color    = table[NK_COLOR_WINDOW];
Ivan Mahonin b53a5c
    button->text_background = table[NK_COLOR_WINDOW];
Ivan Mahonin b53a5c
    button->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(2.0f,2.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 0.0f;
Ivan Mahonin b53a5c
    button->rounding        = 0.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* menu button */
Ivan Mahonin b53a5c
    button = &style->menu_button;
Ivan Mahonin b53a5c
    nk_zero_struct(*button);
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(table[NK_COLOR_WINDOW]);
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(table[NK_COLOR_WINDOW]);
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(table[NK_COLOR_WINDOW]);
Ivan Mahonin b53a5c
    button->border_color    = table[NK_COLOR_WINDOW];
Ivan Mahonin b53a5c
    button->text_background = table[NK_COLOR_WINDOW];
Ivan Mahonin b53a5c
    button->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(2.0f,2.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 0.0f;
Ivan Mahonin b53a5c
    button->rounding        = 1.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* checkbox toggle */
Ivan Mahonin b53a5c
    toggle = &style->checkbox;
Ivan Mahonin b53a5c
    nk_zero_struct(*toggle);
Ivan Mahonin b53a5c
    toggle->normal          = nk_style_item_color(table[NK_COLOR_TOGGLE]);
Ivan Mahonin b53a5c
    toggle->hover           = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
Ivan Mahonin b53a5c
    toggle->active          = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
Ivan Mahonin b53a5c
    toggle->cursor_normal   = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
Ivan Mahonin b53a5c
    toggle->cursor_hover    = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
Ivan Mahonin b53a5c
    toggle->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    toggle->text_background = table[NK_COLOR_WINDOW];
Ivan Mahonin b53a5c
    toggle->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    toggle->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    toggle->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    toggle->padding         = nk_vec2(2.0f, 2.0f);
Ivan Mahonin b53a5c
    toggle->touch_padding   = nk_vec2(0,0);
Ivan Mahonin b53a5c
    toggle->border_color    = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    toggle->border          = 0.0f;
Ivan Mahonin b53a5c
    toggle->spacing         = 4;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* option toggle */
Ivan Mahonin b53a5c
    toggle = &style->option;
Ivan Mahonin b53a5c
    nk_zero_struct(*toggle);
Ivan Mahonin b53a5c
    toggle->normal          = nk_style_item_color(table[NK_COLOR_TOGGLE]);
Ivan Mahonin b53a5c
    toggle->hover           = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
Ivan Mahonin b53a5c
    toggle->active          = nk_style_item_color(table[NK_COLOR_TOGGLE_HOVER]);
Ivan Mahonin b53a5c
    toggle->cursor_normal   = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
Ivan Mahonin b53a5c
    toggle->cursor_hover    = nk_style_item_color(table[NK_COLOR_TOGGLE_CURSOR]);
Ivan Mahonin b53a5c
    toggle->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    toggle->text_background = table[NK_COLOR_WINDOW];
Ivan Mahonin b53a5c
    toggle->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    toggle->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    toggle->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    toggle->padding         = nk_vec2(3.0f, 3.0f);
Ivan Mahonin b53a5c
    toggle->touch_padding   = nk_vec2(0,0);
Ivan Mahonin b53a5c
    toggle->border_color    = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    toggle->border          = 0.0f;
Ivan Mahonin b53a5c
    toggle->spacing         = 4;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* selectable */
Ivan Mahonin b53a5c
    select = &style->selectable;
Ivan Mahonin b53a5c
    nk_zero_struct(*select);
Ivan Mahonin b53a5c
    select->normal          = nk_style_item_color(table[NK_COLOR_SELECT]);
Ivan Mahonin b53a5c
    select->hover           = nk_style_item_color(table[NK_COLOR_SELECT]);
Ivan Mahonin b53a5c
    select->pressed         = nk_style_item_color(table[NK_COLOR_SELECT]);
Ivan Mahonin b53a5c
    select->normal_active   = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]);
Ivan Mahonin b53a5c
    select->hover_active    = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]);
Ivan Mahonin b53a5c
    select->pressed_active  = nk_style_item_color(table[NK_COLOR_SELECT_ACTIVE]);
Ivan Mahonin b53a5c
    select->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    select->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    select->text_pressed    = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    select->text_normal_active  = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    select->text_hover_active   = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    select->text_pressed_active = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    select->padding         = nk_vec2(2.0f,2.0f);
Ivan Mahonin b53a5c
    select->image_padding   = nk_vec2(2.0f,2.0f);
Ivan Mahonin b53a5c
    select->touch_padding   = nk_vec2(0,0);
Ivan Mahonin b53a5c
    select->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    select->rounding        = 0.0f;
Ivan Mahonin b53a5c
    select->draw_begin      = 0;
Ivan Mahonin b53a5c
    select->draw_end        = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* slider */
Ivan Mahonin b53a5c
    slider = &style->slider;
Ivan Mahonin b53a5c
    nk_zero_struct(*slider);
Ivan Mahonin b53a5c
    slider->normal          = nk_style_item_hide();
Ivan Mahonin b53a5c
    slider->hover           = nk_style_item_hide();
Ivan Mahonin b53a5c
    slider->active          = nk_style_item_hide();
Ivan Mahonin b53a5c
    slider->bar_normal      = table[NK_COLOR_SLIDER];
Ivan Mahonin b53a5c
    slider->bar_hover       = table[NK_COLOR_SLIDER];
Ivan Mahonin b53a5c
    slider->bar_active      = table[NK_COLOR_SLIDER];
Ivan Mahonin b53a5c
    slider->bar_filled      = table[NK_COLOR_SLIDER_CURSOR];
Ivan Mahonin b53a5c
    slider->cursor_normal   = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR]);
Ivan Mahonin b53a5c
    slider->cursor_hover    = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_HOVER]);
Ivan Mahonin b53a5c
    slider->cursor_active   = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_ACTIVE]);
Ivan Mahonin b53a5c
    slider->inc_symbol      = NK_SYMBOL_TRIANGLE_RIGHT;
Ivan Mahonin b53a5c
    slider->dec_symbol      = NK_SYMBOL_TRIANGLE_LEFT;
Ivan Mahonin b53a5c
    slider->cursor_size     = nk_vec2(16,16);
Ivan Mahonin b53a5c
    slider->padding         = nk_vec2(2,2);
Ivan Mahonin b53a5c
    slider->spacing         = nk_vec2(2,2);
Ivan Mahonin b53a5c
    slider->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    slider->show_buttons    = nk_false;
Ivan Mahonin b53a5c
    slider->bar_height      = 8;
Ivan Mahonin b53a5c
    slider->rounding        = 0;
Ivan Mahonin b53a5c
    slider->draw_begin      = 0;
Ivan Mahonin b53a5c
    slider->draw_end        = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* slider buttons */
Ivan Mahonin b53a5c
    button = &style->slider.inc_button;
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(nk_rgb(40,40,40));
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(nk_rgb(42,42,42));
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(nk_rgb(44,44,44));
Ivan Mahonin b53a5c
    button->border_color    = nk_rgb(65,65,65);
Ivan Mahonin b53a5c
    button->text_background = nk_rgb(40,40,40);
Ivan Mahonin b53a5c
    button->text_normal     = nk_rgb(175,175,175);
Ivan Mahonin b53a5c
    button->text_hover      = nk_rgb(175,175,175);
Ivan Mahonin b53a5c
    button->text_active     = nk_rgb(175,175,175);
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(8.0f,8.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 1.0f;
Ivan Mahonin b53a5c
    button->rounding        = 0.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
    style->slider.dec_button = style->slider.inc_button;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* progressbar */
Ivan Mahonin b53a5c
    prog = &style->progress;
Ivan Mahonin b53a5c
    nk_zero_struct(*prog);
Ivan Mahonin b53a5c
    prog->normal            = nk_style_item_color(table[NK_COLOR_SLIDER]);
Ivan Mahonin b53a5c
    prog->hover             = nk_style_item_color(table[NK_COLOR_SLIDER]);
Ivan Mahonin b53a5c
    prog->active            = nk_style_item_color(table[NK_COLOR_SLIDER]);
Ivan Mahonin b53a5c
    prog->cursor_normal     = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR]);
Ivan Mahonin b53a5c
    prog->cursor_hover      = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_HOVER]);
Ivan Mahonin b53a5c
    prog->cursor_active     = nk_style_item_color(table[NK_COLOR_SLIDER_CURSOR_ACTIVE]);
Ivan Mahonin b53a5c
    prog->border_color      = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    prog->cursor_border_color = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    prog->userdata          = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    prog->padding           = nk_vec2(4,4);
Ivan Mahonin b53a5c
    prog->rounding          = 0;
Ivan Mahonin b53a5c
    prog->border            = 0;
Ivan Mahonin b53a5c
    prog->cursor_rounding   = 0;
Ivan Mahonin b53a5c
    prog->cursor_border     = 0;
Ivan Mahonin b53a5c
    prog->draw_begin        = 0;
Ivan Mahonin b53a5c
    prog->draw_end          = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* scrollbars */
Ivan Mahonin b53a5c
    scroll = &style->scrollh;
Ivan Mahonin b53a5c
    nk_zero_struct(*scroll);
Ivan Mahonin b53a5c
    scroll->normal          = nk_style_item_color(table[NK_COLOR_SCROLLBAR]);
Ivan Mahonin b53a5c
    scroll->hover           = nk_style_item_color(table[NK_COLOR_SCROLLBAR]);
Ivan Mahonin b53a5c
    scroll->active          = nk_style_item_color(table[NK_COLOR_SCROLLBAR]);
Ivan Mahonin b53a5c
    scroll->cursor_normal   = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR]);
Ivan Mahonin b53a5c
    scroll->cursor_hover    = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR_HOVER]);
Ivan Mahonin b53a5c
    scroll->cursor_active   = nk_style_item_color(table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE]);
Ivan Mahonin b53a5c
    scroll->dec_symbol      = NK_SYMBOL_CIRCLE_SOLID;
Ivan Mahonin b53a5c
    scroll->inc_symbol      = NK_SYMBOL_CIRCLE_SOLID;
Ivan Mahonin b53a5c
    scroll->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    scroll->border_color    = table[NK_COLOR_SCROLLBAR];
Ivan Mahonin b53a5c
    scroll->cursor_border_color = table[NK_COLOR_SCROLLBAR];
Ivan Mahonin b53a5c
    scroll->padding         = nk_vec2(0,0);
Ivan Mahonin b53a5c
    scroll->show_buttons    = nk_false;
Ivan Mahonin b53a5c
    scroll->border          = 0;
Ivan Mahonin b53a5c
    scroll->rounding        = 0;
Ivan Mahonin b53a5c
    scroll->border_cursor   = 0;
Ivan Mahonin b53a5c
    scroll->rounding_cursor = 0;
Ivan Mahonin b53a5c
    scroll->draw_begin      = 0;
Ivan Mahonin b53a5c
    scroll->draw_end        = 0;
Ivan Mahonin b53a5c
    style->scrollv = style->scrollh;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* scrollbars buttons */
Ivan Mahonin b53a5c
    button = &style->scrollh.inc_button;
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(nk_rgb(40,40,40));
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(nk_rgb(42,42,42));
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(nk_rgb(44,44,44));
Ivan Mahonin b53a5c
    button->border_color    = nk_rgb(65,65,65);
Ivan Mahonin b53a5c
    button->text_background = nk_rgb(40,40,40);
Ivan Mahonin b53a5c
    button->text_normal     = nk_rgb(175,175,175);
Ivan Mahonin b53a5c
    button->text_hover      = nk_rgb(175,175,175);
Ivan Mahonin b53a5c
    button->text_active     = nk_rgb(175,175,175);
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(4.0f,4.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 1.0f;
Ivan Mahonin b53a5c
    button->rounding        = 0.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
    style->scrollh.dec_button = style->scrollh.inc_button;
Ivan Mahonin b53a5c
    style->scrollv.inc_button = style->scrollh.inc_button;
Ivan Mahonin b53a5c
    style->scrollv.dec_button = style->scrollh.inc_button;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* edit */
Ivan Mahonin b53a5c
    edit = &style->edit;
Ivan Mahonin b53a5c
    nk_zero_struct(*edit);
Ivan Mahonin b53a5c
    edit->normal            = nk_style_item_color(table[NK_COLOR_EDIT]);
Ivan Mahonin b53a5c
    edit->hover             = nk_style_item_color(table[NK_COLOR_EDIT]);
Ivan Mahonin b53a5c
    edit->active            = nk_style_item_color(table[NK_COLOR_EDIT]);
Ivan Mahonin b53a5c
    edit->cursor_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->cursor_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->cursor_text_normal= table[NK_COLOR_EDIT];
Ivan Mahonin b53a5c
    edit->cursor_text_hover = table[NK_COLOR_EDIT];
Ivan Mahonin b53a5c
    edit->border_color      = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    edit->text_normal       = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->text_hover        = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->text_active       = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->selected_normal   = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->selected_hover    = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->selected_text_normal  = table[NK_COLOR_EDIT];
Ivan Mahonin b53a5c
    edit->selected_text_hover   = table[NK_COLOR_EDIT];
Ivan Mahonin b53a5c
    edit->scrollbar_size    = nk_vec2(10,10);
Ivan Mahonin b53a5c
    edit->scrollbar         = style->scrollv;
Ivan Mahonin b53a5c
    edit->padding           = nk_vec2(4,4);
Ivan Mahonin b53a5c
    edit->row_padding       = 2;
Ivan Mahonin b53a5c
    edit->cursor_size       = 4;
Ivan Mahonin b53a5c
    edit->border            = 1;
Ivan Mahonin b53a5c
    edit->rounding          = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* property */
Ivan Mahonin b53a5c
    property = &style->property;
Ivan Mahonin b53a5c
    nk_zero_struct(*property);
Ivan Mahonin b53a5c
    property->normal        = nk_style_item_color(table[NK_COLOR_PROPERTY]);
Ivan Mahonin b53a5c
    property->hover         = nk_style_item_color(table[NK_COLOR_PROPERTY]);
Ivan Mahonin b53a5c
    property->active        = nk_style_item_color(table[NK_COLOR_PROPERTY]);
Ivan Mahonin b53a5c
    property->border_color  = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    property->label_normal  = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    property->label_hover   = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    property->label_active  = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    property->sym_left      = NK_SYMBOL_TRIANGLE_LEFT;
Ivan Mahonin b53a5c
    property->sym_right     = NK_SYMBOL_TRIANGLE_RIGHT;
Ivan Mahonin b53a5c
    property->userdata      = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    property->padding       = nk_vec2(4,4);
Ivan Mahonin b53a5c
    property->border        = 1;
Ivan Mahonin b53a5c
    property->rounding      = 10;
Ivan Mahonin b53a5c
    property->draw_begin    = 0;
Ivan Mahonin b53a5c
    property->draw_end      = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* property buttons */
Ivan Mahonin b53a5c
    button = &style->property.dec_button;
Ivan Mahonin b53a5c
    nk_zero_struct(*button);
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(table[NK_COLOR_PROPERTY]);
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(table[NK_COLOR_PROPERTY]);
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(table[NK_COLOR_PROPERTY]);
Ivan Mahonin b53a5c
    button->border_color    = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    button->text_background = table[NK_COLOR_PROPERTY];
Ivan Mahonin b53a5c
    button->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 0.0f;
Ivan Mahonin b53a5c
    button->rounding        = 0.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
    style->property.inc_button = style->property.dec_button;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* property edit */
Ivan Mahonin b53a5c
    edit = &style->property.edit;
Ivan Mahonin b53a5c
    nk_zero_struct(*edit);
Ivan Mahonin b53a5c
    edit->normal            = nk_style_item_color(table[NK_COLOR_PROPERTY]);
Ivan Mahonin b53a5c
    edit->hover             = nk_style_item_color(table[NK_COLOR_PROPERTY]);
Ivan Mahonin b53a5c
    edit->active            = nk_style_item_color(table[NK_COLOR_PROPERTY]);
Ivan Mahonin b53a5c
    edit->border_color      = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    edit->cursor_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->cursor_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->cursor_text_normal= table[NK_COLOR_EDIT];
Ivan Mahonin b53a5c
    edit->cursor_text_hover = table[NK_COLOR_EDIT];
Ivan Mahonin b53a5c
    edit->text_normal       = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->text_hover        = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->text_active       = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->selected_normal   = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->selected_hover    = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    edit->selected_text_normal  = table[NK_COLOR_EDIT];
Ivan Mahonin b53a5c
    edit->selected_text_hover   = table[NK_COLOR_EDIT];
Ivan Mahonin b53a5c
    edit->padding           = nk_vec2(0,0);
Ivan Mahonin b53a5c
    edit->cursor_size       = 8;
Ivan Mahonin b53a5c
    edit->border            = 0;
Ivan Mahonin b53a5c
    edit->rounding          = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* chart */
Ivan Mahonin b53a5c
    chart = &style->chart;
Ivan Mahonin b53a5c
    nk_zero_struct(*chart);
Ivan Mahonin b53a5c
    chart->background       = nk_style_item_color(table[NK_COLOR_CHART]);
Ivan Mahonin b53a5c
    chart->border_color     = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    chart->selected_color   = table[NK_COLOR_CHART_COLOR_HIGHLIGHT];
Ivan Mahonin b53a5c
    chart->color            = table[NK_COLOR_CHART_COLOR];
Ivan Mahonin b53a5c
    chart->padding          = nk_vec2(4,4);
Ivan Mahonin b53a5c
    chart->border           = 0;
Ivan Mahonin b53a5c
    chart->rounding         = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* combo */
Ivan Mahonin b53a5c
    combo = &style->combo;
Ivan Mahonin b53a5c
    combo->normal           = nk_style_item_color(table[NK_COLOR_COMBO]);
Ivan Mahonin b53a5c
    combo->hover            = nk_style_item_color(table[NK_COLOR_COMBO]);
Ivan Mahonin b53a5c
    combo->active           = nk_style_item_color(table[NK_COLOR_COMBO]);
Ivan Mahonin b53a5c
    combo->border_color     = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    combo->label_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    combo->label_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    combo->label_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    combo->sym_normal       = NK_SYMBOL_TRIANGLE_DOWN;
Ivan Mahonin b53a5c
    combo->sym_hover        = NK_SYMBOL_TRIANGLE_DOWN;
Ivan Mahonin b53a5c
    combo->sym_active       = NK_SYMBOL_TRIANGLE_DOWN;
Ivan Mahonin b53a5c
    combo->content_padding  = nk_vec2(4,4);
Ivan Mahonin b53a5c
    combo->button_padding   = nk_vec2(0,4);
Ivan Mahonin b53a5c
    combo->spacing          = nk_vec2(4,0);
Ivan Mahonin b53a5c
    combo->border           = 1;
Ivan Mahonin b53a5c
    combo->rounding         = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* combo button */
Ivan Mahonin b53a5c
    button = &style->combo.button;
Ivan Mahonin b53a5c
    nk_zero_struct(*button);
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(table[NK_COLOR_COMBO]);
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(table[NK_COLOR_COMBO]);
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(table[NK_COLOR_COMBO]);
Ivan Mahonin b53a5c
    button->border_color    = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    button->text_background = table[NK_COLOR_COMBO];
Ivan Mahonin b53a5c
    button->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(2.0f,2.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 0.0f;
Ivan Mahonin b53a5c
    button->rounding        = 0.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* tab */
Ivan Mahonin b53a5c
    tab = &style->tab;
Ivan Mahonin b53a5c
    tab->background         = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
Ivan Mahonin b53a5c
    tab->border_color       = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    tab->text               = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    tab->sym_minimize       = NK_SYMBOL_TRIANGLE_RIGHT;
Ivan Mahonin b53a5c
    tab->sym_maximize       = NK_SYMBOL_TRIANGLE_DOWN;
Ivan Mahonin b53a5c
    tab->padding            = nk_vec2(4,4);
Ivan Mahonin b53a5c
    tab->spacing            = nk_vec2(4,4);
Ivan Mahonin b53a5c
    tab->indent             = 10.0f;
Ivan Mahonin b53a5c
    tab->border             = 1;
Ivan Mahonin b53a5c
    tab->rounding           = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* tab button */
Ivan Mahonin b53a5c
    button = &style->tab.tab_minimize_button;
Ivan Mahonin b53a5c
    nk_zero_struct(*button);
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(table[NK_COLOR_TAB_HEADER]);
Ivan Mahonin b53a5c
    button->border_color    = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    button->text_background = table[NK_COLOR_TAB_HEADER];
Ivan Mahonin b53a5c
    button->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(2.0f,2.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 0.0f;
Ivan Mahonin b53a5c
    button->rounding        = 0.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
    style->tab.tab_maximize_button =*button;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* node button */
Ivan Mahonin b53a5c
    button = &style->tab.node_minimize_button;
Ivan Mahonin b53a5c
    nk_zero_struct(*button);
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(table[NK_COLOR_WINDOW]);
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(table[NK_COLOR_WINDOW]);
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(table[NK_COLOR_WINDOW]);
Ivan Mahonin b53a5c
    button->border_color    = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    button->text_background = table[NK_COLOR_TAB_HEADER];
Ivan Mahonin b53a5c
    button->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(2.0f,2.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 0.0f;
Ivan Mahonin b53a5c
    button->rounding        = 0.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
    style->tab.node_maximize_button =*button;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* window header */
Ivan Mahonin b53a5c
    win = &style->window;
Ivan Mahonin b53a5c
    win->header.align = NK_HEADER_RIGHT;
Ivan Mahonin b53a5c
    win->header.close_symbol = NK_SYMBOL_X;
Ivan Mahonin b53a5c
    win->header.minimize_symbol = NK_SYMBOL_MINUS;
Ivan Mahonin b53a5c
    win->header.maximize_symbol = NK_SYMBOL_PLUS;
Ivan Mahonin b53a5c
    win->header.normal = nk_style_item_color(table[NK_COLOR_HEADER]);
Ivan Mahonin b53a5c
    win->header.hover = nk_style_item_color(table[NK_COLOR_HEADER]);
Ivan Mahonin b53a5c
    win->header.active = nk_style_item_color(table[NK_COLOR_HEADER]);
Ivan Mahonin b53a5c
    win->header.label_normal = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    win->header.label_hover = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    win->header.label_active = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    win->header.label_padding = nk_vec2(4,4);
Ivan Mahonin b53a5c
    win->header.padding = nk_vec2(4,4);
Ivan Mahonin b53a5c
    win->header.spacing = nk_vec2(0,0);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* window header close button */
Ivan Mahonin b53a5c
    button = &style->window.header.close_button;
Ivan Mahonin b53a5c
    nk_zero_struct(*button);
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(table[NK_COLOR_HEADER]);
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(table[NK_COLOR_HEADER]);
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(table[NK_COLOR_HEADER]);
Ivan Mahonin b53a5c
    button->border_color    = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    button->text_background = table[NK_COLOR_HEADER];
Ivan Mahonin b53a5c
    button->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 0.0f;
Ivan Mahonin b53a5c
    button->rounding        = 0.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* window header minimize button */
Ivan Mahonin b53a5c
    button = &style->window.header.minimize_button;
Ivan Mahonin b53a5c
    nk_zero_struct(*button);
Ivan Mahonin b53a5c
    button->normal          = nk_style_item_color(table[NK_COLOR_HEADER]);
Ivan Mahonin b53a5c
    button->hover           = nk_style_item_color(table[NK_COLOR_HEADER]);
Ivan Mahonin b53a5c
    button->active          = nk_style_item_color(table[NK_COLOR_HEADER]);
Ivan Mahonin b53a5c
    button->border_color    = nk_rgba(0,0,0,0);
Ivan Mahonin b53a5c
    button->text_background = table[NK_COLOR_HEADER];
Ivan Mahonin b53a5c
    button->text_normal     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_hover      = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->text_active     = table[NK_COLOR_TEXT];
Ivan Mahonin b53a5c
    button->padding         = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->touch_padding   = nk_vec2(0.0f,0.0f);
Ivan Mahonin b53a5c
    button->userdata        = nk_handle_ptr(0);
Ivan Mahonin b53a5c
    button->text_alignment  = NK_TEXT_CENTERED;
Ivan Mahonin b53a5c
    button->border          = 0.0f;
Ivan Mahonin b53a5c
    button->rounding        = 0.0f;
Ivan Mahonin b53a5c
    button->draw_begin      = 0;
Ivan Mahonin b53a5c
    button->draw_end        = 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* window */
Ivan Mahonin b53a5c
    win->background = table[NK_COLOR_WINDOW];
Ivan Mahonin b53a5c
    win->fixed_background = nk_style_item_color(table[NK_COLOR_WINDOW]);
Ivan Mahonin b53a5c
    win->border_color = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    win->popup_border_color = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    win->combo_border_color = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    win->contextual_border_color = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    win->menu_border_color = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    win->group_border_color = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    win->tooltip_border_color = table[NK_COLOR_BORDER];
Ivan Mahonin b53a5c
    win->scaler = nk_style_item_color(table[NK_COLOR_TEXT]);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    win->rounding = 0.0f;
Ivan Mahonin b53a5c
    win->spacing = nk_vec2(4,4);
Ivan Mahonin b53a5c
    win->scrollbar_size = nk_vec2(10,10);
Ivan Mahonin b53a5c
    win->min_size = nk_vec2(64,64);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    win->combo_border = 1.0f;
Ivan Mahonin b53a5c
    win->contextual_border = 1.0f;
Ivan Mahonin b53a5c
    win->menu_border = 1.0f;
Ivan Mahonin b53a5c
    win->group_border = 1.0f;
Ivan Mahonin b53a5c
    win->tooltip_border = 1.0f;
Ivan Mahonin b53a5c
    win->popup_border = 1.0f;
Ivan Mahonin b53a5c
    win->border = 2.0f;
Ivan Mahonin b53a5c
    win->min_row_height_padding = 8;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    win->padding = nk_vec2(4,4);
Ivan Mahonin b53a5c
    win->group_padding = nk_vec2(4,4);
Ivan Mahonin b53a5c
    win->popup_padding = nk_vec2(4,4);
Ivan Mahonin b53a5c
    win->combo_padding = nk_vec2(4,4);
Ivan Mahonin b53a5c
    win->contextual_padding = nk_vec2(4,4);
Ivan Mahonin b53a5c
    win->menu_padding = nk_vec2(4,4);
Ivan Mahonin b53a5c
    win->tooltip_padding = nk_vec2(4,4);
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API void
Ivan Mahonin b53a5c
nk_style_set_font(struct nk_context *ctx, const struct nk_user_font *font)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_style *style;
Ivan Mahonin b53a5c
    NK_ASSERT(ctx);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    if (!ctx) return;
Ivan Mahonin b53a5c
    style = &ctx->style;
Ivan Mahonin b53a5c
    style->font = font;
Ivan Mahonin b53a5c
    ctx->stacks.fonts.head = 0;
Ivan Mahonin b53a5c
    if (ctx->current)
Ivan Mahonin b53a5c
        nk_layout_reset_min_row_height(ctx);
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API nk_bool
Ivan Mahonin b53a5c
nk_style_push_font(struct nk_context *ctx, const struct nk_user_font *font)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_config_stack_user_font *font_stack;
Ivan Mahonin b53a5c
    struct nk_config_stack_user_font_element *element;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    NK_ASSERT(ctx);
Ivan Mahonin b53a5c
    if (!ctx) return 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    font_stack = &ctx->stacks.fonts;
Ivan Mahonin b53a5c
    NK_ASSERT(font_stack->head < (int)NK_LEN(font_stack->elements));
Ivan Mahonin b53a5c
    if (font_stack->head >= (int)NK_LEN(font_stack->elements))
Ivan Mahonin b53a5c
        return 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    element = &font_stack->elements[font_stack->head++];
Ivan Mahonin b53a5c
    element->address = &ctx->style.font;
Ivan Mahonin b53a5c
    element->old_value = ctx->style.font;
Ivan Mahonin b53a5c
    ctx->style.font = font;
Ivan Mahonin b53a5c
    return 1;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API nk_bool
Ivan Mahonin b53a5c
nk_style_pop_font(struct nk_context *ctx)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_config_stack_user_font *font_stack;
Ivan Mahonin b53a5c
    struct nk_config_stack_user_font_element *element;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    NK_ASSERT(ctx);
Ivan Mahonin b53a5c
    if (!ctx) return 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    font_stack = &ctx->stacks.fonts;
Ivan Mahonin b53a5c
    NK_ASSERT(font_stack->head > 0);
Ivan Mahonin b53a5c
    if (font_stack->head < 1)
Ivan Mahonin b53a5c
        return 0;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    element = &font_stack->elements[--font_stack->head];
Ivan Mahonin b53a5c
    *element->address = element->old_value;
Ivan Mahonin b53a5c
    return 1;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
#define NK_STYLE_PUSH_IMPLEMENATION(prefix, type, stack) \
Ivan Mahonin b53a5c
nk_style_push_##type(struct nk_context *ctx, prefix##_##type *address, prefix##_##type value)\
Ivan Mahonin b53a5c
{\
Ivan Mahonin b53a5c
    struct nk_config_stack_##type * type_stack;\
Ivan Mahonin b53a5c
    struct nk_config_stack_##type##_element *element;\
Ivan Mahonin b53a5c
    NK_ASSERT(ctx);\
Ivan Mahonin b53a5c
    if (!ctx) return 0;\
Ivan Mahonin b53a5c
    type_stack = &ctx->stacks.stack;\
Ivan Mahonin b53a5c
    NK_ASSERT(type_stack->head < (int)NK_LEN(type_stack->elements));\
Ivan Mahonin b53a5c
    if (type_stack->head >= (int)NK_LEN(type_stack->elements))\
Ivan Mahonin b53a5c
        return 0;\
Ivan Mahonin b53a5c
    element = &type_stack->elements[type_stack->head++];\
Ivan Mahonin b53a5c
    element->address = address;\
Ivan Mahonin b53a5c
    element->old_value = *address;\
Ivan Mahonin b53a5c
    *address = value;\
Ivan Mahonin b53a5c
    return 1;\
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
#define NK_STYLE_POP_IMPLEMENATION(type, stack) \
Ivan Mahonin b53a5c
nk_style_pop_##type(struct nk_context *ctx)\
Ivan Mahonin b53a5c
{\
Ivan Mahonin b53a5c
    struct nk_config_stack_##type *type_stack;\
Ivan Mahonin b53a5c
    struct nk_config_stack_##type##_element *element;\
Ivan Mahonin b53a5c
    NK_ASSERT(ctx);\
Ivan Mahonin b53a5c
    if (!ctx) return 0;\
Ivan Mahonin b53a5c
    type_stack = &ctx->stacks.stack;\
Ivan Mahonin b53a5c
    NK_ASSERT(type_stack->head > 0);\
Ivan Mahonin b53a5c
    if (type_stack->head < 1)\
Ivan Mahonin b53a5c
        return 0;\
Ivan Mahonin b53a5c
    element = &type_stack->elements[--type_stack->head];\
Ivan Mahonin b53a5c
    *element->address = element->old_value;\
Ivan Mahonin b53a5c
    return 1;\
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(struct nk, style_item, style_items)
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(nk,float, floats)
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(struct nk, vec2, vectors)
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(nk,flags, flags)
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_PUSH_IMPLEMENATION(struct nk,color, colors)
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(style_item, style_items)
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(float,floats)
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(vec2, vectors)
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(flags,flags)
Ivan Mahonin b53a5c
NK_API nk_bool NK_STYLE_POP_IMPLEMENATION(color,colors)
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API nk_bool
Ivan Mahonin b53a5c
nk_style_set_cursor(struct nk_context *ctx, enum nk_style_cursor c)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_style *style;
Ivan Mahonin b53a5c
    NK_ASSERT(ctx);
Ivan Mahonin b53a5c
    if (!ctx) return 0;
Ivan Mahonin b53a5c
    style = &ctx->style;
Ivan Mahonin b53a5c
    if (style->cursors[c]) {
Ivan Mahonin b53a5c
        style->cursor_active = style->cursors[c];
Ivan Mahonin b53a5c
        return 1;
Ivan Mahonin b53a5c
    }
Ivan Mahonin b53a5c
    return 0;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API void
Ivan Mahonin b53a5c
nk_style_show_cursor(struct nk_context *ctx)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    ctx->style.cursor_visible = nk_true;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API void
Ivan Mahonin b53a5c
nk_style_hide_cursor(struct nk_context *ctx)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    ctx->style.cursor_visible = nk_false;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API void
Ivan Mahonin b53a5c
nk_style_load_cursor(struct nk_context *ctx, enum nk_style_cursor cursor,
Ivan Mahonin b53a5c
    const struct nk_cursor *c)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    struct nk_style *style;
Ivan Mahonin b53a5c
    NK_ASSERT(ctx);
Ivan Mahonin b53a5c
    if (!ctx) return;
Ivan Mahonin b53a5c
    style = &ctx->style;
Ivan Mahonin b53a5c
    style->cursors[cursor] = c;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
NK_API void
Ivan Mahonin b53a5c
nk_style_load_all_cursors(struct nk_context *ctx, struct nk_cursor *cursors)
Ivan Mahonin b53a5c
{
Ivan Mahonin b53a5c
    int i = 0;
Ivan Mahonin b53a5c
    struct nk_style *style;
Ivan Mahonin b53a5c
    NK_ASSERT(ctx);
Ivan Mahonin b53a5c
    if (!ctx) return;
Ivan Mahonin b53a5c
    style = &ctx->style;
Ivan Mahonin b53a5c
    for (i = 0; i < NK_CURSOR_COUNT; ++i)
Ivan Mahonin b53a5c
        style->cursors[i] = &cursors[i];
Ivan Mahonin b53a5c
    style->cursor_visible = nk_true;
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c