示例#1
0
 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 = () => { };
 }
示例#2
0
        protected GuiComponent(GuiComponent parent)
        {
            this.Parent = parent;
            Manager     = parent.Manager;

            Position   = parent.GetInnerCanvasTopLeft();
            Dimensions = new GuiDimensions(new Size(), new Size());

            parent.RegisterChildComponent(this);
        }
示例#3
0
        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(); };
        }
示例#4
0
        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;
                }
            }
        }
示例#5
0
 protected GuiComponent(GuiComponent parent, Coord position) : this(parent) {
     RelativePositionToParent = position;
     AdjustWhenParentsReposition();
 }
示例#6
0
 public virtual void RemoveChild(GuiComponent child)
 {
     Children.Remove(child);
 }
示例#7
0
 public GuiComponent RegisterChildComponent(GuiComponent child)
 {
     Children.Add(child);
     return(child);
 }
示例#8
0
 public Button(GuiComponent parent, string buttonText, Action onClick, Coord position) : base(parent, position)
 {
     this.buttonText = buttonText;
     this.onClick    = onClick;
 }
示例#9
0
 public override void RemoveChild(GuiComponent child)
 {
     RemoveMeAndChildren();
 }
示例#10
0
 public TitledWindow(GuiComponent parent, string title) : base(parent)
 {
     this.title = title;
 }