public static void nk_textedit_layout_row(nk_text_edit_row *r, nk_text_edit edit, int line_start_id, float row_height,
                                                  nk_user_font font)
        {
            int   glyphs = (int)(0);
            char *remaining;
            int   len = (int)(edit._string_.len);

            fixed(char *str2 = edit._string_.str)
            {
                char *end = str2 + len;

                char *  text = str2 + line_start_id;
                nk_vec2 size =
                    (nk_vec2)
                    (nk_text_calculate_text_bounds(font, text, (int)(end - text), (float)(row_height), &remaining, null, &glyphs,
                                                   (int)(NK_STOP_ON_NEW_LINE)));

                r->x0 = (float)(0.0f);
                r->x1 = (float)(size.x);
                r->baseline_y_delta = (float)(size.y);
                r->ymin             = (float)(0.0f);
                r->ymax             = (float)(size.y);
                r->num_chars        = (int)(glyphs);
            }
        }
Exemplo n.º 2
0
        public static nk_vec2 nk_rect_size(nk_rect r)
        {
            nk_vec2 ret = new nk_vec2();

            ret.x = (float)(r.w);
            ret.y = (float)(r.h);
            return((nk_vec2)(ret));
        }
Exemplo n.º 3
0
        public static nk_vec2 nk_rect_pos(nk_rect r)
        {
            nk_vec2 ret = new nk_vec2();

            ret.x = (float)(r.x);
            ret.y = (float)(r.y);
            return((nk_vec2)(ret));
        }
Exemplo n.º 4
0
 public static nk_rect nk_pad_rect(nk_rect r, nk_vec2 pad)
 {
     r.w  = (float)((r.w) < (2 * pad.x) ? (2 * pad.x) : (r.w));
     r.h  = (float)((r.h) < (2 * pad.y) ? (2 * pad.y) : (r.h));
     r.x += (float)(pad.x);
     r.y += (float)(pad.y);
     r.w -= (float)(2 * pad.x);
     r.h -= (float)(2 * pad.y);
     return((nk_rect)(r));
 }
Exemplo n.º 5
0
        public static float nk_layout_row_calculate_usable_space(nk_style style, int type, float total_space, int columns)
        {
            float   panel_padding;
            float   panel_spacing;
            float   panel_space;
            nk_vec2 spacing = new nk_vec2();
            nk_vec2 padding = new nk_vec2();

            spacing       = (nk_vec2)(style.window.spacing);
            padding       = (nk_vec2)(nk_panel_get_padding(style, (int)(type)));
            panel_padding = (float)(2 * padding.x);
            panel_spacing = (float)((float)((columns - 1) < (0) ? (0) : (columns - 1)) * spacing.x);
            panel_space   = (float)(total_space - panel_padding - panel_spacing);
            return((float)(panel_space));
        }
Exemplo n.º 6
0
        public static int nk_widget_fitting(nk_rect *bounds, nk_context ctx, nk_vec2 item_padding)
        {
            nk_window win;
            nk_style  style;
            nk_panel  layout;
            int       state;
            nk_vec2   panel_padding = new nk_vec2();

            if (((ctx == null) || (ctx.current == null)) || (ctx.current.layout == null))
            {
                return((int)(NK_WIDGET_INVALID));
            }
            win           = ctx.current;
            style         = ctx.style;
            layout        = win.layout;
            state         = (int)(nk_widget(bounds, ctx));
            panel_padding = (nk_vec2)(nk_panel_get_padding(style, (int)(layout.type)));
            if ((layout.row.index) == (1))
            {
                bounds->w += (float)(panel_padding.x);
                bounds->x -= (float)(panel_padding.x);
            }
            else
            {
                bounds->x -= (float)(item_padding.x);
            }
            if ((layout.row.index) == (layout.row.columns))
            {
                bounds->w += (float)(panel_padding.x);
            }
            else
            {
                bounds->w += (float)(item_padding.x);
            }
            return((int)(state));
        }
Exemplo n.º 7
0
 public static void nk_draw_list_stroke_circle(nk_draw_list *dl, nk_vec2 center, float radius, nk_color col, uint segs, float thickness) => _nk_draw_list_stroke_circle(dl, center, radius, col, segs, thickness);
Exemplo n.º 8
0
 public static void nk_draw_list_stroke_curve(nk_draw_list *dl, nk_vec2 p0, nk_vec2 cp0, nk_vec2 cp1, nk_vec2 p1, nk_color col, uint segments, float thickness) => _nk_draw_list_stroke_curve(dl, p0, cp0, cp1, p1, col, segments, thickness);
