diff -r 3145aadca3d2 -r 0c551e8818e0 External/Aga.Controls/Tree/ListModel.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/External/Aga.Controls/Tree/ListModel.cs Sun May 27 15:16:19 2012 +0000 @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections; + +namespace Aga.Controls.Tree +{ + public class ListModel : TreeModelBase + { + private IList _list; + + public int Count + { + get { return _list.Count; } + } + + public ListModel() + { + _list = new List(); + } + + public ListModel(IList list) + { + _list = list; + } + + public override IEnumerable GetChildren(TreePath treePath) + { + return _list; + } + + public override bool IsLeaf(TreePath treePath) + { + return true; + } + + public void AddRange(IEnumerable items) + { + foreach (object obj in items) + _list.Add(obj); + OnStructureChanged(new TreePathEventArgs(TreePath.Empty)); + } + + public void Add(object item) + { + _list.Add(item); + OnNodesInserted(new TreeModelEventArgs(TreePath.Empty, new int[] { _list.Count - 1 }, new object[] { item })); + } + + public void Clear() + { + _list.Clear(); + OnStructureChanged(new TreePathEventArgs(TreePath.Empty)); + } + } +}