mattercontrol/original/MatterControlLib/Utilities/SelectedListItems.cs

40 lines
602 B
C#
Raw Permalink Normal View History

2014-10-27 10:25:54 -07:00
using System;
using System.Collections.Generic;
namespace MatterHackers.MatterControl
{
2015-04-08 15:20:10 -07:00
public class SelectedListItems<T> : List<T>
{
public event EventHandler OnAdd;
2014-10-27 10:25:54 -07:00
2015-04-08 15:20:10 -07:00
public event EventHandler OnRemove;
2014-10-27 10:25:54 -07:00
2015-04-08 15:20:10 -07:00
new public void Add(T item)
{
base.Add(item);
if (null != OnAdd)
{
OnAdd(this, null);
}
}
2014-10-27 10:25:54 -07:00
2015-04-08 15:20:10 -07:00
new public void Remove(T item)
{
base.Remove(item);
if (null != OnRemove)
{
OnRemove(this, null);
}
}
// Also fire OnRemove on Clear
new public void Clear()
{
base.Clear();
if (null != OnRemove)
{
OnRemove(this, null);
}
}
}
}