Exemplo n.º 9
0
 public static void nk_draw_list_path_curve_to(nk_draw_list *dl, nk_vec2 p2, nk_vec2 p3, nk_vec2 p4, uint num_segments) => _nk_draw_list_path_curve_to(dl, p2, p3, p4, num_segments);
Exemplo n.º 10
0
 public static void nk_draw_list_stroke_triangle(nk_draw_list *dl, nk_vec2 a, nk_vec2 b, nk_vec2 c, nk_color col, float thickness) => _nk_draw_list_stroke_triangle(dl, a, b, c, col, thickness);
Exemplo n.º 11
0
 public static void nk_draw_list_path_arc_to(nk_draw_list *dl, nk_vec2 center, float radius, float a_min, float a_max, uint segments) => _nk_draw_list_path_arc_to(dl, center, radius, a_min, a_max, segments);
Exemplo n.º 12
0
 public static void nk_draw_list_path_rect_to(nk_draw_list *dl, nk_vec2 a, nk_vec2 b, float rounding) => _nk_draw_list_path_rect_to(dl, a, b, rounding);
Exemplo n.º 13
0
 public static void nk_draw_list_path_line_to(nk_draw_list *dl, nk_vec2 pos) => _nk_draw_list_path_line_to(dl, pos);
Exemplo n.º 14
0
 public static void nk_draw_list_path_arc_to_fast(nk_draw_list *dl, nk_vec2 center, float radius, int a_min, int a_max) => _nk_draw_list_path_arc_to_fast(dl, center, radius, a_min, a_max);
Exemplo n.º 15
0
 public static int nk_style_push_vec2(nk_context *ctx, nk_vec2 *a, nk_vec2 b) => _nk_style_push_vec2(ctx, a, b);
Exemplo n.º 16
0
 public static nk_vec2 nk_layout_space_to_local(nk_context *ctx, nk_vec2 v) => _nk_layout_space_to_local(ctx, v);
Exemplo n.º 17
0
 public static void nk_draw_list_fill_triangle(nk_draw_list *dl, nk_vec2 a, nk_vec2 b, nk_vec2 c, nk_color col) => _nk_draw_list_fill_triangle(dl, a, b, c, col);
