1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
4 using System
.Collections
.Generic
;
6 using System
.Collections
;
8 namespace Aga
.Controls
.Tree
10 public class SortedTreeModel
: TreeModelBase
12 private ITreeModel _innerModel
;
13 public ITreeModel InnerModel
15 get { return _innerModel; }
18 private IComparer _comparer
;
19 public IComparer Comparer
21 get { return _comparer; }
25 OnStructureChanged(new TreePathEventArgs(TreePath
.Empty
));
29 public SortedTreeModel(ITreeModel innerModel
)
31 _innerModel
= innerModel
;
32 _innerModel
.NodesChanged
+= new EventHandler
<TreeModelEventArgs
>(_innerModel_NodesChanged
);
33 _innerModel
.NodesInserted
+= new EventHandler
<TreeModelEventArgs
>(_innerModel_NodesInserted
);
34 _innerModel
.NodesRemoved
+= new EventHandler
<TreeModelEventArgs
>(_innerModel_NodesRemoved
);
35 _innerModel
.StructureChanged
+= new EventHandler
<TreePathEventArgs
>(_innerModel_StructureChanged
);
38 void _innerModel_StructureChanged(object sender
, TreePathEventArgs e
)
40 OnStructureChanged(e
);
43 void _innerModel_NodesRemoved(object sender
, TreeModelEventArgs e
)
45 OnStructureChanged(new TreePathEventArgs(e
.Path
));
48 void _innerModel_NodesInserted(object sender
, TreeModelEventArgs e
)
50 OnStructureChanged(new TreePathEventArgs(e
.Path
));
53 void _innerModel_NodesChanged(object sender
, TreeModelEventArgs e
)
55 OnStructureChanged(new TreePathEventArgs(e
.Path
));
58 public override IEnumerable
GetChildren(TreePath treePath
)
62 ArrayList list
= new ArrayList();
63 IEnumerable res
= InnerModel
.GetChildren(treePath
);
66 foreach (object obj
in res
)
75 return InnerModel
.GetChildren(treePath
);
78 public override bool IsLeaf(TreePath treePath
)
80 return InnerModel
.IsLeaf(treePath
);