Esempio n. 1
0
        public static int nk_group_scrolled_offset_begin(this NuklearContext ctx, Offset offset, string title,
                                                         uint flags)
        {
            var       bounds = new RectangleF();
            var       panel  = ctx.nk_create_window();
            nk_window win;

            win = ctx.current;
            ctx.PanelAllocSpace(ref bounds);
            {
                if (
                    !!(bounds.X > win.Layout.Clip.X + win.Layout.Clip.Width ||
                       bounds.X + bounds.Width < win.Layout.Clip.X ||
                       bounds.Y > win.Layout.Clip.Y + win.Layout.Clip.Height ||
                       bounds.Y + bounds.Height < win.Layout.Clip.Y) &&
                    (flags & NK_WINDOW_MOVABLE) == 0)
                {
                    return(0);
                }
            }

            if ((win.Flags & NK_WINDOW_ROM) != 0)
            {
                flags |= NK_WINDOW_ROM;
            }

            panel.Bounds      = bounds;
            panel.Flags       = flags;
            panel.Scrollbar.X = offset.X;
            panel.Scrollbar.Y = offset.Y;
            panel.Buffer      = win.Buffer;
            panel.Layout      = new nk_panel();
            ctx.current       = panel;
            ctx.nk_panel_begin((flags & NK_WINDOW_TITLE) != 0 ? title : null, NK_PANEL_GROUP);
            win.Buffer          = panel.Buffer;
            win.Buffer.Clip     = panel.Layout.Clip;
            panel.Layout.Offset = offset;

            panel.Layout.Parent = win.Layout;
            win.Layout          = panel.Layout;
            ctx.current         = win;
            if ((panel.Layout.Flags & NK_WINDOW_CLOSED) != 0 || (panel.Layout.Flags & NK_WINDOW_MINIMIZED) != 0)
            {
                var f = panel.Layout.Flags;
                nk_group_scrolled_end(ctx);
                if ((f & NK_WINDOW_CLOSED) != 0)
                {
                    return(NK_WINDOW_CLOSED);
                }
                if ((f & NK_WINDOW_MINIMIZED) != 0)
                {
                    return(NK_WINDOW_MINIMIZED);
                }
            }

            return(1);
        }