Exemplo n.º 18
0
        public static void nk_layout_widget_space(nk_rect *bounds, nk_context ctx, nk_window win, int modify)
        {
            nk_panel layout;
            nk_style style;
            nk_vec2  spacing      = new nk_vec2();
            nk_vec2  padding      = new nk_vec2();
            float    item_offset  = (float)(0);
            float    item_width   = (float)(0);
            float    item_spacing = (float)(0);
            float    panel_space  = (float)(0);

            if (((ctx == null) || (ctx.current == null)) || (ctx.current.layout == null))
            {
                return;
            }
            win         = ctx.current;
            layout      = win.layout;
            style       = ctx.style;
            spacing     = (nk_vec2)(style.window.spacing);
            padding     = (nk_vec2)(nk_panel_get_padding(style, (int)(layout.type)));
            panel_space =
                (float)
                (nk_layout_row_calculate_usable_space(ctx.style, (int)(layout.type), (float)(layout.bounds.w),
                                                      (int)(layout.row.columns)));
            switch (layout.row.type)
            {
            case NK_LAYOUT_DYNAMIC_FIXED:
            {
                item_width   = (float)(((1.0f) < (panel_space - 1.0f) ? (panel_space - 1.0f) : (1.0f)) / (float)(layout.row.columns));
                item_offset  = (float)((float)(layout.row.index) * item_width);
                item_spacing = (float)((float)(layout.row.index) * spacing.x);
            }
            break;

            case NK_LAYOUT_DYNAMIC_ROW:
            {
                item_width   = (float)(layout.row.item_width * panel_space);
                item_offset  = (float)(layout.row.item_offset);
                item_spacing = (float)(0);
                if ((modify) != 0)
                {
                    layout.row.item_offset += (float)(item_width + spacing.x);
                    layout.row.filled      += (float)(layout.row.item_width);
                    layout.row.index        = (int)(0);
                }
            }
            break;

            case NK_LAYOUT_DYNAMIC_FREE:
            {
                bounds->x  = (float)(layout.at_x + (layout.bounds.w * layout.row.item.x));
                bounds->x -= ((float)(layout.offset.x));
                bounds->y  = (float)(layout.at_y + (layout.row.height * layout.row.item.y));
                bounds->y -= ((float)(layout.offset.y));
                bounds->w  = (float)(layout.bounds.w * layout.row.item.w);
                bounds->h  = (float)(layout.row.height * layout.row.item.h);
                return;
            }

            case NK_LAYOUT_DYNAMIC:
            {
                float ratio;
                ratio =
                    (float)
                    (((layout.row.ratio[layout.row.index]) < (0)) ? layout.row.item_width : layout.row.ratio[layout.row.index]);
                item_spacing = (float)((float)(layout.row.index) * spacing.x);
                item_width   = (float)(ratio * panel_space);
                item_offset  = (float)(layout.row.item_offset);
                if ((modify) != 0)
                {
                    layout.row.item_offset += (float)(item_width);
                    layout.row.filled      += (float)(ratio);
                }
            }
            break;

            case NK_LAYOUT_STATIC_FIXED:
            {
                item_width   = (float)(layout.row.item_width);
                item_offset  = (float)((float)(layout.row.index) * item_width);
                item_spacing = (float)((float)(layout.row.index) * spacing.x);
            }
            break;

            case NK_LAYOUT_STATIC_ROW:
            {
                item_width   = (float)(layout.row.item_width);
                item_offset  = (float)(layout.row.item_offset);
                item_spacing = (float)((float)(layout.row.index) * spacing.x);
                if ((modify) != 0)
                {
                    layout.row.item_offset += (float)(item_width);
                }
            }
            break;

            case NK_LAYOUT_STATIC_FREE:
            {
                bounds->x = (float)(layout.at_x + layout.row.item.x);
                bounds->w = (float)(layout.row.item.w);
                if (((bounds->x + bounds->w) > (layout.max_x)) && ((modify) != 0))
                {
                    layout.max_x = (float)(bounds->x + bounds->w);
                }
                bounds->x -= ((float)(layout.offset.x));
                bounds->y  = (float)(layout.at_y + layout.row.item.y);
                bounds->y -= ((float)(layout.offset.y));
                bounds->h  = (float)(layout.row.item.h);
                return;
            }

            case NK_LAYOUT_STATIC:
            {
                item_spacing = (float)((float)(layout.row.index) * spacing.x);
                item_width   = (float)(layout.row.ratio[layout.row.index]);
                item_offset  = (float)(layout.row.item_offset);
                if ((modify) != 0)
                {
                    layout.row.item_offset += (float)(item_width);
                }
            }
            break;

            case NK_LAYOUT_TEMPLATE:
            {
                item_width   = (float)(layout.row.templates[layout.row.index]);
                item_offset  = (float)(layout.row.item_offset);
                item_spacing = (float)((float)(layout.row.index) * spacing.x);
                if ((modify) != 0)
                {
                    layout.row.item_offset += (float)(item_width);
                }
            }
            break;

            default:
                ;
                break;
            }

            bounds->w = (float)(item_width);
            bounds->h = (float)(layout.row.height - spacing.y);
            bounds->y = (float)(layout.at_y - (float)(layout.offset.y));
            bounds->x = (float)(layout.at_x + item_offset + item_spacing + padding.x);
            if (((bounds->x + bounds->w) > (layout.max_x)) && ((modify) != 0))
            {
                layout.max_x = (float)(bounds->x + bounds->w);
            }
            bounds->x -= ((float)(layout.offset.x));
        }
Exemplo n.º 19
0
 public static void nk_input_scroll(nk_context *context, nk_vec2 val) => _nk_input_scroll(context, val);
Exemplo n.º 20
0
 public static nk_rect nk_recta(nk_vec2 pos, nk_vec2 size) => _nk_recta(pos, size);
Exemplo n.º 21
0
 public static nk_rect nk_recta(nk_vec2 pos, nk_vec2 size)
 {
     return((nk_rect)(nk_rect_((float)(pos.x), (float)(pos.y), (float)(size.x), (float)(size.y))));
 }
Exemplo n.º 22
0
 public static void nk_draw_list_fill_circle(nk_draw_list *dl, nk_vec2 center, float radius, nk_color col, uint segs) => _nk_draw_list_fill_circle(dl, center, radius, col, segs);
Exemplo n.º 23
0
 public static nk_vec2 nk_layout_space_to_screen(nk_context *ctx, nk_vec2 v) => _nk_layout_space_to_screen(ctx, v);