Ejemplo n.º 1
0
        public override void HandleRepaint(ConsoleGui.Interfaces.Drawing.IDrawingContext context)
        {
            var subRegion = Region.Interior;

            if (HasFocus)
            {
                context.DrawThinBorder(Region);
                context.DrawText(subRegion, _text, false, true, _scrollPosition, _scrollbarVisible);
            }
            else
            {
                context.DrawText(subRegion, _text, false, true, _scrollPosition, _scrollbarVisible);
            }

            base.HandleRepaint(context);
        }
Ejemplo n.º 2
0
        public override void HandleRepaint(ConsoleGui.Interfaces.Drawing.IDrawingContext context)
        {
            if (HasFocus)
            {
                context.DrawThinBorder(Region, Text);
            }

            var sbMenuUptions = new StringBuilder();

            for (int i = 0; i < _checkboxItems.Count; i++)
            {
                var    option = _checkboxItems [i];
                string c      = "";
                if (option.IsChecked)
                {
                    c = c + "✓";                   // Is this terminal friendly?
                }
                else
                {
                    c = c + " ";
                }
                if (i == _cursorPosition && HasFocus)
                {
                    sbMenuUptions.AppendLine(context.Invert($"[{c}] {option.Text}"));
                }
                else
                {
                    sbMenuUptions.AppendLine($"[{c}] {option.Text}");
                }
            }

            var upper = Math.Max(0, _cursorPosition - (Region.Bottom - Region.Top) / 2);

            context.DrawText(new ConsoleGui.Drawing.Rect(
                                 Region.Left + 1,
                                 Region.Top + 1,
                                 Region.Right - 1,
                                 Region.Bottom - 1), sbMenuUptions.ToString(), false, false, upper);

            base.HandleRepaint(context);
        }