Beispiel #1
0
        public static IEnumerable <TreeIter> Childs(this TreeModel model, TreeIter parent)
        {
            List <TreeIter> childs = new List <TreeIter>();

            if (parent.Equals(TreeIter.Zero))
            {
                for (int i = 0; i < model.IterNChildren(); i++)
                {
                    TreeIter iter;
                    if (model.IterNthChild(out iter, i))
                    {
                        childs.Add(iter);
                        childs.AddRange(model.Childs(iter));
                    }
                }
            }
            else
            {
                for (int i = 0; i < model.IterNChildren(parent); i++)
                {
                    TreeIter iter;
                    if (model.IterNthChild(out iter, parent, i))
                    {
                        childs.Add(iter);
                        childs.AddRange(model.Childs(iter));
                    }
                }
            }
            return(childs);
        }