예제 #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;
 }