forked from danieldantasdev/DesignPatternsInUse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPanel.cs
More file actions
26 lines (22 loc) · 620 Bytes
/
Panel.cs
File metadata and controls
26 lines (22 loc) · 620 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public class Panel : GUIComponent
{
private List<GUIComponent> children = new List<GUIComponent>();
public Panel(string name) : base(name) { }
public void Add(GUIComponent component)
{
children.Add(component);
}
public void Remove(GUIComponent component)
{
children.Remove(component);
}
public override void Display(int depth)
{
Console.WriteLine(new String('-', depth) + " Panel: " + name);
// Recursively display child nodes
foreach (var component in children)
{
component.Display(depth + 2);
}
}
}