Example #1
0
        protected override void Drawing(ITerminal <TGlyph, TColor> terminal)
        {
            if (Text == null)
            {
                return;
            }
            var y     = 0;
            var lines = Text.Split(Delimiter.ToArray());

            foreach (var line in lines)
            {
                var parts = line.Split(Width);
                foreach (var part in parts)
                {
                    terminal.DrawString(Left, Top + y, part, ColorTheme.Foreground, ColorTheme.Background);
                    y++;
                    if (y >= Height)
                    {
                        break;
                    }
                }
                if (y >= Height)
                {
                    break;
                }
            }
        }
Example #2
0
        protected override void Drawing(ITerminal <TGlyph, TColor> terminal)
        {
            int itemWidth = Width - 1;
            int i         = 0;

            foreach (var item in _items)
            {
                if (i > Height)
                {
                    throw new Exception();
                }
                terminal.DrawString(Left + 1, Top + i, item.Glyphs.Fit(itemWidth, EllipsisGlyph),
                                    ColorTheme.Foreground, ColorTheme.Background);
                if (_unselectedItemIndex.HasValue && item == _items[_unselectedItemIndex.Value])
                {
                    terminal.Clear(Left, Top + i);
                    _unselectedItemIndex = null;
                }
                if (i == _selectedItemIndex)
                {
                    terminal.Draw(Left, Top + i, SelectionGlyph, ColorTheme.Foreground, ColorTheme.Background);
                }
                i++;
            }
        }
Example #3
0
 protected override void Drawing(ITerminal <TGlyph, TColor> terminal)
 {
     PrepareContent();
     Drawing(terminal, Left, Top, Width, Height, BorderTheme, ColorTheme);
     if (Title?.Any() == true)
     {
         terminal.DrawString(Left + 1, Top, Title.Fit(Width - 2, Ellipsis),
                             ColorTheme.Foreground, ColorTheme.Background);
     }
     if (Controls.Any())
     {
         Controls.First().Draw(terminal);
     }
 }