Exemple #1
0
        public void InitializeItems(ITreeGridStore <ITreeGridItem> store)
        {
            ClearCache();
            if (sections != null)
            {
                sections.Clear();
            }
            Store = store;

            if (Store != null)
            {
                for (int row = 0; row < Store.Count; row++)
                {
                    var item = Store[row];
                    if (item.Expanded)
                    {
                        var children = (ITreeGridStore <ITreeGridItem>)item;
                        var section  = new TreeController {
                            StartRow = row, Handler = Handler, parent = this
                        };
                        section.InitializeItems(children);
                        Sections.Add(section);
                    }
                }
            }
            ResetCollection();
        }
Exemple #2
0
        public void InitializeItems(ITreeGridStore <ITreeGridItem> store)
        {
            ClearCache();
            if (sections != null)
            {
                sections.Clear();
            }
            Store = store;

            ResetSections();
            ResetCollection();
        }
 void ExpandItems(ITreeGridStore <ITreeGridItem> store, Gtk.TreePath path)
 {
     for (int i = 0; i < store.Count; i++)
     {
         var item = store[i];
         if (item.Expandable && item.Expanded)
         {
             var newpath = path.Copy();
             newpath.AppendIndex(i);
             Handler.Tree.ExpandToPath(newpath);
             ExpandItems((ITreeGridStore <ITreeGridItem>)item, newpath);
         }
     }
 }
Exemple #4
0
        ITreeGridStore <ITreeGridItem> ExpandRowInternal(int row)
        {
            ITreeGridStore <ITreeGridItem> children = null;

            if (sections == null || sections.Count == 0)
            {
                children = (ITreeGridStore <ITreeGridItem>)Store [row];
                var childController = new TreeController {
                    StartRow = row, Store = children, Handler = this.Handler, parent = this
                };
                Sections.Add(childController);
            }
            else
            {
                bool addTop = true;
                foreach (var section in sections)
                {
                    if (row <= section.StartRow)
                    {
                        break;
                    }
                    else if (row <= section.StartRow + section.Count)
                    {
                        children = section.ExpandRowInternal(row - section.StartRow - 1);
                        addTop   = false;
                        break;
                    }
                    else
                    {
                        row -= section.Count;
                    }
                }
                if (addTop && row < Store.Count)
                {
                    children = (ITreeGridStore <ITreeGridItem>)Store [row];
                    var childController = new TreeController {
                        StartRow = row, Store = children, Handler = this.Handler, parent = this
                    };
                    Sections.Add(childController);
                }
            }
            Sections.Sort((x, y) => x.StartRow.CompareTo(y.StartRow));
            if (children != null)
            {
                ClearCache();
                ResetCollection();
            }
            return(children);
        }