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 = () => { }; }
protected GuiComponent(GuiComponent parent) { this.Parent = parent; Manager = parent.Manager; Position = parent.GetInnerCanvasTopLeft(); Dimensions = new GuiDimensions(new Size(), new Size()); parent.RegisterChildComponent(this); }
public TextArea(GuiComponent parent, int width, int height, string content, Coord position) : base(parent, position) { lines = (content ?? "").Split(new[] { '\n' }, StringSplitOptions.None).ToList(); Dimensions = new GuiDimensions(new Size(width), new Size(height)); BackGround = ConsoleColor.DarkCyan; Foreground = ConsoleColor.Yellow; OnUserEscape = () => { RemoveMeAndChildren(); }; }
public void FocusNextChild(GuiComponent currentComponent) { int index = Children.FindIndex(x => x == currentComponent); for (int i = 1; i < Children.Count; i++) { var child = Children[(i + index) % Children.Count]; if (child.IsVisible && child.IsFocusable) { child.Focus(); return; } } }
protected GuiComponent(GuiComponent parent, Coord position) : this(parent) { RelativePositionToParent = position; AdjustWhenParentsReposition(); }
public virtual void RemoveChild(GuiComponent child) { Children.Remove(child); }
public GuiComponent RegisterChildComponent(GuiComponent child) { Children.Add(child); return(child); }
public Button(GuiComponent parent, string buttonText, Action onClick, Coord position) : base(parent, position) { this.buttonText = buttonText; this.onClick = onClick; }
public override void RemoveChild(GuiComponent child) { RemoveMeAndChildren(); }
public TitledWindow(GuiComponent parent, string title) : base(parent) { this.title = title; }