2024-03-06 21:49:54 +00:00
|
|
|
using System.Text;
|
|
|
|
using TUI.Engine;
|
2024-03-15 19:13:09 +00:00
|
|
|
using TUI.Engine.Attributes;
|
|
|
|
using TUI.Engine.Attributes.Alignments;
|
|
|
|
using TUI.Engine.Components;
|
2024-03-06 21:49:54 +00:00
|
|
|
|
|
|
|
namespace TUI.Components.Controls;
|
|
|
|
|
2024-03-15 19:13:09 +00:00
|
|
|
public class CellsComponentAttribute : ComponentAttribute, IComponent
|
2024-03-06 21:49:54 +00:00
|
|
|
{
|
|
|
|
private const int MaxCellWidth = 10;
|
|
|
|
|
|
|
|
private readonly IEnumerable<string> _cells;
|
|
|
|
|
2024-03-15 19:13:09 +00:00
|
|
|
public CellsComponentAttribute(IEnumerable<string> cells)
|
2024-03-06 21:49:54 +00:00
|
|
|
{
|
|
|
|
_cells = cells;
|
|
|
|
}
|
|
|
|
|
2024-03-08 20:48:16 +00:00
|
|
|
public void Render(Horizontal horizontal, Size size)
|
2024-03-06 21:49:54 +00:00
|
|
|
{
|
|
|
|
var content = new StringBuilder();
|
|
|
|
foreach (var cell in _cells)
|
|
|
|
{
|
2024-03-08 09:41:29 +00:00
|
|
|
content.Append(Symbols.Space.Repeat(MaxCellWidth - cell.GetWidth()));
|
2024-03-06 21:49:54 +00:00
|
|
|
content.Append(cell);
|
|
|
|
}
|
|
|
|
|
|
|
|
// base.Render(content, position, size);
|
|
|
|
}
|
|
|
|
|
2024-03-15 19:13:09 +00:00
|
|
|
protected override Sketch DrawComponent()
|
2024-03-06 21:49:54 +00:00
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
}
|