public override Canvass Paint() { var size = Dimensions; if (Dimensions.IsFullyAutosize()) { Position = Children.Single().Position - GetInnerCanvasTopLeft(); // todo find max spanning area of all children var childrensSize = GetSize(); var mySize = new GuiDimensions(new Size(title.Length + CloseButton.Length), childrensSize.Height); size = GuiDimensions.Max(childrensSize, mySize); } else { Position = Parent.GetInnerCanvasTopLeft(); } var titleline = title.PadRight(size.Width.Pixels - CloseButton.Length) + CloseButton; var c = new Canvass(); c.RawPaintString(titleline, 0, 0, ConsoleColor.DarkGray, ConsoleColor.Gray); var line = "".PadRight(size.Width.Pixels); for (int y = 1; y < size.Height.Pixels; y++) { c.RawPaintString(line, 0, y, BackGround, Foreground); } return(c); }
public TextBox(GuiComponent parent, int width, Coord position) : base(parent, position) { Dimensions = new GuiDimensions(new Size(width), new Size(1)); Value = ""; BackGround = ConsoleColor.DarkCyan; Foreground = ConsoleColor.Yellow; OnUserEscape = () => { }; }