Esempio n. 1
0
        public static void nk_group_scrolled_end(this NuklearContext ctx)
        {
            nk_window win;
            nk_panel  parent;
            nk_panel  g;
            var       clip          = new RectangleF();
            var       pan           = ctx.nk_create_window();
            var       panel_padding = new Vector2();

            if (ctx == null || ctx.current == null)
            {
                return;
            }
            win    = ctx.current;
            g      = win.Layout;
            parent = g.Parent;

            panel_padding     = nk_panel_get_padding(ctx.style, NK_PANEL_GROUP);
            pan.Bounds.Y      = g.Bounds.Y - (g.Header_height + g.Menu.Height);
            pan.Bounds.X      = g.Bounds.X - panel_padding.X;
            pan.Bounds.Width  = g.Bounds.Width + 2 * panel_padding.X;
            pan.Bounds.Height = g.Bounds.Height + g.Header_height + g.Menu.Height;
            if ((g.Flags & NK_WINDOW_BORDER) != 0)
            {
                pan.Bounds.X      -= g.Border;
                pan.Bounds.Y      -= g.Border;
                pan.Bounds.Width  += 2 * g.Border;
                pan.Bounds.Height += 2 * g.Border;
            }

            if ((g.Flags & NK_WINDOW_NO_SCROLLBAR) == 0)
            {
                pan.Bounds.Width  += ctx.style.window.scrollbar_size.X;
                pan.Bounds.Height += ctx.style.window.scrollbar_size.Y;
            }

            pan.Scrollbar = g.Offset.ToPoint();
            pan.Flags     = g.Flags;
            pan.Buffer    = win.Buffer;
            pan.Layout    = g;
            pan.Parent    = win;
            ctx.current   = pan;
            RectangleF.nk_unify(ref clip, ref parent.Clip, pan.Bounds.X, pan.Bounds.Y,
                                pan.Bounds.X + pan.Bounds.Width, pan.Bounds.Y + pan.Bounds.Height + panel_padding.X);
            pan.Buffer.Scissor(clip);
            ctx.End();
            win.Buffer = pan.Buffer;
            win.Buffer.Scissor(parent.Clip);
            ctx.current = win;
            win.Layout  = parent;
            g.Bounds    = pan.Bounds;
        }