Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 7
0
        public void RemoveChild(GuiElement element)
        {
            List <Child> l = Children.Where(p => p.element == element).ToList();

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