Example #1
0
        public static Vector2 nk_panel_get_padding(nk_style style, int type)
        {
            switch (type)
            {
            default:
            case NK_PANEL_WINDOW:
                return((Vector2)(style.window.padding));

            case NK_PANEL_GROUP:
                return((Vector2)(style.window.group_padding));

            case NK_PANEL_POPUP:
                return((Vector2)(style.window.popup_padding));

            case NK_PANEL_CONTEXTUAL:
                return((Vector2)(style.window.contextual_padding));

            case NK_PANEL_COMBO:
                return((Vector2)(style.window.combo_padding));

            case NK_PANEL_MENU:
                return((Vector2)(style.window.menu_padding));

            case NK_PANEL_TOOLTIP:
                return((Vector2)(style.window.menu_padding));
            }
        }
Example #2
0
        public static float nk_panel_get_border(nk_style style, uint flags, int type)
        {
            if ((flags & NK_WINDOW_BORDER) != 0)
            {
                switch (type)
                {
                default:
                case NK_PANEL_WINDOW:
                    return((float)(style.window.border));

                case NK_PANEL_GROUP:
                    return((float)(style.window.group_border));

                case NK_PANEL_POPUP:
                    return((float)(style.window.popup_border));

                case NK_PANEL_CONTEXTUAL:
                    return((float)(style.window.contextual_border));

                case NK_PANEL_COMBO:
                    return((float)(style.window.combo_border));

                case NK_PANEL_MENU:
                    return((float)(style.window.menu_border));

                case NK_PANEL_TOOLTIP:
                    return((float)(style.window.menu_border));
                }
            }
            else
            {
                return((float)(0));
            }
        }
Example #3
0
        public static Color nk_panel_get_border_color(nk_style style, int type)
        {
            switch (type)
            {
            default:
            case NK_PANEL_WINDOW:
                return((Color)(style.window.border_color));

            case NK_PANEL_GROUP:
                return((Color)(style.window.group_border_color));

            case NK_PANEL_POPUP:
                return((Color)(style.window.popup_border_color));

            case NK_PANEL_CONTEXTUAL:
                return((Color)(style.window.contextual_border_color));

            case NK_PANEL_COMBO:
                return((Color)(style.window.combo_border_color));

            case NK_PANEL_MENU:
                return((Color)(style.window.menu_border_color));

            case NK_PANEL_TOOLTIP:
                return((Color)(style.window.menu_border_color));
            }
        }
Example #4
0
        public static float LayoutRowCalculateUsableSpace(nk_style style, int type, float total_space, int columns)
        {
            float panel_padding;
            float panel_spacing;
            float panel_space;
            var   spacing = new Vector2();
            var   padding = new Vector2();

            spacing       = style.window.spacing;
            padding       = nk_panel_get_padding(style, type);
            panel_padding = 2 * padding.X;
            panel_spacing = (columns - 1 < 0 ? 0 : columns - 1) * spacing.X;
            panel_space   = total_space - panel_padding - panel_spacing;
            return(panel_space);
        }
Example #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));
        }