Наследование: TreePosition
Пример #1
0
        public void Remove(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            Gtk.TreeIter it = tpos.Iter;
            Tree.Remove(ref it);
        }
Пример #2
0
        public TreePosition InsertAfter(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;
            var     p    = Tree.InsertNodeAfter(tpos.Iter);

            return(new IterPos(p));
        }
Пример #3
0
        public void Remove(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it = tpos.Iter;
            Tree.Remove(ref it);
        }
Пример #4
0
        public TreePosition InsertAfter(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);
            var     p    = Tree.InsertNodeAfter(tpos.Iter);

            return(new IterPos(version, p));
        }
Пример #5
0
        public void SetValue(TreePosition pos, int column, object value)
        {
            IterPos tpos = GetIterPos(pos);

            SetValue(tpos.Iter, column, value);
            if (NodeChanged != null)
            {
                NodeChanged(this, new TreeNodeEventArgs(pos));
            }
        }
Пример #6
0
 void HandleRowActivated(object o, Gtk.RowActivatedArgs args)
 {
     Gtk.TreeIter it;
     if (Widget.Model.GetIter(out it, args.Path))
     {
         CurrentEventRow = new IterPos(-1, it);
         ApplicationContext.InvokeUserCode(delegate {
             EventSink.OnRowActivated(new IterPos(-1, it));
         });
     }
 }
Пример #7
0
        IterPos GetIterPos(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            if (tpos != null && tpos.Version != version)
            {
                tpos.LastChildIndex = -1;
                tpos.ChildrenCount  = -1;
            }
            return(tpos);
        }
Пример #8
0
        public TreePosition GetNext(TreePosition pos)
        {
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it = tpos.Iter;
            if (!Tree.IterNext(ref it))
            {
                return(null);
            }
            return(new IterPos(version, it));
        }
Пример #9
0
        public TreePosition GetParent(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            Gtk.TreeIter it;
            if (!Tree.IterParent(out it, tpos.Iter))
            {
                return(null);
            }
            return(new IterPos(it));
        }
Пример #10
0
        public TreePosition GetNext(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            Gtk.TreeIter it = tpos.Iter;
            if (!Tree.IterNext(ref it))
            {
                return(null);
            }
            return(new IterPos(it));
        }
Пример #11
0
        public TreePosition GetParent(TreePosition pos)
        {
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it;
            if (!Tree.IterParent(out it, tpos.Iter))
            {
                return(null);
            }
            return(new IterPos(version, it));
        }
Пример #12
0
        public TreePosition GetChild(TreePosition pos, int index)
        {
            IterPos tpos = (IterPos)pos;

            if (tpos.LastChildIndex == index)
            {
                return(new IterPos(tpos.LastChildIter));
            }
            if (index == 0)
            {
                Gtk.TreeIter it;
                if (Tree.GetIterFirst(out it))
                {
                    tpos.LastChildIter  = it;
                    tpos.LastChildIndex = 0;
                    return(new IterPos(it));
                }
                else
                {
                    return(null);
                }
            }
            if (tpos.LastChildIndex == -1 || tpos.LastChildIndex > index)
            {
                Gtk.TreeIter it;
                if (Tree.IterNthChild(out it, index))
                {
                    tpos.LastChildIter  = it;
                    tpos.LastChildIndex = index;
                    return(new IterPos(it));
                }
                else
                {
                    return(null);
                }
            }

            // tpos.LastChildIndex < index

            Gtk.TreeIter iter = tpos.LastChildIter;
            for (int n = tpos.LastChildIndex; n < index; n++)
            {
                if (!Tree.IterNext(ref iter))
                {
                    return(null);
                }
            }
            tpos.LastChildIter  = iter;
            tpos.LastChildIndex = index;
            return(new IterPos(iter));
        }
Пример #13
0
        public TreePosition InsertAfter(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);
            var     p    = Tree.InsertNodeAfter(tpos.Iter);

            var node = new IterPos(version, p);

            if (NodeInserted != null)
            {
                NodeInserted(this, new TreeNodeEventArgs(node));
            }
            return(node);
        }
Пример #14
0
        public TreePosition AddChild(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            Gtk.TreeIter it;
            if (pos == null)
            {
                it = Tree.AppendNode();
            }
            else
            {
                it = Tree.AppendNode(tpos.Iter);
            }
            return(new IterPos(it));
        }
Пример #15
0
        public void Remove(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it        = tpos.Iter;
            var          delPath   = Tree.GetPath(it);
            var          eventArgs = new TreeNodeChildEventArgs(GetParent(tpos), delPath.Indices[delPath.Indices.Length - 1], pos);

            Tree.Remove(ref it);
            if (NodeDeleted != null)
            {
                NodeDeleted(this, eventArgs);
            }
        }
Пример #16
0
        public int GetChildrenCount(TreePosition pos)
        {
            if (pos == null)
            {
                return(Tree.IterNChildren());
            }

            IterPos tpos = GetIterPos(pos);

            if (tpos.ChildrenCount != -1)
            {
                return(tpos.ChildrenCount);
            }

            return(tpos.ChildrenCount = Tree.IterNChildren(tpos.Iter));
        }
