Exemplo n.º 1
0
        public static void Spacing(this NuklearContext ctx, int cols)
        {
            nk_window win;
            nk_panel  layout;
            var       none = new RectangleF();
            int       i;
            int       index;
            int       rows;

            if (ctx == null || ctx.current == null || ctx.current.Layout == null)
            {
                return;
            }
            win    = ctx.current;
            layout = win.Layout;
            index  = (layout.Row.index + cols) % layout.Row.columns;
            rows   = (layout.Row.index + cols) / layout.Row.columns;
            if (rows != 0)
            {
                for (i = 0; i < rows; ++i)
                {
                    ctx.PanelAllocRow(win);
                }
                cols = index;
            }

            if (layout.Row.type != NK_LAYOUT_DYNAMIC_FIXED && layout.Row.type != NK_LAYOUT_STATIC_FIXED)
            {
                for (i = 0; i < cols; ++i)
                {
                    ctx.PanelAllocSpace(ref none);
                }
            }

            layout.Row.index = index;
        }