예제 #1
0
        public void AddChild(GuiElement element)
        {
            Child ch = new Child();

            ch.element        = element;
            ch.id             = Children.Count;
            ch.parent         = this;
            ch.element.Parent = this;
            Children.Add(ch);
        }
예제 #2
0
        public void AddChild(GuiElement element, string name)
        {
            Child ch = new Child();

            ch.element        = element;
            ch.id             = Children.Count;
            ch.name           = name;
            ch.element.Parent = this;
            Children.Add(ch);
        }
 public void Add(GuiElement element, string name, Object parent)
 {
     if (element is Button)
     {
         Button b = (Button)element;
         b.Parent         = parent;
         b.clickEventInt += ChildClicked;
         grid.AddChild(b, name);
     }
     else
     {
         grid.AddChild(element, name);
     }
 }
예제 #4
0
        public void AddChild(GuiElement element, int row, int column)
        {
            Child ch = new Child
            {
                element = element,
                column  = column,
                row     = row
            };

            ch.id          = Children.Count;
            element.Parent = this;
            Children.Add(ch);
            Update();
            UpdateChildren();
        }
예제 #5
0
        public void AddChild(GuiElement element, string name)
        {
            Child ch = new Child()
            {
                element = element,
                name    = name,
                column  = 0
            };

            ch.id          = Children.Count;
            ch.row         = Rows;
            element.Parent = this;
            Children.Add(ch);
            Update();
            UpdateChildren();
        }
예제 #6
0
        public void AddChild(GuiElement element, bool tooltip)
        {
            if (MaxChildren)
            {
                Vector2 pos = new Vector2();
                if (Children.Count < ChildMaxAmount)
                {
                    pos = GetMaxFreeSpace();
                }
                Child ch = new Child()
                {
                    element = element,
                    column  = (int)pos.Y,
                    row     = (int)pos.X
                };

                ch.id = Children.Count;
                if (Children.Count < ChildMaxAmount)
                {
                    Children.Add(ch);
                    element.Parent = this;
                }

                if (element is Card)
                {
                    Card c = (Card)element;
                    c.Parent = this;
                }
                Update();
                UpdateChildren();
            }
            else
            {
                Child ch = new Child()
                {
                    element = element,
                    column  = 0
                };
                ch.element.Parent = this;
                ch.id             = Children.Count;
                ch.row            = Rows;

                Children.Add(ch);
                Update();
                UpdateChildren();
            }
        }
예제 #7
0
        public void RemoveChild(GuiElement element)
        {
            List <Child> l = Children.Where(p => p.element == element).ToList();

            l.ForEach(p => Children.Remove(p));
        }