50 lines
1.1 KiB
C#
50 lines
1.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Dashboard.Controls
|
|
{
|
|
public abstract class ContainerControl : Control, ICollection<Control>
|
|
{
|
|
private readonly List<Control> children = new List<Control>();
|
|
|
|
public int Count => children.Count;
|
|
|
|
public bool IsReadOnly => false;
|
|
|
|
public void Add(Control item)
|
|
{
|
|
children.Add(item);
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
children.Clear();
|
|
}
|
|
|
|
public bool Contains(Control item)
|
|
{
|
|
return children.Contains(item);
|
|
}
|
|
|
|
public void CopyTo(Control[] array, int arrayIndex)
|
|
{
|
|
children.CopyTo(array, arrayIndex);
|
|
}
|
|
|
|
public IEnumerator<Control> GetEnumerator()
|
|
{
|
|
return children.GetEnumerator();
|
|
}
|
|
|
|
public bool Remove(Control item)
|
|
{
|
|
return children.Remove(item);
|
|
}
|
|
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return children.GetEnumerator();
|
|
}
|
|
}
|
|
} |