Esempio n. 1
0
        int GetCount(Gtk.TreeIter parent, int upToIndex)
        {
            int rows  = upToIndex == -1 ? model.IterNChildren(parent) : upToIndex;
            int count = 0;

            for (int i = 0; i < rows; i++)
            {
                Gtk.TreeIter iter;
                if (model.IterNthChild(out iter, parent, i))
                {
                    var childPath = model.GetPath(iter);

                    if (Tree.GetRowExpanded(childPath))
                    {
                        count += GetCount(iter, -1);
                    }
                }
                count++;
            }
            return(count);
        }
Esempio n. 2
0
        int GetCount(Gtk.TreeIter parent, int upToIndex)
        {
            int rows  = upToIndex == -1 ? model.IterNChildren(parent) : upToIndex;
            int count = 0;
            var path  = model.GetPath(parent);

            path.AppendIndex(0);
            for (int i = 0; i < rows; i++)
            {
                Gtk.TreeIter iter;
                if (Tree.GetRowExpanded(path))
                {
                    if (model.IterNthChild(out iter, parent, i))
                    {
                        count += GetCount(iter, -1);
                    }
                }
                path.Next();
                count++;
            }
            return(count);
        }