Example #1
0
 public static void nk_tooltip_end(this NuklearContext ctx)
 {
     if (ctx == null || ctx.current == null)
     {
         return;
     }
     ctx.PopupClose();
     ctx.PopupEnd();
 }
Example #2
0
        public static void ContextualEnd(this NuklearContext ctx)
        {
            nk_window popup;
            nk_panel  panel;

            if (ctx == null || ctx.current == null)
            {
                return;
            }
            popup = ctx.current;
            panel = popup.Layout;
            if ((panel.Flags & NK_WINDOW_DYNAMIC) != 0)
            {
                var body = new RectangleF();
                if (panel.At_y < panel.Bounds.Y + panel.Bounds.Height)
                {
                    var padding = nk_panel_get_padding(ctx.style, panel.Type);
                    body        = panel.Bounds;
                    body.Y      = panel.At_y + panel.Footer_height + panel.Border + padding.Y + panel.Row.height;
                    body.Height = panel.Bounds.Y + panel.Bounds.Height - body.Y;
                }

                {
                    var pressed = nk_input_is_mouse_pressed(ctx.input, NK_BUTTON_LEFT);
                    var in_body = nk_input_is_mouse_hovering_rect(ctx.input, body);
                    if (pressed && in_body)
                    {
                        popup.Flags |= NK_WINDOW_HIDDEN;
                    }
                }
            }

            if ((popup.Flags & NK_WINDOW_HIDDEN) != 0)
            {
                popup.Seq = 0;
            }

            ctx.PopupEnd();
        }