Пример #17
0
        public TreePosition AddChild(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it;
            if (pos == null)
            {
                it = Tree.AppendNode();
            }
            else
            {
                it = Tree.AppendNode(tpos.Iter);
            }
            return(new IterPos(version, it));
        }
Пример #18
0
        public int GetChildrenCount(TreePosition pos)
        {
            IterPos tpos = (IterPos)pos;

            if (tpos.ChildrenCount != -1)
            {
                return(tpos.ChildrenCount);
            }
            if (pos == null)
            {
                tpos.ChildrenCount = Tree.IterNChildren();
            }
            else
            {
                tpos.ChildrenCount = Tree.IterNChildren(tpos.Iter);
            }
            return(tpos.ChildrenCount);
        }
Пример #19
0
        public TreePosition GetPrevious(TreePosition pos)
        {
            IterPos tpos = GetIterPos(pos);

            Gtk.TreePath path    = Tree.GetPath(tpos.Iter);
            int []       indices = path.Indices;
            if (indices.Length < 1 || indices [indices.Length - 1] == 0)
            {
                return(null);
            }
            indices [indices.Length - 1]--;
            Gtk.TreePath previousPath = new Gtk.TreePath(indices);
            Gtk.TreeIter previous;
            if (!Tree.GetIter(out previous, previousPath))
            {
                return(null);
            }
            return(new IterPos(version, previous));
        }
Пример #20
0
        public TreePosition AddChild(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos(pos);

            Gtk.TreeIter it;
            if (pos == null)
            {
                it = Tree.AppendNode();
            }
            else
            {
                it = Tree.AppendNode(tpos.Iter);
            }

            var node = new IterPos(version, it);

            if (NodeInserted != null)
            {
                NodeInserted(this, new TreeNodeEventArgs(node));
            }
            return(node);
        }
Пример #21
0
        public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition)
        {
            Gtk.TreeViewDropPosition tpos;
            Gtk.TreePath             path;
            if (!Widget.GetDestRowAtPos((int)x, (int)y, out path, out tpos))
            {
                pos          = RowDropPosition.Into;
                nodePosition = null;
                return(false);
            }

            Gtk.TreeIter it;
            Widget.Model.GetIter(out it, path);
            nodePosition = new IterPos(-1, it);
            switch (tpos)
            {
            case Gtk.TreeViewDropPosition.After: pos = RowDropPosition.After; break;

            case Gtk.TreeViewDropPosition.Before: pos = RowDropPosition.Before; break;

            default: pos = RowDropPosition.Into; break;
            }
            return(true);
        }
Пример #22
0
        public bool GetDropTargetRow(double x, double y, out RowDropPosition pos, out TreePosition nodePosition)
        {
            Gtk.TreeViewDropPosition tpos;
            Gtk.TreePath path;
            if (!Widget.GetDestRowAtPos ((int)x, (int)y, out path, out tpos)) {
                pos = RowDropPosition.Into;
                nodePosition = null;
                return false;
            }

            Gtk.TreeIter it;
            Widget.Model.GetIter (out it, path);
            nodePosition = new IterPos (-1, it);
            switch (tpos) {
            case Gtk.TreeViewDropPosition.After: pos = RowDropPosition.After; break;
            case Gtk.TreeViewDropPosition.Before: pos = RowDropPosition.Before; break;
            default: pos = RowDropPosition.Into; break;
            }
            return true;
        }
Пример #23
0
        public TreePosition AddChild(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos (pos);
            Gtk.TreeIter it;
            if (pos == null)
                it = Tree.AppendNode ();
            else
                it = Tree.AppendNode (tpos.Iter);

            var node = new IterPos (version, it);
            if (NodeInserted != null)
                NodeInserted (this, new TreeNodeEventArgs (node));
            return node;
        }
Пример #24
0
        public TreePosition InsertBefore(TreePosition pos)
        {
            version++;
            IterPos tpos = GetIterPos (pos);
            var p = Tree.InsertNodeBefore (tpos.Iter);

            var node = new IterPos (version, p);
            if (NodeInserted != null)
                NodeInserted (this, new TreeNodeEventArgs (node));
            return node;
        }
Пример #25
0
 void HandleTestExpandRow(object o, Gtk.TestExpandRowArgs args)
 {
     Gtk.TreeIter it;
     if (Widget.Model.GetIter (out it, args.Path)) {
         CurrentEventRow = new IterPos (-1, it);
         ApplicationContext.InvokeUserCode (delegate {
             EventSink.OnRowExpanding (new IterPos (-1, it));
         });
     }
 }
Пример #26
0
        public void SetValue(TreePosition pos, int column, object value)
        {
            IterPos tpos = GetIterPos(pos);

            SetValue(tpos.Iter, column, value);
        }
Пример #27
0
        public object GetValue(TreePosition pos, int column)
        {
            IterPos tpos = GetIterPos(pos);

            return(GetValue(tpos.Iter, column));
        }